Commit 43c4a295 authored by Cedric Roux's avatar Cedric Roux
Browse files

apply patch OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0

parent 1658dde2
......@@ -779,4 +779,6 @@ asn_dec_rval_t OCTET_STRING_decode_aper(asn_codec_ctx_t *ctx, asn_TYPE_descripto
asn_enc_rval_t OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = { 0, 0, 0 }; (void)td; (void)cts; (void)sptr; (void)po; return er; }
asn_comp_rval_t * OCTET_STRING_compare(asn_TYPE_descriptor_t *td1, const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2) { (void)td1; (void)sptr1; (void)td2; (void)sptr2; return 0; }
size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size) { (void)chunk_buf; (void)chunk_size; return 0; }
......@@ -1082,6 +1082,8 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
enum tvm_compat tv_mode;
enum etd_spec etd_spec;
char *p;
//char tmp_buf[512];
//int i = 0;
if(arg->embed) {
enum tnfmt tnfmt = TNF_CTYPE;
......@@ -1243,7 +1245,8 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("td->uper_decoder = asn_DEF_%s.uper_decoder;\n", type_name);
OUT("td->uper_encoder = asn_DEF_%s.uper_encoder;\n", type_name);
OUT("td->aper_decoder = asn_DEF_%s.aper_decoder;\n", type_name);
OUT("td->aper_encoder = asn_DEF_%s.aper_encoder;\n", type_name);
OUT("td->aper_encoder = asn_DEF_%s.aper_encoder;\n", type_name);
OUT("td->compare = asn_DEF_%s.compare;\n", type_name);
if(!terminal && !tags_count) {
OUT("/* The next four lines are here because of -fknown-extern-type */\n");
OUT("td->tags = asn_DEF_%s.tags;\n", type_name);
......@@ -1413,6 +1416,39 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("}\n");
OUT("\n");
//i = 0;
//while ((p[i] != '_') && (i < sizeof(tmp_buf))) {
// tmp_buf[i] = p[i];
// i++;
//}
//tmp_buf[i] = '\0';
// hack, only for s1ap
//if ((strcmp("S1ap", tmp_buf) == 0) || (strcmp("X2ap", tmp_buf) == 0))
// OUT("#include \"%s-ProtocolIE-ID.h\"\n", tmp_buf);
p = MKID(expr);
if(HIDE_INNER_DEFS) OUT("static ");
OUT("asn_comp_rval_t * \n");
OUT("%s", p);
if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index);
OUT("_compare(asn_TYPE_descriptor_t *td1,\n");
INDENTED(
OUT("\tconst void *structure1,\n");
OUT("\tasn_TYPE_descriptor_t *td2,\n");
OUT("\tconst void *structure2) {\n");
OUT("asn_comp_rval_t * res = NULL;\n");
OUT("%s_%d_inherit_TYPE_descriptor(td1);\n",
p, expr->_type_unique_index);
OUT("%s_%d_inherit_TYPE_descriptor(td2);\n",
p, expr->_type_unique_index);
OUT("res = td1->compare(td1, structure1, td2, structure2);\n");
OUT("return res;\n");
);
OUT("}\n");
OUT("\n");
p = MKID(expr);
if(HIDE_INNER_DEFS) OUT("static ");
......@@ -1450,7 +1486,8 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
OUT("per_type_decoder_f %s_decode_uper;\n", p);
OUT("per_type_encoder_f %s_encode_uper;\n", p);
OUT("per_type_decoder_f %s_decode_aper;\n", p);
OUT("per_type_encoder_f %s_encode_aper;\n", p);
OUT("per_type_encoder_f %s_encode_aper;\n", p);
OUT("type_compare_f %s_compare;\n", p);
}
}
......@@ -2501,6 +2538,7 @@ emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_
OUT("0, 0,\t/* No APER support, "
"use \"-gen-PER\" to enable */\n");
}
FUNCREF(compare);
if(!terminal || terminal->expr_type == ASN_CONSTR_CHOICE) {
//if(expr->expr_type == ASN_CONSTR_CHOICE) {
......
......@@ -24,7 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_ANY = {
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
0, 0, 0, 0,
0, /* No PER visible constraints */
......
......@@ -30,7 +30,8 @@ asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
OCTET_STRING_decode_uper, /* Unaligned PER decoder */
OCTET_STRING_encode_uper, /* Unaligned PER encoder */
OCTET_STRING_decode_aper, /* Aligned PER decoder */
OCTET_STRING_encode_aper, /* Aligned PER encoder */
OCTET_STRING_encode_aper, /* Aligned PER encoder */
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_BIT_STRING_tags,
sizeof(asn_DEF_BIT_STRING_tags)
......
......@@ -36,7 +36,8 @@ asn_TYPE_descriptor_t asn_DEF_BMPString = {
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper, /* Aligned PER decoder */
OCTET_STRING_encode_aper, /* Aligned PER encoder */
OCTET_STRING_encode_aper, /* Aligned PER encoder */
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_BMPString_tags,
sizeof(asn_DEF_BMPString_tags)
......
......@@ -25,7 +25,8 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
BOOLEAN_decode_uper, /* Unaligned PER decoder */
BOOLEAN_encode_uper, /* Unaligned PER encoder */
BOOLEAN_decode_aper, /* Aligned PER decoder */
BOOLEAN_encode_aper, /* Aligned PER encoder */
BOOLEAN_encode_aper, /* Aligned PER encoder */
BOOLEAN_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_BOOLEAN_tags,
sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]),
......@@ -326,3 +327,22 @@ BOOLEAN_encode_aper(asn_TYPE_descriptor_t *td,
_ASN_ENCODED_OK(er);
}
asn_comp_rval_t *
BOOLEAN_compare(asn_TYPE_descriptor_t *td1,
const void *sptr1, asn_TYPE_descriptor_t *td2, const void *sptr2) {
const BOOLEAN_t *st1 = (const BOOLEAN_t *)sptr1;
const BOOLEAN_t *st2 = (const BOOLEAN_t *)sptr2;
asn_comp_rval_t *res = NULL;
COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
if (*st1 == *st2) return NULL;
res = calloc(1, sizeof(asn_comp_rval_t));
res->name = td1->name;
res->structure1 = sptr1;
res->structure2 = sptr2;
res->err_code = COMPARE_ERR_CODE_NO_MATCH;
return res;
}
......@@ -30,6 +30,7 @@ per_type_decoder_f BOOLEAN_decode_uper;
per_type_encoder_f BOOLEAN_encode_uper;
per_type_decoder_f BOOLEAN_decode_aper;
per_type_encoder_f BOOLEAN_encode_aper;
type_compare_f BOOLEAN_compare;
#ifdef __cplusplus
}
......
......@@ -27,7 +27,8 @@ asn_TYPE_descriptor_t asn_DEF_ENUMERATED = {
ENUMERATED_decode_uper, /* Unaligned PER decoder */
ENUMERATED_encode_uper, /* Unaligned PER encoder */
ENUMERATED_decode_aper, /* Aligned PER decoder */
ENUMERATED_encode_aper, /* Aligned PER encoder */
ENUMERATED_encode_aper, /* Aligned PER encoder */
ENUMERATED_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_ENUMERATED_tags,
sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]),
......@@ -103,3 +104,22 @@ ENUMERATED_encode_aper(asn_TYPE_descriptor_t *td,
return NativeEnumerated_encode_aper(td, constraints, &value, po);
}
asn_comp_rval_t *
ENUMERATED_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
asn_TYPE_descriptor_t *td2, const void *sptr2) {
const ENUMERATED_t *st1 = (const ENUMERATED_t *)sptr1;
const ENUMERATED_t *st2 = (const ENUMERATED_t *)sptr2;
asn_comp_rval_t *res = NULL;
COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
if (*st1 == *st2) return NULL;
res = calloc(1, sizeof(asn_comp_rval_t));
res->name = td1->name;
res->structure1 = sptr1;
res->structure2 = sptr2;
res->err_code = COMPARE_ERR_CODE_NO_MATCH;
return res;
}
......@@ -19,6 +19,7 @@ per_type_decoder_f ENUMERATED_decode_uper;
per_type_encoder_f ENUMERATED_encode_uper;
per_type_decoder_f ENUMERATED_decode_aper;
per_type_encoder_f ENUMERATED_encode_aper;
type_compare_f ENUMERATED_compare;
#ifdef __cplusplus
}
......
......@@ -25,7 +25,8 @@ asn_TYPE_descriptor_t asn_DEF_GeneralString = {
OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_GeneralString_tags,
sizeof(asn_DEF_GeneralString_tags)
......
......@@ -168,7 +168,8 @@ asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = {
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_GeneralizedTime_tags,
sizeof(asn_DEF_GeneralizedTime_tags)
......
......@@ -25,7 +25,8 @@ asn_TYPE_descriptor_t asn_DEF_GraphicString = {
OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_GraphicString_tags,
sizeof(asn_DEF_GraphicString_tags)
......
......@@ -31,6 +31,7 @@ asn_TYPE_descriptor_t asn_DEF_IA5String = {
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_IA5String_tags,
sizeof(asn_DEF_IA5String_tags)
......
......@@ -35,6 +35,7 @@ asn_TYPE_descriptor_t asn_DEF_INTEGER = {
INTEGER_decode_aper,
INTEGER_encode_aper,
#endif /* ASN_DISABLE_PER_SUPPORT */
INTEGER_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_INTEGER_tags,
sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]),
......@@ -1501,3 +1502,30 @@ asn_int642INTEGER(INTEGER_t *st, int64_t value) {
}
asn_comp_rval_t *
INTEGER_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
asn_TYPE_descriptor_t *td2, const void *sptr2) {
const INTEGER_t *st1 = (const INTEGER_t *)sptr1;
const INTEGER_t *st2 = (const INTEGER_t *)sptr2;
asn_comp_rval_t *res = NULL;
COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
if (st1->size != st2->size) {
res = calloc(1, sizeof(asn_comp_rval_t));
res->name = td1->name;
res->structure1 = sptr1;
res->structure2 = sptr2;
res->err_code = COMPARE_ERR_CODE_NO_MATCH;
return res;
}
if (0 != memcmp(st1->buf, st2->buf, st1->size)) {
res = calloc(1, sizeof(asn_comp_rval_t));
res->name = td1->name;
res->structure1 = sptr1;
res->structure2 = sptr2;
res->err_code = COMPARE_ERR_CODE_NO_MATCH;
return res;
}
return NULL;
}
......@@ -43,6 +43,7 @@ per_type_decoder_f INTEGER_decode_uper;
per_type_encoder_f INTEGER_encode_uper;
per_type_decoder_f INTEGER_decode_aper;
per_type_encoder_f INTEGER_encode_aper;
type_compare_f INTEGER_compare;
/***********************************
* Some handy conversion routines. *
......
......@@ -30,7 +30,8 @@ asn_TYPE_descriptor_t asn_DEF_ISO646String = {
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
OCTET_STRING_decode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_encode_aper,
OCTET_STRING_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_ISO646String_tags,
sizeof(asn_DEF_ISO646String_tags)
......
......@@ -46,11 +46,11 @@ libasn1cskeletons_la_SOURCES = \
asn_SET_OF.c asn_SET_OF.h \
asn_application.h asn_codecs.h \
asn_codecs_prim.c asn_codecs_prim.h \
asn_internal.h asn_system.h \
asn_internal.h asn_system.h asn_compare.h \
ber_decoder.c ber_decoder.h \
ber_tlv_length.c ber_tlv_length.h \
ber_tlv_tag.c ber_tlv_tag.h \
constr_CHOICE.c constr_CHOICE.h \
ber_tlv_tag.c ber_tlv_tag.h compare.h \
comparison.h constr_CHOICE.c constr_CHOICE.h \
constr_SEQUENCE.c constr_SEQUENCE.h \
constr_SEQUENCE_OF.c constr_SEQUENCE_OF.h \
constr_SET.c constr_SET.h \
......
......@@ -26,7 +26,8 @@ asn_TYPE_descriptor_t asn_DEF_NULL = {
NULL_decode_uper, /* Unaligned PER decoder */
NULL_encode_uper, /* Unaligned PER encoder */
NULL_decode_aper, /* Aligned PER decoder */
NULL_encode_aper, /* Aligned PER encoder */
NULL_encode_aper, /* Aligned PER encoder */
NULL_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_NULL_tags,
sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
......@@ -192,3 +193,10 @@ NULL_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
er.encoded = 0;
_ASN_ENCODED_OK(er);
}
asn_comp_rval_t *
NULL_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
asn_TYPE_descriptor_t *td2, const void *sptr2) {
return NULL;
}
......@@ -27,6 +27,7 @@ per_type_decoder_f NULL_decode_uper;
per_type_encoder_f NULL_encode_uper;
per_type_decoder_f NULL_decode_aper;
per_type_encoder_f NULL_encode_aper;
type_compare_f NULL_compare;
#ifdef __cplusplus
}
......
......@@ -31,7 +31,8 @@ asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = {
NativeEnumerated_decode_uper,
NativeEnumerated_encode_uper,
NativeEnumerated_decode_aper,
NativeEnumerated_encode_aper,
NativeEnumerated_encode_aper,
NativeEnumerated_compare,
0, /* Use generic outmost tag fetcher */
asn_DEF_NativeEnumerated_tags,
sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
......@@ -335,3 +336,22 @@ NativeEnumerated_encode_aper(asn_TYPE_descriptor_t *td,
_ASN_ENCODED_OK(er);
}
asn_comp_rval_t *
NativeEnumerated_compare(asn_TYPE_descriptor_t *td1, const void *sptr1,
asn_TYPE_descriptor_t *td2, const void *sptr2) {
const asn_INTEGER_enum_map_t *a = sptr1;
const asn_INTEGER_enum_map_t *b = sptr2;
asn_comp_rval_t *res = NULL;
COMPARE_CHECK_ARGS(td1, td2, sptr1, sptr2, res)
if(a->nat_value == b->nat_value)
return NULL;
res = calloc(1, sizeof(asn_comp_rval_t));
res->name = td1->name;
res->structure1 = sptr1;
res->structure2 = sptr2;
res->err_code = COMPARE_ERR_CODE_NO_MATCH;
return res;
}
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