blob: 06db2d1287db10af93569219941e9f2683adaba7 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*
2 * CLASS-related stuff.
3 */
4#ifndef ASN1_PARSER_CLASS_H
5#define ASN1_PARSER_CLASS_H
6
Lev Walkin8d35c462005-02-25 13:32:12 +00007#include "asn1p_ref.h"
Lev Walkinf15320b2004-06-03 03:38:44 +00008
9/*
10 * WITH SYNTAX free-form chunks.
11 */
12typedef struct asn1p_wsyntx_chunk_s {
Lev Walkin9d542d22006-03-14 16:31:37 +000013 enum {
14 WC_LITERAL,
Lev Walkin57074f12006-03-16 05:11:14 +000015 WC_WHITESPACE,
Lev Walkin9d542d22006-03-14 16:31:37 +000016 WC_REFERENCE,
17 WC_OPTIONALGROUP
18 } type;
Lev Walkinf15320b2004-06-03 03:38:44 +000019 /*
Lev Walkin57074f12006-03-16 05:11:14 +000020 * WC_LITERAL -> {token}
21 * WC_WHITESPACE -> {token}
Lev Walkin9d542d22006-03-14 16:31:37 +000022 * WC_REFERENCE -> {ref}
23 * WC_OPTIONALGROUP -> {syntax}
Lev Walkinf15320b2004-06-03 03:38:44 +000024 */
Lev Walkin9d542d22006-03-14 16:31:37 +000025 union {
26 char *token;
27 asn1p_ref_t *ref;
28 struct asn1p_wsyntx_s *syntax;
29 } content;
Lev Walkinf15320b2004-06-03 03:38:44 +000030
31 TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next;
32} asn1p_wsyntx_chunk_t;
33
34typedef struct asn1p_wsyntx_s {
35
36 TQ_HEAD(struct asn1p_wsyntx_chunk_s) chunks;
37
38} asn1p_wsyntx_t;
39
40
41/*
42 * Constructor, destructor and cloning function.
43 */
44asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void);
45void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *);
46asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *);
47
48asn1p_wsyntx_t *asn1p_wsyntx_new(void);
49void asn1p_wsyntx_free(asn1p_wsyntx_t *);
50asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *);
51
52/*
53 * RETURN VALUES:
54 * 0: Component has been added
55 * -1: Failure to add component (refer to errno)
56 */
57asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromref(asn1p_ref_t *ref, int do_copy);
Lev Walkin9d542d22006-03-14 16:31:37 +000058asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_frombuf(char *buf, int len, int _copy);
59asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax);
Lev Walkinf15320b2004-06-03 03:38:44 +000060
61
62#endif /* ASN1_PARSER_CLASS_H */