BMPString and UniversalString support

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1271 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2006-11-24 11:20:27 +00:00
parent 0840962a08
commit 1daeca001b
20 changed files with 956 additions and 182 deletions

View File

@ -0,0 +1,10 @@
<PDU>
<many>
<PDU><bm>abra kadabra</bm></PDU>
<PDU><bm-c>AAAAZZZZ</bm-c></PDU>
<PDU><bm-cs>шесть!</bm-cs></PDU>
<PDU><bm-ce>ABC</bm-ce></PDU>
<PDU><bm-ce>ABCabc (extensibility in play)</bm-ce></PDU>
<PDU><bm-ir>ABXZ</bm-ir></PDU>
</many>
</PDU>

View File

@ -0,0 +1,10 @@
<PDU>
<many>
<PDU><us>kadabra</us></PDU>
<PDU><us-c>AAAAZZZZ</us-c></PDU>
<PDU><us-cs>шесть!</us-cs></PDU>
<PDU><us-ce>ABC</us-ce></PDU>
<PDU><us-ce>ABCabc (extensibility in play)</us-ce></PDU>
<PDU><us-ir>ABXZ</us-ir></PDU>
</many>
</PDU>

View File

@ -0,0 +1,3 @@
<PDU>
<bm-c>abcd</bm-c>
</PDU>

View File

@ -0,0 +1,3 @@
<PDU>
<us-c>abcd</us-c>
</PDU>

View File

@ -0,0 +1,3 @@
<PDU>
<bm-cs></bm-cs>
</PDU>

View File

@ -0,0 +1,3 @@
<PDU>
<us-cs></us-cs>
</PDU>

View File

@ -0,0 +1,3 @@
<PDU>
<bm-ir>ABC</bm-ir>
</PDU>

View File

@ -0,0 +1,3 @@
<PDU>
<us-ir>ABC</us-ir>
</PDU>

View File

@ -1825,14 +1825,16 @@ emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int alpha
}
}
if(1) {
if(alphabetsize) {
ebits = rbits;
} else {
/* X.691, #10.9.4.1 */
for(ebits = 0; ebits <= 16; ebits++)
if(r <= 1 << ebits) break;
if(ebits == 17
|| range->right.value >= 65536)
ebits = -1;
} else {
if(0) {
/* X.691, #10.5.7.1 */
for(ebits = 0; ebits <= 8; ebits++)
if(r <= 1 << ebits) break;
@ -1843,11 +1845,25 @@ emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int alpha
ebits = -1;
}
}
}
OUT("{ APC_CONSTRAINED%s,%s% d, % d, ",
range->extensible
? " | APC_EXTENSIBLE" : "",
range->extensible ? " " : "\t", rbits, ebits);
if(alphabetsize) {
asn1c_integer_t lv = range->left.value;
asn1c_integer_t rv = range->right.value;
int gcmt = 0;
if(lv > 0x7fffffff) { lv = 0x7fffffff; gcmt++; }
if(rv > 0x7fffffff) { rv = 0x7fffffff; gcmt++; }
if(gcmt) {
OUT("% " PRIdASN ", % " PRIdASN " }",
lv, rv);
goto pcmt;
}
}
} else {
if(range->extensible) {
OUT("{ APC_SEMI_CONSTRAINED | APC_EXTENSIBLE, "
@ -1862,6 +1878,8 @@ emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int alpha
OUT("{ APC_UNCONSTRAINED,\t-1, -1, 0, 0 }");
}
pcmt:
/*
* Print some courtesy debug information.
*/
@ -1948,8 +1966,30 @@ emit_member_PER_constraints(arg_t *arg, asn1p_expr_t *expr, const char *pfx) {
expr->combined_constraints, ACT_CT_FROM,
0, 0, 0);
DEBUG("Emitting FROM constraint for %s", expr->Identifier);
if((range->left.type == ARE_MIN && range->right.type == ARE_MAX)
|| range->not_PER_visible) {
switch(etype) {
case ASN_STRING_BMPString:
range->left.type = ARE_VALUE;
range->left.value = 0;
range->right.type = ARE_VALUE;
range->right.value = 65535;
range->not_PER_visible = 0;
range->extensible = 0;
break;
case ASN_STRING_UniversalString:
OUT("{ APC_CONSTRAINED,\t32, 32,"
" 0, 2147483647 }"
" /* special case 1 */\n");
goto avoid;
default:
break;
}
}
if(emit_single_member_PER_constraint(arg, range, 1, 0))
return -1;
avoid:
asn1constraint_range_free(range);
} else {
range = asn1constraint_compute_PER_range(etype,

View File

@ -72,7 +72,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
case ASN_BASIC_BIT_STRING:
case ASN_BASIC_OCTET_STRING:
produce_st = 1;
break;
break;
default:
if(etype & ASN_STRING_MASK)
produce_st = 1;
@ -222,7 +222,6 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
return 0;
}
if(range->left.type == ARE_MIN
&& range->right.type == ARE_MAX) {
/*

View File

@ -128,7 +128,7 @@ asn1constraint_default_alphabet(asn1p_expr_type_e expr_type) {
DECL_notPV(utf8, 0x00, 0x7fffffff); /* Not PER-visible */
DECL(bmp, 0x00, 65533); /* 64K-2 cells */
DECL(uint7, 0x00, 0x7f);
DECL(uint31, 0x00, 0x7fffffff);
DECL(uint32, 0x00, 0xffffffff);
DECL(Space, 0x20, 0x20);
DECL(ApostropheAndParens, 0x27, 0x29);
DECL(PlusTillColon, 0x2b, 0x3a);
@ -213,7 +213,7 @@ asn1constraint_default_alphabet(asn1p_expr_type_e expr_type) {
assert(range_utf8.not_PER_visible);
return &range_utf8;
case ASN_STRING_UniversalString:
return &range_uint31;
return &range_uint32;
case ASN_BASIC_UTCTime:
/* Permitted alphabet constraint is not applicable */
assert(range_UTCTime.not_PER_visible);

View File

@ -9,7 +9,7 @@
static asn_OCTET_STRING_specifics_t asn_DEF_ANY_specs = {
sizeof(ANY_t),
offsetof(ANY_t, _asn_ctx),
2 /* Special indicator that this is an ANY type */
ASN_OSUBV_ANY
};
asn_TYPE_descriptor_t asn_DEF_ANY = {
"ANY",

View File

@ -15,7 +15,7 @@ static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = {
static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = {
sizeof(BIT_STRING_t),
offsetof(BIT_STRING_t, _asn_ctx),
1, /* Special indicator that this is a BIT STRING type */
ASN_OSUBV_BIT
};
asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
"BIT STRING",

View File

@ -13,6 +13,16 @@ static ber_tlv_tag_t asn_DEF_BMPString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (30 << 2)), /* [UNIVERSAL 30] IMPLICIT ...*/
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
static asn_OCTET_STRING_specifics_t asn_DEF_BMPString_specs = {
sizeof(BMPString_t),
offsetof(BMPString_t, _asn_ctx),
ASN_OSUBV_U16 /* 16-bits character */
};
static asn_per_constraints_t asn_DEF_BMPString_constraints = {
{ APC_CONSTRAINED, 16, 16, 0, 65535 },
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 },
0, 0
};
asn_TYPE_descriptor_t asn_DEF_BMPString = {
"BMPString",
"BMPString",
@ -23,7 +33,8 @@ asn_TYPE_descriptor_t asn_DEF_BMPString = {
OCTET_STRING_encode_der,
BMPString_decode_xer, /* Convert from UTF-8 */
BMPString_encode_xer, /* Convert to UTF-8 */
0, 0,
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_BMPString_tags,
sizeof(asn_DEF_BMPString_tags)
@ -31,9 +42,9 @@ asn_TYPE_descriptor_t asn_DEF_BMPString = {
asn_DEF_BMPString_tags,
sizeof(asn_DEF_BMPString_tags)
/ sizeof(asn_DEF_BMPString_tags[0]),
0, /* No PER visible constraints */
&asn_DEF_BMPString_constraints,
0, 0, /* No members */
0 /* No specifics */
&asn_DEF_BMPString_specs
};
/*
@ -131,7 +142,7 @@ BMPString_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
rc.consumed = 0;
return rc;
} else {
dstwc[2 * wcs_len] = 0;
dstwc[wcs_len] = 0; /* nul-terminate */
wcs = (uint32_t *)dstwc;
}
}

View File

@ -17,10 +17,12 @@ static ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = {
static asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = {
sizeof(OCTET_STRING_t),
offsetof(OCTET_STRING_t, _asn_ctx),
0
ASN_OSUBV_STR
};
static asn_per_constraint_t asn_DEF_OCTET_STRING_constraint = {
APC_SEMI_CONSTRAINED, -1, -1, 0, 0
static asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = {
{ APC_CONSTRAINED, 8, 8, 0, 255 },
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 },
0, 0
};
asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
"OCTET STRING", /* Canonical name */
@ -102,15 +104,6 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
st->size = _es; \
} while(0)
/*
* Internal variant of the OCTET STRING.
*/
typedef enum OS_type {
_TT_GENERIC = 0, /* Just a random OCTET STRING */
_TT_BIT_STRING = 1, /* BIT STRING type, a special case */
_TT_ANY = 2 /* ANY type, a special case too */
} OS_type_e;
/*
* The main reason why ASN.1 is still alive is that too much time and effort
* is necessary for learning it more or less adequately, thus creating a gut
@ -185,11 +178,11 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
struct _stack *stck; /* Expectations stack structure */
struct _stack_el *sel = 0; /* Stack element */
int tlv_constr;
OS_type_e type_variant = (OS_type_e)specs->subvariant;
enum asn_OS_Subvariant type_variant = specs->subvariant;
ASN_DEBUG("Decoding %s as %s (frame %ld)",
td->name,
(type_variant == _TT_GENERIC) ?
(type_variant == ASN_OSUBV_STR) ?
"OCTET STRING" : "OS-SpecialCase",
(long)size);
@ -230,7 +223,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
* Jump into stackless primitive decoding.
*/
_CH_PHASE(ctx, 3);
if(type_variant == _TT_ANY && tag_mode != 1)
if(type_variant == ASN_OSUBV_ANY && tag_mode != 1)
APPEND(buf_ptr, rval.consumed);
ADVANCE(rval.consumed);
goto phase3;
@ -309,7 +302,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls);
if(type_variant == _TT_ANY
if(type_variant == ASN_OSUBV_ANY
&& (tag_mode != 1 || sel->cont_level))
APPEND("\0\0", 2);
@ -334,10 +327,10 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
* depending on ASN.1 type being decoded.
*/
switch(type_variant) {
case _TT_BIT_STRING:
case ASN_OSUBV_BIT:
/* X.690: 8.6.4.1, NOTE 2 */
/* Fall through */
case _TT_GENERIC:
case ASN_OSUBV_STR:
default:
if(sel) {
int level = sel->cont_level;
@ -352,7 +345,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
/* else, Fall through */
}
/* Fall through */
case _TT_ANY:
case ASN_OSUBV_ANY:
expected_tag = tlv_tag;
break;
}
@ -397,7 +390,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
} else {
sel->left = tlv_len;
}
if(type_variant == _TT_ANY
if(type_variant == ASN_OSUBV_ANY
&& (tag_mode != 1 || sel->cont_level))
APPEND(buf_ptr, tlvl);
sel->got += tlvl;
@ -431,7 +424,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
len = ((ber_tlv_len_t)size < sel->left)
? (ber_tlv_len_t)size : sel->left;
if(len > 0) {
if(type_variant == _TT_BIT_STRING
if(type_variant == ASN_OSUBV_BIT
&& sel->bits_chopped == 0) {
/* Put the unused-bits-octet away */
st->bits_unused = *(const uint8_t *)buf_ptr;
@ -464,7 +457,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
if(size < (size_t)ctx->left) {
if(!size) RETURN(RC_WMORE);
if(type_variant == _TT_BIT_STRING && !ctx->context) {
if(type_variant == ASN_OSUBV_BIT && !ctx->context) {
st->bits_unused = *(const uint8_t *)buf_ptr;
ctx->left--;
ADVANCE(1);
@ -475,7 +468,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
ADVANCE(size);
RETURN(RC_WMORE);
} else {
if(type_variant == _TT_BIT_STRING
if(type_variant == ASN_OSUBV_BIT
&& !ctx->context && ctx->left) {
st->bits_unused = *(const uint8_t *)buf_ptr;
ctx->left--;
@ -502,14 +495,14 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
/*
* BIT STRING-specific processing.
*/
if(type_variant == _TT_BIT_STRING && st->size) {
if(type_variant == ASN_OSUBV_BIT && st->size) {
/* Finalize BIT STRING: zero out unused bits. */
st->buf[st->size-1] &= 0xff << st->bits_unused;
}
ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld",
(long)consumed_myself, td->name,
(type_variant == _TT_GENERIC) ? (char *)st->buf : "<data>",
(type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "<data>",
(long)st->size);
@ -528,7 +521,7 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
? (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;
enum asn_OS_Subvariant type_variant = specs->subvariant;
int fix_last_byte = 0;
ASN_DEBUG("%s %s as OCTET STRING",
@ -537,10 +530,11 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
/*
* Write tags.
*/
if(type_variant != _TT_ANY || tag_mode == 1) {
if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) {
er.encoded = der_write_tags(td,
(type_variant == _TT_BIT_STRING) + st->size,
tag_mode, type_variant == _TT_ANY, tag, cb, app_key);
(type_variant == ASN_OSUBV_BIT) + st->size,
tag_mode, type_variant == ASN_OSUBV_ANY, tag,
cb, app_key);
if(er.encoded == -1) {
er.failed_type = td;
er.structure_ptr = sptr;
@ -548,19 +542,19 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
}
} else {
/* Disallow: [<tag>] IMPLICIT ANY */
assert(type_variant != _TT_ANY || tag_mode != -1);
assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1);
er.encoded = 0;
}
if(!cb) {
er.encoded += (type_variant == _TT_BIT_STRING) + st->size;
er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size;
_ASN_ENCODED_OK(er);
}
/*
* Prepare to deal with the last octet of BIT STRING.
*/
if(type_variant == _TT_BIT_STRING) {
if(type_variant == ASN_OSUBV_BIT) {
uint8_t b = st->bits_unused & 0x07;
if(b && st->size) fix_last_byte = 1;
_ASN_CALLBACK(&b, 1);
@ -1198,36 +1192,50 @@ OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx,
}
static int
OCTET_STRING_per_get_expanded(asn_per_data_t *po, uint8_t *buf,
size_t size, long lb, long ub, int (*code2value)(unsigned int),
int unit_bits) {
uint8_t *end = buf + size;
OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf,
size_t units, unsigned int bpc, unsigned int unit_bits,
long lb, long ub, asn_per_constraints_t *pc) {
uint8_t *end = buf + units * bpc;
ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d",
(int)size, lb, ub, unit_bits);
(int)units, lb, ub, unit_bits);
/* X.691: 27.5.4 */
if(ub <= (2 << (unit_bits - 1))) {
if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) {
/* Decode without translation */
lb = 0;
} else if(code2value) {
for(; buf < end; buf++) {
int code = per_get_few_bits(po, unit_bits);
} else if(pc && pc->code2value) {
if(unit_bits > 16)
return 1; /* FATAL: can't have constrained
* UniversalString with more than
* 16 million code points */
for(; buf < end; buf += bpc) {
int value;
int code = per_get_few_bits(po, unit_bits);
if(code < 0) return -1; /* WMORE */
value = code2value(code);
value = pc->code2value(code);
if(value < 0) {
ASN_DEBUG("Code %d (0x%02x) is"
" not in map (%ld..%ld)",
code, code, lb, ub);
return 1; /* FATAL */
}
*buf = value;
switch(bpc) {
case 1: *buf = value; break;
case 2: buf[0] = value >> 8; buf[1] = value; break;
case 4: buf[0] = value >> 24; buf[1] = value >> 16;
buf[2] = value >> 8; buf[3] = value; break;
}
}
return 0;
}
for(; buf < end; buf++) {
/* Shortcut the no-op copying to the aligned structure */
if(lb == 0 && (unit_bits == 8 * bpc)) {
return per_get_many_bits(po, buf, 0, unit_bits * units);
}
for(; buf < end; buf += bpc) {
int code = per_get_few_bits(po, unit_bits);
int ch = code + lb;
if(code < 0) return -1; /* WMORE */
@ -1236,28 +1244,42 @@ OCTET_STRING_per_get_expanded(asn_per_data_t *po, uint8_t *buf,
ch, lb, ub);
return 1; /* FATAL */
}
*buf = ch;
switch(bpc) {
case 1: *buf = ch; break;
case 2: buf[0] = ch >> 8; buf[1] = ch; break;
case 4: buf[0] = ch >> 24; buf[1] = ch >> 16;
buf[2] = ch >> 8; buf[3] = ch; break;
}
}
return 0;
}
static int
OCTET_STRING_per_put_squeezed(asn_per_outp_t *po, const uint8_t *buf,
size_t size, long lb, long ub, int (*value2code)(unsigned int),
int unit_bits) {
const uint8_t *end = buf + size;
OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf,
size_t units, unsigned int bpc, unsigned int unit_bits,
long lb, long ub, asn_per_constraints_t *pc) {
const uint8_t *end = buf + units * bpc;
ASN_DEBUG("Squeezing %d bytes into (%ld..%ld):%d",
(int)size, lb, ub, unit_bits);
ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)",
(int)units, lb, ub, unit_bits, bpc);
/* X.691: 27.5.4 */
if(ub <= (2 << (unit_bits - 1))) {
if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) {
/* Encode as is */
lb = 0;
} else if(value2code) {
for(; buf < end; buf++) {
int code = value2code(*buf);
} else if(pc && pc->value2code) {
for(; buf < end; buf += bpc) {
int code;
uint32_t value;
switch(bpc) {
case 1: value = *(const uint8_t *)buf; break;
case 2: value = (buf[0] << 8) | buf[1]; break;
case 4: value = (buf[0] << 24) | (buf[1] << 16)
| (buf[2] << 8) | buf[3]; break;
default: return -1;
}
code = pc->value2code(value);
if(code < 0) {
ASN_DEBUG("Character %d (0x%02x) is"
" not in map (%ld..%ld)",
@ -1269,8 +1291,22 @@ OCTET_STRING_per_put_squeezed(asn_per_outp_t *po, const uint8_t *buf,
}
}
for(ub -= lb; buf < end; buf++) {
int ch = *buf - lb;
/* Shortcut the no-op copying to the aligned structure */
if(lb == 0 && (unit_bits == 8 * bpc)) {
return per_put_many_bits(po, buf, unit_bits * units);
}
for(ub -= lb; buf < end; buf += bpc) {
int ch;
uint32_t value;
switch(bpc) {
case 1: value = *(const uint8_t *)buf; break;
case 2: value = (buf[0] << 8) | buf[1]; break;
case 4: value = (buf[0] << 24) | (buf[1] << 16)
| (buf[2] << 8) | buf[3]; break;
default: return -1;
}
ch = value - lb;
if(ch < 0 || ch > ub) {
ASN_DEBUG("Character %d (0x%02x)"
" is out of range (%ld..%ld)",
@ -1294,18 +1330,60 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
: &asn_DEF_OCTET_STRING_specs;
asn_per_constraints_t *pc = constraints ? constraints
: td->per_constraints;
asn_per_constraint_t *cv = pc ? &pc->value : 0;
asn_per_constraint_t *ct = pc ? &pc->size
: &asn_DEF_OCTET_STRING_constraint;
asn_per_constraint_t *cval;
asn_per_constraint_t *csiz;
asn_dec_rval_t rval = { RC_OK, 0 };
BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
ssize_t consumed_myself = 0;
int repeat;
int unit_bits = (specs->subvariant != 1) * 7 + 1;
int expand = 0;
enum {
OS__BPC_BIT = 0,
OS__BPC_CHAR = 1,
OS__BPC_U16 = 2,
OS__BPC_U32 = 4
} bpc; /* Bytes per character */
unsigned int unit_bits;
unsigned int canonical_unit_bits;
(void)opt_codec_ctx;
if(pc) {
cval = &pc->value;
csiz = &pc->size;
} else {
cval = &asn_DEF_OCTET_STRING_constraints.value;
csiz = &asn_DEF_OCTET_STRING_constraints.size;
}
switch(specs->subvariant) {
default:
case ASN_OSUBV_ANY:
ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant);
RETURN(RC_FAIL);
case ASN_OSUBV_BIT:
canonical_unit_bits = unit_bits = 1;
bpc = OS__BPC_BIT;
break;
case ASN_OSUBV_STR:
canonical_unit_bits = unit_bits = 8;
if(cval->flags & APC_CONSTRAINED)
unit_bits = cval->range_bits;
bpc = OS__BPC_CHAR;
break;
case ASN_OSUBV_U16:
canonical_unit_bits = unit_bits = 16;
if(cval->flags & APC_CONSTRAINED)
unit_bits = cval->range_bits;
bpc = OS__BPC_U16;
break;
case ASN_OSUBV_U32:
canonical_unit_bits = unit_bits = 32;
if(cval->flags & APC_CONSTRAINED)
unit_bits = cval->range_bits;
bpc = OS__BPC_U32;
break;
}
/*
* Allocate the string.
*/
@ -1314,29 +1392,26 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
if(!st) RETURN(RC_FAIL);
}
if(cv && (cv->flags & APC_CONSTRAINED)) {
unit_bits = cv->range_bits;
if(unit_bits != 8) expand = 1;
}
ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d",
ct->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible",
ct->lower_bound, ct->upper_bound, ct->effective_bits);
csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible",
csiz->lower_bound, csiz->upper_bound, csiz->effective_bits);
if(ct->flags & APC_EXTENSIBLE) {
if(csiz->flags & APC_EXTENSIBLE) {
int inext = per_get_few_bits(pd, 1);
if(inext < 0) RETURN(RC_WMORE);
if(inext) ct = &asn_DEF_OCTET_STRING_constraint;
consumed_myself = 0;
if(inext) {
csiz = &asn_DEF_OCTET_STRING_constraints.size;
cval = &asn_DEF_OCTET_STRING_constraints.value;
unit_bits = canonical_unit_bits;
}
}
if(ct->effective_bits >= 0
&& (!st->buf || st->size < ct->upper_bound)) {
if(csiz->effective_bits >= 0) {
FREEMEM(st->buf);
if(unit_bits == 1) {
st->size = (ct->upper_bound + 7) >> 3;
if(bpc) {
st->size = csiz->upper_bound * bpc;
} else {
st->size = ct->upper_bound;
st->size = (csiz->upper_bound + 7) >> 3;
}
st->buf = (uint8_t *)MALLOC(st->size + 1);
if(!st->buf) { st->size = 0; RETURN(RC_FAIL); }
@ -1345,59 +1420,65 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
/* X.691, #16.5: zero-length encoding */
/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
if(ct->effective_bits == 0) {
if(csiz->effective_bits == 0) {
int ret;
if(expand) {
ret = OCTET_STRING_per_get_expanded(pd, st->buf,
cv->upper_bound,
cv->lower_bound, cv->upper_bound,
pc->code2value, unit_bits);
if(bpc) {
ASN_DEBUG("Encoding OCTET STRING size %ld",
csiz->upper_bound);
ret = OCTET_STRING_per_get_characters(pd, st->buf,
csiz->upper_bound, bpc, unit_bits,
cval->lower_bound, cval->upper_bound, pc);
if(ret > 0) RETURN(RC_FAIL);
} else {
ASN_DEBUG("Encoding BIT STRING size %ld",
csiz->upper_bound);
ret = per_get_many_bits(pd, st->buf, 0,
unit_bits * ct->upper_bound);
unit_bits * csiz->upper_bound);
}
if(ret < 0) RETURN(RC_WMORE);
consumed_myself += unit_bits * ct->upper_bound;
consumed_myself += unit_bits * csiz->upper_bound;
st->buf[st->size] = 0;
if(unit_bits == 1 && (ct->upper_bound & 0x7))
st->bits_unused = 8 - (ct->upper_bound & 0x7);
if(bpc == 0) {
int ubs = (csiz->upper_bound & 0x7);
st->bits_unused = ubs ? 8 - ubs : 0;
}
RETURN(RC_OK);
}
st->size = 0;
do {
ssize_t raw_len;
ssize_t len_bytes;
ssize_t len_bits;
void *p;
int ret;
/* Get the PER length */
len_bits = uper_get_length(pd, ct->effective_bits, &repeat);
if(len_bits < 0) RETURN(RC_WMORE);
len_bits += ct->lower_bound;
raw_len = uper_get_length(pd, csiz->effective_bits, &repeat);
if(raw_len < 0) RETURN(RC_WMORE);
raw_len += csiz->lower_bound;
ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)",
(long)ct->effective_bits, (long)len_bits,
(long)csiz->effective_bits, (long)raw_len,
repeat ? "repeat" : "once", td->name);
if(unit_bits == 1 && !expand) {
if(bpc) {
len_bytes = raw_len * bpc;
len_bits = len_bytes * unit_bits;
} else {
len_bits = raw_len;
len_bytes = (len_bits + 7) >> 3;
if(len_bits & 0x7)
st->bits_unused = 8 - (len_bits & 0x7);
/* len_bits be multiple of 16K if repeat is set */
} else {
len_bytes = len_bits;
len_bits = len_bytes << 3;
}
p = REALLOC(st->buf, st->size + len_bytes + 1);
if(!p) RETURN(RC_FAIL);
st->buf = (uint8_t *)p;
if(expand) {
ret = OCTET_STRING_per_get_expanded(pd,
&st->buf[st->size], len_bytes,
cv->lower_bound, cv->upper_bound,
pc->code2value, unit_bits);
if(bpc) {
ret = OCTET_STRING_per_get_characters(pd,
&st->buf[st->size], raw_len, bpc, unit_bits,
cval->lower_bound, cval->upper_bound, pc);
if(ret > 0) RETURN(RC_FAIL);
} else {
ret = per_get_many_bits(pd, &st->buf[st->size],
@ -1420,46 +1501,85 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
: &asn_DEF_OCTET_STRING_specs;
asn_per_constraints_t *pc = constraints ? constraints
: td->per_constraints;
asn_per_constraint_t *cv = pc ? &pc->value : 0;
asn_per_constraint_t *ct = pc ? &pc->size
: &asn_DEF_OCTET_STRING_constraint;
asn_per_constraint_t *cval;
asn_per_constraint_t *csiz;
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
asn_enc_rval_t er = { 0, 0 };
int ct_extensible = ct->flags & APC_EXTENSIBLE;
asn_enc_rval_t er = { 0, 0, 0 };
int inext = 0; /* Lies not within extension root */
int unit_bits = (specs->subvariant != 1) * 7 + 1;
int sizeinunits = st->size;
unsigned int unit_bits;
unsigned int canonical_unit_bits;
unsigned int sizeinunits;
const uint8_t *buf;
int squeeze = 0;
int ret;
enum {
OS__BPC_BIT = 0,
OS__BPC_CHAR = 1,
OS__BPC_U16 = 2,
OS__BPC_U32 = 4
} bpc; /* Bytes per character */
int ct_extensible;
if(!st || (!st->buf && st->size))
_ASN_ENCODE_FAILED;
if(unit_bits == 1) {
if(pc) {
cval = &pc->value;
csiz = &pc->size;
} else {
cval = &asn_DEF_OCTET_STRING_constraints.value;
csiz = &asn_DEF_OCTET_STRING_constraints.size;
}
ct_extensible = csiz->flags & APC_EXTENSIBLE;
switch(specs->subvariant) {
default:
case ASN_OSUBV_ANY:
_ASN_ENCODE_FAILED;
case ASN_OSUBV_BIT:
canonical_unit_bits = unit_bits = 1;
bpc = OS__BPC_BIT;
sizeinunits = st->size * 8 - (st->bits_unused & 0x07);
ASN_DEBUG("BIT STRING of %d bytes, %d bits unused",
sizeinunits, st->bits_unused);
sizeinunits = sizeinunits * 8 - (st->bits_unused & 0x07);
}
if(cv && (cv->flags & APC_CONSTRAINED)) {
unit_bits = cv->range_bits;
if(unit_bits != 8) squeeze = 1;
break;
case ASN_OSUBV_STR:
canonical_unit_bits = unit_bits = 8;
if(cval->flags & APC_CONSTRAINED)
unit_bits = cval->range_bits;
bpc = OS__BPC_CHAR;
sizeinunits = st->size;
break;
case ASN_OSUBV_U16:
canonical_unit_bits = unit_bits = 16;
if(cval->flags & APC_CONSTRAINED)
unit_bits = cval->range_bits;
bpc = OS__BPC_U16;
sizeinunits = st->size / 2;
break;
case ASN_OSUBV_U32:
canonical_unit_bits = unit_bits = 32;
if(cval->flags & APC_CONSTRAINED)
unit_bits = cval->range_bits;
bpc = OS__BPC_U32;
sizeinunits = st->size / 4;
break;
}
ASN_DEBUG("Encoding %s into %d units of %d bits"
" (%ld..%ld, effective %d)%s",
td->name, sizeinunits, unit_bits,
ct->lower_bound, ct->upper_bound,
ct->effective_bits, ct_extensible ? " EXT" : "");
csiz->lower_bound, csiz->upper_bound,
csiz->effective_bits, ct_extensible ? " EXT" : "");
/* Figure out wheter size lies within PER visible constraint */
if(ct->effective_bits >= 0) {
if(sizeinunits < ct->lower_bound
|| sizeinunits > ct->upper_bound) {
if(csiz->effective_bits >= 0) {
if((int)sizeinunits < csiz->lower_bound
|| (int)sizeinunits > csiz->upper_bound) {
if(ct_extensible) {
ct = &asn_DEF_OCTET_STRING_constraint;
cval = &asn_DEF_OCTET_STRING_constraints.value;
csiz = &asn_DEF_OCTET_STRING_constraints.size;
unit_bits = canonical_unit_bits;
inext = 1;
} else
_ASN_ENCODE_FAILED;
@ -1477,17 +1597,17 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
/* X.691, #16.5: zero-length encoding */
/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
if(ct->effective_bits >= 0) {
if(csiz->effective_bits >= 0) {
ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits",
st->size, sizeinunits - ct->lower_bound,
ct->effective_bits);
ret = per_put_few_bits(po, sizeinunits - ct->lower_bound,
ct->effective_bits);
st->size, sizeinunits - csiz->lower_bound,
csiz->effective_bits);
ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound,
csiz->effective_bits);
if(ret) _ASN_ENCODE_FAILED;
if(squeeze) {
ret = OCTET_STRING_per_put_squeezed(po, st->buf,
sizeinunits, cv->lower_bound, cv->upper_bound,
pc->value2code, unit_bits);
if(bpc) {
ret = OCTET_STRING_per_put_characters(po, st->buf,
sizeinunits, bpc, unit_bits,
cval->lower_bound, cval->upper_bound, pc);
} else {
ret = per_put_many_bits(po, st->buf,
sizeinunits * unit_bits);
@ -1512,19 +1632,19 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
ASN_DEBUG("Encoding %ld of %ld",
(long)maySave, (long)sizeinunits);
if(squeeze) {
ret = OCTET_STRING_per_put_squeezed(po, buf,
maySave, cv->lower_bound, cv->upper_bound,
pc->value2code, unit_bits);
if(bpc) {
ret = OCTET_STRING_per_put_characters(po, buf,
maySave, bpc, unit_bits,
cval->lower_bound, cval->upper_bound, pc);
} else {
ret = per_put_many_bits(po, buf, maySave * unit_bits);
}
if(ret) _ASN_ENCODE_FAILED;
if(unit_bits == 1 && !squeeze)
buf += maySave >> 3;
if(bpc)
buf += maySave * bpc;
else
buf += maySave;
buf += maySave >> 3;
sizeinunits -= maySave;
assert(!(maySave & 0x07) || !sizeinunits);
}

View File

@ -70,7 +70,13 @@ typedef struct asn_OCTET_STRING_specifics_s {
int struct_size; /* Size of the structure */
int ctx_offset; /* Offset of the asn_struct_ctx_t member */
int subvariant; /* {0,1,2} for O-S, BIT STRING or ANY */
enum asn_OS_Subvariant {
ASN_OSUBV_ANY, /* The open type (ANY) */
ASN_OSUBV_BIT, /* BIT STRING */
ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */
ASN_OSUBV_U16, /* 16-bit character (BMPString) */
ASN_OSUBV_U32 /* 32-bit character (UniversalString) */
} subvariant;
} asn_OCTET_STRING_specifics_t;
#ifdef __cplusplus

View File

@ -13,6 +13,16 @@ static ber_tlv_tag_t asn_DEF_UniversalString_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (28 << 2)), /* [UNIVERSAL 28] IMPLICIT ...*/
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
};
static asn_OCTET_STRING_specifics_t asn_DEF_UniversalString_specs = {
sizeof(UniversalString_t),
offsetof(UniversalString_t, _asn_ctx),
ASN_OSUBV_U32 /* 32-bits character */
};
static asn_per_constraints_t asn_DEF_UniversalString_constraints = {
{ APC_CONSTRAINED, 32, 32, 0, 2147483647 },
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 },
0, 0
};
asn_TYPE_descriptor_t asn_DEF_UniversalString = {
"UniversalString",
"UniversalString",
@ -23,7 +33,8 @@ asn_TYPE_descriptor_t asn_DEF_UniversalString = {
OCTET_STRING_encode_der,
UniversalString_decode_xer, /* Convert from UTF-8 */
UniversalString_encode_xer, /* Convert into UTF-8 */
0, 0,
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_UniversalString_tags,
sizeof(asn_DEF_UniversalString_tags)
@ -31,9 +42,9 @@ asn_TYPE_descriptor_t asn_DEF_UniversalString = {
asn_DEF_UniversalString_tags,
sizeof(asn_DEF_UniversalString_tags)
/ sizeof(asn_DEF_UniversalString_tags[0]),
0, /* No PER visible constraints */
&asn_DEF_UniversalString_constraints,
0, 0, /* No members */
0 /* No specifics */
&asn_DEF_UniversalString_specs
};

View File

@ -31,6 +31,16 @@ BEGIN
ut-c UTF8String (SIZE(6)) OPTIONAL,
ut-ce UTF8String (SIZE(6,...)) OPTIONAL,
ut-ir UTF8String (FROM("A"|"Z")) OPTIONAL,
bm BMPString OPTIONAL,
bm-c BMPString (FROM("A".."Z")) OPTIONAL,
bm-cs BMPString (SIZE(6)) OPTIONAL,
bm-ce BMPString (FROM("A".."Z",...)) OPTIONAL,
bm-ir BMPString (FROM("A".."B"|"X".."Z")) OPTIONAL,
us UniversalString OPTIONAL,
us-c UniversalString (FROM("A".."Z")) OPTIONAL,
us-cs UniversalString (SIZE(6)) OPTIONAL,
us-ce UniversalString (FROM("A".."Z",...)) OPTIONAL,
us-ir UniversalString (FROM("A".."B"|"X".."Z")) OPTIONAL,
real REAL OPTIONAL,
oid OBJECT IDENTIFIER OPTIONAL
}

View File

@ -23,8 +23,18 @@ PDU ::= SEQUENCE {
ut-c [16] IMPLICIT UTF8String (SIZE(6)) OPTIONAL,
ut-ce [17] IMPLICIT UTF8String (SIZE(6,...)) OPTIONAL,
ut-ir [18] IMPLICIT UTF8String (FROM("A" | "Z")) OPTIONAL,
real [19] IMPLICIT REAL OPTIONAL,
oid [20] IMPLICIT OBJECT IDENTIFIER OPTIONAL
bm [19] IMPLICIT BMPString OPTIONAL,
bm-c [20] IMPLICIT BMPString (FROM("A".."Z")) OPTIONAL,
bm-cs [21] IMPLICIT BMPString (SIZE(6)) OPTIONAL,
bm-ce [22] IMPLICIT BMPString (FROM("A".."Z",...)) OPTIONAL,
bm-ir [23] IMPLICIT BMPString (FROM("A".."B" | "X".."Z")) OPTIONAL,
us [24] IMPLICIT UniversalString OPTIONAL,
us-c [25] IMPLICIT UniversalString (FROM("A".."Z")) OPTIONAL,
us-cs [26] IMPLICIT UniversalString (SIZE(6)) OPTIONAL,
us-ce [27] IMPLICIT UniversalString (FROM("A".."Z",...)) OPTIONAL,
us-ir [28] IMPLICIT UniversalString (FROM("A".."B" | "X".."Z")) OPTIONAL,
real [29] IMPLICIT REAL OPTIONAL,
oid [30] IMPLICIT OBJECT IDENTIFIER OPTIONAL
}
END

View File

@ -6,6 +6,8 @@
#include <PrintableString.h>
#include <NumericString.h>
#include <UTF8String.h>
#include <BMPString.h>
#include <UniversalString.h>
#include <REAL.h>
#include <OBJECT_IDENTIFIER.h>
#include <asn_SEQUENCE_OF.h>
@ -43,6 +45,16 @@ typedef struct PDU {
UTF8String_t *ut_c /* OPTIONAL */;
UTF8String_t *ut_ce /* OPTIONAL */;
UTF8String_t *ut_ir /* OPTIONAL */;
BMPString_t *bm /* OPTIONAL */;
BMPString_t *bm_c /* OPTIONAL */;
BMPString_t *bm_cs /* OPTIONAL */;
BMPString_t *bm_ce /* OPTIONAL */;
BMPString_t *bm_ir /* OPTIONAL */;
UniversalString_t *us /* OPTIONAL */;
UniversalString_t *us_c /* OPTIONAL */;
UniversalString_t *us_cs /* OPTIONAL */;
UniversalString_t *us_ce /* OPTIONAL */;
UniversalString_t *us_ir /* OPTIONAL */;
REAL_t *real /* OPTIONAL */;
OBJECT_IDENTIFIER_t *oid /* OPTIONAL */;
@ -277,6 +289,162 @@ static int check_permitted_alphabet_21(const void *sptr) {
return 0;
}
static int check_permitted_alphabet_23(const void *sptr) {
/* The underlying type is BMPString */
const BMPString_t *st = (const BMPString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 2) return -1; /* (size%2)! */
for(; ch < end; ch += 2) {
uint16_t cv = (ch[0] << 8)
| ch[1];
if(!(cv >= 65 && cv <= 90)) return -1;
}
return 0;
}
static int check_permitted_alphabet_24(const void *sptr) {
/* The underlying type is BMPString */
const BMPString_t *st = (const BMPString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 2) return -1; /* (size%2)! */
for(; ch < end; ch += 2) {
uint16_t cv = (ch[0] << 8)
| ch[1];
if(!(cv <= 65533)) return -1;
}
return 0;
}
static int check_permitted_alphabet_25(const void *sptr) {
/* The underlying type is BMPString */
const BMPString_t *st = (const BMPString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 2) return -1; /* (size%2)! */
for(; ch < end; ch += 2) {
uint16_t cv = (ch[0] << 8)
| ch[1];
if(!(cv >= 65 && cv <= 90)) return -1;
}
return 0;
}
static int permitted_alphabet_table_26[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */
0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */
};
static int permitted_alphabet_code2value_26[5] = {
65,66,88,89,90,};
static int check_permitted_alphabet_26(const void *sptr) {
int *table = permitted_alphabet_table_26;
/* The underlying type is BMPString */
const BMPString_t *st = (const BMPString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 2) return -1; /* (size%2)! */
for(; ch < end; ch += 2) {
uint16_t cv = (ch[0] << 8)
| ch[1];
if(cv > 255) return -1;
if(!table[cv]) return -1;
}
return 0;
}
static int check_permitted_alphabet_28(const void *sptr) {
/* The underlying type is UniversalString */
const UniversalString_t *st = (const UniversalString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 4) return -1; /* (size%4)! */
for(; ch < end; ch += 4) {
uint32_t cv = (ch[0] << 24)
| (ch[1] << 16)
| (ch[2] << 8)
| ch[3];
if(!(cv >= 65 && cv <= 90)) return -1;
}
return 0;
}
static int check_permitted_alphabet_29(const void *sptr) {
/* The underlying type is UniversalString */
const UniversalString_t *st = (const UniversalString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 4) return -1; /* (size%4)! */
for(; ch < end; ch += 4) {
uint32_t cv = (ch[0] << 24)
| (ch[1] << 16)
| (ch[2] << 8)
| ch[3];
if(!(1 /* Constraint matches natural range of cv */)) return -1;
}
return 0;
}
static int check_permitted_alphabet_30(const void *sptr) {
/* The underlying type is UniversalString */
const UniversalString_t *st = (const UniversalString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 4) return -1; /* (size%4)! */
for(; ch < end; ch += 4) {
uint32_t cv = (ch[0] << 24)
| (ch[1] << 16)
| (ch[2] << 8)
| ch[3];
if(!(cv >= 65 && cv <= 90)) return -1;
}
return 0;
}
static int permitted_alphabet_table_31[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */
0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */
};
static int permitted_alphabet_code2value_31[5] = {
65,66,88,89,90,};
static int check_permitted_alphabet_31(const void *sptr) {
int *table = permitted_alphabet_table_31;
/* The underlying type is UniversalString */
const UniversalString_t *st = (const UniversalString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
if(st->size % 4) return -1; /* (size%4)! */
for(; ch < end; ch += 4) {
uint32_t cv = (ch[0] << 24)
| (ch[1] << 16)
| (ch[2] << 8)
| ch[3];
if(cv > 255) return -1;
if(!table[cv]) return -1;
}
return 0;
}
/*** <<< CODE [PDU] >>> ***/
@ -672,6 +840,224 @@ memb_ut_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
}
}
static int
memb_bm_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const BMPString_t *st = (const BMPString_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_23(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_bm_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const BMPString_t *st = (const BMPString_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size >> 1; /* 2 byte per character */
if((size == 6)
&& !check_permitted_alphabet_24(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_bm_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const BMPString_t *st = (const BMPString_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_25(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_bm_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const BMPString_t *st = (const BMPString_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_26(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int asn_PER_MAP_bm_ir_26_v2c(unsigned int value) {
if(value >= sizeof(permitted_alphabet_table_26)/sizeof(permitted_alphabet_table_26[0]))
return -1;
return permitted_alphabet_table_26[value] - 1;
}
static int asn_PER_MAP_bm_ir_26_c2v(unsigned int code) {
if(code >= sizeof(permitted_alphabet_code2value_26)/sizeof(permitted_alphabet_code2value_26[0]))
return -1;
return permitted_alphabet_code2value_26[code];
}
static int
memb_us_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const UniversalString_t *st = (const UniversalString_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_28(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_us_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const UniversalString_t *st = (const UniversalString_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size >> 2; /* 4 byte per character */
if((size == 6)
&& !check_permitted_alphabet_29(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_us_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const UniversalString_t *st = (const UniversalString_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_30(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_us_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const UniversalString_t *st = (const UniversalString_t *)sptr;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_31(st)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int asn_PER_MAP_us_ir_31_v2c(unsigned int value) {
if(value >= sizeof(permitted_alphabet_table_31)/sizeof(permitted_alphabet_table_31[0]))
return -1;
return permitted_alphabet_table_31[value] - 1;
}
static int asn_PER_MAP_us_ir_31_c2v(unsigned int code) {
if(code >= sizeof(permitted_alphabet_code2value_31)/sizeof(permitted_alphabet_code2value_31[0]))
return -1;
return permitted_alphabet_code2value_31[code];
}
/*** <<< CTDEFS [PDU] >>> ***/
@ -749,6 +1135,49 @@ static asn_per_constraints_t asn_PER_memb_ut_ir_constr_21 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
static asn_per_constraints_t asn_PER_memb_bm_c_constr_23 = {
{ APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */,
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_bm_cs_constr_24 = {
{ APC_CONSTRAINED, 16, 16, 0, 65533 } /* (0..65533) */,
{ APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_bm_ce_constr_25 = {
{ APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */,
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_bm_ir_constr_26 = {
{ APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */,
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */,
asn_PER_MAP_bm_ir_26_v2c, /* Value to PER code map */
asn_PER_MAP_bm_ir_26_c2v /* PER code to value map */
};
static asn_per_constraints_t asn_PER_memb_us_c_constr_28 = {
{ APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */,
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_us_cs_constr_29 = {
{ APC_CONSTRAINED, 32, 32, 0, 2147483647 } /* (0..4294967295) */,
{ APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_us_ce_constr_30 = {
{ APC_CONSTRAINED, 32, 32, 0, 2147483647 } /* special case 1 */
,
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_us_ir_constr_31 = {
{ APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */,
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */,
asn_PER_MAP_us_ir_31_v2c, /* Value to PER code map */
asn_PER_MAP_us_ir_31_c2v /* PER code to value map */
};
/*** <<< STAT-DEFS [PDU] >>> ***/
@ -799,7 +1228,7 @@ asn_TYPE_descriptor_t asn_DEF_many_2 = {
};
static asn_TYPE_member_t asn_MBR_PDU_1[] = {
{ ATF_POINTER, 21, offsetof(struct PDU, many),
{ ATF_POINTER, 31, offsetof(struct PDU, many),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = 0,
.type = &asn_DEF_many_2,
@ -808,7 +1237,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "many"
},
{ ATF_POINTER, 20, offsetof(struct PDU, ia5),
{ ATF_POINTER, 30, offsetof(struct PDU, ia5),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_IA5String,
@ -817,7 +1246,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ia5"
},
{ ATF_POINTER, 19, offsetof(struct PDU, ia5_c),
{ ATF_POINTER, 29, offsetof(struct PDU, ia5_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_IA5String,
@ -826,7 +1255,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ia5-c"
},
{ ATF_POINTER, 18, offsetof(struct PDU, ia5_ce),
{ ATF_POINTER, 28, offsetof(struct PDU, ia5_ce),
.tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_IA5String,
@ -835,7 +1264,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ia5-ce"
},
{ ATF_POINTER, 17, offsetof(struct PDU, ia5_ir),
{ ATF_POINTER, 27, offsetof(struct PDU, ia5_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_IA5String,
@ -844,7 +1273,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ia5-ir"
},
{ ATF_POINTER, 16, offsetof(struct PDU, vs),
{ ATF_POINTER, 26, offsetof(struct PDU, vs),
.tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
@ -853,7 +1282,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "vs"
},
{ ATF_POINTER, 15, offsetof(struct PDU, vs_c),
{ ATF_POINTER, 25, offsetof(struct PDU, vs_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
@ -862,7 +1291,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "vs-c"
},
{ ATF_POINTER, 14, offsetof(struct PDU, vs_ce),
{ ATF_POINTER, 24, offsetof(struct PDU, vs_ce),
.tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
@ -871,7 +1300,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "vs-ce"
},
{ ATF_POINTER, 13, offsetof(struct PDU, vs_ir),
{ ATF_POINTER, 23, offsetof(struct PDU, vs_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_VisibleString,
@ -880,7 +1309,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "vs-ir"
},
{ ATF_POINTER, 12, offsetof(struct PDU, pr),
{ ATF_POINTER, 22, offsetof(struct PDU, pr),
.tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_PrintableString,
@ -889,7 +1318,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "pr"
},
{ ATF_POINTER, 11, offsetof(struct PDU, pr_c),
{ ATF_POINTER, 21, offsetof(struct PDU, pr_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (10 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_PrintableString,
@ -898,7 +1327,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "pr-c"
},
{ ATF_POINTER, 10, offsetof(struct PDU, pr_ir),
{ ATF_POINTER, 20, offsetof(struct PDU, pr_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (11 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_PrintableString,
@ -907,7 +1336,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "pr-ir"
},
{ ATF_POINTER, 9, offsetof(struct PDU, ns),
{ ATF_POINTER, 19, offsetof(struct PDU, ns),
.tag = (ASN_TAG_CLASS_CONTEXT | (12 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_NumericString,
@ -916,7 +1345,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ns"
},
{ ATF_POINTER, 8, offsetof(struct PDU, ns_c),
{ ATF_POINTER, 18, offsetof(struct PDU, ns_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (13 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_NumericString,
@ -925,7 +1354,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ns-c"
},
{ ATF_POINTER, 7, offsetof(struct PDU, ns_ce),
{ ATF_POINTER, 17, offsetof(struct PDU, ns_ce),
.tag = (ASN_TAG_CLASS_CONTEXT | (14 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_NumericString,
@ -934,7 +1363,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ns-ce"
},
{ ATF_POINTER, 6, offsetof(struct PDU, ns_ir),
{ ATF_POINTER, 16, offsetof(struct PDU, ns_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (15 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_NumericString,
@ -943,7 +1372,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ns-ir"
},
{ ATF_POINTER, 5, offsetof(struct PDU, ut_c),
{ ATF_POINTER, 15, offsetof(struct PDU, ut_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (16 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UTF8String,
@ -952,7 +1381,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ut-c"
},
{ ATF_POINTER, 4, offsetof(struct PDU, ut_ce),
{ ATF_POINTER, 14, offsetof(struct PDU, ut_ce),
.tag = (ASN_TAG_CLASS_CONTEXT | (17 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UTF8String,
@ -961,7 +1390,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ut-ce"
},
{ ATF_POINTER, 3, offsetof(struct PDU, ut_ir),
{ ATF_POINTER, 13, offsetof(struct PDU, ut_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (18 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UTF8String,
@ -970,9 +1399,99 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.default_value = 0,
.name = "ut-ir"
},
{ ATF_POINTER, 2, offsetof(struct PDU, real),
{ ATF_POINTER, 12, offsetof(struct PDU, bm),
.tag = (ASN_TAG_CLASS_CONTEXT | (19 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_BMPString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
.name = "bm"
},
{ ATF_POINTER, 11, offsetof(struct PDU, bm_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (20 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_BMPString,
.memb_constraints = memb_bm_c_constraint_1,
.per_constraints = &asn_PER_memb_bm_c_constr_23,
.default_value = 0,
.name = "bm-c"
},
{ ATF_POINTER, 10, offsetof(struct PDU, bm_cs),
.tag = (ASN_TAG_CLASS_CONTEXT | (21 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_BMPString,
.memb_constraints = memb_bm_cs_constraint_1,
.per_constraints = &asn_PER_memb_bm_cs_constr_24,
.default_value = 0,
.name = "bm-cs"
},
{ ATF_POINTER, 9, offsetof(struct PDU, bm_ce),
.tag = (ASN_TAG_CLASS_CONTEXT | (22 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_BMPString,
.memb_constraints = memb_bm_ce_constraint_1,
.per_constraints = &asn_PER_memb_bm_ce_constr_25,
.default_value = 0,
.name = "bm-ce"
},
{ ATF_POINTER, 8, offsetof(struct PDU, bm_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (23 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_BMPString,
.memb_constraints = memb_bm_ir_constraint_1,
.per_constraints = &asn_PER_memb_bm_ir_constr_26,
.default_value = 0,
.name = "bm-ir"
},
{ ATF_POINTER, 7, offsetof(struct PDU, us),
.tag = (ASN_TAG_CLASS_CONTEXT | (24 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UniversalString,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
.default_value = 0,
.name = "us"
},
{ ATF_POINTER, 6, offsetof(struct PDU, us_c),
.tag = (ASN_TAG_CLASS_CONTEXT | (25 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UniversalString,
.memb_constraints = memb_us_c_constraint_1,
.per_constraints = &asn_PER_memb_us_c_constr_28,
.default_value = 0,
.name = "us-c"
},
{ ATF_POINTER, 5, offsetof(struct PDU, us_cs),
.tag = (ASN_TAG_CLASS_CONTEXT | (26 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UniversalString,
.memb_constraints = memb_us_cs_constraint_1,
.per_constraints = &asn_PER_memb_us_cs_constr_29,
.default_value = 0,
.name = "us-cs"
},
{ ATF_POINTER, 4, offsetof(struct PDU, us_ce),
.tag = (ASN_TAG_CLASS_CONTEXT | (27 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UniversalString,
.memb_constraints = memb_us_ce_constraint_1,
.per_constraints = &asn_PER_memb_us_ce_constr_30,
.default_value = 0,
.name = "us-ce"
},
{ ATF_POINTER, 3, offsetof(struct PDU, us_ir),
.tag = (ASN_TAG_CLASS_CONTEXT | (28 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_UniversalString,
.memb_constraints = memb_us_ir_constraint_1,
.per_constraints = &asn_PER_memb_us_ir_constr_31,
.default_value = 0,
.name = "us-ir"
},
{ ATF_POINTER, 2, offsetof(struct PDU, real),
.tag = (ASN_TAG_CLASS_CONTEXT | (29 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_REAL,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.per_constraints = 0, /* No PER visible constraints */
@ -980,7 +1499,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.name = "real"
},
{ ATF_POINTER, 1, offsetof(struct PDU, oid),
.tag = (ASN_TAG_CLASS_CONTEXT | (20 << 2)),
.tag = (ASN_TAG_CLASS_CONTEXT | (30 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = &asn_DEF_OBJECT_IDENTIFIER,
.memb_constraints = 0, /* Defer constraints checking to the member type */
@ -989,7 +1508,7 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.name = "oid"
},
};
static int asn_MAP_PDU_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
static int asn_MAP_PDU_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 };
static ber_tlv_tag_t asn_DEF_PDU_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
@ -1013,16 +1532,26 @@ static asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* ut-c at 31 */
{ (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* ut-ce at 32 */
{ (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* ut-ir at 33 */
{ (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* real at 34 */
{ (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 } /* oid at 35 */
{ (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* bm at 34 */
{ (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* bm-c at 35 */
{ (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 }, /* bm-cs at 36 */
{ (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0 }, /* bm-ce at 37 */
{ (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0 }, /* bm-ir at 38 */
{ (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0 }, /* us at 39 */
{ (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0 }, /* us-c at 40 */
{ (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0 }, /* us-cs at 41 */
{ (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0 }, /* us-ce at 42 */
{ (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0 }, /* us-ir at 43 */
{ (ASN_TAG_CLASS_CONTEXT | (29 << 2)), 29, 0, 0 }, /* real at 44 */
{ (ASN_TAG_CLASS_CONTEXT | (30 << 2)), 30, 0, 0 } /* oid at 45 */
};
static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = {
sizeof(struct PDU),
offsetof(struct PDU, _asn_ctx),
asn_MAP_PDU_tag2el_1,
21, /* Count of tags in the map */
31, /* Count of tags in the map */
asn_MAP_PDU_oms_1, /* Optional members */
21, 0, /* Root/Additions */
31, 0, /* Root/Additions */
-1, /* Start extensions */
-1 /* Stop extensions */
};
@ -1047,7 +1576,7 @@ asn_TYPE_descriptor_t asn_DEF_PDU = {
/sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
asn_MBR_PDU_1,
21, /* Elements count */
31, /* Elements count */
&asn_SPC_PDU_specs_1 /* Additional specs */
};