Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
15750405
Commit
15750405
authored
Jul 03, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new tests for parametrization
parent
472bbdc2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
691 additions
and
26 deletions
+691
-26
tests/70-xer-test-OK.asn1
tests/70-xer-test-OK.asn1
+8
-0
tests/70-xer-test-OK.asn1.-EF
tests/70-xer-test-OK.asn1.-EF
+11
-3
tests/70-xer-test-OK.asn1.-P
tests/70-xer-test-OK.asn1.-P
+124
-23
tests/84-param-tags-OK.asn1
tests/84-param-tags-OK.asn1
+41
-0
tests/84-param-tags-OK.asn1.-EF
tests/84-param-tags-OK.asn1.-EF
+39
-0
tests/84-param-tags-OK.asn1.-P
tests/84-param-tags-OK.asn1.-P
+468
-0
No files found.
tests/70-xer-test-OK.asn1
View file @
15750405
...
...
@@ -22,6 +22,7 @@ BEGIN
sequenceOf SequenceOf,
extensibleSet ExtensibleSet,
extensibleSequence ExtensibleSequence,
extensibleSequence2 ExtensibleSequence2,
setOfNULL SetOfNULL,
setOfEnums SetOfEnums,
seqOfZuka SeqOfZuka,
...
...
@@ -47,6 +48,13 @@ BEGIN
}
ExtensibleSequence ::= SEQUENCE {
string UTF8String OPTIONAL,
...,
integer INTEGER OPTIONAL,
gtime GeneralizedTime
}
ExtensibleSequence2 ::= SEQUENCE {
string UTF8String OPTIONAL,
...,
integer INTEGER OPTIONAL
...
...
tests/70-xer-test-OK.asn1.-EF
View file @
15750405
...
...
@@ -10,9 +10,10 @@ PDU ::= CHOICE {
sequenceOf [3] IMPLICIT SequenceOf,
extensibleSet [4] IMPLICIT ExtensibleSet,
extensibleSequence [5] IMPLICIT ExtensibleSequence,
setOfNULL [6] IMPLICIT SetOfNULL,
setOfEnums [7] IMPLICIT SetOfEnums,
seqOfZuka [8] IMPLICIT SeqOfZuka,
extensibleSequence2 [6] IMPLICIT ExtensibleSequence2,
setOfNULL [7] IMPLICIT SetOfNULL,
setOfEnums [8] IMPLICIT SetOfEnums,
seqOfZuka [9] IMPLICIT SeqOfZuka,
...
}
...
...
@@ -38,6 +39,13 @@ ExtensibleSet ::= SET {
}
ExtensibleSequence ::= SEQUENCE {
string [0] IMPLICIT UTF8String OPTIONAL,
...,
integer [1] IMPLICIT INTEGER OPTIONAL,
gtime [2] IMPLICIT GeneralizedTime
}
ExtensibleSequence2 ::= SEQUENCE {
string [0] IMPLICIT UTF8String OPTIONAL,
...,
integer [1] IMPLICIT INTEGER OPTIONAL
...
...
tests/70-xer-test-OK.asn1.-P
View file @
15750405
...
...
@@ -7,6 +7,7 @@
#include <SequenceOf.h>
#include <ExtensibleSet.h>
#include <ExtensibleSequence.h>
#include <ExtensibleSequence2.h>
#include <SetOfNULL.h>
#include <SetOfEnums.h>
#include <SeqOfZuka.h>
...
...
@@ -22,6 +23,7 @@ typedef enum PDU_PR {
PDU_PR_sequenceOf,
PDU_PR_extensibleSet,
PDU_PR_extensibleSequence,
PDU_PR_extensibleSequence2,
PDU_PR_setOfNULL,
PDU_PR_setOfEnums,
PDU_PR_seqOfZuka,
...
...
@@ -39,6 +41,7 @@ typedef struct PDU {
SequenceOf_t sequenceOf;
ExtensibleSet_t extensibleSet;
ExtensibleSequence_t extensibleSequence;
ExtensibleSequence2_t extensibleSequence2;
SetOfNULL_t setOfNULL;
SetOfEnums_t setOfEnums;
SeqOfZuka_t seqOfZuka;
...
...
@@ -101,22 +104,29 @@ static asn_TYPE_member_t asn_MBR_PDU_1[] = {
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "extensibleSequence"
},
{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.
setOfNULL
),
{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.
extensibleSequence2
),
.tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_ExtensibleSequence2,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "extensibleSequence2"
},
{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfNULL),
.tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_SetOfNULL,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "setOfNULL"
},
{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfEnums),
.tag = (ASN_TAG_CLASS_CONTEXT | (
7
<< 2)),
.tag = (ASN_TAG_CLASS_CONTEXT | (
8
<< 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_SetOfEnums,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "setOfEnums"
},
{ ATF_NOFLAGS, 0, offsetof(struct PDU, choice.seqOfZuka),
.tag = (ASN_TAG_CLASS_CONTEXT | (
8
<< 2)),
.tag = (ASN_TAG_CLASS_CONTEXT | (
9
<< 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_SeqOfZuka,
.memb_constraints = 0, /* Defer constraints checking to the member type */
...
...
@@ -130,9 +140,10 @@ static asn_TYPE_tag2member_t asn_MAP_PDU_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sequenceOf at 22 */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* extensibleSet at 23 */
{ (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* extensibleSequence at 24 */
{ (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* setOfNULL at 25 */
{ (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* setOfEnums at 26 */
{ (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* seqOfZuka at 27 */
{ (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* extensibleSequence2 at 25 */
{ (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* setOfNULL at 26 */
{ (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* setOfEnums at 27 */
{ (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* seqOfZuka at 28 */
};
static asn_CHOICE_specifics_t asn_SPC_PDU_1_specs = {
sizeof(struct PDU),
...
...
@@ -140,7 +151,7 @@ static asn_CHOICE_specifics_t asn_SPC_PDU_1_specs = {
offsetof(struct PDU, present),
sizeof(((struct PDU *)0)->present),
asn_MAP_PDU_1_tag2el,
9
, /* Count of tags in the map */
10
, /* Count of tags in the map */
1 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_PDU = {
...
...
@@ -159,7 +170,7 @@ asn_TYPE_descriptor_t asn_DEF_PDU = {
0, /* No tags (pointer) */
0, /* No tags (count) */
asn_MBR_PDU_1,
9
, /* Elements count */
10
, /* Elements count */
&asn_SPC_PDU_1_specs /* Additional specs */
};
...
...
@@ -231,10 +242,10 @@ static ber_tlv_tag_t asn_DEF_Sequence_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_Sequence_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* integer at 3
2
*/
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sequence at 3
3
*/
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* bits at 3
4
*/
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* string at 3
5
*/
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* integer at 3
3
*/
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sequence at 3
4
*/
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* bits at 3
5
*/
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* string at 3
6
*/
};
static asn_SEQUENCE_specifics_t asn_SPC_Sequence_1_specs = {
sizeof(struct Sequence),
...
...
@@ -324,8 +335,8 @@ static ber_tlv_tag_t asn_DEF_Set_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_Set_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* roid at
39
*/
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* opaque at 4
0
*/
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* roid at
40
*/
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* opaque at 4
1
*/
};
static uint8_t asn_MAP_Set_1_mmap[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = {
(1 << 7) | (0 << 6)
...
...
@@ -543,8 +554,8 @@ static ber_tlv_tag_t asn_DEF_ExtensibleSet_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_ExtensibleSet_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string at 4
4
*/
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* enum at 4
6
*/
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string at 4
5
*/
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* enum at 4
7
*/
};
static uint8_t asn_MAP_ExtensibleSet_1_mmap[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = {
(0 << 7) | (0 << 6)
...
...
@@ -587,6 +598,7 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleSet = {
#include <UTF8String.h>
#include <INTEGER.h>
#include <GeneralizedTime.h>
#include <constr_SEQUENCE.h>
/*** <<< TYPE-DECLS [ExtensibleSequence] >>> ***/
...
...
@@ -598,6 +610,7 @@ typedef struct ExtensibleSequence {
* possible extensions are below.
*/
INTEGER_t *integer /* OPTIONAL */;
GeneralizedTime_t *gtime;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
...
...
@@ -610,35 +623,43 @@ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence;
/*** <<< STAT-DEFS [ExtensibleSequence] >>> ***/
static asn_TYPE_member_t asn_MBR_ExtensibleSequence_1[] = {
{ ATF_POINTER,
2
, offsetof(struct ExtensibleSequence, string),
{ ATF_POINTER,
3
, offsetof(struct ExtensibleSequence, string),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_UTF8String,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "string"
},
{ ATF_POINTER,
1
, offsetof(struct ExtensibleSequence, integer),
{ ATF_POINTER,
2
, offsetof(struct ExtensibleSequence, integer),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_INTEGER,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "integer"
},
{ ATF_POINTER, 0, offsetof(struct ExtensibleSequence, gtime),
.tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_GeneralizedTime,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "gtime"
},
};
static ber_tlv_tag_t asn_DEF_ExtensibleSequence_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_ExtensibleSequence_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string at 50 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* integer at 52 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string at 51 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* integer at 53 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gtime at 54 */
};
static asn_SEQUENCE_specifics_t asn_SPC_ExtensibleSequence_1_specs = {
sizeof(struct ExtensibleSequence),
offsetof(struct ExtensibleSequence, _asn_ctx),
asn_MAP_ExtensibleSequence_1_tag2el,
2
, /* Count of tags in the map */
3
, /* Count of tags in the map */
0, /* Start extensions */
3
/* Stop extensions */
4
/* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence = {
"ExtensibleSequence",
...
...
@@ -658,11 +679,91 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence = {
sizeof(asn_DEF_ExtensibleSequence_1_tags)
/sizeof(asn_DEF_ExtensibleSequence_1_tags[0]), /* 1 */
asn_MBR_ExtensibleSequence_1,
2
, /* Elements count */
3
, /* Elements count */
&asn_SPC_ExtensibleSequence_1_specs /* Additional specs */
};
/*** <<< INCLUDES [ExtensibleSequence2] >>> ***/
#include <UTF8String.h>
#include <INTEGER.h>
#include <constr_SEQUENCE.h>
/*** <<< TYPE-DECLS [ExtensibleSequence2] >>> ***/
typedef struct ExtensibleSequence2 {
UTF8String_t *string /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
INTEGER_t *integer /* OPTIONAL */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ExtensibleSequence2_t;
/*** <<< FUNC-DECLS [ExtensibleSequence2] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence2;
/*** <<< STAT-DEFS [ExtensibleSequence2] >>> ***/
static asn_TYPE_member_t asn_MBR_ExtensibleSequence2_1[] = {
{ ATF_POINTER, 2, offsetof(struct ExtensibleSequence2, string),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_UTF8String,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "string"
},
{ ATF_POINTER, 1, offsetof(struct ExtensibleSequence2, integer),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_INTEGER,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "integer"
},
};
static ber_tlv_tag_t asn_DEF_ExtensibleSequence2_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_ExtensibleSequence2_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string at 58 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* integer at 60 */
};
static asn_SEQUENCE_specifics_t asn_SPC_ExtensibleSequence2_1_specs = {
sizeof(struct ExtensibleSequence2),
offsetof(struct ExtensibleSequence2, _asn_ctx),
asn_MAP_ExtensibleSequence2_1_tag2el,
2, /* Count of tags in the map */
0, /* Start extensions */
3 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence2 = {
"ExtensibleSequence2",
"ExtensibleSequence2",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_ExtensibleSequence2_1_tags,
sizeof(asn_DEF_ExtensibleSequence2_1_tags)
/sizeof(asn_DEF_ExtensibleSequence2_1_tags[0]), /* 1 */
asn_DEF_ExtensibleSequence2_1_tags, /* Same as above */
sizeof(asn_DEF_ExtensibleSequence2_1_tags)
/sizeof(asn_DEF_ExtensibleSequence2_1_tags[0]), /* 1 */
asn_MBR_ExtensibleSequence2_1,
2, /* Elements count */
&asn_SPC_ExtensibleSequence2_1_specs /* Additional specs */
};
/*** <<< INCLUDES [SetOf] >>> ***/
#include <REAL.h>
...
...
tests/84-param-tags-OK.asn1
0 → 100644
View file @
15750405
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .84 1
-- .84 2
ModuleTestParametrizationTags1
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 84 1 }
DEFINITIONS ::=
BEGIN
TestType {Parameter} ::= SEQUENCE {
common Parameter DEFAULT 0
}
TestChoice ::= CHOICE {
type1 TestType {INTEGER (1..10)},
type2 [0] IMPLICIT TestType {BOOLEAN}
}
END
ModuleTestParametrizationTagsAuto2
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 84 2 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
AutoType {Parameter} ::= SEQUENCE {
common Parameter (0)
}
AutoChoice ::= CHOICE {
type1 AutoType {INTEGER (0..1)},
type2 AutoType {BOOLEAN}
}
END
tests/84-param-tags-OK.asn1.-EF
0 → 100644
View file @
15750405
ModuleTestParametrizationTags1 { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 84 1 }
DEFINITIONS ::=
BEGIN
TestType{Parameter} ::= SEQUENCE {
common Parameter DEFAULT 0
}
TestChoice ::= CHOICE {
type1 SEQUENCE {
common INTEGER (1..10) DEFAULT 0
},
type2 [0] IMPLICIT SEQUENCE {
common BOOLEAN DEFAULT 0
}
}
END
ModuleTestParametrizationTagsAuto2 { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 84 2 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
AutoType{Parameter} ::= SEQUENCE {
common Parameter (0)
}
AutoChoice ::= CHOICE {
type1 [0] IMPLICIT SEQUENCE {
common [0] IMPLICIT INTEGER ((0..1))((0))
},
type2 [1] IMPLICIT SEQUENCE {
common [0] IMPLICIT BOOLEAN (0)
}
}
END
tests/84-param-tags-OK.asn1.-P
0 → 100644
View file @
15750405
/*** <<< INCLUDES [TestChoice] >>> ***/
#include <INTEGER.h>
#include <constr_SEQUENCE.h>
#include <BOOLEAN.h>
#include <constr_CHOICE.h>
/*** <<< DEPS [TestChoice] >>> ***/
typedef enum TestChoice_PR {
TestChoice_PR_NOTHING, /* No components present */
TestChoice_PR_type1,
TestChoice_PR_type2,
} TestChoice_PR;
/*** <<< TYPE-DECLS [TestChoice] >>> ***/
typedef struct TestChoice {
TestChoice_PR present;
union {
struct type1 {
INTEGER_t *common /* DEFAULT 0 */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} type1;
struct type2 {
BOOLEAN_t *common /* DEFAULT 0 */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} type2;
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} TestChoice_t;
/*** <<< FUNC-DECLS [TestChoice] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_TestChoice;
/*** <<< CODE [TestChoice] >>> ***/
static int
memb_common_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const INTEGER_t *st = (const INTEGER_t *)sptr;
long value;
if(!sptr) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(asn_INTEGER2long(st, &value)) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: value too large (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if((value >= 1 && value <= 10)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_ERRLOG(app_errlog, app_key,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*** <<< STAT-DEFS [TestChoice] >>> ***/
static asn_TYPE_member_t asn_MBR_type1_2[] = {
{ ATF_POINTER, 1, offsetof(struct type1, common),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
.tag_mode = 0,
.type = (void *)&asn_DEF_INTEGER,
.memb_constraints = memb_common_2_constraint,
.name = "common"
},
};
static ber_tlv_tag_t asn_DEF_type1_2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_type1_2_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* common at 20 */
};
static asn_SEQUENCE_specifics_t asn_SPC_type1_2_specs = {
sizeof(struct type1),
offsetof(struct type1, _asn_ctx),
asn_MAP_type1_2_tag2el,
1, /* Count of tags in the map */
-1, /* Start extensions */
-1 /* Stop extensions */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_type1_2 = {
"type1",
"type1",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_type1_2_tags,
sizeof(asn_DEF_type1_2_tags)
/sizeof(asn_DEF_type1_2_tags[0]), /* 1 */
asn_DEF_type1_2_tags, /* Same as above */
sizeof(asn_DEF_type1_2_tags)
/sizeof(asn_DEF_type1_2_tags[0]), /* 1 */
asn_MBR_type1_2,
1, /* Elements count */
&asn_SPC_type1_2_specs /* Additional specs */
};
static asn_TYPE_member_t asn_MBR_type2_4[] = {
{ ATF_POINTER, 1, offsetof(struct type2, common),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
.tag_mode = 0,
.type = (void *)&asn_DEF_BOOLEAN,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "common"
},
};
static ber_tlv_tag_t asn_DEF_type2_4_tags[] = {
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_type2_4_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 0, 0, 0 } /* common at 21 */
};
static asn_SEQUENCE_specifics_t asn_SPC_type2_4_specs = {
sizeof(struct type2),
offsetof(struct type2, _asn_ctx),
asn_MAP_type2_4_tag2el,
1, /* Count of tags in the map */
-1, /* Start extensions */
-1 /* Stop extensions */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_type2_4 = {
"type2",
"type2",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_type2_4_tags,
sizeof(asn_DEF_type2_4_tags)
/sizeof(asn_DEF_type2_4_tags[0]) - 1, /* 1 */
asn_DEF_type2_4_tags, /* Same as above */
sizeof(asn_DEF_type2_4_tags)
/sizeof(asn_DEF_type2_4_tags[0]), /* 2 */
asn_MBR_type2_4,
1, /* Elements count */
&asn_SPC_type2_4_specs /* Additional specs */
};
static asn_TYPE_member_t asn_MBR_TestChoice_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type1),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
.tag_mode = 0,
.type = (void *)&asn_DEF_type1_2,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "type1"
},
{ ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type2),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_type2_4,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "type2"
},
};
static asn_TYPE_tag2member_t asn_MAP_TestChoice_1_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* type1 at 16 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* type2 at 16 */
};
static asn_CHOICE_specifics_t asn_SPC_TestChoice_1_specs = {
sizeof(struct TestChoice),
offsetof(struct TestChoice, _asn_ctx),
offsetof(struct TestChoice, present),
sizeof(((struct TestChoice *)0)->present),
asn_MAP_TestChoice_1_tag2el,
2, /* Count of tags in the map */
0 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_TestChoice = {
"TestChoice",
"TestChoice",
CHOICE_free,
CHOICE_print,
CHOICE_constraint,
CHOICE_decode_ber,
CHOICE_encode_der,
CHOICE_decode_xer,
CHOICE_encode_xer,
CHOICE_outmost_tag,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
asn_MBR_TestChoice_1,
2, /* Elements count */
&asn_SPC_TestChoice_1_specs /* Additional specs */
};
/*** <<< INCLUDES [AutoChoice] >>> ***/
#include <INTEGER.h>
#include <constr_SEQUENCE.h>
#include <BOOLEAN.h>
#include <constr_CHOICE.h>
/*** <<< DEPS [AutoChoice] >>> ***/
typedef enum AutoChoice_PR {
AutoChoice_PR_NOTHING, /* No components present */
AutoChoice_PR_type1,
AutoChoice_PR_type2,
} AutoChoice_PR;
/*** <<< TYPE-DECLS [AutoChoice] >>> ***/
typedef struct AutoChoice {
AutoChoice_PR present;
union {
struct type1 {
INTEGER_t common;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} type1;
struct type2 {
BOOLEAN_t common;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} type2;
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} AutoChoice_t;
/*** <<< FUNC-DECLS [AutoChoice] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_AutoChoice;
/*** <<< CODE [AutoChoice] >>> ***/
static int
memb_common_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const INTEGER_t *st = (const INTEGER_t *)sptr;
long value;
if(!sptr) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(asn_INTEGER2long(st, &value)) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: value too large (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if((value == 0)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_ERRLOG(app_errlog, app_key,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_common_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
BOOLEAN_t value;
if(!sptr) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
value = (*(const long *)sptr) ? 1 : 0;
if((value <= 0)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_ERRLOG(app_errlog, app_key,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*** <<< STAT-DEFS [AutoChoice] >>> ***/
static asn_TYPE_member_t asn_MBR_type1_2[] = {
{ ATF_NOFLAGS, 0, offsetof(struct type1, common),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_INTEGER,
.memb_constraints = memb_common_2_constraint,
.name = "common"
},
};
static ber_tlv_tag_t asn_DEF_type1_2_tags[] = {
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_type1_2_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* common at 37 */
};
static asn_SEQUENCE_specifics_t asn_SPC_type1_2_specs = {
sizeof(struct type1),
offsetof(struct type1, _asn_ctx),
asn_MAP_type1_2_tag2el,
1, /* Count of tags in the map */
-1, /* Start extensions */
-1 /* Stop extensions */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_type1_2 = {
"type1",
"type1",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_type1_2_tags,
sizeof(asn_DEF_type1_2_tags)
/sizeof(asn_DEF_type1_2_tags[0]) - 1, /* 1 */
asn_DEF_type1_2_tags, /* Same as above */
sizeof(asn_DEF_type1_2_tags)
/sizeof(asn_DEF_type1_2_tags[0]), /* 2 */
asn_MBR_type1_2,
1, /* Elements count */
&asn_SPC_type1_2_specs /* Additional specs */
};
static asn_TYPE_member_t asn_MBR_type2_4[] = {
{ ATF_NOFLAGS, 0, offsetof(struct type2, common),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_BOOLEAN,
.memb_constraints = memb_common_4_constraint,
.name = "common"
},
};
static ber_tlv_tag_t asn_DEF_type2_4_tags[] = {
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_type2_4_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* common at 38 */
};
static asn_SEQUENCE_specifics_t asn_SPC_type2_4_specs = {
sizeof(struct type2),
offsetof(struct type2, _asn_ctx),
asn_MAP_type2_4_tag2el,
1, /* Count of tags in the map */
-1, /* Start extensions */
-1 /* Stop extensions */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_type2_4 = {
"type2",
"type2",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_type2_4_tags,
sizeof(asn_DEF_type2_4_tags)
/sizeof(asn_DEF_type2_4_tags[0]) - 1, /* 1 */
asn_DEF_type2_4_tags, /* Same as above */
sizeof(asn_DEF_type2_4_tags)
/sizeof(asn_DEF_type2_4_tags[0]), /* 2 */
asn_MBR_type2_4,
1, /* Elements count */
&asn_SPC_type2_4_specs /* Additional specs */
};
static asn_TYPE_member_t asn_MBR_AutoChoice_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type1),
.tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_type1_2,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "type1"
},
{ ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type2),
.tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
.tag_mode = -1, /* IMPLICIT tag at current level */
.type = (void *)&asn_DEF_type2_4,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "type2"
},
};
static asn_TYPE_tag2member_t asn_MAP_AutoChoice_1_tag2el[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* type1 at 34 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* type2 at 34 */
};
static asn_CHOICE_specifics_t asn_SPC_AutoChoice_1_specs = {
sizeof(struct AutoChoice),
offsetof(struct AutoChoice, _asn_ctx),
offsetof(struct AutoChoice, present),
sizeof(((struct AutoChoice *)0)->present),
asn_MAP_AutoChoice_1_tag2el,
2, /* Count of tags in the map */
0 /* Whether extensible */
};
asn_TYPE_descriptor_t asn_DEF_AutoChoice = {
"AutoChoice",
"AutoChoice",
CHOICE_free,
CHOICE_print,
CHOICE_constraint,
CHOICE_decode_ber,
CHOICE_encode_der,
CHOICE_decode_xer,
CHOICE_encode_xer,
CHOICE_outmost_tag,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
asn_MBR_AutoChoice_1,
2, /* Elements count */
&asn_SPC_AutoChoice_1_specs /* Additional specs */
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment