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
fe7f6ecd
Commit
fe7f6ecd
authored
Mar 04, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
c8285715
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
213 additions
and
10 deletions
+213
-10
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+3
-1
tests/66-ref-simple-OK.asn1.-P
tests/66-ref-simple-OK.asn1.-P
+1
-1
tests/73-circular-OK.asn1
tests/73-circular-OK.asn1
+4
-1
tests/73-circular-OK.asn1.-P
tests/73-circular-OK.asn1.-P
+205
-7
No files found.
libasn1compiler/asn1c_C.c
View file @
fe7f6ecd
...
...
@@ -602,7 +602,9 @@ asn1c_lang_C_type_SEx_OF(arg_t *arg) {
arg
->
embed
--
;
assert
(
arg
->
target
->
target
==
OT_TYPE_DECLS
);
}
else
{
OUT
(
"%s"
,
asn1c_type_name
(
arg
,
memb
,
TNF_RSAFE
));
OUT
(
"%s"
,
asn1c_type_name
(
arg
,
memb
,
(
memb
->
marker
.
flags
&
EM_UNRECURSE
)
?
TNF_RSAFE
:
TNF_CTYPE
));
}
OUT
(
") list;
\n
"
);
INDENT
(
-
1
);
...
...
tests/66-ref-simple-OK.asn1.-P
View file @
fe7f6ecd
...
...
@@ -8,7 +8,7 @@
/*** <<< TYPE-DECLS [T] >>> ***/
typedef struct T {
A_SET_OF(
struct SimpleType
) list;
A_SET_OF(
SimpleType_t
) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
...
...
tests/73-circular-OK.asn1
View file @
fe7f6ecd
...
...
@@ -25,7 +25,10 @@ BEGIN
Ypet ::= SET {
epyt Epyt,
plain INTEGER DEFAULT 7
plain INTEGER DEFAULT 7,
senums SET OF EnumType
}
EnumType ::= ENUMERATED { one, two }
END
tests/73-circular-OK.asn1.-P
View file @
fe7f6ecd
...
...
@@ -263,6 +263,9 @@ asn_TYPE_descriptor_t asn_DEF_Epyt = {
#include <Epyt.h>
#include <INTEGER.h>
#include <EnumType.h>
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
#include <constr_SET.h>
/*** <<< DEPS [Ypet] >>> ***/
...
...
@@ -274,6 +277,7 @@ asn_TYPE_descriptor_t asn_DEF_Epyt = {
typedef enum Ypet_PR {
Ypet_PR_epyt, /* Member epyt is present */
Ypet_PR_plain, /* Member plain is present */
Ypet_PR_senums, /* Member senums is present */
} Ypet_PR;
/*** <<< TYPE-DECLS [Ypet] >>> ***/
...
...
@@ -281,10 +285,16 @@ typedef enum Ypet_PR {
typedef struct Ypet {
Epyt_t epyt;
INTEGER_t *plain /* DEFAULT 7 */;
struct senums {
A_SET_OF(EnumType_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} senums;
/* Presence bitmask: ASN_SET_ISPRESENT(pYpet, Ypet_PR_x) */
unsigned int _presence_map
[((
2
+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
[((
3
+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
...
...
@@ -296,6 +306,46 @@ extern asn_TYPE_descriptor_t asn_DEF_Ypet;
/*** <<< STAT-DEFS [Ypet] >>> ***/
static asn_TYPE_member_t asn_MBR_senums_2[] = {
{ ATF_NOFLAGS, 0, 0,
.tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
.tag_mode = 0,
.type = (void *)&asn_DEF_EnumType,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = ""
},
};
static ber_tlv_tag_t asn_DEF_senums_2_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_SET_OF_specifics_t asn_SPC_senums_2_specs = {
sizeof(struct senums),
offsetof(struct senums, _asn_ctx),
1, /* XER encoding is XMLValueList */
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_senums_2 = {
"senums",
"senums",
SET_OF_free,
SET_OF_print,
SET_OF_constraint,
SET_OF_decode_ber,
SET_OF_encode_der,
SET_OF_decode_xer,
SET_OF_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_senums_2_tags,
sizeof(asn_DEF_senums_2_tags)
/sizeof(asn_DEF_senums_2_tags[0]), /* 1 */
asn_DEF_senums_2_tags, /* Same as above */
sizeof(asn_DEF_senums_2_tags)
/sizeof(asn_DEF_senums_2_tags[0]), /* 1 */
asn_MBR_senums_2,
1, /* Single element */
&asn_SPC_senums_2_specs /* Additional specs */
};
static asn_TYPE_member_t asn_MBR_Ypet_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Ypet, epyt),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
...
...
@@ -311,25 +361,33 @@ static asn_TYPE_member_t asn_MBR_Ypet_1[] = {
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "plain"
},
{ ATF_NOFLAGS, 0, offsetof(struct Ypet, senums),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
.tag_mode = 0,
.type = (void *)&asn_DEF_senums_2,
.memb_constraints = 0, /* Defer constraints checking to the member type */
.name = "senums"
},
};
static ber_tlv_tag_t asn_DEF_Ypet_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_Ypet_1_tag2el[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* plain at 28 */
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* epyt at 27 */
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* epyt at 27 */
{ (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 } /* senums at 30 */
};
static uint8_t asn_MAP_Ypet_1_mmap[(
2
+ (8 * sizeof(unsigned int)) - 1) / 8] = {
(1 << 7) | (0 << 6)
static uint8_t asn_MAP_Ypet_1_mmap[(
3
+ (8 * sizeof(unsigned int)) - 1) / 8] = {
(1 << 7) | (0 << 6)
| (1 << 5)
};
static asn_SET_specifics_t asn_SPC_Ypet_1_specs = {
sizeof(struct Ypet),
offsetof(struct Ypet, _asn_ctx),
offsetof(struct Ypet, _presence_map),
asn_MAP_Ypet_1_tag2el,
2
, /* Count of tags in the map */
3
, /* Count of tags in the map */
asn_MAP_Ypet_1_tag2el, /* Same as above */
2
, /* Count of tags in the CXER map */
3
, /* Count of tags in the CXER map */
0, /* Whether extensible */
(unsigned int *)asn_MAP_Ypet_1_mmap /* Mandatory elements map */
};
...
...
@@ -351,7 +409,147 @@ asn_TYPE_descriptor_t asn_DEF_Ypet = {
sizeof(asn_DEF_Ypet_1_tags)
/sizeof(asn_DEF_Ypet_1_tags[0]), /* 1 */
asn_MBR_Ypet_1,
2
, /* Elements count */
3
, /* Elements count */
&asn_SPC_Ypet_1_specs /* Additional specs */
};
/*** <<< INCLUDES [EnumType] >>> ***/
#include <ENUMERATED.h>
/*** <<< DEPS [EnumType] >>> ***/
typedef enum EnumType {
EnumType_one = 0,
EnumType_two = 1
} EnumType_e;
/*** <<< TYPE-DECLS [EnumType] >>> ***/
typedef ENUMERATED_t EnumType_t;
/*** <<< FUNC-DECLS [EnumType] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_EnumType;
asn_struct_free_f EnumType_free;
asn_struct_print_f EnumType_print;
asn_constr_check_f EnumType_constraint;
ber_type_decoder_f EnumType_decode_ber;
der_type_encoder_f EnumType_encode_der;
xer_type_decoder_f EnumType_decode_xer;
xer_type_encoder_f EnumType_encode_xer;
/*** <<< CODE [EnumType] >>> ***/
int
EnumType_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
/* Replace with underlying type checker */
td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
return td->check_constraints(td, sptr, app_errlog, app_key);
}
/*
* This type is implemented using ENUMERATED,
* so here we adjust the DEF accordingly.
*/
static void
EnumType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_ENUMERATED.free_struct;
td->print_struct = asn_DEF_ENUMERATED.print_struct;
td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
td->elements = asn_DEF_ENUMERATED.elements;
td->elements_count = asn_DEF_ENUMERATED.elements_count;
/* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
}
void
EnumType_free(asn_TYPE_descriptor_t *td,
void *struct_ptr, int contents_only) {
EnumType_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only);
}
int
EnumType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
EnumType_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
asn_dec_rval_t
EnumType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
EnumType_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}
asn_enc_rval_t
EnumType_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
EnumType_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}
asn_dec_rval_t
EnumType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const char *opt_mname, void *bufptr, size_t size) {
EnumType_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}
asn_enc_rval_t
EnumType_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) {
EnumType_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}
/*** <<< STAT-DEFS [EnumType] >>> ***/
static asn_INTEGER_enum_map_t asn_MAP_EnumType_1_value2enum[] = {
{ 0, 3, "one" },
{ 1, 3, "two" }
};
static unsigned int asn_MAP_EnumType_1_enum2value[] = {
0, /* one(0) */
1 /* two(1) */
};
static asn_INTEGER_specifics_t asn_SPC_EnumType_1_specs = {
asn_MAP_EnumType_1_value2enum, /* "tag" => N; sorted by tag */
asn_MAP_EnumType_1_enum2value, /* N => "tag"; sorted by N */
2, /* Number of elements in the maps */
0, /* Enumeration is not extensible */
1 /* Strict enumeration */
};
static ber_tlv_tag_t asn_DEF_EnumType_1_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_EnumType = {
"EnumType",
"EnumType",
EnumType_free,
EnumType_print,
EnumType_constraint,
EnumType_decode_ber,
EnumType_encode_der,
EnumType_decode_xer,
EnumType_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_EnumType_1_tags,
sizeof(asn_DEF_EnumType_1_tags)
/sizeof(asn_DEF_EnumType_1_tags[0]), /* 1 */
asn_DEF_EnumType_1_tags, /* Same as above */
sizeof(asn_DEF_EnumType_1_tags)
/sizeof(asn_DEF_EnumType_1_tags[0]), /* 1 */
0, 0, /* Defined elsewhere */
&asn_SPC_EnumType_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