XER support

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@513 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2004-10-20 15:50:55 +00:00
parent 45ca098028
commit 9de248e720
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>.
*/
#if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_))
#if (!defined(__FreeBSD__) || !defined(_SYS_INTSYSTEM_H_))
#if defined(sun)
#include <alloca.h> /* For alloca(3) */
#else
@ -62,4 +62,4 @@
#endif /* __GNUC__ */
#endif /* MIN */
#endif /* _ASN_TYPES_H_ */
#endif /* _ASN_SYSTEM_H_ */

View File

@ -10,12 +10,12 @@
/*
* Decode an always-primitive type.
*/
ber_dec_rval_t
asn_dec_rval_t
ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
void **sptr, void *buf_ptr, size_t size, int tag_mode) {
ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
ber_tlv_len_t length;
/*

View File

@ -14,7 +14,7 @@
} while(0)
#undef RETURN
#define RETURN(_code) do { \
ber_dec_rval_t rval; \
asn_dec_rval_t rval; \
rval.code = _code; \
if(opt_ctx) opt_ctx->step = step; /* Save context */ \
if(_code == RC_OK || opt_ctx) \
@ -27,7 +27,7 @@
/*
* The BER decoder of any type.
*/
ber_dec_rval_t
asn_dec_rval_t
ber_decode(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *type_descriptor,
void **struct_ptr, void *ptr, size_t size) {
@ -55,7 +55,7 @@ ber_decode(asn_codec_ctx_t *opt_codec_ctx,
/*
* Check the set of <TL<TL<TL...>>> tags matches the definition.
*/
ber_dec_rval_t
asn_dec_rval_t
ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx,
void *ptr, size_t size, int tag_mode, int last_tag_form,

View File

@ -10,30 +10,11 @@
struct asn_TYPE_descriptor_s; /* Forward declaration */
struct asn_codec_ctx_s; /* Forward declaration */
/*
* This structure describes the return value common across the
* various BER decoders.
*
* Please note that the number of consumed bytes is ALWAYS meaningful,
* even if code!=RC_OK. This is so to indicate the number of successfully
* decoded bytes, hence provide a possibility, to fail with more diagnostics
* (i.e., print the offending remainder of the buffer).
*/
enum ber_dec_rval_code_e {
RC_OK, /* Decoded successfully */
RC_WMORE, /* More data expected, call again */
RC_FAIL /* Failure to decode data */
};
typedef struct ber_dec_rval_s {
enum ber_dec_rval_code_e code; /* Result code */
size_t consumed; /* Number of bytes consumed */
} ber_dec_rval_t;
/*
* The BER decoder of any type.
* This function may be invoked directly from the application.
*/
ber_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor,
void **struct_ptr, /* Pointer to a target structure's pointer */
void *buffer, /* Data to be decoded */
@ -43,10 +24,10 @@ ber_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
/*
* Type of generic function which decodes the byte stream into the structure.
*/
typedef ber_dec_rval_t (ber_type_decoder_f)(
typedef asn_dec_rval_t (ber_type_decoder_f)(
struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor,
void **type_structure, void *buf_ptr, size_t size,
void **struct_ptr, void *buf_ptr, size_t size,
int tag_mode);
/*******************************
@ -60,7 +41,7 @@ typedef ber_dec_rval_t (ber_type_decoder_f)(
* "end of content" sequences. The number may only be negative if the
* head->last_tag_form is non-zero.
*/
ber_dec_rval_t ber_check_tags(
asn_dec_rval_t ber_check_tags(
struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */
struct asn_TYPE_descriptor_s *type_dsc,
asn_struct_ctx_t *opt_ctx, /* saved decoding context */

View File

@ -96,7 +96,7 @@ _search4tag(const void *ap, const void *bp) {
/*
* The decoder of the CHOICE type.
*/
ber_dec_rval_t
asn_dec_rval_t
CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **struct_ptr, void *ptr, size_t size, int tag_mode) {
/*
@ -113,7 +113,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ber_tlv_tag_t tlv_tag; /* T from TLV */
ssize_t tag_len; /* Length of TLV's T */
ber_dec_rval_t rval; /* Return code from subparsers */
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */

View File

@ -12,7 +12,7 @@ typedef struct asn_CHOICE_specifics_s {
* Target structure description.
*/
int struct_size; /* Size of the target structure. */
int ctx_offset; /* Offset of the ber_dec_ctx_t member */
int ctx_offset; /* Offset of the asn_codec_ctx_t member */
int pres_offset; /* Identifier of the present member */
int pres_size; /* Size of the identifier (enum) */

View File

@ -107,7 +107,7 @@ _t2e_cmp(const void *ap, const void *bp) {
/*
* The decoder of the SEQUENCE type.
*/
ber_dec_rval_t
asn_dec_rval_t
SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **struct_ptr, void *ptr, size_t size, int tag_mode) {
/*
@ -123,7 +123,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_struct_ctx_t *ctx; /* Decoder context */
ber_tlv_tag_t tlv_tag; /* T from TLV */
ber_dec_rval_t rval; /* Return code from subparsers */
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* SEQUENCE element's index */

View File

@ -92,7 +92,8 @@ SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_TYPE_member_t *element = td->elements;
A_SEQUENCE_OF(void) *list;
const char *mname = specs->as_XMLValueList
? 0 : ((*element->name) ? element->name : element->type->name);
? 0 : ((*element->name)
? element->name : element->type->xml_tag);
unsigned int mlen = mname ? strlen(mname) : 0;
int xcan = (flags & XER_F_CANONICAL);
int i;

View File

@ -96,7 +96,7 @@ _t2e_cmp(const void *ap, const void *bp) {
/*
* The decoder of the SET type.
*/
ber_dec_rval_t
asn_dec_rval_t
SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **struct_ptr, void *ptr, size_t size, int tag_mode) {
/*
@ -112,7 +112,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_struct_ctx_t *ctx; /* Decoder context */
ber_tlv_tag_t tlv_tag; /* T from TLV */
ber_dec_rval_t rval; /* Return code from subparsers */
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* SET element's index */

View File

@ -65,7 +65,7 @@
/*
* The decoder of the SET OF type.
*/
ber_dec_rval_t
asn_dec_rval_t
SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **struct_ptr, void *ptr, size_t size, int tag_mode) {
/*
@ -81,7 +81,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_struct_ctx_t *ctx; /* Decoder context */
ber_tlv_tag_t tlv_tag; /* T from TLV */
ber_dec_rval_t rval; /* Return code from subparsers */
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
@ -495,7 +495,8 @@ SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_TYPE_member_t *element = td->elements;
A_SET_OF(void) *list;
const char *mname = specs->as_XMLValueList
? 0 : ((*element->name) ? element->name : element->type->name);
? 0 : ((*element->name)
? element->name : element->type->xml_tag);
size_t mlen = mname ? strlen(mname) : 0;
int xcan = (flags & XER_F_CANONICAL);
xer_tmp_enc_t *encs = 0;

View File

@ -8,8 +8,8 @@
* This structure even contains pointer to these encoding and decoding routines
* for each defined ASN.1 type.
*/
#ifndef _CONSTR_TYPE_H
#define _CONSTR_TYPE_H
#ifndef _CONSTR_TYPE_H_
#define _CONSTR_TYPE_H_
#include <ber_tlv_length.h>
#include <ber_tlv_tag.h>
@ -29,58 +29,11 @@ typedef struct asn_struct_ctx_s {
void *ptr; /* Decoder-specific stuff (stack elements) */
} asn_struct_ctx_t;
/*
* 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)
#include <ber_decoder.h>
#include <der_encoder.h>
#include <xer_encoder.h>
#include <constraints.h>
#include <ber_decoder.h> /* Basic Encoding Rules decoder */
#include <der_encoder.h> /* Distinguished Encoding Rules encoder */
#include <xer_decoder.h> /* Decoder of XER (XML, text) */
#include <xer_encoder.h> /* Encoder into XER (XML, text) */
#include <constraints.h> /* Subtype constraints support */
/*
* Free the structure according to its specification.
@ -119,7 +72,8 @@ asn_outmost_tag_f asn_TYPE_outmost_tag;
* The definitive description of the destination language's structure.
*/
typedef struct asn_TYPE_descriptor_s {
char *name; /* A name of the ASN.1 type */
char *name; /* A name of the ASN.1 type. "" in some cases. */
char *xml_tag; /* Name used in XML tag */
/*
* Generalized functions for dealing with the specific type.
@ -128,9 +82,9 @@ typedef struct asn_TYPE_descriptor_s {
asn_struct_free_f *free_struct; /* Free the structure */
asn_struct_print_f *print_struct; /* Human readable output */
asn_constr_check_f *check_constraints; /* Constraints validator */
ber_type_decoder_f *ber_decoder; /* Free-form BER decoder */
ber_type_decoder_f *ber_decoder; /* Generic BER decoder */
der_type_encoder_f *der_encoder; /* Canonical DER encoder */
int (*xer_decoder);/* PLACEHOLDER */ /* Free-form XER decoder */
xer_type_decoder_f *xer_decoder; /* Generic XER decoder */
xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */
/***********************************************************************

View File

@ -5,7 +5,7 @@
#ifndef _ASN1_CONSTRAINTS_VALIDATOR_H_
#define _ASN1_CONSTRAINTS_VALIDATOR_H_
#include <asn_types.h> /* System-dependent types */
#include <asn_system.h> /* Platform-dependent types */
struct asn_TYPE_descriptor_s; /* Forward declaration */

View File

@ -44,7 +44,8 @@ constr_SET_OF.h constr_SET_OF.c asn_SET_OF.h
COMMON-FILES: # This is a special section
asn_application.h
asn_internal.h
asn_types.h
asn_codecs.h
asn_system.h # Platform-dependent types
OCTET_STRING.h OCTET_STRING.c # This one is used too widely
BIT_STRING.h BIT_STRING.c # This one is necessary for the above one
ber_decoder.h ber_decoder.c
@ -54,4 +55,5 @@ ber_tlv_tag.h ber_tlv_tag.c
constr_TYPE.h constr_TYPE.c
constraints.h constraints.c
der_encoder.h der_encoder.c
xer_decoder.h xer_decoder.c xer_support.h xer_support.c # XER/XML decoding
xer_encoder.h xer_encoder.c

View File

@ -5,10 +5,12 @@ check_PROGRAMS = \
check-length \
check-OIDs \
check-GeneralizedTime \
check-OCTET_STRING \
check-UTF8String \
check-UTCTime \
check-INTEGER \
check-REAL
check-REAL \
check-XER
LDADD = -lm

View File

@ -13,7 +13,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = check-GeneralizedTime.c check-INTEGER.c check-OIDs.c check-REAL.c check-UTCTime.c check-UTF8String.c check-ber_tlv_tag.c check-length.c
SOURCES = check-GeneralizedTime.c check-INTEGER.c check-OCTET_STRING.c check-OIDs.c check-REAL.c check-UTCTime.c check-UTF8String.c check-XER.c check-ber_tlv_tag.c check-length.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@ -38,8 +38,9 @@ POST_UNINSTALL = :
host_triplet = @host@
check_PROGRAMS = check-ber_tlv_tag$(EXEEXT) check-length$(EXEEXT) \
check-OIDs$(EXEEXT) check-GeneralizedTime$(EXEEXT) \
check-UTF8String$(EXEEXT) check-UTCTime$(EXEEXT) \
check-INTEGER$(EXEEXT) check-REAL$(EXEEXT)
check-OCTET_STRING$(EXEEXT) check-UTF8String$(EXEEXT) \
check-UTCTime$(EXEEXT) check-INTEGER$(EXEEXT) \
check-REAL$(EXEEXT) check-XER$(EXEEXT)
subdir = skeletons/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -57,6 +58,10 @@ check_INTEGER_SOURCES = check-INTEGER.c
check_INTEGER_OBJECTS = check-INTEGER.$(OBJEXT)
check_INTEGER_LDADD = $(LDADD)
check_INTEGER_DEPENDENCIES =
check_OCTET_STRING_SOURCES = check-OCTET_STRING.c
check_OCTET_STRING_OBJECTS = check-OCTET_STRING.$(OBJEXT)
check_OCTET_STRING_LDADD = $(LDADD)
check_OCTET_STRING_DEPENDENCIES =
check_OIDs_SOURCES = check-OIDs.c
check_OIDs_OBJECTS = check-OIDs.$(OBJEXT)
check_OIDs_LDADD = $(LDADD)
@ -73,6 +78,10 @@ check_UTF8String_SOURCES = check-UTF8String.c
check_UTF8String_OBJECTS = check-UTF8String.$(OBJEXT)
check_UTF8String_LDADD = $(LDADD)
check_UTF8String_DEPENDENCIES =
check_XER_SOURCES = check-XER.c
check_XER_OBJECTS = check-XER.$(OBJEXT)
check_XER_LDADD = $(LDADD)
check_XER_DEPENDENCIES =
check_ber_tlv_tag_SOURCES = check-ber_tlv_tag.c
check_ber_tlv_tag_OBJECTS = check-ber_tlv_tag.$(OBJEXT)
check_ber_tlv_tag_LDADD = $(LDADD)
@ -86,10 +95,12 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/check-GeneralizedTime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-INTEGER.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-OCTET_STRING.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-OIDs.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-REAL.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-UTCTime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-UTF8String.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-XER.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-ber_tlv_tag.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/check-length.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@ -100,12 +111,13 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = check-GeneralizedTime.c check-INTEGER.c check-OIDs.c \
check-REAL.c check-UTCTime.c check-UTF8String.c \
check-ber_tlv_tag.c check-length.c
DIST_SOURCES = check-GeneralizedTime.c check-INTEGER.c check-OIDs.c \
check-REAL.c check-UTCTime.c check-UTF8String.c \
check-ber_tlv_tag.c check-length.c
SOURCES = check-GeneralizedTime.c check-INTEGER.c check-OCTET_STRING.c \
check-OIDs.c check-REAL.c check-UTCTime.c check-UTF8String.c \
check-XER.c check-ber_tlv_tag.c check-length.c
DIST_SOURCES = check-GeneralizedTime.c check-INTEGER.c \
check-OCTET_STRING.c check-OIDs.c check-REAL.c check-UTCTime.c \
check-UTF8String.c check-XER.c check-ber_tlv_tag.c \
check-length.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -267,6 +279,9 @@ check-GeneralizedTime$(EXEEXT): $(check_GeneralizedTime_OBJECTS) $(check_General
check-INTEGER$(EXEEXT): $(check_INTEGER_OBJECTS) $(check_INTEGER_DEPENDENCIES)
@rm -f check-INTEGER$(EXEEXT)
$(LINK) $(check_INTEGER_LDFLAGS) $(check_INTEGER_OBJECTS) $(check_INTEGER_LDADD) $(LIBS)
check-OCTET_STRING$(EXEEXT): $(check_OCTET_STRING_OBJECTS) $(check_OCTET_STRING_DEPENDENCIES)
@rm -f check-OCTET_STRING$(EXEEXT)
$(LINK) $(check_OCTET_STRING_LDFLAGS) $(check_OCTET_STRING_OBJECTS) $(check_OCTET_STRING_LDADD) $(LIBS)
check-OIDs$(EXEEXT): $(check_OIDs_OBJECTS) $(check_OIDs_DEPENDENCIES)
@rm -f check-OIDs$(EXEEXT)
$(LINK) $(check_OIDs_LDFLAGS) $(check_OIDs_OBJECTS) $(check_OIDs_LDADD) $(LIBS)
@ -279,6 +294,9 @@ check-UTCTime$(EXEEXT): $(check_UTCTime_OBJECTS) $(check_UTCTime_DEPENDENCIES)
check-UTF8String$(EXEEXT): $(check_UTF8String_OBJECTS) $(check_UTF8String_DEPENDENCIES)
@rm -f check-UTF8String$(EXEEXT)
$(LINK) $(check_UTF8String_LDFLAGS) $(check_UTF8String_OBJECTS) $(check_UTF8String_LDADD) $(LIBS)
check-XER$(EXEEXT): $(check_XER_OBJECTS) $(check_XER_DEPENDENCIES)
@rm -f check-XER$(EXEEXT)
$(LINK) $(check_XER_LDFLAGS) $(check_XER_OBJECTS) $(check_XER_LDADD) $(LIBS)
check-ber_tlv_tag$(EXEEXT): $(check_ber_tlv_tag_OBJECTS) $(check_ber_tlv_tag_DEPENDENCIES)
@rm -f check-ber_tlv_tag$(EXEEXT)
$(LINK) $(check_ber_tlv_tag_LDFLAGS) $(check_ber_tlv_tag_OBJECTS) $(check_ber_tlv_tag_LDADD) $(LIBS)
@ -294,10 +312,12 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-GeneralizedTime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-INTEGER.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-OCTET_STRING.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-OIDs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-REAL.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-UTCTime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-UTF8String.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-XER.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-ber_tlv_tag.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-length.Po@am__quote@

View File

@ -116,7 +116,7 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber_
}
asn_enc_rval_t
OCTET_STRING_encode_xer_ascii(asn_TYPE_descriptor_t *td, void *ptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) {
OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *ptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t erval;
(void)td;

View File

@ -19,7 +19,7 @@ _print(const void *buffer, size_t size, void *app_key) {
static void
check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
OBJECT_IDENTIFIER_t *oid;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
unsigned long arcs[10];
int alen;
int i;
@ -66,7 +66,7 @@ check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
static void
check_ROID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
RELATIVE_OID_t *oid;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
unsigned long arcs[10];
int alen;
int i;

View File

@ -79,7 +79,7 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber_
}
asn_enc_rval_t
OCTET_STRING_encode_xer_ascii(asn_TYPE_descriptor_t *td, void *ptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) {
OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *ptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t erval;
(void)td;

View File

@ -4,6 +4,8 @@
#include <ber_tlv_length.c>
#include <ber_tlv_tag.c>
#include <der_encoder.c>
#include <xer_decoder.c>
#include <xer_support.c>
#include <constraints.c>
#include <sys/time.h>

View File

@ -2,6 +2,8 @@
#include <ber_tlv_length.c>
#include <ber_tlv_tag.c>
#include <der_encoder.c>
#include <xer_decoder.c>
#include <xer_support.c>
#include <constraints.c>
#undef ADVANCE
#undef RETURN
@ -37,7 +39,7 @@ check(int size) {
OCTET_STRING_t *os;
OCTET_STRING_t *nos = 0;
asn_enc_rval_t erval;
ber_dec_rval_t rval;
asn_dec_rval_t rval;
int i;
os = OCTET_STRING_new_fromBuf(&asn_DEF_OCTET_STRING, 0, size);

288
skeletons/xer_decoder.c Normal file
View File

@ -0,0 +1,288 @@
#include <asn_application.h>
#include <asn_internal.h>
#include <xer_support.h> /* XER/XML parsing support */
#include <assert.h>
/*
* Decode the XER encoding of a given type.
*/
asn_dec_rval_t
xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **struct_ptr, void *buffer, size_t size) {
asn_codec_ctx_t s_codec_ctx;
/*
* Satisfy the requirement that the codec context
* must be allocated on the stack.
*/
if(opt_codec_ctx && opt_codec_ctx->max_stack_size) {
s_codec_ctx = *opt_codec_ctx;
opt_codec_ctx = &s_codec_ctx;
}
/*
* Invoke type-specific decoder.
*/
return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size);
}
struct xer__cb_arg {
pxml_chunk_type_e chunk_type;
size_t chunk_size;
void *chunk_buf;
int callback_not_invoked;
};
static int
xer__token_cb(pxml_chunk_type_e type, void *_chunk_data, size_t _chunk_size, void *key) {
struct xer__cb_arg *arg = (struct xer__cb_arg *)key;
arg->chunk_type = type;
arg->chunk_size = _chunk_size;
arg->chunk_buf = _chunk_data;
arg->callback_not_invoked = 0;
return -1; /* Terminate the XML parsing */
}
/*
* Fetch the next token from the XER/XML stream.
*/
ssize_t
xer_next_token(int *stateContext, void *buffer, size_t size,
pxer_chunk_type_e *ch_type) {
struct xer__cb_arg arg;
ssize_t ret;
arg.callback_not_invoked = 1;
ret = pxml_parse(stateContext, buffer, size, xer__token_cb, &arg);
if(ret < 0) return -1;
if(arg.callback_not_invoked) {
assert(ret == 0); /* No data was consumed */
return 0; /* Try again with more data */
} else {
assert(arg.chunk_size);
assert(arg.chunk_buf == buffer);
}
/*
* Translate the XML chunk types into more convenient ones.
*/
switch(arg.chunk_type) {
case PXML_TEXT:
*ch_type = PXER_TEXT;
break;
case PXML_TAG: return 0; /* Want more */
case PXML_TAG_END:
*ch_type = PXER_TAG;
break;
case PXML_COMMENT:
case PXML_COMMENT_END:
*ch_type = PXER_COMMENT;
break;
}
return arg.chunk_size;
}
#define CSLASH 0x2f /* '/' */
#define LANGLE 0x3c /* '<' */
#define RANGLE 0x3e /* '>' */
xer_check_tag_e
xer_check_tag(const void *buf_ptr, int size, const char *need_tag) {
const char *buf = (const char *)buf_ptr;
const char *end;
xer_check_tag_e ct = XCT_OPENING;
if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) {
return XCT_BROKEN;
}
/*
* Determine the tag class.
*/
if(buf[1] == CSLASH) {
buf += 2; /* advance past "</" */
size -= 3; /* strip "</" and ">" */
ct = XCT_CLOSING;
if(size > 0 && buf[size-1] == CSLASH)
return XCT_BROKEN; /* </abc/> */
} else {
buf++; /* advance past "<" */
size -= 2; /* strip "<" and ">" */
if(size > 0 && buf[size-1] == CSLASH) {
ct = XCT_BOTH;
size--; /* One more, for "/" */
}
}
/*
* Determine the tag name.
*/
for(end = buf + size; buf < end; buf++, need_tag++) {
int b = *buf, n = *need_tag;
if(b != n) {
if(n == 0) {
switch(b) {
case 0x09: case 0x0a: case 0x0c: case 0x0d:
case 0x20:
/* "<abc def/>": whitespace is normal */
return ct;
}
}
return XCT_UNEXPECTED;
}
if(b == 0)
return XCT_BROKEN; /* Embedded 0 in buf?! */
}
if(*need_tag) return XCT_UNEXPECTED;
return ct;
}
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
size_t num = (num_bytes); \
buf_ptr = ((char *)buf_ptr) + num; \
size -= num; \
consumed_myself += num; \
} while(0)
#undef RETURN
#define RETURN(_code) do { \
rval.code = _code; \
rval.consumed = consumed_myself; \
return rval; \
} while(0)
#define XER_GOT_BODY(chunk_buf, chunk_size) do { \
ssize_t converted_size = body_receiver \
(struct_ptr, chunk_buf, chunk_size, \
(size_t)chunk_size < size); \
if(converted_size == -1) RETURN(RC_FAIL); \
chunk_size = converted_size; \
} while(0)
#define XER_GOT_EMPTY() do { \
ssize_t chunk_size = 0; \
XER_GOT_BODY(0, chunk_size); \
} while(0)
/*
* Generalized function for decoding the primitive values.
*/
asn_dec_rval_t
xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
asn_struct_ctx_t *ctx, /* Type decoder context */
void *struct_ptr, /* The structure must be already allocated */
const char *xml_tag, /* Expected XML tag */
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_dec_rval_t rval;
ssize_t consumed_myself = 0;
pxer_chunk_type_e ch_type; /* XER chunk type */
int xer_state; /* XER low level parsing context */
(void)opt_codec_ctx;
/*
* Phases of XER/XML processing:
* Phase 0: Check that the opening tag matches our expectations.
* Phase 1: Processing body and reacting on closing tag.
*/
if(ctx->phase > 1) RETURN(RC_FAIL);
for(xer_state = ctx->step;;) {
ssize_t ch_size; /* Chunk size */
xer_check_tag_e tcv; /* Tag check value */
/*
* Get the next part of the XML stream.
*/
ch_size = xer_next_token(&xer_state, buf_ptr, size, &ch_type);
switch(ch_size) {
case -1: RETURN(RC_FAIL);
case 0:
ctx->step = xer_state;
RETURN(RC_WMORE);
default:
switch(ch_type) {
case PXER_COMMENT: /* Got XML comment */
ADVANCE(ch_size); /* Skip silently */
continue;
case PXER_TEXT:
if(ctx->phase == 0) {
/* Unexpected data */
/* TODO: ignore whitespace? */
RETURN(RC_FAIL);
}
XER_GOT_BODY(buf_ptr, ch_size);
ADVANCE(ch_size);
continue;
case PXER_TAG:
break; /* Check the rest down there */
}
}
assert(ch_type == PXER_TAG && size);
tcv = xer_check_tag(buf_ptr, ch_size, xml_tag);
if(ctx->phase == 0) {
/*
* Expecting the opening tag
* for the type being processed.
*/
switch(tcv) {
case XCT_BOTH:
/* Finished decoding of an empty element */
XER_GOT_EMPTY();
ADVANCE(ch_size);
ctx->phase = 2; /* Phase out */
RETURN(RC_OK);
case XCT_OPENING:
ADVANCE(ch_size);
ctx->phase = 1; /* Processing body phase */
continue;
default:
break; /* Unexpected tag */
}
} else {
/*
* Waiting for the closing XML tag.
*/
switch(tcv) {
case XCT_CLOSING:
ADVANCE(ch_size);
ctx->phase = 2; /* Phase out */
RETURN(RC_OK);
case XCT_UNEXPECTED:
/*
* Certain tags in the body may be expected.
*/
if(opt_unexpected_tag_decoder
&& opt_unexpected_tag_decoder(struct_ptr,
buf_ptr, ch_size) == 0) {
/* Tag's processed fine */
ADVANCE(ch_size);
continue;
}
/* Fall through */
default:
break;
}
ASN_DEBUG("Unexpected XML tag");
}
break; /* Dark and mysterious things have just happened */
}
RETURN(RC_FAIL);
}

82
skeletons/xer_decoder.h Normal file
View File

@ -0,0 +1,82 @@
/*-
* Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _XER_DECODER_H_
#define _XER_DECODER_H_
#include <asn_application.h>
struct asn_TYPE_descriptor_s; /* Forward declaration */
/*
* The XER decoder of any type. May be invoked by the application.
*/
asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor,
void **struct_ptr, /* Pointer to a target structure's pointer */
void *buffer, /* Data to be decoded */
size_t size /* Size of that buffer */
);
/*
* Type of the type-specific XER decoder function.
*/
typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor,
void **struct_ptr,
const char *opt_mname, /* Member name */
void *buf_ptr, size_t size
);
/*******************************
* INTERNALLY USEFUL FUNCTIONS *
*******************************/
/*
* Generalized function for decoding the primitive values.
* Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8
* and others. This function should not be used by applications, as its API
* is subject to changes.
*/
asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
asn_struct_ctx_t *ctx, /* Type decoder context */
void *struct_ptr, /* The structure must be already allocated */
const char *xml_tag, /* Expected XML tag name */
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)
);
/*
* Fetch the next XER (XML) token from the stream.
* The function returns the number of bytes occupied by the chunk type,
* returned in the _ch_type. The _ch_type is only set (and valid) when
* the return value is greater than 0.
*/
typedef enum pxer_chunk_type {
PXER_TAG, /* Complete XER tag */
PXER_TEXT, /* Plain text between XER tags */
PXER_COMMENT, /* A comment, may be part of */
} pxer_chunk_type_e;
ssize_t xer_next_token(int *stateContext, void *buffer, size_t size,
pxer_chunk_type_e *_ch_type);
/*
* This function checks the buffer against the tag name is expected to occur.
*/
typedef enum xer_check_tag {
XCT_BROKEN, /* The tag is broken */
XCT_UNEXPECTED, /* The tag is fine, but unexpected */
XCT_OPENING, /* This is the opening <tag> */
XCT_CLOSING, /* This is the closing </tag> */
XCT_BOTH, /* This is the opening and closing tag <tag/> */
} xer_check_tag_e;
xer_check_tag_e xer_check_tag(const void *buf_ptr, int size,
const char *need_tag);
#endif /* _XER_DECODER_H_ */

View File

@ -21,7 +21,7 @@ xer_encode(asn_TYPE_descriptor_t *td, void *sptr,
if(!td || !sptr) goto cb_failed;
mname = td->name;
mname = td->xml_tag;
mlen = strlen(mname);
_ASN_CALLBACK3("<", 1, mname, mlen, ">", 1);

234
skeletons/xer_support.c Normal file
View File

@ -0,0 +1,234 @@
/*
* Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <xer_support.h>
/* Parser states */
typedef enum {
ST_TEXT,
ST_TAG_START,
ST_TAG_BODY,
ST_TAG_QUOTE_WAIT,
ST_TAG_QUOTED_STRING,
ST_TAG_UNQUOTED_STRING,
ST_COMMENT_WAIT_DASH1, // "<!--"[1]
ST_COMMENT_WAIT_DASH2, // "<!--"[2]
ST_COMMENT,
ST_COMMENT_CLO_DASH2, // "-->"[0]
ST_COMMENT_CLO_RT // "-->"[1]
} pstate_e;
static pxml_chunk_type_e final_chunk_type[] = {
PXML_TEXT,
PXML_TAG_END,
PXML_COMMENT_END,
PXML_TAG_END,
PXML_COMMENT_END,
};
static int
_charclass[256] = {
0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */
0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */
3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */
0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */
3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */
};
#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1)
#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2)
#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3)
/* Aliases for characters, ASCII/UTF-8 */
#define EXCLAM 0x21 /* '!' */
#define CQUOTE 0x22 /* '"' */
#define CDASH 0x2d /* '-' */
#define CSLASH 0x2f /* '/' */
#define LANGLE 0x3c /* '<' */
#define CEQUAL 0x3d /* '=' */
#define RANGLE 0x3e /* '>' */
/* Invoke token callback */
#define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \
int _ret; \
pstate_e ns = _ns; \
ssize_t _sz = (p - chunk_start) + _current_too; \
if (!_sz) { \
/* Shortcut */ \
state = _ns; \
break; \
} \
_ret = cb(type, chunk_start, _sz, key); \
if(_ret < _sz) { \
if(_current_too && _ret == -1) \
state = ns; \
goto finish; \
} \
chunk_start = p + _current_too; \
state = ns; \
} while(0)
#define TOKEN_CB(_type, _ns, _current_too) \
TOKEN_CB_CALL(_type, _ns, _current_too, 0)
#define TOKEN_CB_FINAL(_type, _ns, _current_too) \
TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1)
/*
* Parser itself
*/
int pxml_parse(int *stateContext, void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) {
pstate_e state = (pstate_e)*stateContext;
char *chunk_start = (char *)xmlbuf;
char *p = chunk_start;
char *end = p + size;
for(; p < end; p++) {
int C = *(unsigned char *)p;
switch(state) {
case ST_TEXT:
/*
* Initial state: we're in the middle of some text,
* or just have started.
*/
if (C == LANGLE)
/* We're now in the tag, probably */
TOKEN_CB(PXML_TEXT, ST_TAG_START, 0);
break;
case ST_TAG_START:
if (ALPHA(C) || (C == CSLASH))
state = ST_TAG_BODY;
else if (C == EXCLAM)
state = ST_COMMENT_WAIT_DASH1;
else
/*
* Not characters and not whitespace.
* Must be something like "3 < 4".
*/
TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */
break;
case ST_TAG_BODY:
switch(C) {
case RANGLE:
/* End of the tag */
TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1);
break;
case LANGLE:
/*
* The previous tag wasn't completed, but still
* recognized as valid. (Mozilla-compatible)
*/
TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0);
break;
case CEQUAL:
state = ST_TAG_QUOTE_WAIT;
break;
}
break;
case ST_TAG_QUOTE_WAIT:
/*
* State after the equal sign ("=") in the tag.
*/
switch(C) {
case CQUOTE:
state = ST_TAG_QUOTED_STRING;
break;
case RANGLE:
/* End of the tag */
TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1);
break;
default:
if(!WHITESPACE(C))
/* Unquoted string value */
state = ST_TAG_UNQUOTED_STRING;
}
break;
case ST_TAG_QUOTED_STRING:
/*
* Tag attribute's string value in quotes.
*/
if(C == CQUOTE) {
/* Return back to the tag state */
state = ST_TAG_BODY;
}
break;
case ST_TAG_UNQUOTED_STRING:
if(C == RANGLE) {
/* End of the tag */
TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1);
} else if(WHITESPACE(C)) {
/* Return back to the tag state */
state = ST_TAG_BODY;
}
break;
case ST_COMMENT_WAIT_DASH1:
if(C == CDASH) {
state = ST_COMMENT_WAIT_DASH2;
} else {
/* Some ordinary tag. */
state = ST_TAG_BODY;
}
break;
case ST_COMMENT_WAIT_DASH2:
if(C == CDASH) {
/* Seen "<--" */
state = ST_COMMENT;
} else {
/* Some ordinary tag */
state = ST_TAG_BODY;
}
break;
case ST_COMMENT:
if(C == CDASH) {
state = ST_COMMENT_CLO_DASH2;
}
break;
case ST_COMMENT_CLO_DASH2:
if(C == CDASH) {
state = ST_COMMENT_CLO_RT;
} else {
/* This is not an end of a comment */
state = ST_COMMENT;
}
break;
case ST_COMMENT_CLO_RT:
if(C == RANGLE) {
TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1);
} else {
state = ST_COMMENT;
}
break;
} /* switch(*ptr) */
} /* for() */
/*
* Flush the partially processed chunk, state permitting.
*/
if(p - chunk_start) {
switch (state) {
case ST_COMMENT:
TOKEN_CB(PXML_COMMENT, state, 0);
break;
case ST_TEXT:
TOKEN_CB(PXML_TEXT, state, 0);
break;
default: break; /* a no-op */
}
}
finish:
*stateContext = (int)state;
return chunk_start - (char *)xmlbuf;
}

45
skeletons/xer_support.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _XER_SUPPORT_H_
#define _XER_SUPPORT_H_
/*
* Types of data transferred to the application.
*/
typedef enum {
PXML_TEXT, /* Plain text between XML tags. */
PXML_TAG, /* A tag, starting with '<'. */
PXML_COMMENT, /* An XML comment, including "<!--" and "-->". */
/*
* The following chunk types are reported if the chunk
* terminates the specified XML element.
*/
PXML_TAG_END, /* Tag ended */
PXML_COMMENT_END /* Comment ended */
} pxml_chunk_type_e;
/*
* Callback function that is called by the parser when parsed data is
* available. The _opaque is the pointer to a field containing opaque user
* data specified in pxml_create() call. The chunk type is _type and the text
* data is the piece of buffer identified by _bufid (as supplied to
* pxml_feed() call) starting at offset _offset and of _size bytes size.
* The chunk is NOT '\0'-terminated.
*/
typedef int (pxml_callback_f)(pxml_chunk_type_e _type,
void *_chunk_data, size_t _chunk_size, void *_key);
/*
* Parse the given buffer as it were a chunk of XML data.
* Invoke the specified callback each time the meaninful data is found.
* This function returns number of bytes consumed from the bufer.
* It will always be lesser than or equal to the specified _size.
* The next invocation of this function must account the difference.
*/
ssize_t pxml_parse(int *_stateContext, void *_buf, size_t _size,
pxml_callback_f *cb, void *_key);
#endif /* _XER_SUPPORT_H_ */

View File

@ -107,6 +107,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_toBeSigned_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_toBeSigned = {
"toBeSigned",
"toBeSigned",
SEQUENCE_free,
SEQUENCE_print,
@ -167,6 +168,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_Certificate_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Certificate = {
"Certificate",
"Certificate",
SEQUENCE_free,
SEQUENCE_print,
@ -228,6 +230,7 @@ static asn_SET_OF_specifics_t asn_DEF_Name_specs = {
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_Name = {
"Name",
"Name",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
@ -344,6 +347,7 @@ static asn_SET_OF_specifics_t asn_DEF_RelativeDistinguishedName_specs = {
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = {
"RelativeDistinguishedName",
"RelativeDistinguishedName",
SET_OF_free,
SET_OF_print,

View File

@ -87,6 +87,7 @@ static asn_SET_specifics_t asn_DEF_T_specs = {
(unsigned int *)asn_DEF_T_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
SET_free,
SET_print,

View File

@ -39,6 +39,7 @@ static asn_SET_OF_specifics_t asn_DEF_Forest_specs = {
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_Forest = {
"Forest",
"Forest",
SET_OF_free,
SET_OF_print,
@ -114,6 +115,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_Tree_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Tree = {
"Tree",
"Tree",
SEQUENCE_free,
SEQUENCE_print,
@ -234,6 +236,7 @@ static asn_SET_OF_specifics_t asn_DEF_trees_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_trees = {
"trees",
"trees",
SET_OF_free,
SET_OF_print,
@ -279,6 +282,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_anything_member_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_anything_member = {
"",
"",
SEQUENCE_free,
SEQUENCE_print,
@ -319,6 +323,7 @@ static asn_SET_OF_specifics_t asn_DEF_anything_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_anything = {
"anything",
"anything",
SET_OF_free,
SET_OF_print,
@ -370,6 +375,7 @@ static asn_CHOICE_specifics_t asn_DEF_other_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_other = {
"other",
"other",
CHOICE_free,
CHOICE_print,
@ -440,6 +446,7 @@ static asn_SET_specifics_t asn_DEF_Stuff_specs = {
(unsigned int *)asn_DEF_Stuff_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_Stuff = {
"Stuff",
"Stuff",
SET_free,
SET_print,

View File

@ -39,6 +39,7 @@ static asn_SET_OF_specifics_t asn_DEF_Programming_specs = {
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_Programming = {
"Programming",
"Programming",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
@ -100,6 +101,7 @@ static asn_SET_OF_specifics_t asn_DEF_Fault_specs = {
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_Fault = {
"Fault",
"Fault",
SET_OF_free,
SET_OF_print,
@ -158,6 +160,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_Error_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Error = {
"Error",
"Error",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -48,6 +48,7 @@ static asn_SET_OF_specifics_t asn_DEF_collection_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_collection = {
"collection",
"collection",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
@ -100,6 +101,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_T_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
SEQUENCE_free,
SEQUENCE_print,
@ -176,6 +178,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_T2_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_T2 = {
"T2",
"T2",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -84,6 +84,7 @@ static asn_SET_OF_specifics_t asn_DEF_varsets_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_varsets = {
"varsets",
"varsets",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
@ -136,6 +137,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_LogLine_specs = {
3 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_LogLine = {
"LogLine",
"LogLine",
SEQUENCE_free,
SEQUENCE_print,
@ -232,6 +234,7 @@ static asn_SET_OF_specifics_t asn_DEF_vparts_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_vparts = {
"vparts",
"vparts",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
@ -284,6 +287,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_VariablePartSet_specs = {
3 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_VariablePartSet = {
"VariablePartSet",
"VariablePartSet",
SEQUENCE_free,
SEQUENCE_print,
@ -409,6 +413,7 @@ static asn_SET_OF_specifics_t asn_DEF_vset_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_vset = {
"vset",
"vset",
SET_OF_free,
SET_OF_print,
@ -462,6 +467,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_vrange_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_vrange = {
"vrange",
"vrange",
SEQUENCE_free,
SEQUENCE_print,
@ -512,6 +518,7 @@ static asn_CHOICE_specifics_t asn_DEF_VariablePart_specs = {
1 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_VariablePart = {
"VariablePart",
"VariablePart",
CHOICE_free,
CHOICE_print,
@ -603,6 +610,7 @@ static asn_SET_OF_specifics_t asn_DEF_email_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_email = {
"email",
"email",
SET_OF_free,
SET_OF_print,
@ -656,6 +664,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_notify_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_notify = {
"notify",
"notify",
SEQUENCE_free,
SEQUENCE_print,
@ -708,6 +717,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_ActionItem_specs = {
3 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_ActionItem = {
"ActionItem",
"ActionItem",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -59,6 +59,7 @@ static asn_SET_OF_specifics_t asn_DEF_t_member1_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_t_member1 = {
"t-member1",
"t-member1",
SET_OF_free,
SET_OF_print,
@ -98,6 +99,7 @@ static asn_SET_OF_specifics_t asn_DEF_t_member2_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_t_member2 = {
"t-member2",
"t-member2",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
@ -166,6 +168,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_Test_structure_1_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Test_structure_1 = {
"Test-structure-1",
"Test-structure-1",
SEQUENCE_free,
SEQUENCE_print,
@ -253,6 +256,7 @@ static asn_SET_OF_specifics_t asn_DEF_or_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_or = {
"or",
"or",
SET_OF_free,
SET_OF_print,
@ -319,6 +323,7 @@ static asn_CHOICE_specifics_t asn_DEF_Choice_1_specs = {
0 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_Choice_1 = {
"Choice-1",
"Choice-1",
CHOICE_free,
CHOICE_print,
@ -402,6 +407,7 @@ static asn_SET_specifics_t asn_DEF_Test_structure_2_specs = {
(unsigned int *)asn_DEF_Test_structure_2_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_Test_structure_2 = {
"Test-structure-2",
"Test-structure-2",
SET_free,
SET_print,
@ -487,6 +493,7 @@ static asn_SET_specifics_t asn_DEF_Test_structure_3_specs = {
(unsigned int *)asn_DEF_Test_structure_3_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_Test_structure_3 = {
"Test-structure-3",
"Test-structure-3",
SET_free,
SET_print,

View File

@ -99,6 +99,7 @@ static asn_CHOICE_specifics_t asn_DEF_e_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_e = {
"e",
"e",
CHOICE_free,
CHOICE_print,
@ -148,6 +149,7 @@ static asn_CHOICE_specifics_t asn_DEF_h_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_h = {
"h",
"h",
CHOICE_free,
CHOICE_print,
@ -214,6 +216,7 @@ static asn_CHOICE_specifics_t asn_DEF_b_specs = {
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_b = {
"b",
"b",
CHOICE_free,
CHOICE_print,
@ -269,6 +272,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_T_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -63,6 +63,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_ConstructedType_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_ConstructedType = {
"ConstructedType",
"ConstructedType",
SEQUENCE_free,
SEQUENCE_print,
@ -144,7 +145,7 @@ T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T_inherit_TYPE_descriptor(td);
@ -175,6 +176,7 @@ static ber_tlv_tag_t asn_DEF_T_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
T_free,
T_print,

View File

@ -65,6 +65,7 @@ static asn_SET_specifics_t asn_DEF_T1_specs = {
(unsigned int *)asn_DEF_T1_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_T1 = {
"T1",
"T1",
SET_free,
SET_print,
@ -152,6 +153,7 @@ static asn_SET_specifics_t asn_DEF_T2_specs = {
(unsigned int *)asn_DEF_T2_mmap /* Mandatory elements map */
};
asn_TYPE_descriptor_t asn_DEF_T2 = {
"T2",
"T2",
SET_free,
SET_print,
@ -228,6 +230,7 @@ static asn_CHOICE_specifics_t asn_DEF_T3_specs = {
1 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_T3 = {
"T3",
"T3",
CHOICE_free,
CHOICE_print,
@ -302,6 +305,7 @@ static asn_CHOICE_specifics_t asn_DEF_T4_specs = {
1 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_T4 = {
"T4",
"T4",
CHOICE_free,
CHOICE_print,

View File

@ -97,7 +97,7 @@ Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Int2_inherit_TYPE_descriptor(td);
@ -127,6 +127,7 @@ static ber_tlv_tag_t asn_DEF_Int2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Int2 = {
"Int2",
"Int2",
Int2_free,
Int2_print,
@ -230,7 +231,7 @@ Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Int3_inherit_TYPE_descriptor(td);
@ -260,6 +261,7 @@ static ber_tlv_tag_t asn_DEF_Int3_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Int3 = {
"Int3",
"Int3",
Int3_free,
Int3_print,
@ -363,7 +365,7 @@ Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Int4_inherit_TYPE_descriptor(td);
@ -393,6 +395,7 @@ static ber_tlv_tag_t asn_DEF_Int4_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Int4 = {
"Int4",
"Int4",
Int4_free,
Int4_print,
@ -496,7 +499,7 @@ Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Int5_inherit_TYPE_descriptor(td);
@ -526,6 +529,7 @@ static ber_tlv_tag_t asn_DEF_Int5_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Int5 = {
"Int5",
"Int5",
Int5_free,
Int5_print,
@ -629,7 +633,7 @@ ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
ExtensibleExtensions_inherit_TYPE_descriptor(td);
@ -659,6 +663,7 @@ static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
"ExtensibleExtensions",
"ExtensibleExtensions",
ExtensibleExtensions_free,
ExtensibleExtensions_print,
@ -793,7 +798,7 @@ Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Str2_inherit_TYPE_descriptor(td);
@ -823,6 +828,7 @@ static ber_tlv_tag_t asn_DEF_Str2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Str2 = {
"Str2",
"Str2",
Str2_free,
Str2_print,
@ -949,7 +955,7 @@ Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Str3_inherit_TYPE_descriptor(td);
@ -979,6 +985,7 @@ static ber_tlv_tag_t asn_DEF_Str3_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Str3 = {
"Str3",
"Str3",
Str3_free,
Str3_print,
@ -1091,7 +1098,7 @@ Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Str4_inherit_TYPE_descriptor(td);
@ -1121,6 +1128,7 @@ static ber_tlv_tag_t asn_DEF_Str4_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Str4 = {
"Str4",
"Str4",
Str4_free,
Str4_print,
@ -1233,7 +1241,7 @@ PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
PER_Visible_inherit_TYPE_descriptor(td);
@ -1263,6 +1271,7 @@ static ber_tlv_tag_t asn_DEF_PER_Visible_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
"PER-Visible",
"PER-Visible",
PER_Visible_free,
PER_Visible_print,
@ -1375,7 +1384,7 @@ PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
PER_Visible_2_inherit_TYPE_descriptor(td);
@ -1405,6 +1414,7 @@ static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
"PER-Visible-2",
"PER-Visible-2",
PER_Visible_2_free,
PER_Visible_2_print,
@ -1517,7 +1527,7 @@ Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Not_PER_Visible_1_inherit_TYPE_descriptor(td);
@ -1547,6 +1557,7 @@ static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
"Not-PER-Visible-1",
"Not-PER-Visible-1",
Not_PER_Visible_1_free,
Not_PER_Visible_1_print,
@ -1659,7 +1670,7 @@ Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Not_PER_Visible_2_inherit_TYPE_descriptor(td);
@ -1689,6 +1700,7 @@ static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
"Not-PER-Visible-2",
"Not-PER-Visible-2",
Not_PER_Visible_2_free,
Not_PER_Visible_2_print,
@ -1801,7 +1813,7 @@ Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Not_PER_Visible_3_inherit_TYPE_descriptor(td);
@ -1831,6 +1843,7 @@ static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
"Not-PER-Visible-3",
"Not-PER-Visible-3",
Not_PER_Visible_3_free,
Not_PER_Visible_3_print,
@ -1946,7 +1959,7 @@ SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
@ -1976,6 +1989,7 @@ static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
"SIZE-but-not-FROM",
"SIZE-but-not-FROM",
SIZE_but_not_FROM_free,
SIZE_but_not_FROM_print,
@ -2091,7 +2105,7 @@ SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
SIZE_and_FROM_inherit_TYPE_descriptor(td);
@ -2121,6 +2135,7 @@ static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
"SIZE-and-FROM",
"SIZE-and-FROM",
SIZE_and_FROM_free,
SIZE_and_FROM_print,
@ -2233,7 +2248,7 @@ Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
@ -2263,6 +2278,7 @@ static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
"Neither-SIZE-nor-FROM",
"Neither-SIZE-nor-FROM",
Neither_SIZE_nor_FROM_free,
Neither_SIZE_nor_FROM_print,
@ -2369,7 +2385,7 @@ Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Utf8_4_inherit_TYPE_descriptor(td);
@ -2399,6 +2415,7 @@ static ber_tlv_tag_t asn_DEF_Utf8_4_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
"Utf8-4",
"Utf8-4",
Utf8_4_free,
Utf8_4_print,
@ -2533,7 +2550,7 @@ Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Utf8_3_inherit_TYPE_descriptor(td);
@ -2563,6 +2580,7 @@ static ber_tlv_tag_t asn_DEF_Utf8_3_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
"Utf8-3",
"Utf8-3",
Utf8_3_free,
Utf8_3_print,
@ -2667,7 +2685,7 @@ Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Utf8_2_inherit_TYPE_descriptor(td);
@ -2697,6 +2715,7 @@ static ber_tlv_tag_t asn_DEF_Utf8_2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
"Utf8-2",
"Utf8-2",
Utf8_2_free,
Utf8_2_print,
@ -2862,7 +2881,7 @@ Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Identifier_inherit_TYPE_descriptor(td);
@ -2892,6 +2911,7 @@ static ber_tlv_tag_t asn_DEF_Identifier_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Identifier = {
"Identifier",
"Identifier",
Identifier_free,
Identifier_print,

View File

@ -53,6 +53,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_T1_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_T1 = {
"T1",
"T1",
SEQUENCE_free,
SEQUENCE_print,
@ -129,6 +130,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_T2_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_T2 = {
"T2",
"T2",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -59,7 +59,7 @@ T1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T1_inherit_TYPE_descriptor(td);
@ -100,6 +100,7 @@ static ber_tlv_tag_t asn_DEF_T1_all_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T1 = {
"T1",
"T1",
T1_free,
T1_print,
@ -180,7 +181,7 @@ T2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T2_inherit_TYPE_descriptor(td);
@ -219,6 +220,7 @@ static ber_tlv_tag_t asn_DEF_T2_all_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T2 = {
"T2",
"T2",
T2_free,
T2_print,
@ -299,7 +301,7 @@ T3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T3_inherit_TYPE_descriptor(td);
@ -336,6 +338,7 @@ static ber_tlv_tag_t asn_DEF_T3_all_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T3 = {
"T3",
"T3",
T3_free,
T3_print,
@ -416,7 +419,7 @@ T4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T4_inherit_TYPE_descriptor(td);
@ -448,6 +451,7 @@ static ber_tlv_tag_t asn_DEF_T4_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T4 = {
"T4",
"T4",
T4_free,
T4_print,
@ -528,7 +532,7 @@ T5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T5_inherit_TYPE_descriptor(td);
@ -559,6 +563,7 @@ static ber_tlv_tag_t asn_DEF_T5_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T5 = {
"T5",
"T5",
T5_free,
T5_print,
@ -658,7 +663,7 @@ T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T_inherit_TYPE_descriptor(td);
@ -690,6 +695,7 @@ static ber_tlv_tag_t asn_DEF_T_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
T_free,
T_print,
@ -775,6 +781,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_Ts_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Ts = {
"Ts",
"Ts",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -59,7 +59,7 @@ T1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T1_inherit_TYPE_descriptor(td);
@ -100,6 +100,7 @@ static ber_tlv_tag_t asn_DEF_T1_all_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T1 = {
"T1",
"T1",
T1_free,
T1_print,
@ -180,7 +181,7 @@ T2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T2_inherit_TYPE_descriptor(td);
@ -219,6 +220,7 @@ static ber_tlv_tag_t asn_DEF_T2_all_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T2 = {
"T2",
"T2",
T2_free,
T2_print,
@ -299,7 +301,7 @@ T3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T3_inherit_TYPE_descriptor(td);
@ -336,6 +338,7 @@ static ber_tlv_tag_t asn_DEF_T3_all_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T3 = {
"T3",
"T3",
T3_free,
T3_print,
@ -416,7 +419,7 @@ T4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T4_inherit_TYPE_descriptor(td);
@ -448,6 +451,7 @@ static ber_tlv_tag_t asn_DEF_T4_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T4 = {
"T4",
"T4",
T4_free,
T4_print,
@ -528,7 +532,7 @@ T5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T5_inherit_TYPE_descriptor(td);
@ -559,6 +563,7 @@ static ber_tlv_tag_t asn_DEF_T5_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T5 = {
"T5",
"T5",
T5_free,
T5_print,
@ -658,7 +663,7 @@ T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
T_inherit_TYPE_descriptor(td);
@ -690,6 +695,7 @@ static ber_tlv_tag_t asn_DEF_T_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
T_free,
T_print,
@ -775,6 +781,7 @@ static asn_SEQUENCE_specifics_t asn_DEF_Ts_specs = {
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Ts = {
"Ts",
"Ts",
SEQUENCE_free,
SEQUENCE_print,

View File

@ -39,6 +39,7 @@ static asn_SET_OF_specifics_t asn_DEF_T_specs = {
1, /* XER encoding is XMLValueList */
};
asn_TYPE_descriptor_t asn_DEF_T = {
"T",
"T",
SET_OF_free,
SET_OF_print,
@ -128,7 +129,7 @@ SimpleType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
asn_dec_rval_t
SimpleType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
SimpleType_inherit_TYPE_descriptor(td);
@ -158,6 +159,7 @@ static ber_tlv_tag_t asn_DEF_SimpleType_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_SimpleType = {
"SimpleType",
"SimpleType",
SimpleType_free,
SimpleType_print,