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 | |
| 9 | /* |
| 10 | * WITH SYNTAX free-form chunks. |
| 11 | */ |
| 12 | typedef struct asn1p_wsyntx_chunk_s { |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame^] | 13 | enum { |
| 14 | WC_LITERAL, |
| 15 | WC_REFERENCE, |
| 16 | WC_OPTIONALGROUP |
| 17 | } type; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 18 | /* |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame^] | 19 | * WC_LITERAL -> {buf, len} |
| 20 | * WC_REFERENCE -> {ref} |
| 21 | * WC_OPTIONALGROUP -> {syntax} |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 22 | */ |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame^] | 23 | union { |
| 24 | char *token; |
| 25 | asn1p_ref_t *ref; |
| 26 | struct asn1p_wsyntx_s *syntax; |
| 27 | } content; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 28 | |
| 29 | TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next; |
| 30 | } asn1p_wsyntx_chunk_t; |
| 31 | |
| 32 | typedef struct asn1p_wsyntx_s { |
| 33 | |
| 34 | TQ_HEAD(struct asn1p_wsyntx_chunk_s) chunks; |
| 35 | |
| 36 | } asn1p_wsyntx_t; |
| 37 | |
| 38 | |
| 39 | /* |
| 40 | * Constructor, destructor and cloning function. |
| 41 | */ |
| 42 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void); |
| 43 | void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *); |
| 44 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *); |
| 45 | |
| 46 | asn1p_wsyntx_t *asn1p_wsyntx_new(void); |
| 47 | void asn1p_wsyntx_free(asn1p_wsyntx_t *); |
| 48 | asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *); |
| 49 | |
| 50 | /* |
| 51 | * RETURN VALUES: |
| 52 | * 0: Component has been added |
| 53 | * -1: Failure to add component (refer to errno) |
| 54 | */ |
| 55 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromref(asn1p_ref_t *ref, int do_copy); |
vlm | 808411d | 2006-03-14 16:31:37 +0000 | [diff] [blame^] | 56 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_frombuf(char *buf, int len, int _copy); |
| 57 | asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax); |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 58 | |
| 59 | |
| 60 | #endif /* ASN1_PARSER_CLASS_H */ |