Lev Walkin | f15320b | 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 | |
Lev Walkin | 8d35c46 | 2005-02-25 13:32:12 +0000 | [diff] [blame] | 7 | #include "asn1p_ref.h" |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 8 | |
Lev Walkin | d370e9f | 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 */ |
Bi-Ruei, Chiu | 80fd306 | 2017-05-07 21:00:51 +0800 | [diff] [blame] | 15 | int new_ref; |
Lev Walkin | d370e9f | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 16 | } *column; |
| 17 | int columns; |
| 18 | int max_identifier_length; |
| 19 | } asn1p_ioc_row_t; |
| 20 | |
| 21 | asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass); |
| 22 | void asn1p_ioc_row_delete(asn1p_ioc_row_t *); |
| 23 | struct asn1p_ioc_cell_s *asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *, |
| 24 | const char *fieldname); |
| 25 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 26 | /* |
| 27 | * WITH SYNTAX free-form chunks. |
| 28 | */ |
| 29 | typedef struct asn1p_wsyntx_chunk_s { |
Lev Walkin | 9d542d2 | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 30 | enum { |
| 31 | WC_LITERAL, |
Lev Walkin | 57074f1 | 2006-03-16 05:11:14 +0000 | [diff] [blame] | 32 | WC_WHITESPACE, |
Lev Walkin | d370e9f | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 33 | WC_FIELD, |
Lev Walkin | 9d542d2 | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 34 | WC_OPTIONALGROUP |
| 35 | } type; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 36 | /* |
Lev Walkin | 57074f1 | 2006-03-16 05:11:14 +0000 | [diff] [blame] | 37 | * WC_LITERAL -> {token} |
| 38 | * WC_WHITESPACE -> {token} |
Lev Walkin | d370e9f | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 39 | * WC_FIELD -> {token} |
Lev Walkin | 9d542d2 | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 40 | * WC_OPTIONALGROUP -> {syntax} |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 41 | */ |
Lev Walkin | 9d542d2 | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 42 | union { |
Lev Walkin | d370e9f | 2006-03-16 10:03:35 +0000 | [diff] [blame] | 43 | char *token; |
Lev Walkin | 9d542d2 | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 44 | struct asn1p_wsyntx_s *syntax; |
| 45 | } content; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 46 | |
| 47 | TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next; |
| 48 | } asn1p_wsyntx_chunk_t; |
| 49 | |
| 50 | typedef struct asn1p_wsyntx_s { |
| 51 | |
Bi-Ruei, Chiu | 80fd306 | 2017-05-07 21:00:51 +0800 | [diff] [blame] | 52 | struct asn1p_wsyntx_chunk_s *parent; |
| 53 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 54 | TQ_HEAD(struct asn1p_wsyntx_chunk_s) chunks; |
| 55 | |
| 56 | } asn1p_wsyntx_t; |
| 57 | |
| 58 | |
| 59 | /* |
| 60 | * Constructor, destructor and cloning function. |
| 61 | */ |
| 62 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void); |
| 63 | void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *); |
| 64 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *); |
| 65 | |
| 66 | asn1p_wsyntx_t *asn1p_wsyntx_new(void); |
| 67 | void asn1p_wsyntx_free(asn1p_wsyntx_t *); |
| 68 | asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *); |
| 69 | |
| 70 | /* |
| 71 | * RETURN VALUES: |
| 72 | * 0: Component has been added |
| 73 | * -1: Failure to add component (refer to errno) |
| 74 | */ |
Lev Walkin | c46b7cb | 2006-08-18 02:27:55 +0000 | [diff] [blame] | 75 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromstring(char *token, int _copy); |
Lev Walkin | 9d542d2 | 2006-03-14 16:31:37 +0000 | [diff] [blame] | 76 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 77 | |
| 78 | |
| 79 | #endif /* ASN1_PARSER_CLASS_H */ |