blob: 571be6171b595dd531ddd7d75fb15ede5d2dbb6b [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001/*
2 * CLASS-related stuff.
3 */
4#ifndef ASN1_PARSER_CLASS_H
5#define ASN1_PARSER_CLASS_H
6
vlmea4246f2005-02-25 13:32:12 +00007#include "asn1p_ref.h"
vlmfa67ddc2004-06-03 03:38:44 +00008
vlma6a84d72006-03-16 10:03:35 +00009struct asn1p_expr_s; /* Forward declaration */
10
11typedef 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
20asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass);
21void asn1p_ioc_row_delete(asn1p_ioc_row_t *);
22struct asn1p_ioc_cell_s *asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *,
23 const char *fieldname);
24
vlmfa67ddc2004-06-03 03:38:44 +000025/*
26 * WITH SYNTAX free-form chunks.
27 */
28typedef struct asn1p_wsyntx_chunk_s {
vlm808411d2006-03-14 16:31:37 +000029 enum {
30 WC_LITERAL,
vlmeeb3c512006-03-16 05:11:14 +000031 WC_WHITESPACE,
vlma6a84d72006-03-16 10:03:35 +000032 WC_FIELD,
vlm808411d2006-03-14 16:31:37 +000033 WC_OPTIONALGROUP
34 } type;
vlmfa67ddc2004-06-03 03:38:44 +000035 /*
vlmeeb3c512006-03-16 05:11:14 +000036 * WC_LITERAL -> {token}
37 * WC_WHITESPACE -> {token}
vlma6a84d72006-03-16 10:03:35 +000038 * WC_FIELD -> {token}
vlm808411d2006-03-14 16:31:37 +000039 * WC_OPTIONALGROUP -> {syntax}
vlmfa67ddc2004-06-03 03:38:44 +000040 */
vlm808411d2006-03-14 16:31:37 +000041 union {
vlma6a84d72006-03-16 10:03:35 +000042 char *token;
vlm808411d2006-03-14 16:31:37 +000043 struct asn1p_wsyntx_s *syntax;
44 } content;
vlmfa67ddc2004-06-03 03:38:44 +000045
46 TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next;
47} asn1p_wsyntx_chunk_t;
48
49typedef 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 */
59asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void);
60void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *);
61asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *);
62
63asn1p_wsyntx_t *asn1p_wsyntx_new(void);
64void asn1p_wsyntx_free(asn1p_wsyntx_t *);
65asn1p_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 */
vlm1fcf7592006-08-18 02:27:55 +000072asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromstring(char *token, int _copy);
vlm808411d2006-03-14 16:31:37 +000073asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax);
vlmfa67ddc2004-06-03 03:38:44 +000074
75
76#endif /* ASN1_PARSER_CLASS_H */