Commit d357f3d5 authored by Lev Walkin's avatar Lev Walkin

fix ioc value encoding

parent 83d8b2f2
...@@ -132,8 +132,8 @@ emit_ioc_value(arg_t *arg, struct asn1p_ioc_cell_s *cell) { ...@@ -132,8 +132,8 @@ emit_ioc_value(arg_t *arg, struct asn1p_ioc_cell_s *cell) {
return -1; return -1;
} }
} }
OUT("static const %s asn_VAL_%s_%d = ", prim_type, MKID(cell->value), OUT("static const %s asn_VAL_%d_%s = ", prim_type,
cell->value->_type_unique_index); cell->value->_type_unique_index, MKID(cell->value));
asn1p_expr_t *expr_value = cell->value; asn1p_expr_t *expr_value = cell->value;
while(expr_value->value->type == ATV_REFERENCED) { while(expr_value->value->type == ATV_REFERENCED) {
...@@ -198,8 +198,8 @@ emit_ioc_cell(arg_t *arg, struct asn1p_ioc_cell_s *cell) { ...@@ -198,8 +198,8 @@ emit_ioc_cell(arg_t *arg, struct asn1p_ioc_cell_s *cell) {
GEN_INCLUDE(asn1c_type_name(arg, cell->value, TNF_INCLUDE)); GEN_INCLUDE(asn1c_type_name(arg, cell->value, TNF_INCLUDE));
OUT("aioc__value, "); OUT("aioc__value, ");
OUT("&asn_DEF_%s, ", asn1c_type_name(arg, cell->value, TNF_SAFE)); OUT("&asn_DEF_%s, ", asn1c_type_name(arg, cell->value, TNF_SAFE));
OUT("&asn_VAL_%s_%d", MKID(cell->value), OUT("&asn_VAL_%d_%s", cell->value->_type_unique_index,
cell->value->_type_unique_index); MKID(cell->value));
} else if(cell->value->meta_type == AMT_TYPEREF) { } else if(cell->value->meta_type == AMT_TYPEREF) {
GEN_INCLUDE(asn1c_type_name(arg, cell->value, TNF_INCLUDE)); GEN_INCLUDE(asn1c_type_name(arg, cell->value, TNF_INCLUDE));
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
static int _asn1f_parse_class_object_data(arg_t *, asn1p_expr_t *eclass, static int _asn1f_parse_class_object_data(arg_t *, asn1p_expr_t *eclass,
struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax, struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax,
const uint8_t *buf, const uint8_t *bend, const uint8_t *buf, const uint8_t *bend,
int optional_mode, const uint8_t **newpos); int optional_mode, const uint8_t **newpos, int counter);
static int _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, const uint8_t *buf, const uint8_t *bend); static int _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, const uint8_t *buf, const uint8_t *bend, int counter);
static asn1p_wsyntx_chunk_t *asn1f_next_literal_chunk(asn1p_wsyntx_t *syntax, asn1p_wsyntx_chunk_t *chunk, const uint8_t *buf); static asn1p_wsyntx_chunk_t *asn1f_next_literal_chunk(asn1p_wsyntx_t *syntax, asn1p_wsyntx_chunk_t *chunk, const uint8_t *buf);
int int
...@@ -43,7 +43,7 @@ asn1f_check_class_object(arg_t *arg) { ...@@ -43,7 +43,7 @@ asn1f_check_class_object(arg_t *arg) {
expr->value->value.string.buf + 1, expr->value->value.string.buf + 1,
expr->value->value.string.buf expr->value->value.string.buf
+ expr->value->value.string.size - 1, + expr->value->value.string.size - 1,
0, 0); 0, 0, 0);
asn1p_ioc_row_delete(row); asn1p_ioc_row_delete(row);
...@@ -74,6 +74,7 @@ struct parse_object_key { ...@@ -74,6 +74,7 @@ struct parse_object_key {
arg_t *arg; arg_t *arg;
asn1p_expr_t *expr; /* InformationObjectSet */ asn1p_expr_t *expr; /* InformationObjectSet */
asn1p_expr_t *eclass; /* CLASS */ asn1p_expr_t *eclass; /* CLASS */
int sequence; /* Sequence counter */
}; };
/* /*
...@@ -120,11 +121,13 @@ _asn1f_parse_object_cb(const uint8_t *buf, size_t size, void *keyp) { ...@@ -120,11 +121,13 @@ _asn1f_parse_object_cb(const uint8_t *buf, size_t size, void *keyp) {
asn1p_ioc_row_t *row; asn1p_ioc_row_t *row;
int ret; int ret;
key->sequence++;
row = asn1p_ioc_row_new(eclass); row = asn1p_ioc_row_new(eclass);
assert(row); assert(row);
ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax, ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax,
buf, buf + size, 0, 0); buf, buf + size, 0, 0, key->sequence);
if(ret) { if(ret) {
LOG((int)(ret < 0), LOG((int)(ret < 0),
"Cannot parse %s of CLASS %s found at line %d", "Cannot parse %s of CLASS %s found at line %d",
...@@ -143,7 +146,7 @@ _asn1f_parse_object_cb(const uint8_t *buf, size_t size, void *keyp) { ...@@ -143,7 +146,7 @@ _asn1f_parse_object_cb(const uint8_t *buf, size_t size, void *keyp) {
row = asn1p_ioc_row_new(eclass); row = asn1p_ioc_row_new(eclass);
assert(row); assert(row);
ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax, ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax,
buf, buf + size, 0, 0); buf, buf + size, 0, 0, key->sequence);
assert(ret == 0); assert(ret == 0);
if(_asn1f_add_unique_row(arg, expr, row) != 0) if(_asn1f_add_unique_row(arg, expr, row) != 0)
...@@ -261,6 +264,7 @@ asn1f_parse_class_object(arg_t *arg) { ...@@ -261,6 +264,7 @@ asn1f_parse_class_object(arg_t *arg) {
.arg = arg, .arg = arg,
.expr = expr, .expr = expr,
.eclass = eclass, .eclass = eclass,
.sequence = 0
}; };
switch(source) { switch(source) {
...@@ -288,7 +292,7 @@ static int ...@@ -288,7 +292,7 @@ static int
_asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass,
struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax, struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax,
const uint8_t *buf, const uint8_t *bend, const uint8_t *buf, const uint8_t *bend,
int optional_mode, const uint8_t **newpos) { int optional_mode, const uint8_t **newpos, int counter) {
struct asn1p_wsyntx_chunk_s *chunk; struct asn1p_wsyntx_chunk_s *chunk;
int ret; int ret;
...@@ -342,7 +346,7 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, ...@@ -342,7 +346,7 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass,
DEBUG("Reference %s satisfied by %s (%d)", DEBUG("Reference %s satisfied by %s (%d)",
chunk->content.token, chunk->content.token,
buf, p - buf); buf, p - buf);
ret = _asn1f_assign_cell_value(arg, cell, buf, p); ret = _asn1f_assign_cell_value(arg, cell, buf, p, counter);
if(ret) return ret; if(ret) return ret;
buf = p; buf = p;
if(newpos) *newpos = buf; if(newpos) *newpos = buf;
...@@ -351,7 +355,7 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, ...@@ -351,7 +355,7 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass,
const uint8_t *np = 0; const uint8_t *np = 0;
SKIPSPACES; SKIPSPACES;
ret = _asn1f_parse_class_object_data(arg, eclass, row, ret = _asn1f_parse_class_object_data(arg, eclass, row,
chunk->content.syntax, buf, bend, 1, &np); chunk->content.syntax, buf, bend, 1, &np, counter);
if(newpos) *newpos = np; if(newpos) *newpos = np;
if(ret && np != buf) if(ret && np != buf)
return ret; return ret;
...@@ -368,9 +372,9 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, ...@@ -368,9 +372,9 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass,
static int static int
_asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
const uint8_t *buf, const uint8_t *bend) { const uint8_t *buf, const uint8_t *bend, int counter) {
asn1p_expr_t *expr = (asn1p_expr_t *)NULL; asn1p_expr_t *expr = (asn1p_expr_t *)NULL;
char *p; char *mivr; /* Most Immediate Value Representation */
int new_ref = 1; int new_ref = 1;
asn1p_t *asn; asn1p_t *asn;
asn1p_module_t *mod; asn1p_module_t *mod;
...@@ -385,19 +389,19 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, ...@@ -385,19 +389,19 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
return -1; return -1;
} }
p = malloc(bend - buf + 1); mivr = malloc(bend - buf + 1);
assert(p); assert(mivr);
memcpy(p, buf, bend - buf); memcpy(mivr, buf, bend - buf);
p[bend - buf] = '\0'; mivr[bend - buf] = '\0';
/* remove trailing space */ /* remove trailing space */
for (i = bend - buf - 1; (i > 0) && isspace(p[i]); i--) for (i = bend - buf - 1; (i > 0) && isspace(mivr[i]); i--)
p[i] = '\0'; mivr[i] = '\0';
/* This value 100 should be larger than following formatting string */ /* This value 100 should be larger than following formatting string */
psize = bend - buf + 100; psize = bend - buf + 100;
pp = malloc(psize); pp = malloc(psize);
if(pp == NULL) { if(pp == NULL) {
free(p); free(mivr);
return -1; return -1;
} }
...@@ -406,7 +410,7 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, ...@@ -406,7 +410,7 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
"M DEFINITIONS ::=\nBEGIN\n" "M DEFINITIONS ::=\nBEGIN\n"
"V ::= %s\n" "V ::= %s\n"
"END\n", "END\n",
p mivr
); );
} else if(cell->field->expr_type == A1TC_CLASSFIELD_FTVFS) { } else if(cell->field->expr_type == A1TC_CLASSFIELD_FTVFS) {
type_expr = TQ_FIRST(&(cell->field->members)); type_expr = TQ_FIRST(&(cell->field->members));
...@@ -417,11 +421,11 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, ...@@ -417,11 +421,11 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
type_expr->reference ? type_expr->reference ?
type_expr->reference->components[0].name : type_expr->reference->components[0].name :
_asn1p_expr_type2string(type_expr->expr_type), _asn1p_expr_type2string(type_expr->expr_type),
p mivr
); );
} else { } else {
WARNING("asn1c only be able to parse TypeFieldSpec and FixedTypeValueFieldSpec. Failed when parsing %s at line %d\n", p, arg->expr->_lineno); WARNING("asn1c only be able to parse TypeFieldSpec and FixedTypeValueFieldSpec. Failed when parsing %s at line %d\n", mivr, arg->expr->_lineno);
free(p); free(mivr);
free(pp); free(pp);
return -1; return -1;
} }
...@@ -435,10 +439,10 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, ...@@ -435,10 +439,10 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
if(asn == NULL) { if(asn == NULL) {
FATAL("Cannot parse Setting token %s " FATAL("Cannot parse Setting token %s "
"at line %d", "at line %d",
p, mivr,
arg->expr->_lineno arg->expr->_lineno
); );
free(p); free(mivr);
return -1; return -1;
} else { } else {
mod = TQ_FIRST(&(asn->modules)); mod = TQ_FIRST(&(asn->modules));
...@@ -446,13 +450,19 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, ...@@ -446,13 +450,19 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
expr = TQ_REMOVE(&(mod->members), next); expr = TQ_REMOVE(&(mod->members), next);
assert(expr); assert(expr);
free(expr->Identifier);
expr->parent_expr = NULL; expr->parent_expr = NULL;
asn1p_expr_set_source(expr, arg->expr->module, arg->expr->_lineno); asn1p_expr_set_source(expr, arg->expr->module, arg->expr->_lineno);
if (expr->reference) { expr->_type_unique_index = counter;
DEBUG("Parsed identifier %s, mivr [%s], reference [%s] value [%s]",
expr->Identifier, mivr, asn1p_ref_string(expr->reference),
asn1f_printable_value(expr->value));
free(expr->Identifier);
if(expr->value) {
expr->Identifier = strdup(asn1f_printable_value(expr->value));
} else if (expr->reference) {
expr->Identifier = strdup(expr->reference->components[expr->reference->comp_count - 1].name); expr->Identifier = strdup(expr->reference->components[expr->reference->comp_count - 1].name);
} else { } else {
expr->Identifier = p; expr->Identifier = mivr;
} }
asn1p_delete(asn); asn1p_delete(asn);
} }
...@@ -467,21 +477,21 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell, ...@@ -467,21 +477,21 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_cell_s *cell,
expr->reference = 0; expr->reference = 0;
asn1p_expr_free(expr); asn1p_expr_free(expr);
FATAL("Cannot find %s referenced by %s at line %d", FATAL("Cannot find %s referenced by %s at line %d",
p, arg->expr->Identifier, mivr, arg->expr->Identifier,
arg->expr->_lineno); arg->expr->_lineno);
free(p); /* freeing must happen *after* p was used in FATAL() */ free(mivr);
return -1; return -1;
} }
} }
DEBUG("Field %s assignment of %s got %s", DEBUG("Field %s assignment of %s got %s",
cell->field->Identifier, p, expr->Identifier); cell->field->Identifier, mivr, expr->Identifier);
cell->value = expr; cell->value = expr;
cell->new_ref = new_ref; cell->new_ref = new_ref;
if(expr->Identifier != p) { if(expr->Identifier != mivr) {
free(p); free(mivr);
} }
return 0; return 0;
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<!-- ASN.1 module <!-- ASN.1 module
ModuleBitStringConstraint { iso org(3) dod(6) internet(1) private(4) ModuleBitStringConstraint { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 125 } enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 125 }
found in ../tests/125-bitstring-constraint-OK.asn1 --> found in ../../tests/tests-asn1c-compiler/125-bitstring-constraint-OK.asn1 -->
<!ELEMENT T (flag1?, flag2?, flag3?)> <!ELEMENT T (flag1?, flag2?, flag3?)>
...@@ -28,12 +28,12 @@ extern asn_TYPE_descriptor_t asn_DEF_Frame; ...@@ -28,12 +28,12 @@ extern asn_TYPE_descriptor_t asn_DEF_Frame;
/*** <<< IOC-TABLES [Frame] >>> ***/ /*** <<< IOC-TABLES [Frame] >>> ***/
static const long asn_VAL_basicMessage_0 = 1; static const long asn_VAL_1_basicMessage = 1;
static const long asn_VAL_2_0 = 2; static const long asn_VAL_2_2 = 2;
static const asn_ioc_cell_t asn_IOS_FrameTypes_1_rows[] = { static const asn_ioc_cell_t asn_IOS_FrameTypes_1_rows[] = {
{ "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_basicMessage_0 }, { "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_1_basicMessage },
{ "&Type", aioc__type, &asn_DEF_PrimitiveMessage }, { "&Type", aioc__type, &asn_DEF_PrimitiveMessage },
{ "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_2_0 }, { "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_2_2 },
{ "&Type", aioc__type, &asn_DEF_ComplexMessage } { "&Type", aioc__type, &asn_DEF_ComplexMessage }
}; };
static asn_ioc_set_t asn_IOS_FrameTypes_1[] = { static asn_ioc_set_t asn_IOS_FrameTypes_1[] = {
......
...@@ -13,7 +13,7 @@ BEGIN ...@@ -13,7 +13,7 @@ BEGIN
Frame ::= SEQUENCE { Frame ::= SEQUENCE {
ident FRAME-STRUCTURE.&id({FrameTypes}), ident FRAME-STRUCTURE.&id({FrameTypes}),
value FRAME-STRUCTURE.&Type({FrameTypes}{@.ident}), value FRAME-STRUCTURE.&Type({FrameTypes}{@ident}),
... ...
} }
......
...@@ -5,7 +5,7 @@ BEGIN ...@@ -5,7 +5,7 @@ BEGIN
Frame ::= SEQUENCE { Frame ::= SEQUENCE {
ident FRAME-STRUCTURE.&id ({FrameTypes}), ident FRAME-STRUCTURE.&id ({FrameTypes}),
value FRAME-STRUCTURE.&Type ({FrameTypes}{@.ident}), value FRAME-STRUCTURE.&Type ({FrameTypes}{@ident}),
... ...
} }
......
...@@ -28,12 +28,12 @@ extern asn_TYPE_descriptor_t asn_DEF_Frame; ...@@ -28,12 +28,12 @@ extern asn_TYPE_descriptor_t asn_DEF_Frame;
/*** <<< IOC-TABLES [Frame] >>> ***/ /*** <<< IOC-TABLES [Frame] >>> ***/
static const long asn_VAL_basicMessage_0 = 1; static const long asn_VAL_1_basicMessage = 1;
static const long asn_VAL_2_0 = 2; static const long asn_VAL_2_2 = 2;
static const asn_ioc_cell_t asn_IOS_FrameTypes_1_rows[] = { static const asn_ioc_cell_t asn_IOS_FrameTypes_1_rows[] = {
{ "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_basicMessage_0 }, { "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_1_basicMessage },
{ "&Type", aioc__type, &asn_DEF_PrimitiveMessage }, { "&Type", aioc__type, &asn_DEF_PrimitiveMessage },
{ "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_2_0 }, { "&id", aioc__value, &asn_DEF_NativeInteger, &asn_VAL_2_2 },
{ "&Type", aioc__type, &asn_DEF_ComplexMessage } { "&Type", aioc__type, &asn_DEF_ComplexMessage }
}; };
static asn_ioc_set_t asn_IOS_FrameTypes_1[] = { static asn_ioc_set_t asn_IOS_FrameTypes_1[] = {
......

-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .141
ModuleComponentRelationConstraint
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 141 }
DEFINITIONS ::=
BEGIN
Frame ::= SEQUENCE {
ident FRAME-STRUCTURE.&id({FrameTypes}),
value FRAME-STRUCTURE.&Type({FrameTypes}{@.ident}),
...
}
FRAME-STRUCTURE ::= CLASS {
&id ConstrainedInteger UNIQUE,
&Type
} WITH SYNTAX {&Type IDENTIFIED BY &id}
ConstrainedInteger ::= INTEGER (0..32767)
FrameTypes FRAME-STRUCTURE ::= {
{ PrimitiveMessage IDENTIFIED BY primMessage } |
{ ComplexMessage IDENTIFIED BY cplxMessage }
, ... }
PrimitiveMessage ::= SEQUENCE {}
ComplexMessage ::= SEQUENCE {}
primMessage INTEGER ::= 1
cplxMessage INTEGER ::= 2
END
ModuleComponentRelationConstraint { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 141 }
DEFINITIONS ::=
BEGIN
Frame ::= SEQUENCE {
ident FRAME-STRUCTURE.&id ({FrameTypes}),
value FRAME-STRUCTURE.&Type ({FrameTypes}{@.ident}),
...
}
FRAME-STRUCTURE ::= CLASS {
&id ConstrainedInteger UNIQUE,
&Type ANY
} WITH SYNTAX {&Type IDENTIFIED BY &id}
-- Information Object Set has 2 entries:
-- [ &id][ &Type]
-- [1] primMessage PrimitiveMessage
-- [2] cplxMessage ComplexMessage
ConstrainedInteger ::= INTEGER (0..32767)
FrameTypes FRAME-STRUCTURE ::= {{ PrimitiveMessage IDENTIFIED BY primMessage } | { ComplexMessage IDENTIFIED BY cplxMessage },...}
-- Information Object Set has 2 entries:
-- [ &id][ &Type]
-- [1] primMessage PrimitiveMessage
-- [2] cplxMessage ComplexMessage
PrimitiveMessage ::= SEQUENCE { }
ComplexMessage ::= SEQUENCE { }
primMessage INTEGER ::= 1
cplxMessage INTEGER ::= 2
END
/*** <<< INCLUDES [Frame] >>> ***/
#include "ConstrainedInteger.h"
#include <ANY.h>
#include <asn_ioc.h>
#include "PrimitiveMessage.h"
#include "ComplexMessage.h"
#include <constr_SEQUENCE.h>
/*** <<< TYPE-DECLS [Frame] >>> ***/
typedef struct Frame {
ConstrainedInteger_t ident;
ANY_t value;
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Frame_t;
/*** <<< FUNC-DECLS [Frame] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_Frame;
/*** <<< IOC-TABLES [Frame] >>> ***/
static const long asn_VAL_1_primMessage = 1;
static const long asn_VAL_2_cplxMessage = 2;
static const asn_ioc_cell_t asn_IOS_FrameTypes_1_rows[] = {
{ "&id", aioc__value, &asn_DEF_ConstrainedInteger, &asn_VAL_1_primMessage },
{ "&Type", aioc__type, &asn_DEF_PrimitiveMessage },
{ "&id", aioc__value, &asn_DEF_ConstrainedInteger, &asn_VAL_2_cplxMessage },
{ "&Type", aioc__type, &asn_DEF_ComplexMessage }
};
static asn_ioc_set_t asn_IOS_FrameTypes_1[] = {
2, 2, asn_IOS_FrameTypes_1_rows
};
/*** <<< CODE [Frame] >>> ***/
static int
memb_ident_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
value = *(const long *)sptr;
if((value >= 0 && value <= 32767)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static asn_TYPE_descriptor_t *
select_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
asn_ioc_set_t *itable = asn_IOS_FrameTypes_1;
size_t constraining_column = 0; /* &id */
size_t for_column = 1; /* &Type */
size_t row;
const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct Frame, ident));
for(row=0; row < itable->rows_count; row++) {
asn_ioc_cell_s *constraining_cell = itable->rows[row * itable->columns_count + constraining_column];
asn_ioc_cell_s *type_cell = itable->rows[row * itable->columns_count + for_column];
if(constraining_cell->type_descriptor->struct_compare(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
return type_cell->type_descriptor;
}
}
return NULL;
}
static int
memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(1 /* No applicable constraints whatsoever */) {
/* Nothing is here. See below */
}
return td->check_constraints(td, sptr, ctfailcb, app_key);
}
/*** <<< STAT-DEFS [Frame] >>> ***/
static asn_TYPE_member_t asn_MBR_Frame_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Frame, ident),
.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
.tag_mode = 0,
.type = &asn_DEF_ConstrainedInteger,
.type_selector = 0,
.memb_constraints = memb_ident_constraint_1,
.oer_constraints = 0, /* OER is not compiled, use -gen-OER */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = 0,
.name = "ident"
},
{ ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
.tag = -1 /* Ambiguous tag (ANY?) */,
.tag_mode = 0,
.type = &asn_DEF_ANY,
.type_selector = select_value_type,
.memb_constraints = memb_value_constraint_1,
.oer_constraints = 0, /* OER is not compiled, use -gen-OER */
.per_constraints = 0, /* PER is not compiled, use -gen-PER */
.default_value = 0,
.name = "value"
},
};
static const ber_tlv_tag_t asn_DEF_Frame_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_Frame_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* ident */
};
static asn_SEQUENCE_specifics_t asn_SPC_Frame_specs_1 = {
sizeof(struct Frame),
offsetof(struct Frame, _asn_ctx),
asn_MAP_Frame_tag2el_1,
1, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
1, /* Start extensions */
3 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Frame = {
"Frame",
"Frame",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_Frame_tags_1,
sizeof(asn_DEF_Frame_tags_1)
/sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
asn_DEF_Frame_tags_1, /* Same as above */
sizeof(asn_DEF_Frame_tags_1)
/sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
asn_MBR_Frame_1,
2, /* Elements count */
&asn_SPC_Frame_specs_1 /* Additional specs */
};
/*** <<< INCLUDES [ConstrainedInteger] >>> ***/
#include <NativeInteger.h>
/*** <<< TYPE-DECLS [ConstrainedInteger] >>> ***/
typedef long ConstrainedInteger_t;
/*** <<< FUNC-DECLS [ConstrainedInteger] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger;
asn_struct_free_f ConstrainedInteger_free;
asn_struct_print_f ConstrainedInteger_print;
asn_constr_check_f ConstrainedInteger_constraint;
ber_type_decoder_f ConstrainedInteger_decode_ber;
der_type_encoder_f ConstrainedInteger_encode_der;
xer_type_decoder_f ConstrainedInteger_decode_xer;
xer_type_encoder_f ConstrainedInteger_encode_xer;
/*** <<< CODE [ConstrainedInteger] >>> ***/
int
ConstrainedInteger_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
long value;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
value = *(const long *)sptr;
if((value >= 0 && value <= 32767)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using NativeInteger,
* so here we adjust the DEF accordingly.
*/
/*** <<< STAT-DEFS [ConstrainedInteger] >>> ***/
static const ber_tlv_tag_t asn_DEF_ConstrainedInteger_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger = {
"ConstrainedInteger",
"ConstrainedInteger",
NativeInteger_free,
NativeInteger_print,
NativeInteger_compare,
ConstrainedInteger_constraint,
NativeInteger_decode_ber,
NativeInteger_encode_der,
NativeInteger_decode_xer,
NativeInteger_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_ConstrainedInteger_tags_1,
sizeof(asn_DEF_ConstrainedInteger_tags_1)
/sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
asn_DEF_ConstrainedInteger_tags_1, /* Same as above */
sizeof(asn_DEF_ConstrainedInteger_tags_1)
/sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
/*** <<< INCLUDES [PrimitiveMessage] >>> ***/
#include <constr_SEQUENCE.h>
/*** <<< TYPE-DECLS [PrimitiveMessage] >>> ***/
typedef struct PrimitiveMessage {
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} PrimitiveMessage_t;
/*** <<< FUNC-DECLS [PrimitiveMessage] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage;
extern asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1;
/*** <<< STAT-DEFS [PrimitiveMessage] >>> ***/
static const ber_tlv_tag_t asn_DEF_PrimitiveMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1 = {
sizeof(struct PrimitiveMessage),
offsetof(struct PrimitiveMessage, _asn_ctx),
0, /* No top level tags */
0, /* No tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage = {
"PrimitiveMessage",
"PrimitiveMessage",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_PrimitiveMessage_tags_1,
sizeof(asn_DEF_PrimitiveMessage_tags_1)
/sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
asn_DEF_PrimitiveMessage_tags_1, /* Same as above */
sizeof(asn_DEF_PrimitiveMessage_tags_1)
/sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
0, 0, /* No members */
&asn_SPC_PrimitiveMessage_specs_1 /* Additional specs */
};
/*** <<< INCLUDES [ComplexMessage] >>> ***/
#include <constr_SEQUENCE.h>
/*** <<< TYPE-DECLS [ComplexMessage] >>> ***/
typedef struct ComplexMessage {
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ComplexMessage_t;
/*** <<< FUNC-DECLS [ComplexMessage] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_ComplexMessage;
extern asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1;
/*** <<< STAT-DEFS [ComplexMessage] >>> ***/
static const ber_tlv_tag_t asn_DEF_ComplexMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1 = {
sizeof(struct ComplexMessage),
offsetof(struct ComplexMessage, _asn_ctx),
0, /* No top level tags */
0, /* No tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_ComplexMessage = {
"ComplexMessage",
"ComplexMessage",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_compare,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
0, 0, /* No OER support, use "-gen-OER" to enable */
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_ComplexMessage_tags_1,
sizeof(asn_DEF_ComplexMessage_tags_1)
/sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
asn_DEF_ComplexMessage_tags_1, /* Same as above */
sizeof(asn_DEF_ComplexMessage_tags_1)
/sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
0, /* No OER visible constraints */
0, /* No PER visible constraints */
0, 0, /* No members */
&asn_SPC_ComplexMessage_specs_1 /* Additional specs */
};
...@@ -22,11 +22,11 @@ extern asn_TYPE_descriptor_t asn_DEF_Attribute; ...@@ -22,11 +22,11 @@ extern asn_TYPE_descriptor_t asn_DEF_Attribute;
/*** <<< IOC-TABLES [Attribute] >>> ***/ /*** <<< IOC-TABLES [Attribute] >>> ***/
static const RELATIVE_OID_t asn_VAL_raf_0 = { "not supported", 0 }; static const RELATIVE_OID_t asn_VAL_1_raf = { "not supported", 0 };
static const RELATIVE_OID_t asn_VAL_rcf_0 = { "not supported", 0 }; static const RELATIVE_OID_t asn_VAL_2_rcf = { "not supported", 0 };
static const asn_ioc_cell_t asn_IOS_Attributes_1_rows[] = { static const asn_ioc_cell_t asn_IOS_Attributes_1_rows[] = {
{ "&id", aioc__value, &asn_DEF_RELATIVE_OID, &asn_VAL_raf_0 }, { "&id", aioc__value, &asn_DEF_RELATIVE_OID, &asn_VAL_1_raf },
{ "&id", aioc__value, &asn_DEF_RELATIVE_OID, &asn_VAL_rcf_0 } { "&id", aioc__value, &asn_DEF_RELATIVE_OID, &asn_VAL_2_rcf }
}; };
static asn_ioc_set_t asn_IOS_Attributes_1[] = { static asn_ioc_set_t asn_IOS_Attributes_1[] = {
2, 1, asn_IOS_Attributes_1_rows 2, 1, asn_IOS_Attributes_1_rows
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment