vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * CLASS-related stuff. |
| 3 | */ |
| 4 | #ifndef ASN1_PARSER_CLASS_H |
| 5 | #define ASN1_PARSER_CLASS_H |
| 6 | |
vlm | ea4246f | 2005-02-25 13:32:12 +0000 | [diff] [blame] | 7 | #include "asn1p_ref.h" |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 8 | |
vlm | a6a84d7 | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 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 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 25 | /* |
| 26 | * WITH SYNTAX free-form chunks. |
| 27 | */ |
| 28 | typedef struct asn1p_wsyntx_chunk_s { |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 29 | enum { |
| 30 | WC_LITERAL, |
vlm | eeb3c51 | 2006-03-16 05:11:14 +0000 | [diff] [blame] | 31 | WC_WHITESPACE, |
vlm | a6a84d7 | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 32 | WC_FIELD, |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 33 | WC_OPTIONALGROUP |
| 34 | } type; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 35 | /* |
vlm | eeb3c51 | 2006-03-16 05:11:14 +0000 | [diff] [blame] | 36 | * WC_LITERAL -> {token} |
| 37 | * WC_WHITESPACE -> {token} |
vlm | a6a84d7 | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 38 | * WC_FIELD -> {token} |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 39 | * WC_OPTIONALGROUP -> {syntax} |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 40 | */ |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 41 | union { |
vlm | a6a84d7 | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 42 | char *token; |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 43 | struct asn1p_wsyntx_s *syntax; |
| 44 | } content; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 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 | */ |
vlm | 1fcf759 | 2006-08-18 02:27:55 +0000 | [diff] [blame] | 72 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromstring(char *token, int _copy); |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 73 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 74 | |
| 75 | |
| 76 | #endif /* ASN1_PARSER_CLASS_H */ |