2 * A generic value of different syntaxes.
4 #ifndef ASN1_PARSER_VALUE_H
5 #define ASN1_PARSER_VALUE_H
7 struct asn1p_constraint_s; /* Forward declaration */
12 * A wrapper around various kinds of values.
14 typedef struct asn1p_value_s {
16 * The value of the element.
20 ATV_TYPE, /* A type (as in CONTAINING Type) */
21 ATV_NULL, /* A "NULL" value of type NULL. */
22 ATV_REAL, /* A constant floating-point value */
23 ATV_INTEGER, /* An integer constant */
28 ATV_TUPLE, /* { 1, 15 } */
29 ATV_QUADRUPLE, /* { 0, 14, 0, 255 } */
30 ATV_STRING, /* "abcdef" */
33 ATV_VALUESET, /* { 1 | 2 | 3 } */
34 ATV_REFERENCED, /* Reference to a value defined elsewhere */
35 ATV_CHOICE_IDENTIFIER, /* ChoiceIdentifier value */
36 } type; /* Value type and location */
39 struct asn1p_constraint_s *constraint; /* ValueSet */
40 struct asn1p_expr_s *v_type; /* Type */
41 asn1p_ref_t *reference;
42 asn1c_integer_t v_integer;
57 struct asn1p_value_s *value;
63 * Destructor and constructors for value.
64 * If ref, bits or buffer are omitted, the corresponding function returns
65 * (asn1p_value_t *)0 with errno = EINVAL.
66 * Allocated value (where applicable) is guaranteed to be NUL-terminated.
68 void asn1p_value_free(asn1p_value_t *);
69 asn1p_value_t *asn1p_value_fromref(asn1p_ref_t *ref, int do_copy);
70 asn1p_value_t *asn1p_value_fromconstr(struct asn1p_constraint_s *ct, int dc);
71 asn1p_value_t *asn1p_value_frombits(uint8_t *bits, int size_in_bits, int dc);
72 asn1p_value_t *asn1p_value_frombuf(char *buffer, int size, int do_copy);
73 asn1p_value_t *asn1p_value_fromdouble(double);
74 asn1p_value_t *asn1p_value_fromint(asn1c_integer_t);
75 asn1p_value_t *asn1p_value_fromtype(struct asn1p_expr_s *);
76 asn1p_value_t *asn1p_value_clone(asn1p_value_t *);
77 asn1p_value_t *asn1p_value_clone_with_resolver(asn1p_value_t *,
78 asn1p_value_t *(*resolver)(asn1p_value_t *, void *rarg),
80 int asn1p_value_compare(const asn1p_value_t *, const asn1p_value_t *);
81 void asn1p_value_set_source(asn1p_value_t *, struct asn1p_module_s *, int line);
83 #endif /* ASN1_PARSER_VALUE_H */