From fb953d17548e30422d2fdab0d17e5df54746e420 Mon Sep 17 00:00:00 2001 From: Lev Walkin Date: Sat, 23 Jun 2007 20:06:04 +0000 Subject: extensibility fix, at least --- tests/126-per-extensions-OK.asn1 | 20 +++++++ tests/126-per-extensions-OK.asn1.-Pgen-PER | 89 ++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 tests/126-per-extensions-OK.asn1 create mode 100644 tests/126-per-extensions-OK.asn1.-Pgen-PER (limited to 'tests') diff --git a/tests/126-per-extensions-OK.asn1 b/tests/126-per-extensions-OK.asn1 new file mode 100644 index 00000000..c4729d32 --- /dev/null +++ b/tests/126-per-extensions-OK.asn1 @@ -0,0 +1,20 @@ + +-- OK: Everything is fine + +-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) +-- .spelio.software.asn1c.test (9363.1.5.1) +-- .126 + +ModulePERExtensions + { iso org(3) dod(6) internet (1) private(4) enterprise(1) + spelio(9363) software(1) asn1c(5) test(1) 126 } + DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + + PDU ::= SEQUENCE { + ..., + str-o IA5String OPTIONAL, + str-m IA5String + } + +END diff --git a/tests/126-per-extensions-OK.asn1.-Pgen-PER b/tests/126-per-extensions-OK.asn1.-Pgen-PER new file mode 100644 index 00000000..8517c023 --- /dev/null +++ b/tests/126-per-extensions-OK.asn1.-Pgen-PER @@ -0,0 +1,89 @@ + +/*** <<< INCLUDES [PDU] >>> ***/ + +#include +#include + +/*** <<< TYPE-DECLS [PDU] >>> ***/ + +typedef struct PDU { + /* + * This type is extensible, + * possible extensions are below. + */ + IA5String_t *str_o /* OPTIONAL */; + IA5String_t *str_m; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDU_t; + +/*** <<< FUNC-DECLS [PDU] >>> ***/ + +extern asn_TYPE_descriptor_t asn_DEF_PDU; + +/*** <<< STAT-DEFS [PDU] >>> ***/ + +static asn_TYPE_member_t asn_MBR_PDU_1[] = { + { ATF_POINTER, 2, offsetof(struct PDU, str_o), + .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_IA5String, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "str-o" + }, + { ATF_POINTER, 1, offsetof(struct PDU, str_m), + .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + .tag_mode = -1, /* IMPLICIT tag at current level */ + .type = &asn_DEF_IA5String, + .memb_constraints = 0, /* Defer constraints checking to the member type */ + .per_constraints = 0, /* No PER visible constraints */ + .default_value = 0, + .name = "str-m" + }, +}; +static int asn_MAP_PDU_oms_1[] = { 0, 1 }; +static ber_tlv_tag_t asn_DEF_PDU_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* str-o at 16 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* str-m at 17 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = { + sizeof(struct PDU), + offsetof(struct PDU, _asn_ctx), + asn_MAP_PDU_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_PDU_oms_1, /* Optional members */ + 0, 2, /* Root/Additions */ + -1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PDU = { + "PDU", + "PDU", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PDU_tags_1, + sizeof(asn_DEF_PDU_tags_1) + /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ + asn_DEF_PDU_tags_1, /* Same as above */ + sizeof(asn_DEF_PDU_tags_1) + /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PDU_1, + 2, /* Elements count */ + &asn_SPC_PDU_specs_1 /* Additional specs */ +}; + -- cgit v1.2.3