4 #ifndef ASN1_PARSER_CLASS_H
5 #define ASN1_PARSER_CLASS_H
7 struct asn1p_expr_s; /* Forward declaration */
9 typedef struct asn1p_ioc_row_s {
10 struct asn1p_ioc_cell_s {
11 struct asn1p_expr_s *field; /* may never be NULL */
12 struct asn1p_expr_s *value; /* may be left uninitialized */
18 asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass);
19 asn1p_ioc_row_t *asn1p_ioc_row_clone(asn1p_ioc_row_t *src);
20 size_t asn1p_ioc_row_max_identifier_length(asn1p_ioc_row_t *);
21 void asn1p_ioc_row_delete(asn1p_ioc_row_t *);
23 typedef struct asn1p_ioc_table_s {
24 asn1p_ioc_row_t **row;
26 int extensible; /* 0 if non-extensible (sealed). Otherwise, extensible. */
29 asn1p_ioc_table_t *asn1p_ioc_table_new(void);
30 void asn1p_ioc_table_add(asn1p_ioc_table_t *, asn1p_ioc_row_t *row);
31 void asn1p_ioc_table_append(asn1p_ioc_table_t *it, asn1p_ioc_table_t *src);
32 size_t asn1p_ioc_table_max_identifier_length(asn1p_ioc_table_t *);
33 void asn1p_ioc_table_free(asn1p_ioc_table_t *);
36 * Match is similar to a comparison,
37 * but -1 means error and 1 means not equal. 0 is OK
39 int asn1p_ioc_row_match(const asn1p_ioc_row_t *, const asn1p_ioc_row_t *);
41 struct asn1p_ioc_cell_s *asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *,
42 const char *fieldname);
45 * WITH SYNTAX free-form chunks.
47 typedef struct asn1p_wsyntx_chunk_s {
55 * WC_LITERAL -> {token}
56 * WC_WHITESPACE -> {token}
58 * WC_OPTIONALGROUP -> {syntax}
62 struct asn1p_wsyntx_s *syntax;
65 TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next;
66 } asn1p_wsyntx_chunk_t;
68 typedef struct asn1p_wsyntx_s {
70 struct asn1p_wsyntx_chunk_s *parent;
72 TQ_HEAD(struct asn1p_wsyntx_chunk_s) chunks;
78 * Constructor, destructor and cloning function.
80 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void);
81 void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *);
82 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *);
84 asn1p_wsyntx_t *asn1p_wsyntx_new(void);
85 void asn1p_wsyntx_free(asn1p_wsyntx_t *);
86 asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *);
90 * 0: Component has been added
91 * -1: Failure to add component (refer to errno)
93 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromstring(char *token, int _copy);
94 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax);
97 #endif /* ASN1_PARSER_CLASS_H */