blob: ca311fe3972403e6f40f7e685e729ea4ebfda91d [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*
2 * CLASS-related stuff.
3 */
4#ifndef ASN1_PARSER_CLASS_H
5#define ASN1_PARSER_CLASS_H
6
Lev Walkin8d35c462005-02-25 13:32:12 +00007#include "asn1p_ref.h"
Lev Walkinf15320b2004-06-03 03:38:44 +00008
9/*
10 * WITH SYNTAX free-form chunks.
11 */
12typedef struct asn1p_wsyntx_chunk_s {
Lev Walkin9d542d22006-03-14 16:31:37 +000013 enum {
14 WC_LITERAL,
15 WC_REFERENCE,
16 WC_OPTIONALGROUP
17 } type;
Lev Walkinf15320b2004-06-03 03:38:44 +000018 /*
Lev Walkin9d542d22006-03-14 16:31:37 +000019 * WC_LITERAL -> {buf, len}
20 * WC_REFERENCE -> {ref}
21 * WC_OPTIONALGROUP -> {syntax}
Lev Walkinf15320b2004-06-03 03:38:44 +000022 */
Lev Walkin9d542d22006-03-14 16:31:37 +000023 union {
24 char *token;
25 asn1p_ref_t *ref;
26 struct asn1p_wsyntx_s *syntax;
27 } content;
Lev Walkinf15320b2004-06-03 03:38:44 +000028
29 TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next;
30} asn1p_wsyntx_chunk_t;
31
32typedef 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 */
42asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void);
43void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *);
44asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *);
45
46asn1p_wsyntx_t *asn1p_wsyntx_new(void);
47void asn1p_wsyntx_free(asn1p_wsyntx_t *);
48asn1p_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 */
55asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromref(asn1p_ref_t *ref, int do_copy);
Lev Walkin9d542d22006-03-14 16:31:37 +000056asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_frombuf(char *buf, int len, int _copy);
57asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax);
Lev Walkinf15320b2004-06-03 03:38:44 +000058
59
60#endif /* ASN1_PARSER_CLASS_H */