Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Generic reference to the yet unknown type defined elsewhere. |
| 3 | */ |
| 4 | #ifndef ASN1_PARSER_REFERENCE_H |
| 5 | #define ASN1_PARSER_REFERENCE_H |
| 6 | |
| 7 | typedef struct asn1p_ref_s { |
| 8 | |
| 9 | /* |
| 10 | * A set of reference name components. |
| 11 | * A reference name consists of several components separated by dots: |
| 12 | * "OBJECT-CLASS.&Algorithm.&id" |
| 13 | */ |
| 14 | struct asn1p_ref_component_s { |
| 15 | enum asn1p_ref_lex_type_e { |
| 16 | RLT_UNKNOWN, /* Invalid? */ |
| 17 | /* |
| 18 | * Object class reference "OCLASS1", |
| 19 | * type reference "Type1", |
| 20 | * value reference "id", |
| 21 | * type field reference "&Type1", |
| 22 | * value field reference "&id", |
| 23 | * "OBJECT-CLASS" |
| 24 | */ |
| 25 | RLT_CAPITALS, |
| 26 | RLT_Uppercase, |
| 27 | RLT_lowercase, |
| 28 | RLT_AmpUppercase, |
| 29 | RLT_Amplowercase, |
| 30 | RLT_Atlowercase, |
| 31 | RLT_AtDotlowercase, |
| 32 | RLT_MAX |
| 33 | } lex_type; /* Inferred lexical type of the identifier */ |
| 34 | char *name; /* An identifier */ |
| 35 | } *components; |
| 36 | |
| 37 | int comp_count; /* Number of the components in the reference name. */ |
| 38 | int comp_size; /* Number of allocated structures */ |
| 39 | |
| 40 | int _lineno; /* Number of line in the file */ |
| 41 | } asn1p_ref_t; |
| 42 | |
| 43 | /* |
| 44 | * Constructor and destructor. |
| 45 | */ |
| 46 | asn1p_ref_t *asn1p_ref_new(int _lineno); |
| 47 | void asn1p_ref_free(asn1p_ref_t *); |
| 48 | |
| 49 | asn1p_ref_t *asn1p_ref_clone(asn1p_ref_t *ref); |
| 50 | |
| 51 | /* |
| 52 | * Add a new reference component to the existing reference structure. |
| 53 | * |
| 54 | * RETURN VALUES: |
| 55 | * 0: All clear. |
| 56 | * -1/EINVAL: Invalid arguments |
| 57 | * -1/ENOMEM: Memory allocation failed |
| 58 | */ |
| 59 | int asn1p_ref_add_component(asn1p_ref_t *, |
| 60 | char *name, enum asn1p_ref_lex_type_e); |
| 61 | |
| 62 | #endif /* ASN1_PARSER_REFERENCE_H */ |