1 /*
2  * CLASS-related stuff.
3  */
4 #ifndef	ASN1_PARSER_CLASS_H
5 #define	ASN1_PARSER_CLASS_H
6 
7 #include "asn1p_ref.h"
8 
9 struct asn1p_expr_s;	/* Forward declaration */
10 
11 typedef struct asn1p_ioc_row_s {
12 	struct asn1p_ioc_cell_s {
13 		struct asn1p_expr_s *field;	/* may never be NULL */
14 		struct asn1p_expr_s *value;	/* may be left uninitialized */
15 	} *column;
16 	int columns;
17 	int max_identifier_length;
18 } asn1p_ioc_row_t;
19 
20 asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass);
21 void asn1p_ioc_row_delete(asn1p_ioc_row_t *);
22 struct asn1p_ioc_cell_s *asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *,
23 		const char *fieldname);
24 
25 /*
26  * WITH SYNTAX free-form chunks.
27  */
28 typedef struct asn1p_wsyntx_chunk_s {
29 	enum {
30 		WC_LITERAL,
31 		WC_WHITESPACE,
32 		WC_FIELD,
33 		WC_OPTIONALGROUP
34 	} type;
35 	/*
36 	 * WC_LITERAL -> {token}
37 	 * WC_WHITESPACE -> {token}
38 	 * WC_FIELD -> {token}
39 	 * WC_OPTIONALGROUP -> {syntax}
40 	 */
41 	union {
42 		char *token;
43 		struct asn1p_wsyntx_s *syntax;
44 	} content;
45 
46 	TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next;
47 } asn1p_wsyntx_chunk_t;
48 
49 typedef struct asn1p_wsyntx_s {
50 
51 	TQ_HEAD(struct asn1p_wsyntx_chunk_s) chunks;
52 
53 } asn1p_wsyntx_t;
54 
55 
56 /*
57  * Constructor, destructor and cloning function.
58  */
59 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void);
60 void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *);
61 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *);
62 
63 asn1p_wsyntx_t *asn1p_wsyntx_new(void);
64 void asn1p_wsyntx_free(asn1p_wsyntx_t *);
65 asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *);
66 
67 /*
68  * RETURN VALUES:
69  * 	 0:	Component has been added
70  * 	-1:	Failure to add component (refer to errno)
71  */
72 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromstring(char *token, int _copy);
73 asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax);
74 
75 
76 #endif	/* ASN1_PARSER_CLASS_H */
77