XER support

pespin/master
Lev Walkin 2004-10-20 15:50:55 +00:00
parent 87534e07f9
commit dc06f6b0d2
76 changed files with 1471 additions and 229 deletions

View File

@ -944,7 +944,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("\n");
p = MKID(expr->Identifier);
OUT("ber_dec_rval_t\n");
OUT("asn_dec_rval_t\n");
OUT("%s_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,\n", p);
INDENTED(
OUT("\tvoid **structure, void *bufptr, size_t size, int tag_mode) {\n");
@ -1472,6 +1472,9 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr) {
return 0;
}
/*
* Generate "asn_DEF_XXX" type definition.
*/
static int
emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec spec) {
char *p;
@ -1482,6 +1485,7 @@ emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_
OUT("asn_TYPE_descriptor_t asn_DEF_%s = {\n", p);
INDENT(+1);
OUT("\"%s\",\n", expr->_anonymous_type?"":expr->Identifier);
OUT("\"%s\",\n", expr->_anonymous_type?"":expr->Identifier);
if(expr->expr_type & ASN_CONSTR_MASK) {
p = asn1c_type_name(arg, arg->expr, TNF_SAFE);

View File

@ -13,13 +13,14 @@ static asn_OCTET_STRING_specifics_t asn_DEF_ANY_specs = {
2 /* Special indicator that this is an ANY type */
};
asn_TYPE_descriptor_t asn_DEF_ANY = {
"ANY",
"ANY",
OCTET_STRING_free,
OCTET_STRING_print,
asn_generic_no_constraint,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
0, /* Not implemented yet */
OCTET_STRING_decode_xer_hex,
ANY_encode_xer,
0, /* Use generic outmost tag fetcher */
0, 0, 0, 0,
@ -111,7 +112,7 @@ ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) {
int
ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
ber_dec_rval_t rval;
asn_dec_rval_t rval;
void *newst = 0;
if(!st || !td || !struct_ptr) {

View File

@ -19,12 +19,13 @@ static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = {
};
asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
"BIT STRING",
"BIT_STRING",
OCTET_STRING_free, /* Implemented in terms of OCTET STRING */
BIT_STRING_print,
BIT_STRING_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_decode_xer_binary,
BIT_STRING_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_BIT_STRING_tags,

View File

@ -13,6 +13,7 @@ static ber_tlv_tag_t asn_DEF_BMPString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_BMPString = {
"BMPString",
"BMPString",
OCTET_STRING_free, /* Implemented in terms of OCTET STRING */
BMPString_print,
@ -20,7 +21,7 @@ asn_TYPE_descriptor_t asn_DEF_BMPString = {
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
BMPString_encode_xer, /* Conver to UTF8 */
BMPString_encode_xer, /* Convert to UTF8 */
0, /* Use generic outmost tag fetcher */
asn_DEF_BMPString_tags,
sizeof(asn_DEF_BMPString_tags)

View File

@ -12,6 +12,7 @@ static ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (1 << 2))
};
asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
"BOOLEAN",
"BOOLEAN",
BOOLEAN_free,
BOOLEAN_print,
@ -32,13 +33,13 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
/*
* Decode BOOLEAN type.
*/
ber_dec_rval_t
asn_dec_rval_t
BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
void **bool_value, void *buf_ptr, size_t size,
int tag_mode) {
BOOLEAN_t *st = (BOOLEAN_t *)*bool_value;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
ber_tlv_len_t length;
ber_tlv_len_t lidx;

View File

@ -13,6 +13,7 @@ static ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_ENUMERATED = {
"ENUMERATED",
"ENUMERATED",
ASN__PRIMITIVE_TYPE_free,
INTEGER_print, /* Implemented in terms of INTEGER */

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_GeneralString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_GeneralString = {
"GeneralString",
"GeneralString",
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
OCTET_STRING_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_GeneralString_tags,
sizeof(asn_DEF_GeneralString_tags)

View File

@ -122,13 +122,14 @@ static ber_tlv_tag_t asn_DEF_GeneralizedTime_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = {
"GeneralizedTime",
"GeneralizedTime",
OCTET_STRING_free,
GeneralizedTime_print,
GeneralizedTime_constraint, /* Check validity of time */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
GeneralizedTime_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
GeneralizedTime_encode_der,
OCTET_STRING_decode_xer_utf8,
GeneralizedTime_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_GeneralizedTime_tags,
@ -231,7 +232,7 @@ GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
sptr = &st;
}
return OCTET_STRING_encode_xer_ascii(td, sptr, ilevel, flags,
return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags,
cb, app_key);
}

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_GraphicString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_GraphicString = {
"GraphicString",
"GraphicString",
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
OCTET_STRING_encode_xer, /* Can't expect it to be ASCII/UTF8 */
0, /* Use generic outmost tag fetcher */
asn_DEF_GraphicString_tags,
sizeof(asn_DEF_GraphicString_tags)

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_IA5String_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_IA5String = {
"IA5String",
"IA5String",
OCTET_STRING_free,
OCTET_STRING_print_ascii, /* ASCII subset */
OCTET_STRING_print_utf8, /* ASCII subset */
IA5String_constraint, /* Constraint on the alphabet */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii,/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_IA5String_tags,
sizeof(asn_DEF_IA5String_tags)

View File

@ -15,6 +15,7 @@ static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_INTEGER = {
"INTEGER",
"INTEGER",
ASN__PRIMITIVE_TYPE_free,
INTEGER_print,

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_ISO646String_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_ISO646String = {
"ISO646String",
"ISO646String",
OCTET_STRING_free,
OCTET_STRING_print_ascii, /* ASCII subset */
OCTET_STRING_print_utf8, /* ASCII subset */
VisibleString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii,/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_ISO646String_tags,
sizeof(asn_DEF_ISO646String_tags)

View File

@ -13,6 +13,7 @@ static ber_tlv_tag_t asn_DEF_NULL_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (5 << 2))
};
asn_TYPE_descriptor_t asn_DEF_NULL = {
"NULL",
"NULL",
BOOLEAN_free,
NULL_print,

View File

@ -20,6 +20,7 @@ static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = {
};
asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = {
"ENUMERATED", /* The ASN.1 type is still ENUMERATED */
"ENUMERATED",
NativeInteger_free,
NativeInteger_print,
asn_generic_no_constraint,

View File

@ -22,6 +22,7 @@ static ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = {
};
asn_TYPE_descriptor_t asn_DEF_NativeInteger = {
"INTEGER", /* The ASN.1 type is still INTEGER */
"INTEGER",
NativeInteger_free,
NativeInteger_print,
asn_generic_no_constraint,
@ -41,12 +42,12 @@ asn_TYPE_descriptor_t asn_DEF_NativeInteger = {
/*
* Decode INTEGER type.
*/
ber_dec_rval_t
asn_dec_rval_t
NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
void **int_ptr, void *buf_ptr, size_t size, int tag_mode) {
int *Int = (int *)*int_ptr;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
ber_tlv_len_t length;
/*

View File

@ -22,6 +22,7 @@ static ber_tlv_tag_t asn_DEF_NativeReal_tags[] = {
};
asn_TYPE_descriptor_t asn_DEF_NativeReal = {
"REAL", /* The ASN.1 type is still REAL */
"REAL",
NativeReal_free,
NativeReal_print,
asn_generic_no_constraint,
@ -41,12 +42,12 @@ asn_TYPE_descriptor_t asn_DEF_NativeReal = {
/*
* Decode REAL type.
*/
ber_dec_rval_t
asn_dec_rval_t
NativeReal_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
void **dbl_ptr, void *buf_ptr, size_t size, int tag_mode) {
double *Dbl = (double *)*dbl_ptr;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
ber_tlv_len_t length;
/*

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_NumericString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_NumericString = {
"NumericString",
"NumericString",
OCTET_STRING_free,
OCTET_STRING_print_ascii, /* ASCII subset */
OCTET_STRING_print_utf8, /* ASCII subset */
NumericString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii,/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_NumericString_tags,
sizeof(asn_DEF_NumericString_tags)

View File

@ -16,6 +16,7 @@ static ber_tlv_tag_t asn_DEF_OBJECT_IDENTIFIER_tags[] = {
};
asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER = {
"OBJECT IDENTIFIER",
"OBJECT_IDENTIFIER",
ASN__PRIMITIVE_TYPE_free,
OBJECT_IDENTIFIER_print,
OBJECT_IDENTIFIER_constraint,

View File

@ -20,13 +20,14 @@ static asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = {
0
};
asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
"OCTET STRING",
"OCTET STRING", /* Canonical name */
"OCTET_STRING", /* XML tag name */
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii stuff, generally */
asn_generic_no_constraint,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
0, /* Not implemented yet */
OCTET_STRING_decode_xer_hex,
OCTET_STRING_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_OCTET_STRING_tags,
@ -160,14 +161,15 @@ _new_stack() {
/*
* Decode OCTET STRING type.
*/
ber_dec_rval_t
asn_dec_rval_t
OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
void **os_structure, void *buf_ptr, size_t size, int tag_mode) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
? td->specifics : &asn_DEF_OCTET_STRING_specs;
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
BIT_STRING_t *st = (BIT_STRING_t *)*os_structure;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
asn_struct_ctx_t *ctx;
ssize_t consumed_myself = 0;
struct _stack *stck; /* Expectations stack structure */
@ -511,7 +513,8 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t er;
asn_OCTET_STRING_specifics_t *specs = td->specifics
? td->specifics : &asn_DEF_OCTET_STRING_specs;
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
BIT_STRING_t *st = (BIT_STRING_t *)sptr;
OS_type_e type_variant = (OS_type_e)specs->subvariant;
int fix_last_byte = 0;
@ -683,8 +686,48 @@ static struct OCTET_STRING__xer_escape_table_s {
OSXET("\046\147\164\073"), /* &gt; */
};
static int
OS__check_escaped_control_char(void *buf, int size) {
size_t i;
/*
* Inefficient algorithm which translates the escape sequences
* defined above into characters. Returns -1 if not found.
* TODO: replace by a faster algorithm (bsearch(), hash or
* nested table lookups).
*/
for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) {
struct OCTET_STRING__xer_escape_table_s *el;
el = &OCTET_STRING__xer_escape_table[i];
if(el->size == size && memcmp(buf, el->string, size) == 0)
return i;
}
return -1;
}
static int
OCTET_STRING__handle_control_chars(void *struct_ptr, void *chunk_buf, size_t chunk_size) {
/*
* This might be one of the escape sequences
* for control characters. Check it out.
* #11.15.5
*/
int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size);
if(control_char >= 0) {
OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr;
void *p = REALLOC(st->buf, st->size + 2);
if(p) {
st->buf = (uint8_t *)p;
st->buf[st->size++] = control_char;
st->buf[st->size] = '\0'; /* nul-termination */
return 0;
}
}
return -1; /* No, it's not */
}
asn_enc_rval_t
OCTET_STRING_encode_xer_ascii(asn_TYPE_descriptor_t *td, void *sptr,
OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr,
int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) {
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
@ -728,6 +771,396 @@ OCTET_STRING_encode_xer_ascii(asn_TYPE_descriptor_t *td, void *sptr,
return er;
}
/*
* Convert from hexadecimal format (cstring): "AB CD EF"
*/
static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, void *chunk_buf, size_t chunk_size, int have_more) {
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
char *chunk_stop = (char *)chunk_buf;
char *p = chunk_stop;
char *pend = p + chunk_size;
unsigned int clv = 0;
int half = 0; /* Half bit */
uint8_t *buf;
/* Reallocate buffer according to high cap estimation */
ssize_t _ns = st->size + (chunk_size + 1) / 2;
void *nptr = REALLOC(st->buf, _ns + 1);
if(!nptr) return -1;
st->buf = (uint8_t *)nptr;
buf = st->buf + st->size;
/*
* If something like " a b c " appears here, the " a b":3 will be
* converted, and the rest skipped. That is, unless buf_size is greater
* than chunk_size, then it'll be equivalent to "ABC0".
*/
for(; p < pend; p++) {
int ch = *(unsigned char *)p;
switch(ch) {
case 0x09: case 0x0a: case 0x0c: case 0x0d:
case 0x20:
/* Ignore whitespace */
continue;
case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/
case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/
clv = (clv << 4) + (ch - 0x30);
break;
case 0x41: case 0x42: case 0x43: /* ABC */
case 0x44: case 0x45: case 0x46: /* DEF */
clv = (clv << 4) + (ch - (0x41 + 10));
break;
case 0x61: case 0x62: case 0x63: /* abc */
case 0x64: case 0x65: case 0x66: /* def */
clv = (clv << 4) + (ch - (0x61 + 10));
break;
default:
*buf = 0; /* JIC */
return -1;
}
if(half++) {
half = 0;
*buf++ = clv;
chunk_stop = p + 1;
}
}
/*
* Check partial decoding.
*/
if(half) {
if(have_more) {
/*
* Partial specification is fine,
* because no more more PXER_TEXT data is available.
*/
*buf++ = clv << 4;
chunk_stop = p;
}
} else {
chunk_stop = p;
}
st->size = buf - st->buf; /* Adjust the buffer size */
assert(st->size <= _ns);
st->buf[st->size] = 0; /* Courtesy termination */
return (chunk_stop - (char *)chunk_buf); /* Converted size */
}
/*
* Convert from binary format: "00101011101"
*/
static ssize_t OCTET_STRING__convert_binary(void *sptr, void *chunk_buf, size_t chunk_size, int have_more) {
BIT_STRING_t *st = (BIT_STRING_t *)sptr;
char *p = (char *)chunk_buf;
char *pend = p + chunk_size;
int bits_unused = st->bits_unused & 0x7;
uint8_t *buf;
/* Reallocate buffer according to high cap estimation */
ssize_t _ns = st->size + (chunk_size + 7) / 8;
void *nptr = REALLOC(st->buf, _ns + 1);
if(!nptr) return -1;
st->buf = (uint8_t *)nptr;
buf = st->buf + st->size;
(void)have_more;
if(bits_unused == 0)
bits_unused = 8;
else if(st->size)
buf--;
/*
* Convert series of 0 and 1 into the octet string.
*/
for(; p < pend; p++) {
int ch = *(unsigned char *)p;
switch(ch) {
case 0x09: case 0x0a: case 0x0c: case 0x0d:
case 0x20:
/* Ignore whitespace */
break;
case 0x30:
case 0x31:
if(bits_unused-- <= 0) {
*++buf = 0; /* Clean the cell */
bits_unused = 7;
}
*buf |= (ch&1) << bits_unused;
break;
default:
st->bits_unused = bits_unused;
return -1;
}
}
if(bits_unused == 8) {
st->size = buf - st->buf;
st->bits_unused = 0;
} else {
st->size = buf - st->buf + 1;
st->bits_unused = bits_unused;
}
assert(st->size <= _ns);
st->buf[st->size] = 0; /* Courtesy termination */
return chunk_size; /* Converted in full */
}
/*
* Something like strtod(), but with stricter rules.
*/
static int
OS__strtoent(int base, char *buf, char *end, long *return_value) {
long val = 0;
char *p;
for(p = buf; p < end; p++) {
int ch = *p;
if((val * base + base) < 0) return -1; /* Strange huge value */
switch(ch) {
case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/
case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/
val = val * base + (ch - 0x30);
break;
case 0x41: case 0x42: case 0x43: /* ABC */
case 0x44: case 0x45: case 0x46: /* DEF */
val = val * base + (ch - (0x41 + 10));
break;
case 0x61: case 0x62: case 0x63: /* abc */
case 0x64: case 0x65: case 0x66: /* def */
val = val * base + (ch - (0x61 + 10));
break;
case 0x3b: /* ';' */
*return_value = val;
return (p - buf) + 1;
default:
return -1; /* Character set error */
}
}
/* Do not return value. It's an error we're talking about here. */
return (p - buf);
}
/*
* Convert from the plain UTF-8 format, expanding entity references: "2 &lt; 3"
*/
static ssize_t OCTET_STRING__convert_entrefs(void *sptr, void *chunk_buf, size_t chunk_size, int have_more) {
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
char *p = (char *)chunk_buf;
char *pend = p + chunk_size;
uint8_t *buf;
/* Reallocate buffer */
ssize_t _ns = st->size + chunk_size;
void *nptr = REALLOC(st->buf, _ns + 1);
if(!nptr) return -1;
st->buf = (uint8_t *)nptr;
buf = st->buf + st->size;
/*
* Convert series of 0 and 1 into the octet string.
*/
for(; p < pend; p++) {
int ch = *(unsigned char *)p;
int len; /* Length of the rest of the chunk */
if(ch != 0x26 /* '&' */) {
*buf++ = ch;
continue; /* That was easy... */
}
/*
* Process entity reference.
*/
len = chunk_size - (p - (char *)chunk_buf);
if(len == 1 /* "&" */) goto want_more;
if(p[1] == 0x23 /* '#' */) {
char *pval; /* Pointer to start of digits */
long val; /* Entity reference value */
int base;
if(len == 2 /* "&#" */) goto want_more;
if(p[2] == 0x78 /* 'x' */)
pval = p + 3, base = 16;
else
pval = p + 2, base = 10;
len = OS__strtoent(base, pval, p + len, &val);
if(len == -1) {
/* Invalid charset. Just copy verbatim. */
*buf++ = ch;
continue;
}
if(!len || pval[len-1] != 0x3b) goto want_more;
assert(val > 0);
p += (pval - p) + len - 1; /* Advance past entref */
if(val < 0x80) {
*buf++ = (char)val;
} else if(val < 0x800) {
*buf++ = 0xc0 | ((val >> 6));
*buf++ = 0x80 | ((val & 0x3f));
} else if(val < 0x10000) {
*buf++ = 0xe0 | ((val >> 12));
*buf++ = 0x80 | ((val >> 6) & 0x3f);
*buf++ = 0x80 | ((val & 0x3f));
} else if(val < 0x200000) {
*buf++ = 0xf0 | ((val >> 18));
*buf++ = 0x80 | ((val >> 12) & 0x3f);
*buf++ = 0x80 | ((val >> 6) & 0x3f);
*buf++ = 0x80 | ((val & 0x3f));
} else if(val < 0x4000000) {
*buf++ = 0xf8 | ((val >> 24));
*buf++ = 0x80 | ((val >> 18) & 0x3f);
*buf++ = 0x80 | ((val >> 12) & 0x3f);
*buf++ = 0x80 | ((val >> 6) & 0x3f);
*buf++ = 0x80 | ((val & 0x3f));
} else {
*buf++ = 0xfc | ((val >> 30) & 0x1);
*buf++ = 0x80 | ((val >> 24) & 0x3f);
*buf++ = 0x80 | ((val >> 18) & 0x3f);
*buf++ = 0x80 | ((val >> 12) & 0x3f);
*buf++ = 0x80 | ((val >> 6) & 0x3f);
*buf++ = 0x80 | ((val & 0x3f));
}
} else {
/*
* Ugly, limited parsing of &amp; &gt; &lt;
*/
char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len);
if(!sc) goto want_more;
if((sc - p) == 4
&& p[1] == 0x61 /* 'a' */
&& p[2] == 0x6d /* 'm' */
&& p[3] == 0x70 /* 'p' */) {
*buf++ = 0x26;
p = sc;
continue;
}
if((sc - p) == 3) {
if(p[1] == 0x6c) {
*buf = 0x3c; /* '<' */
} else if(p[1] == 0x67) {
*buf = 0x3e; /* '>' */
} else {
/* Unsupported entity reference */
*buf++ = ch;
continue;
}
if(p[2] != 0x74) {
/* Unsupported entity reference */
*buf++ = ch;
continue;
}
buf++;
p = sc;
continue;
}
/* Unsupported entity reference */
*buf++ = ch;
}
continue;
want_more:
if(have_more) {
/*
* We know that no more data (of the same type)
* is coming. Copy the rest verbatim.
*/
*buf++ = ch;
continue;
}
*buf = 0; /* JIC */
/* Processing stalled: need more data */
return (p - (char *)chunk_buf);
}
st->size = buf - st->buf;
assert(st->size <= _ns);
st->buf[st->size] = 0; /* Courtesy termination */
return chunk_size; /* Converted in full */
}
/*
* Decode OCTET STRING from the XML element's body.
*/
static asn_dec_rval_t
OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, void **sptr,
const char *opt_mname, void *buf_ptr, size_t size,
int (*opt_unexpected_tag_decoder)
(void *struct_ptr, void *chunk_buf, size_t chunk_size),
ssize_t (*body_receiver)
(void *struct_ptr, void *chunk_buf, size_t chunk_size,
int have_more)
) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
asn_struct_ctx_t *ctx; /* Per-structure parser context */
/*
* Create the string if does not exist.
*/
if(!*sptr) {
*sptr = CALLOC(1, specs->struct_size);
if(*sptr == NULL) {
asn_dec_rval_t rval;
rval.code = RC_FAIL;
rval.consumed = 0;
return rval;
}
}
/* Restore parsing context */
ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset);
return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag,
buf_ptr, size, opt_unexpected_tag_decoder, body_receiver);
}
/*
* Decode OCTET STRING from the hexadecimal data.
*/
asn_dec_rval_t
OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, void **sptr,
const char *opt_mname, void *buf_ptr, size_t size) {
return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal);
}
/*
* Decode OCTET STRING from the binary (0/1) data.
*/
asn_dec_rval_t
OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, void **sptr,
const char *opt_mname, void *buf_ptr, size_t size) {
return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
buf_ptr, size, 0, OCTET_STRING__convert_binary);
}
/*
* Decode OCTET STRING from the string (ASCII/UTF-8) data.
*/
asn_dec_rval_t
OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, void **sptr,
const char *opt_mname, void *buf_ptr, size_t size) {
return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname,
buf_ptr, size,
OCTET_STRING__handle_control_chars,
OCTET_STRING__convert_entrefs);
}
int
OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
@ -770,7 +1203,7 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
int
OCTET_STRING_print_ascii(asn_TYPE_descriptor_t *td, const void *sptr,
OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
@ -788,10 +1221,11 @@ void
OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
asn_OCTET_STRING_specifics_t *specs = td->specifics
? td->specifics : &asn_DEF_OCTET_STRING_specs;
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
asn_struct_ctx_t *ctx = (asn_struct_ctx_t *)
((char *)st + specs->ctx_offset);
struct _stack *stck = ctx->ptr;
struct _stack *stck = (struct _stack *)ctx->ptr;
if(!td || !st)
return;
@ -863,7 +1297,8 @@ OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) {
OCTET_STRING_t *
OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
? td->specifics : &asn_DEF_OCTET_STRING_specs;
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
OCTET_STRING_t *st;
st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size);

View File

@ -18,11 +18,14 @@ extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;
asn_struct_free_f OCTET_STRING_free;
asn_struct_print_f OCTET_STRING_print;
asn_struct_print_f OCTET_STRING_print_ascii;
asn_struct_print_f OCTET_STRING_print_utf8;
ber_type_decoder_f OCTET_STRING_decode_ber;
der_type_encoder_f OCTET_STRING_encode_der;
xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */
xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */
xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */
xer_type_encoder_f OCTET_STRING_encode_xer;
xer_type_encoder_f OCTET_STRING_encode_xer_ascii;
xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
/******************************
* Handy conversion routines. *

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_ObjectDescriptor_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor = {
"ObjectDescriptor",
"ObjectDescriptor",
OCTET_STRING_free,
OCTET_STRING_print_ascii, /* Treat as ASCII subset (it's not) */
OCTET_STRING_print_utf8, /* Treat as ASCII subset (it's not) */
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii,/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_ObjectDescriptor_tags,
sizeof(asn_DEF_ObjectDescriptor_tags)

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_PrintableString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_PrintableString = {
"PrintableString",
"PrintableString",
OCTET_STRING_free,
OCTET_STRING_print_ascii, /* ASCII subset */
OCTET_STRING_print_utf8, /* ASCII subset */
PrintableString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii,/* Implemented in terms of OCTET STRING */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_PrintableString_tags,
sizeof(asn_DEF_PrintableString_tags)

View File

@ -24,6 +24,7 @@ static ber_tlv_tag_t asn_DEF_REAL_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_REAL = {
"REAL",
"REAL",
ASN__PRIMITIVE_TYPE_free,
REAL_print,

View File

@ -17,6 +17,7 @@ static ber_tlv_tag_t asn_DEF_RELATIVE_OID_tags[] = {
};
asn_TYPE_descriptor_t asn_DEF_RELATIVE_OID = {
"RELATIVE-OID",
"RELATIVE_OID",
ASN__PRIMITIVE_TYPE_free,
RELATIVE_OID_print,
asn_generic_no_constraint,

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_T61String_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_T61String = {
"T61String",
"T61String",
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
OCTET_STRING_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_T61String_tags,
sizeof(asn_DEF_T61String_tags)

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_TeletexString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_TeletexString = {
"TeletexString",
"TeletexString",
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
OCTET_STRING_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_TeletexString_tags,
sizeof(asn_DEF_TeletexString_tags)

View File

@ -20,13 +20,14 @@ static ber_tlv_tag_t asn_DEF_UTCTime_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_UTCTime = {
"UTCTime",
"UTCTime",
OCTET_STRING_free,
UTCTime_print,
UTCTime_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_decode_xer_utf8,
UTCTime_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_UTCTime_tags,
@ -88,7 +89,7 @@ UTCTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
sptr = &st;
}
return OCTET_STRING_encode_xer_ascii(td, sptr, ilevel, flags,
return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags,
cb, app_key);
}

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_UTF8String_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_UTF8String = {
"UTF8String",
"UTF8String",
OCTET_STRING_free,
UTF8String_print,
UTF8String_constraint, /* Check for invalid codes, etc. */
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii, /* Already in UTF-8 format */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_UTF8String_tags,
sizeof(asn_DEF_UTF8String_tags)

View File

@ -13,6 +13,7 @@ static ber_tlv_tag_t asn_DEF_UniversalString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_UniversalString = {
"UniversalString",
"UniversalString",
OCTET_STRING_free,
UniversalString_print, /* Convert into UTF8 and print */
@ -20,7 +21,7 @@ asn_TYPE_descriptor_t asn_DEF_UniversalString = {
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
UniversalString_encode_xer, /* Conver into UTF8 */
UniversalString_encode_xer, /* Convert into UTF8 */
0, /* Use generic outmost tag fetcher */
asn_DEF_UniversalString_tags,
sizeof(asn_DEF_UniversalString_tags)

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_VideotexString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_VideotexString = {
"VideotexString",
"VideotexString",
OCTET_STRING_free,
OCTET_STRING_print, /* non-ascii string */
asn_generic_unknown_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
OCTET_STRING_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_VideotexString_tags,
sizeof(asn_DEF_VideotexString_tags)

View File

@ -13,14 +13,15 @@ static ber_tlv_tag_t asn_DEF_VisibleString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
asn_TYPE_descriptor_t asn_DEF_VisibleString = {
"VisibleString",
"VisibleString",
OCTET_STRING_free,
OCTET_STRING_print_ascii, /* ASCII subset */
OCTET_STRING_print_utf8, /* ASCII subset */
VisibleString_constraint,
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
0, /* Not implemented yet */
OCTET_STRING_encode_xer_ascii,/* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_utf8,
OCTET_STRING_encode_xer_utf8,
0, /* Use generic outmost tag fetcher */
asn_DEF_VisibleString_tags,
sizeof(asn_DEF_VisibleString_tags)

View File

@ -3,7 +3,6 @@
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <asn_types.h> /* for MALLOC/REALLOC/FREEMEM */
#include <asn_SEQUENCE_OF.h>
typedef A_SEQUENCE_OF(void) asn_sequence;

View File

@ -3,7 +3,6 @@
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <asn_types.h> /* for MALLOC/REALLOC/FREEMEM */
#include <asn_SET_OF.h>
#include <errno.h>

View File

@ -8,7 +8,8 @@
#ifndef _ASN_APPLICATION_H_
#define _ASN_APPLICATION_H_
#include <asn_types.h> /* for platform-dependent types */
#include <asn_system.h> /* for platform-dependent types */
#include <asn_codecs.h> /* for ASN.1 codecs specifics */
/*
* Generic type of an application-defined callback to return various

76
skeletons/asn_codecs.h Normal file
View File

@ -0,0 +1,76 @@
/*-
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _ASN_CODECS_H_
#define _ASN_CODECS_H_
struct asn_TYPE_descriptor_s; /* Forward declaration */
/*
* This structure defines a context that may be passed to every ASN.1 encoder
* or decoder function.
* WARNING: if max_stack_size member is set, and you are calling the
* function pointers of the asn_TYPE_descriptor_t directly,
* this structure must be ALLOCATED ON THE STACK!
*/
typedef struct asn_codec_ctx_s {
/*
* Limit the decoder routines to use no (much) more stack than a given
* number of bytes. Most of decoders are stack-based, and this
* would protect against stack overflows if the number of nested
* encodings is high.
* The OCTET STRING, BIT STRING and ANY BER decoders are heap-based,
* and are safe from this kind of overflow.
* A value from getrlimit(RLIMIT_STACK) may be used to initialize
* this variable. Be careful in multithreaded environments, as the
* stack size is rather limited.
*/
size_t max_stack_size; /* 0 disables stack bounds checking */
} asn_codec_ctx_t;
/*
* Type of the return value of the encoding functions (der_encode, xer_encode).
*/
typedef struct asn_enc_rval_s {
/*
* Number of bytes encoded.
* -1 indicates failure to encode the structure.
* In this case, the members below this one are meaningful.
*/
ssize_t encoded;
/*
* Members meaningful when (encoded == -1), for post mortem analysis.
*/
/* Type which cannot be encoded */
struct asn_TYPE_descriptor_s *failed_type;
/* Pointer to the structure of that type */
void *structure_ptr;
} asn_enc_rval_t;
#define _ASN_ENCODE_FAILED do { \
asn_enc_rval_t __er = { -1, td, sptr }; \
return __er; \
} while(0)
/*
* Type of the return value of the decoding functions (ber_decode, xer_decode)
*
* Please note that the number of consumed bytes is ALWAYS meaningful,
* even if code==RC_FAIL. This is to indicate the number of successfully
* decoded bytes, hence providing a possibility to fail with more diagnostics
* (i.e., print the offending remainder of the buffer).
*/
enum asn_dec_rval_code_e {
RC_OK, /* Decoded successfully */
RC_WMORE, /* More data expected, call again */
RC_FAIL /* Failure to decode data */
};
typedef struct asn_dec_rval_s {
enum asn_dec_rval_code_e code; /* Result code */
size_t consumed; /* Number of bytes consumed */
} asn_dec_rval_t;
#endif /* _ASN_CODECS_H_ */

View File

@ -8,7 +8,7 @@
#ifndef _ASN_INTERNAL_H_
#define _ASN_INTERNAL_H_
#define ASN1C_ENVIRONMENT_VERSION 96 /* Compile-time version */
#define ASN1C_ENVIRONMENT_VERSION 98 /* Compile-time version */
int get_asn1c_environment_version(void); /* Run-time version */
#include <asn_application.h> /* Application-visible API */

View File

@ -5,8 +5,8 @@
/*
* Miscellaneous system-dependent types.
*/
#ifndef _ASN_TYPES_H_
#define _ASN_TYPES_H_
#ifndef _ASN_SYSTEM_H_
#define _ASN_SYSTEM_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -31,7 +31,7 @@
* 2. Sun Solaris requires <alloca.h> for alloca(3),
* but does not have <stdint.h>.