diff --git a/lib/asn1c/common/ANY.c b/lib/asn1c/common/ANY.c index b24d6f4ef..0b815577e 100644 --- a/lib/asn1c/common/ANY.c +++ b/lib/asn1c/common/ANY.c @@ -82,7 +82,7 @@ static int ANY__consume_bytes(const void *buffer, size_t size, void *key); int ANY_fromType(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) { struct _callback_arg arg; - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; if(!st || !td) { errno = EINVAL; diff --git a/lib/asn1c/common/BIT_STRING.c b/lib/asn1c/common/BIT_STRING.c index 87246f1f7..e8d7354c8 100644 --- a/lib/asn1c/common/BIT_STRING.c +++ b/lib/asn1c/common/BIT_STRING.c @@ -96,7 +96,7 @@ asn_enc_rval_t BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0, 0, 0}; char scratch[128]; char *p = scratch; char *scend = scratch + (sizeof(scratch) - 10); diff --git a/lib/asn1c/common/BOOLEAN.c b/lib/asn1c/common/BOOLEAN.c deleted file mode 100644 index 1bb7f7d5a..000000000 --- a/lib/asn1c/common/BOOLEAN.c +++ /dev/null @@ -1,492 +0,0 @@ -/*- - * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. - * Redistribution and modifications are permitted subject to BSD license. - */ -#include -#include -#include - -/* - * BOOLEAN basic type description. - */ -static const ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) -}; -asn_TYPE_operation_t asn_OP_BOOLEAN = { - BOOLEAN_free, - BOOLEAN_print, - BOOLEAN_compare, - BOOLEAN_decode_ber, - BOOLEAN_encode_der, - BOOLEAN_decode_xer, - BOOLEAN_encode_xer, -#ifdef ASN_DISABLE_OER_SUPPORT - 0, - 0, -#else - BOOLEAN_decode_oer, - BOOLEAN_encode_oer, -#endif /* ASN_DISABLE_OER_SUPPORT */ -#ifdef ASN_DISABLE_PER_SUPPORT - 0, - 0, - 0, - 0, -#else - BOOLEAN_decode_uper, /* Unaligned PER decoder */ - BOOLEAN_encode_uper, /* Unaligned PER encoder */ - BOOLEAN_decode_aper, /* Aligned PER decoder */ - BOOLEAN_encode_aper, /* Aligned PER encoder */ -#endif /* ASN_DISABLE_PER_SUPPORT */ - BOOLEAN_random_fill, - 0 /* Use generic outmost tag fetcher */ -}; -asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { - "BOOLEAN", - "BOOLEAN", - &asn_OP_BOOLEAN, - asn_DEF_BOOLEAN_tags, - sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), - asn_DEF_BOOLEAN_tags, /* Same as above */ - sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), - { 0, 0, asn_generic_no_constraint }, - 0, 0, /* No members */ - 0 /* No specifics */ -}; - -/* - * Decode BOOLEAN type. - */ -asn_dec_rval_t -BOOLEAN_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, - const asn_TYPE_descriptor_t *td, void **bool_value, - const void *buf_ptr, size_t size, int tag_mode) { - BOOLEAN_t *st = (BOOLEAN_t *)*bool_value; - asn_dec_rval_t rval; - ber_tlv_len_t length; - ber_tlv_len_t lidx; - - if(st == NULL) { - st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); - if(st == NULL) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; - } - } - - ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", - td->name, tag_mode); - - /* - * Check tags. - */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; - - ASN_DEBUG("Boolean length is %d bytes", (int)length); - - buf_ptr = ((const char *)buf_ptr) + rval.consumed; - size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } - - /* - * Compute boolean value. - */ - for(*st = 0, lidx = 0; - (lidx < length) && *st == 0; lidx++) { - /* - * Very simple approach: read bytes until the end or - * value is already TRUE. - * BOOLEAN is not supposed to contain meaningful data anyway. - */ - *st |= ((const uint8_t *)buf_ptr)[lidx]; - } - - rval.code = RC_OK; - rval.consumed += length; - - ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", - (long)rval.consumed, (long)length, - td->name, *st); - - return rval; -} - -asn_enc_rval_t -BOOLEAN_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, - int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, - void *app_key) { - asn_enc_rval_t erval; - const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; - - erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key); - if(erval.encoded == -1) { - erval.failed_type = td; - erval.structure_ptr = sptr; - return erval; - } - - if(cb) { - uint8_t bool_value; - - bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ - - if(cb(&bool_value, 1, app_key) < 0) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = sptr; - return erval; - } - } - - erval.encoded += 1; - - ASN__ENCODED_OK(erval); -} - - -/* - * Decode the chunk of XML text encoding INTEGER. - */ -static enum xer_pbd_rval -BOOLEAN__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr, - const void *chunk_buf, size_t chunk_size) { - BOOLEAN_t *st = (BOOLEAN_t *)sptr; - const char *p = (const char *)chunk_buf; - - (void)td; - - if(chunk_size && p[0] == 0x3c /* '<' */) { - switch(xer_check_tag(chunk_buf, chunk_size, "false")) { - case XCT_BOTH: - /* "" */ - *st = 0; - break; - case XCT_UNKNOWN_BO: - if(xer_check_tag(chunk_buf, chunk_size, "true") - != XCT_BOTH) - return XPBD_BROKEN_ENCODING; - /* "" */ - *st = 1; /* Or 0xff as in DER?.. */ - break; - default: - return XPBD_BROKEN_ENCODING; - } - return XPBD_BODY_CONSUMED; - } else { - return XPBD_BROKEN_ENCODING; - } -} - - -asn_dec_rval_t -BOOLEAN_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, - const asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return xer_decode_primitive(opt_codec_ctx, td, - sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size, - BOOLEAN__xer_body_decode); -} - -asn_enc_rval_t -BOOLEAN_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; - asn_enc_rval_t er = {0, 0, 0}; - - (void)ilevel; - (void)flags; - - if(!st) ASN__ENCODE_FAILED; - - if(*st) { - ASN__CALLBACK("", 7); - } else { - ASN__CALLBACK("", 8); - } - - ASN__ENCODED_OK(er); -cb_failed: - ASN__ENCODE_FAILED; -} - -int -BOOLEAN_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { - const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; - const char *buf; - size_t buflen; - - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ - - if(st) { - if(*st) { - buf = "TRUE"; - buflen = 4; - } else { - buf = "FALSE"; - buflen = 5; - } - } else { - buf = ""; - buflen = 8; - } - - return (cb(buf, buflen, app_key) < 0) ? -1 : 0; -} - -void -BOOLEAN_free(const asn_TYPE_descriptor_t *td, void *ptr, - enum asn_struct_free_method method) { - if(td && ptr) { - switch(method) { - case ASFM_FREE_EVERYTHING: - FREEMEM(ptr); - break; - case ASFM_FREE_UNDERLYING: - break; - case ASFM_FREE_UNDERLYING_AND_RESET: - memset(ptr, 0, sizeof(BOOLEAN_t)); - break; - } - } -} - -#ifndef ASN_DISABLE_PER_SUPPORT - -asn_dec_rval_t -BOOLEAN_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, - const asn_TYPE_descriptor_t *td, - const asn_per_constraints_t *constraints, void **sptr, - asn_per_data_t *pd) { - asn_dec_rval_t rv; - BOOLEAN_t *st = (BOOLEAN_t *)*sptr; - - (void)opt_codec_ctx; - (void)td; - (void)constraints; - - if(!st) { - st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); - if(!st) ASN__DECODE_FAILED; - } - - /* - * Extract a single bit - */ - switch(per_get_few_bits(pd, 1)) { - case 1: *st = 1; break; - case 0: *st = 0; break; - case -1: default: ASN__DECODE_STARVED; - } - - ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); - - rv.code = RC_OK; - rv.consumed = 1; - return rv; -} - - -asn_enc_rval_t -BOOLEAN_encode_uper(const asn_TYPE_descriptor_t *td, - const asn_per_constraints_t *constraints, const void *sptr, - asn_per_outp_t *po) { - const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; - asn_enc_rval_t er = { 0, 0, 0 }; - - (void)constraints; - - if(!st) ASN__ENCODE_FAILED; - - if(per_put_few_bits(po, *st ? 1 : 0, 1)) - ASN__ENCODE_FAILED; - - ASN__ENCODED_OK(er); -} - -asn_dec_rval_t -BOOLEAN_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, - const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - asn_dec_rval_t rv; - BOOLEAN_t *st = (BOOLEAN_t *)*sptr; - - (void)opt_codec_ctx; - (void)constraints; - (void)td; - - if(!st) { - st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); - if(!st) ASN__DECODE_FAILED; - } - - /* - * Extract a single bit - */ - switch(per_get_few_bits(pd, 1)) { - case 1: - *st = 1; - break; - case 0: - *st = 0; - break; - case -1: - default: - ASN__DECODE_STARVED; - } - - ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); - - rv.code = RC_OK; - rv.consumed = 1; - return rv; -} - -asn_enc_rval_t -BOOLEAN_encode_aper(const asn_TYPE_descriptor_t *td, - const asn_per_constraints_t *constraints, - const void *sptr, asn_per_outp_t *po) { - const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; - asn_enc_rval_t er = { 0, 0, 0 }; - - (void)constraints; - - if(!st) ASN__ENCODE_FAILED; - - if(per_put_few_bits(po, *st ? 1 : 0, 1)) - ASN__ENCODE_FAILED; - - ASN__ENCODED_OK(er); -} - -#endif /* ASN_DISABLE_PER_SUPPORT */ - -#ifndef ASN_DISABLE_OER_SUPPORT - -/* - * Encode as Canonical OER. - */ -asn_enc_rval_t -BOOLEAN_encode_oer(const asn_TYPE_descriptor_t *td, - const asn_oer_constraints_t *constraints, const void *sptr, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er = { 1, 0, 0 }; - const BOOLEAN_t *st = sptr; - uint8_t bool_value = *st ? 0xff : 0; /* 0xff mandated by OER */ - - (void)td; - (void)constraints; /* Constraints are unused in OER */ - - if(cb(&bool_value, 1, app_key) < 0) { - ASN__ENCODE_FAILED; - } else { - ASN__ENCODED_OK(er); - } -} - -asn_dec_rval_t -BOOLEAN_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, - const asn_TYPE_descriptor_t *td, - const asn_oer_constraints_t *constraints, void **sptr, - const void *ptr, size_t size) { - asn_dec_rval_t ok = {RC_OK, 1}; - BOOLEAN_t *st; - - (void)opt_codec_ctx; - (void)td; - (void)constraints; /* Constraints are unused in OER */ - - if(size < 1) { - ASN__DECODE_STARVED; - } - - if(!(st = *sptr)) { - st = (BOOLEAN_t *)(*sptr = CALLOC(1, sizeof(*st))); - if(!st) ASN__DECODE_FAILED; - } - - *st = *(const uint8_t *)ptr; - - return ok; -} - - - -#endif - -int -BOOLEAN_compare(const asn_TYPE_descriptor_t *td, const void *aptr, - const void *bptr) { - const BOOLEAN_t *a = aptr; - const BOOLEAN_t *b = bptr; - - (void)td; - - if(a && b) { - if(!*a == !*b) { /* TRUE can be encoded by any non-zero byte. */ - return 0; - } else if(!*a) { - return -1; - } else { - return 1; - } - } else if(!a) { - return -1; - } else { - return 1; - } -} - -asn_random_fill_result_t -BOOLEAN_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, - const asn_encoding_constraints_t *constraints, - size_t max_length) { - asn_random_fill_result_t result_ok = {ARFILL_OK, 1}; - asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0}; - asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0}; - BOOLEAN_t *st = *sptr; - - if(max_length == 0) return result_skipped; - - if(st == NULL) { - st = (BOOLEAN_t *)(*sptr = CALLOC(1, sizeof(*st))); - if(st == NULL) { - return result_failed; - } - } - - if(!constraints || !constraints->per_constraints) - constraints = &td->encoding_constraints; - if(constraints->per_constraints) { - const asn_per_constraint_t *pc = &constraints->per_constraints->value; - if(pc->flags & APC_CONSTRAINED) { - *st = asn_random_between(pc->lower_bound, pc->upper_bound); - return result_ok; - } - } - - /* Simulate booleans that are sloppily set and biased. */ - switch(asn_random_between(0, 7)) { - case 0: - case 1: - case 2: - *st = 0; break; - case 3: *st = -1; break; - case 4: *st = 1; break; - case 5: *st = INT_MIN; break; - case 6: *st = INT_MAX; break; - default: - *st = asn_random_between(INT_MIN, INT_MAX); - break; - } - return result_ok; -} diff --git a/lib/asn1c/common/BOOLEAN.h b/lib/asn1c/common/BOOLEAN.h deleted file mode 100644 index 620acf7f1..000000000 --- a/lib/asn1c/common/BOOLEAN.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * Copyright (c) 2003-2017 Lev Walkin . All rights reserved. - * Redistribution and modifications are permitted subject to BSD license. - */ -#ifndef _BOOLEAN_H_ -#define _BOOLEAN_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The underlying integer may contain various values, but everything - * non-zero is capped to 0xff by the DER encoder. The BER decoder may - * yield non-zero values different from 1, beware. - */ -typedef int BOOLEAN_t; - -extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN; -extern asn_TYPE_operation_t asn_OP_BOOLEAN; - -asn_struct_free_f BOOLEAN_free; -asn_struct_print_f BOOLEAN_print; -asn_struct_compare_f BOOLEAN_compare; -ber_type_decoder_f BOOLEAN_decode_ber; -der_type_encoder_f BOOLEAN_encode_der; -oer_type_decoder_f BOOLEAN_decode_oer; -oer_type_encoder_f BOOLEAN_encode_oer; -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; -xer_type_decoder_f BOOLEAN_decode_xer; -xer_type_encoder_f BOOLEAN_encode_xer; -asn_random_fill_f BOOLEAN_random_fill; - -#define BOOLEAN_constraint asn_generic_no_constraint - -#ifdef __cplusplus -} -#endif - -#endif /* _BOOLEAN_H_ */ diff --git a/lib/asn1c/common/GraphicString.c b/lib/asn1c/common/GraphicString.c new file mode 100644 index 000000000..e6642c9ae --- /dev/null +++ b/lib/asn1c/common/GraphicString.c @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +/* + * GraphicString basic type description. + */ +static const ber_tlv_tag_t asn_DEF_GraphicString_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (25 << 2)), /* [UNIVERSAL 25] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +asn_TYPE_operation_t asn_OP_GraphicString = { + OCTET_STRING_free, + OCTET_STRING_print, /* non-ascii string */ + OCTET_STRING_compare, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_hex, + OCTET_STRING_encode_xer, /* Can't expect it to be ASCII/UTF8 */ +#ifdef ASN_DISABLE_OER_SUPPORT + 0, + 0, +#else + OCTET_STRING_decode_oer, + OCTET_STRING_encode_oer, +#endif /* ASN_DISABLE_OER_SUPPORT */ +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, + 0, + 0, +#else + OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_aper, +#endif /* ASN_DISABLE_PER_SUPPORT */ + OCTET_STRING_random_fill, + 0 /* Use generic outmost tag fetcher */ +}; +asn_TYPE_descriptor_t asn_DEF_GraphicString = { + "GraphicString", + "GraphicString", + &asn_OP_GraphicString, + asn_DEF_GraphicString_tags, + sizeof(asn_DEF_GraphicString_tags) + / sizeof(asn_DEF_GraphicString_tags[0]) - 1, + asn_DEF_GraphicString_tags, + sizeof(asn_DEF_GraphicString_tags) + / sizeof(asn_DEF_GraphicString_tags[0]), + { 0, 0, asn_generic_unknown_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/lib/asn1c/common/GraphicString.h b/lib/asn1c/common/GraphicString.h new file mode 100644 index 000000000..19cac6852 --- /dev/null +++ b/lib/asn1c/common/GraphicString.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2003-2017 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _GraphicString_H_ +#define _GraphicString_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t GraphicString_t; /* Implemented via OCTET STRING */ + +extern asn_TYPE_descriptor_t asn_DEF_GraphicString; +extern asn_TYPE_operation_t asn_OP_GraphicString; + +#define GraphicString_free OCTET_STRING_free +#define GraphicString_print OCTET_STRING_print +#define GraphicString_compare OCTET_STRING_compare +#define GraphicString_constraint asn_generic_unknown_constraint +#define GraphicString_decode_ber OCTET_STRING_decode_ber +#define GraphicString_encode_der OCTET_STRING_encode_der +#define GraphicString_decode_xer OCTET_STRING_decode_xer_hex +#define GraphicString_encode_xer OCTET_STRING_encode_xer +#define GraphicString_decode_uper OCTET_STRING_decode_uper +#define GraphicString_encode_uper OCTET_STRING_encode_uper +#define GraphicString_decode_aper OCTET_STRING_decode_aper +#define GraphicString_encode_aper OCTET_STRING_encode_aper + +#ifdef __cplusplus +} +#endif + +#endif /* _GraphicString_H_ */ diff --git a/lib/asn1c/common/INTEGER.c b/lib/asn1c/common/INTEGER.c index ab001b217..beb572e35 100644 --- a/lib/asn1c/common/INTEGER.c +++ b/lib/asn1c/common/INTEGER.c @@ -1,5 +1,5 @@ -/*- - * Copyright (c) 2003-2014 Lev Walkin . +/* + * Copyright (c) 2003-2019 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ @@ -571,7 +571,7 @@ INTEGER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; (void)ilevel; (void)flags; @@ -636,11 +636,11 @@ INTEGER_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, /* #11.5.6 */ ASN_DEBUG("Integer with range %d bits", ct->range_bits); if(ct->range_bits >= 0) { - if((size_t)ct->range_bits > 8 * sizeof(unsigned long)) + if((size_t)ct->range_bits > 8 * sizeof(uintmax_t)) ASN__DECODE_FAILED; if(specs && specs->field_unsigned) { - unsigned long uvalue = 0; + uintmax_t uvalue = 0; if(uper_get_constrained_whole_number(pd, &uvalue, ct->range_bits)) ASN__DECODE_STARVED; @@ -650,16 +650,16 @@ INTEGER_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, if(asn_ulong2INTEGER(st, uvalue)) ASN__DECODE_FAILED; } else { - unsigned long uvalue = 0; - long svalue; + uintmax_t uvalue = 0; + intmax_t svalue; if(uper_get_constrained_whole_number(pd, &uvalue, ct->range_bits)) ASN__DECODE_STARVED; ASN_DEBUG("Got value %lu + low %ld", uvalue, ct->lower_bound); - if(per_long_range_unrebase(uvalue, ct->lower_bound, + if(per_imax_range_unrebase(uvalue, ct->lower_bound, ct->upper_bound, &svalue) - || asn_long2INTEGER(st, svalue)) { + || asn_imax2INTEGER(st, svalue)) { ASN__DECODE_FAILED; } } @@ -692,7 +692,7 @@ INTEGER_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, /* #12.2.3 */ if(ct && ct->lower_bound) { /* - * TODO: replace by in-place arithmetics. + * TODO: replace by in-place arithmetic. */ long value = 0; if(asn_INTEGER2long(st, &value)) @@ -708,14 +708,14 @@ asn_enc_rval_t INTEGER_encode_uper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { - const asn_INTEGER_specifics_t *specs = - (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + const asn_INTEGER_specifics_t *specs = + (const asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; const INTEGER_t *st = (const INTEGER_t *)sptr; const uint8_t *buf; const uint8_t *end; const asn_per_constraint_t *ct; - long value = 0; + intmax_t value = 0; if(!st || st->size == 0) ASN__ENCODE_FAILED; @@ -727,16 +727,16 @@ INTEGER_encode_uper(const asn_TYPE_descriptor_t *td, if(ct) { int inext = 0; if(specs && specs->field_unsigned) { - unsigned long uval; - if(asn_INTEGER2ulong(st, &uval)) + uintmax_t uval; + if(asn_INTEGER2umax(st, &uval)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { - if(uval < (unsigned long)ct->lower_bound) + if(uval < (uintmax_t)ct->lower_bound) inext = 1; } else if(ct->range_bits >= 0) { - if(uval < (unsigned long)ct->lower_bound - || uval > (unsigned long)ct->upper_bound) + if(uval < (uintmax_t)ct->lower_bound + || uval > (uintmax_t)ct->upper_bound) inext = 1; } ASN_DEBUG("Value %lu (%02x/%" ASN_PRI_SIZE ") lb %lu ub %lu %s", @@ -745,7 +745,7 @@ INTEGER_encode_uper(const asn_TYPE_descriptor_t *td, inext ? "ext" : "fix"); value = uval; } else { - if(asn_INTEGER2long(st, &value)) + if(asn_INTEGER2imax(st, &value)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { @@ -773,16 +773,28 @@ INTEGER_encode_uper(const asn_TYPE_descriptor_t *td, /* X.691-11/2008, #13.2.2, test if constrained whole number */ if(ct && ct->range_bits >= 0) { - unsigned long v; + uintmax_t v; /* #11.5.6 -> #11.3 */ ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits", value, value - ct->lower_bound, ct->range_bits); - if(per_long_range_rebase(value, ct->lower_bound, ct->upper_bound, &v)) { - ASN__ENCODE_FAILED; - } + if(specs && specs->field_unsigned) { + if ( ((uintmax_t)ct->lower_bound > (uintmax_t)(ct->upper_bound) + || ((uintmax_t)value < (uintmax_t)ct->lower_bound)) + || ((uintmax_t)value > (uintmax_t)ct->upper_bound) + ) { + ASN_DEBUG("Value %lu to-be-encoded is outside the bounds [%lu, %lu]!", + value, ct->lower_bound, ct->upper_bound); + ASN__ENCODE_FAILED; + } + v = (uintmax_t)value - (uintmax_t)ct->lower_bound; + } else { + if(per_imax_range_rebase(value, ct->lower_bound, ct->upper_bound, &v)) { + ASN__ENCODE_FAILED; + } + } if(uper_put_constrained_whole_number_u(po, v, ct->range_bits)) - ASN__ENCODE_FAILED; - ASN__ENCODED_OK(er); + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); } if(ct && ct->lower_bound) { @@ -961,7 +973,7 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const INTEGER_t *st = (const INTEGER_t *)sptr; const uint8_t *buf; const uint8_t *end; @@ -1031,7 +1043,8 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, v = value - ct->lower_bound; /* #12 <= 8 -> alignment ? */ - if (ct->range_bits < 8) { + int range = ct->upper_bound - ct->lower_bound + 1; + if (ct->range_bits < 8 || (ct->range_bits == 8 && range < 256)) { if(per_put_few_bits(po, 0x00 | v, ct->range_bits)) ASN__ENCODE_FAILED; } else if (ct->range_bits == 8) { @@ -1089,12 +1102,14 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, } for(buf = st->buf, end = st->buf + st->size; buf < end;) { - ssize_t mayEncode = aper_put_length(po, -1, end - buf); + int need_eom = 0; + ssize_t mayEncode = aper_put_length(po, -1, end - buf, &need_eom); if(mayEncode < 0) ASN__ENCODE_FAILED; if(per_put_many_bits(po, buf, 8 * mayEncode)) ASN__ENCODE_FAILED; buf += mayEncode; + if(need_eom && aper_put_length(po, -1, 0, 0)) ASN__ENCODE_FAILED; } ASN__ENCODED_OK(er); @@ -1416,64 +1431,71 @@ asn_int642INTEGER(INTEGER_t *st, int64_t value) { */ enum asn_strtox_result_e asn_strtoimax_lim(const char *str, const char **end, intmax_t *intp) { - int sign = 1; - intmax_t value; + int sign = 1; + intmax_t value; -#define ASN1_INTMAX_MAX ((~(uintmax_t)0) >> 1) - const intmax_t upper_boundary = ASN1_INTMAX_MAX / 10; - intmax_t last_digit_max = ASN1_INTMAX_MAX % 10; -#undef ASN1_INTMAX_MAX + const intmax_t asn1_intmax_max = ((~(uintmax_t)0) >> 1); + const intmax_t upper_boundary = asn1_intmax_max / 10; + intmax_t last_digit_max = asn1_intmax_max % 10; - if(str >= *end) return ASN_STRTOX_ERROR_INVAL; + if(str >= *end) return ASN_STRTOX_ERROR_INVAL; - switch(*str) { - case '-': - last_digit_max++; - sign = -1; - /* FALL THROUGH */ - case '+': - str++; - if(str >= *end) { - *end = str; - return ASN_STRTOX_EXPECT_MORE; - } - } + switch(*str) { + case '-': + last_digit_max++; + sign = -1; + /* FALL THROUGH */ + case '+': + str++; + if(str >= *end) { + *end = str; + return ASN_STRTOX_EXPECT_MORE; + } + } - for(value = 0; str < (*end); str++) { - switch(*str) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: { - int d = *str - '0'; - if(value < upper_boundary) { - value = value * 10 + d; - } else if(value == upper_boundary) { - if(d <= last_digit_max) { - if(sign > 0) { - value = value * 10 + d; - } else { - sign = 1; - value = -value * 10 - d; - } - } else { - *end = str; - return ASN_STRTOX_ERROR_RANGE; - } - } else { - *end = str; - return ASN_STRTOX_ERROR_RANGE; - } - } - continue; - default: - *end = str; - *intp = sign * value; - return ASN_STRTOX_EXTRA_DATA; - } - } + for(value = 0; str < (*end); str++) { + if(*str >= 0x30 && *str <= 0x39) { + int d = *str - '0'; + if(value < upper_boundary) { + value = value * 10 + d; + } else if(value == upper_boundary) { + if(d <= last_digit_max) { + if(sign > 0) { + value = value * 10 + d; + } else { + sign = 1; + value = -value * 10 - d; + } + str += 1; + if(str < *end) { + // If digits continue, we're guaranteed out of range. + *end = str; + if(*str >= 0x30 && *str <= 0x39) { + return ASN_STRTOX_ERROR_RANGE; + } else { + *intp = sign * value; + return ASN_STRTOX_EXTRA_DATA; + } + } + break; + } else { + *end = str; + return ASN_STRTOX_ERROR_RANGE; + } + } else { + *end = str; + return ASN_STRTOX_ERROR_RANGE; + } + } else { + *end = str; + *intp = sign * value; + return ASN_STRTOX_EXTRA_DATA; + } + } - *end = str; - *intp = sign * value; - return ASN_STRTOX_OK; + *end = str; + *intp = sign * value; + return ASN_STRTOX_OK; } /* @@ -1484,56 +1506,63 @@ asn_strtoimax_lim(const char *str, const char **end, intmax_t *intp) { */ enum asn_strtox_result_e asn_strtoumax_lim(const char *str, const char **end, uintmax_t *uintp) { - uintmax_t value; + uintmax_t value; -#define ASN1_UINTMAX_MAX ((~(uintmax_t)0)) - const uintmax_t upper_boundary = ASN1_UINTMAX_MAX / 10; - uintmax_t last_digit_max = ASN1_UINTMAX_MAX % 10; -#undef ASN1_UINTMAX_MAX + const uintmax_t asn1_uintmax_max = ((~(uintmax_t)0)); + const uintmax_t upper_boundary = asn1_uintmax_max / 10; + uintmax_t last_digit_max = asn1_uintmax_max % 10; if(str >= *end) return ASN_STRTOX_ERROR_INVAL; - switch(*str) { - case '-': + switch(*str) { + case '-': return ASN_STRTOX_ERROR_INVAL; - case '+': - str++; - if(str >= *end) { - *end = str; - return ASN_STRTOX_EXPECT_MORE; - } - } + case '+': + str++; + if(str >= *end) { + *end = str; + return ASN_STRTOX_EXPECT_MORE; + } + } - for(value = 0; str < (*end); str++) { - switch(*str) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: { - unsigned int d = *str - '0'; - if(value < upper_boundary) { - value = value * 10 + d; - } else if(value == upper_boundary) { - if(d <= last_digit_max) { + for(value = 0; str < (*end); str++) { + if(*str >= 0x30 && *str <= 0x39) { + unsigned int d = *str - '0'; + if(value < upper_boundary) { + value = value * 10 + d; + } else if(value == upper_boundary) { + if(d <= last_digit_max) { value = value * 10 + d; + str += 1; + if(str < *end) { + // If digits continue, we're guaranteed out of range. + *end = str; + if(*str >= 0x30 && *str <= 0x39) { + return ASN_STRTOX_ERROR_RANGE; + } else { + *uintp = value; + return ASN_STRTOX_EXTRA_DATA; + } + } + break; } else { - *end = str; - return ASN_STRTOX_ERROR_RANGE; - } - } else { - *end = str; - return ASN_STRTOX_ERROR_RANGE; - } - } - continue; - default: - *end = str; - *uintp = value; - return ASN_STRTOX_EXTRA_DATA; - } - } + *end = str; + return ASN_STRTOX_ERROR_RANGE; + } + } else { + *end = str; + return ASN_STRTOX_ERROR_RANGE; + } + } else { + *end = str; + *uintp = value; + return ASN_STRTOX_EXTRA_DATA; + } + } - *end = str; - *uintp = value; - return ASN_STRTOX_OK; + *end = str; + *uintp = value; + return ASN_STRTOX_OK; } enum asn_strtox_result_e diff --git a/lib/asn1c/common/INTEGER.h b/lib/asn1c/common/INTEGER.h index f776c072e..ca4bc1204 100644 --- a/lib/asn1c/common/INTEGER.h +++ b/lib/asn1c/common/INTEGER.h @@ -83,8 +83,8 @@ enum asn_strtox_result_e { ASN_STRTOX_ERROR_RANGE = -3, /* Input outside of supported numeric range */ ASN_STRTOX_ERROR_INVAL = -2, /* Invalid data encountered (e.g., "+-") */ ASN_STRTOX_EXPECT_MORE = -1, /* More data expected (e.g. "+") */ - ASN_STRTOX_OK = 0, /* Conversion succeded, number ends at (*end) */ - ASN_STRTOX_EXTRA_DATA = 1 /* Conversion succeded, but the string has extra stuff */ + ASN_STRTOX_OK = 0, /* Conversion succeeded, number ends at (*end) */ + ASN_STRTOX_EXTRA_DATA = 1 /* Conversion succeeded, but the string has extra stuff */ }; enum asn_strtox_result_e asn_strtol_lim(const char *str, const char **end, long *l); diff --git a/lib/asn1c/common/INTEGER_oer.c b/lib/asn1c/common/INTEGER_oer.c index 5c98d3e75..110689b2d 100644 --- a/lib/asn1c/common/INTEGER_oer.c +++ b/lib/asn1c/common/INTEGER_oer.c @@ -104,7 +104,7 @@ INTEGER_encode_oer(const asn_TYPE_descriptor_t *td, const asn_oer_constraints_t *constraints, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { const INTEGER_t *st = sptr; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; struct asn_oer_constraint_number_s ct = {0, 0}; const uint8_t *buf; const uint8_t *end; diff --git a/lib/asn1c/common/NULL.c b/lib/asn1c/common/NULL.c index d882500e0..f9130e225 100644 --- a/lib/asn1c/common/NULL.c +++ b/lib/asn1c/common/NULL.c @@ -5,7 +5,6 @@ #include #include #include -#include /* Implemented in terms of BOOLEAN type */ /* * NULL basic type description. @@ -14,10 +13,10 @@ static const ber_tlv_tag_t asn_DEF_NULL_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) }; asn_TYPE_operation_t asn_OP_NULL = { - BOOLEAN_free, + NULL_free, NULL_print, NULL_compare, - BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ + NULL_decode_ber, NULL_encode_der, /* Special handling of DER encoding */ NULL_decode_xer, NULL_encode_xer, @@ -55,10 +54,69 @@ asn_TYPE_descriptor_t asn_DEF_NULL = { 0 /* No specifics */ }; +void +NULL_free(const asn_TYPE_descriptor_t *td, void *ptr, + enum asn_struct_free_method method) { + if(td && ptr) { + switch(method) { + case ASFM_FREE_EVERYTHING: + FREEMEM(ptr); + break; + case ASFM_FREE_UNDERLYING: + break; + case ASFM_FREE_UNDERLYING_AND_RESET: + memset(ptr, 0, sizeof(NULL_t)); + break; + } + } +} + +/* + * Decode NULL type. + */ +asn_dec_rval_t +NULL_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, + const asn_TYPE_descriptor_t *td, void **bool_value, + const void *buf_ptr, size_t size, int tag_mode) { + NULL_t *st = (NULL_t *)*bool_value; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + if(st == NULL) { + st = (NULL_t *)(*bool_value = CALLOC(1, sizeof(*st))); + if(st == NULL) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + } + + ASN_DEBUG("Decoding %s as NULL (tm=%d)", td->name, tag_mode); + + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if(rval.code != RC_OK) { + return rval; + } + + // X.690-201508, #8.8.2, length shall be zero. + if(length != 0) { + ASN_DEBUG("Decoding %s as NULL failed: too much data", td->name); + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + + return rval; +} + asn_enc_rval_t NULL_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key); if(erval.encoded == -1) { @@ -73,7 +131,7 @@ asn_enc_rval_t NULL_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; (void)td; (void)sptr; @@ -164,7 +222,7 @@ asn_enc_rval_t NULL_encode_oer(const asn_TYPE_descriptor_t *td, const asn_oer_constraints_t *constraints, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; (void)td; (void)sptr; @@ -215,7 +273,7 @@ asn_enc_rval_t NULL_encode_uper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; (void)td; (void)constraints; @@ -230,7 +288,7 @@ asn_dec_rval_t NULL_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - asn_dec_rval_t rv; + asn_dec_rval_t rv = {RC_OK, 0}; (void)opt_codec_ctx; (void)td; @@ -260,7 +318,7 @@ asn_enc_rval_t NULL_encode_aper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; (void)td; (void)constraints; diff --git a/lib/asn1c/common/NULL.h b/lib/asn1c/common/NULL.h index 802d12c00..048dba7fa 100644 --- a/lib/asn1c/common/NULL.h +++ b/lib/asn1c/common/NULL.h @@ -6,23 +6,24 @@ #define ASN_TYPE_NULL_H #include -#include #ifdef __cplusplus extern "C" { #endif /* - * The value of the NULL type is meaningless: see BOOLEAN if you want to - * carry true/false semantics. + * The value of the NULL type is meaningless. + * Use the BOOLEAN type if you need to carry true/false semantics. */ typedef int NULL_t; extern asn_TYPE_descriptor_t asn_DEF_NULL; extern asn_TYPE_operation_t asn_OP_NULL; +asn_struct_free_f NULL_free; asn_struct_print_f NULL_print; asn_struct_compare_f NULL_compare; +ber_type_decoder_f NULL_decode_ber; der_type_encoder_f NULL_encode_der; xer_type_decoder_f NULL_decode_xer; xer_type_encoder_f NULL_encode_xer; @@ -34,8 +35,6 @@ per_type_decoder_f NULL_decode_aper; per_type_encoder_f NULL_encode_aper; asn_random_fill_f NULL_random_fill; -#define NULL_free BOOLEAN_free -#define NULL_decode_ber BOOLEAN_decode_ber #define NULL_constraint asn_generic_no_constraint #ifdef __cplusplus diff --git a/lib/asn1c/common/NativeEnumerated.c b/lib/asn1c/common/NativeEnumerated.c index 7c069e78d..33e75bb66 100644 --- a/lib/asn1c/common/NativeEnumerated.c +++ b/lib/asn1c/common/NativeEnumerated.c @@ -66,7 +66,7 @@ NativeEnumerated_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const long *native = (const long *)sptr; const asn_INTEGER_enum_map_t *el; @@ -161,9 +161,9 @@ asn_enc_rval_t NativeEnumerated_encode_uper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { - const asn_INTEGER_specifics_t *specs = + const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; long native, value; const asn_per_constraint_t *ct; int inext = 0; @@ -282,11 +282,19 @@ NativeEnumerated_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, /* * X.691, #10.6: normally small non-negative whole number; */ - value = uper_get_nsnnwn(pd); + + /* XXX handle indefinite index length > 64k */ + value = aper_get_nsnnwn(pd, 65537); if(value < 0) ASN__DECODE_STARVED; value += specs->extension - 1; - if(value >= specs->map_count) - ASN__DECODE_FAILED; + //if(value >= specs->map_count) + // ASN__DECODE_FAILED; + if(value >= specs->map_count) { + ASN_DEBUG("Decoded unknown index value %s = %ld", td->name, value); + /* unknown index. Workaround => set the first enumeration value */ + *native = specs->value2enum[0].nat_value; + return rval; + } } *native = specs->value2enum[value].nat_value; @@ -300,7 +308,7 @@ NativeEnumerated_encode_aper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; long native, value; const asn_per_constraint_t *ct; int inext = 0; diff --git a/lib/asn1c/common/NativeEnumerated_oer.c b/lib/asn1c/common/NativeEnumerated_oer.c index 3222348d1..ee3c1895e 100644 --- a/lib/asn1c/common/NativeEnumerated_oer.c +++ b/lib/asn1c/common/NativeEnumerated_oer.c @@ -103,7 +103,7 @@ NativeEnumerated_encode_oer(const asn_TYPE_descriptor_t *td, const asn_oer_constraints_t *constraints, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; long native; (void)constraints; diff --git a/lib/asn1c/common/NativeInteger.c b/lib/asn1c/common/NativeInteger.c index 8c00d54c3..c344b7c9f 100644 --- a/lib/asn1c/common/NativeInteger.c +++ b/lib/asn1c/common/NativeInteger.c @@ -113,7 +113,7 @@ NativeInteger_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, /* * ASN.1 encoded INTEGER: buf_ptr, length * Fill the native, at the same time checking for overflow. - * If overflow occured, return with RC_FAIL. + * If overflow occurred, return with RC_FAIL. */ { INTEGER_t tmp; @@ -154,8 +154,8 @@ asn_enc_rval_t NativeInteger_encode_der(const asn_TYPE_descriptor_t *sd, const void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { - unsigned long native = *(const unsigned long *)ptr; /* Disable sign ext. */ - asn_enc_rval_t erval; + unsigned long native = *(const unsigned long *)ptr; /* Disable sign ext. */ + asn_enc_rval_t erval = {0,0,0}; INTEGER_t tmp; #ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ @@ -236,7 +236,7 @@ NativeInteger_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; char scratch[32]; /* Enough for 64-bit int */ - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const long *native = (const long *)sptr; (void)ilevel; @@ -299,7 +299,7 @@ NativeInteger_encode_uper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; long native; INTEGER_t tmpint; @@ -361,7 +361,7 @@ NativeInteger_encode_aper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; long native; INTEGER_t tmpint; diff --git a/lib/asn1c/common/OBJECT_IDENTIFIER.c b/lib/asn1c/common/OBJECT_IDENTIFIER.c index 80ab797e7..8dccf01e3 100644 --- a/lib/asn1c/common/OBJECT_IDENTIFIER.c +++ b/lib/asn1c/common/OBJECT_IDENTIFIER.c @@ -115,10 +115,14 @@ OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, size_t arcbuf_len, return 0; } else { asn_oid_arc_t accum; + asn_oid_arc_t upper_limit = (ASN_OID_ARC_MAX >> 7); + /* When the value reaches "upper_limit", it can take */ + /* at most one more digit. If it exceeds "upper_limit" */ + /* but there are more digits - it's an Overflow condition */ /* Gather all bits into the accumulator */ for(accum = 0; b < arcend; b++) { accum = (accum << 7) | (*b & ~0x80); - if((*b & 0x80) == 0) { + if((*b & 0x80) == 0) { // no more digits if(accum <= ASN_OID_ARC_MAX) { *ret_value = accum; return 1 + (b - arcbuf); @@ -126,7 +130,12 @@ OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, size_t arcbuf_len, errno = ERANGE; /* Overflow */ return -1; } - } + } else { // to make sure we aren't wrapping around + if(accum > upper_limit) { + errno = ERANGE; /* Overflow */ + return -1; + } + } } errno = EINVAL; return -1; @@ -243,7 +252,7 @@ OBJECT_IDENTIFIER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; (void)ilevel; (void)flags; diff --git a/lib/asn1c/common/OCTET_STRING.c b/lib/asn1c/common/OCTET_STRING.c index 577933070..469c906df 100644 --- a/lib/asn1c/common/OCTET_STRING.c +++ b/lib/asn1c/common/OCTET_STRING.c @@ -123,7 +123,7 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { /* * The main reason why ASN.1 is still alive is that too much time and effort * is necessary for learning it more or less adequately, thus creating a gut - * necessity to demonstrate that aquired skill everywhere afterwards. + * necessity to demonstrate that acquired skill everywhere afterwards. * No, I am not going to explain what the following stuff is. */ struct _stack_el { @@ -539,7 +539,7 @@ asn_enc_rval_t OCTET_STRING_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = { 0, 0, 0 }; const asn_OCTET_STRING_specifics_t *specs = td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics : &asn_SPC_OCTET_STRING_specs; @@ -603,7 +603,7 @@ OCTET_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { const char * const h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; - asn_enc_rval_t er; + asn_enc_rval_t er = { 0, 0, 0 }; char scratch[16 * 3 + 4]; char *p = scratch; uint8_t *buf; @@ -753,8 +753,8 @@ asn_enc_rval_t OCTET_STRING_encode_xer_utf8(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; - asn_enc_rval_t er; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; uint8_t *buf, *end; uint8_t *ss; /* Sequence start */ ssize_t encoded_len = 0; @@ -1753,7 +1753,8 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ if(csiz->effective_bits == 0) { int ret; - if (st->size > 2) { /* X.691 #16 NOTE 1 */ + /* X.691 #16 NOTE 1 for fixed length (<= 16 bits) strings */ + if (st->size > 2 || csiz->range_bits != 0) { if (aper_get_align(pd) < 0) RETURN(RC_FAIL); } @@ -1788,13 +1789,13 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, void *p; int ret; + repeat = 0; /* Get the PER length */ if (csiz->upper_bound - csiz->lower_bound == 0) /* Indefinite length case */ raw_len = aper_get_length(pd, -1, csiz->effective_bits, &repeat); else raw_len = aper_get_length(pd, csiz->upper_bound - csiz->lower_bound + 1, csiz->effective_bits, &repeat); - repeat = 0; if(raw_len < 0) RETURN(RC_WMORE); raw_len += csiz->lower_bound; @@ -1802,7 +1803,9 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, (long)csiz->effective_bits, (long)raw_len, repeat ? "repeat" : "once", td->name); - if (raw_len > 2) { /* X.691 #16 NOTE 1 */ + /* X.691 #16 NOTE 1 for fixed length (<=16 bits) strings */ + if ((raw_len > 2) || (csiz->upper_bound > 2) || (csiz->range_bits != 0)) + { if (aper_get_align(pd) < 0) RETURN(RC_FAIL); } @@ -1953,10 +1956,14 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td, st->size, sizeinunits - csiz->lower_bound, csiz->effective_bits); if (csiz->effective_bits > 0) { - ret = aper_put_length(po, csiz->upper_bound - csiz->lower_bound + 1, sizeinunits - csiz->lower_bound); + ret = aper_put_length(po, csiz->upper_bound - csiz->lower_bound + 1, sizeinunits - csiz->lower_bound, 0); if(ret) ASN__ENCODE_FAILED; } - if (st->size > 2) { /* X.691 #16 NOTE 1 */ + if (csiz->effective_bits > 0 || (st->size > 2) + || (csiz->upper_bound > (2 * 8 / unit_bits)) + || (csiz->range_bits != 0) + ) + { /* X.691 #16 NOTE 1 for fixed length (<=16 bits) strings*/ if (aper_put_align(po) < 0) ASN__ENCODE_FAILED; } @@ -1975,14 +1982,15 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td, ASN_DEBUG("Encoding %lu bytes", st->size); if(sizeinunits == 0) { - if(aper_put_length(po, -1, 0)) + if(aper_put_length(po, -1, 0, 0)) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } buf = st->buf; while(sizeinunits) { - ssize_t maySave = aper_put_length(po, -1, sizeinunits); + int need_eom = 0; + ssize_t maySave = aper_put_length(po, -1, sizeinunits, &need_eom); if(maySave < 0) ASN__ENCODE_FAILED; @@ -2004,6 +2012,8 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td, buf += maySave >> 3; sizeinunits -= maySave; assert(!(maySave & 0x07) || !sizeinunits); + if(need_eom && aper_put_length(po, -1, 0, 0)) + ASN__ENCODE_FAILED; /* End of Message length */ } ASN__ENCODED_OK(er); diff --git a/lib/asn1c/common/OPEN_TYPE.c b/lib/asn1c/common/OPEN_TYPE.c index fd25b6907..a54e99c3c 100644 --- a/lib/asn1c/common/OPEN_TYPE.c +++ b/lib/asn1c/common/OPEN_TYPE.c @@ -364,7 +364,7 @@ OPEN_TYPE_encode_uper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const void *memb_ptr; /* Pointer to the member */ asn_TYPE_member_t *elm; /* CHOICE's element */ - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; unsigned present; (void)constraints; @@ -474,7 +474,7 @@ OPEN_TYPE_encode_aper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const void *memb_ptr; /* Pointer to the member */ asn_TYPE_member_t *elm; /* CHOICE's element */ - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; unsigned present; (void)constraints; diff --git a/lib/asn1c/common/ObjectDescriptor.c b/lib/asn1c/common/ObjectDescriptor.c new file mode 100644 index 000000000..5d8bfb2d6 --- /dev/null +++ b/lib/asn1c/common/ObjectDescriptor.c @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +/* + * ObjectDescriptor basic type description. + */ +static const ber_tlv_tag_t asn_DEF_ObjectDescriptor_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), /* [UNIVERSAL 7] IMPLICIT ... */ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +asn_TYPE_operation_t asn_OP_ObjectDescriptor = { + OCTET_STRING_free, + OCTET_STRING_print_utf8, /* Treat as ASCII subset (it's not) */ + OCTET_STRING_compare, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_utf8, + OCTET_STRING_encode_xer_utf8, +#ifdef ASN_DISABLE_OER_SUPPORT + 0, + 0, +#else + 0, + 0, +#endif /* ASN_DISABLE_OER_SUPPORT */ +#ifdef ASN_DISABLE_PER_SUPPORT + 0, + 0, + 0, + 0, +#else + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, +#endif /* ASN_DISABLE_PER_SUPPORT */ + 0, /* Not supported for ObjectDescriptor */ + 0 /* Use generic outmost tag fetcher */ +}; +asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor = { + "ObjectDescriptor", + "ObjectDescriptor", + &asn_OP_ObjectDescriptor, + asn_DEF_ObjectDescriptor_tags, + sizeof(asn_DEF_ObjectDescriptor_tags) + / sizeof(asn_DEF_ObjectDescriptor_tags[0]) - 1, + asn_DEF_ObjectDescriptor_tags, + sizeof(asn_DEF_ObjectDescriptor_tags) + / sizeof(asn_DEF_ObjectDescriptor_tags[0]), + { 0, 0, asn_generic_unknown_constraint }, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/lib/asn1c/common/ObjectDescriptor.h b/lib/asn1c/common/ObjectDescriptor.h new file mode 100644 index 000000000..fa1c1fcc0 --- /dev/null +++ b/lib/asn1c/common/ObjectDescriptor.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2003-2017 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ObjectDescriptor_H_ +#define _ObjectDescriptor_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef GraphicString_t ObjectDescriptor_t; /* Implemented via GraphicString */ + +extern asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor; +extern asn_TYPE_operation_t asn_OP_ObjectDescriptor; + +#define ObjectDescriptor_free OCTET_STRING_free +#define ObjectDescriptor_print OCTET_STRING_print_utf8 +#define ObjectDescriptor_constraint asn_generic_unknown_constraint +#define ObjectDescriptor_decode_ber OCTET_STRING_decode_ber +#define ObjectDescriptor_encode_der OCTET_STRING_encode_der +#define ObjectDescriptor_decode_xer OCTET_STRING_decode_xer_utf8 +#define ObjectDescriptor_encode_xer OCTET_STRING_encode_xer_utf8 +#define ObjectDescriptor_decode_uper OCTET_STRING_decode_uper +#define ObjectDescriptor_encode_uper OCTET_STRING_encode_uper +#define ObjectDescriptor_decode_aper OCTET_STRING_decode_aper +#define ObjectDescriptor_encode_aper OCTET_STRING_encode_aper + +#ifdef __cplusplus +} +#endif + +#endif /* _ObjectDescriptor_H_ */ diff --git a/lib/asn1c/common/asn_application.c b/lib/asn1c/common/asn_application.c index a55e14e48..2bff46064 100644 --- a/lib/asn1c/common/asn_application.c +++ b/lib/asn1c/common/asn_application.c @@ -134,7 +134,7 @@ asn_encode(const asn_codec_ctx_t *opt_codec_ctx, enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *callback, void *callback_key) { struct callback_failure_catch_key cb_key; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; if(!callback) { errno = EINVAL; @@ -162,7 +162,7 @@ asn_encode_to_buffer(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, const void *sptr, void *buffer, size_t buffer_size) { struct overrun_encoder_key buf_key; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; if(buffer_size > 0 && !buffer) { errno = EINVAL; @@ -225,7 +225,7 @@ asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx, enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *callback, void *callback_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; enum xer_encoder_flags_e xer_flags = XER_F_CANONICAL; (void)opt_codec_ctx; /* Parameters are not checked on encode yet. */ diff --git a/lib/asn1c/common/asn_application.h b/lib/asn1c/common/asn_application.h index 449318df1..034f64612 100644 --- a/lib/asn1c/common/asn_application.h +++ b/lib/asn1c/common/asn_application.h @@ -24,7 +24,7 @@ enum asn_transfer_syntax { ATS_INVALID = 0, /* Plaintext output (not conforming to any standard), for debugging. */ ATS_NONSTANDARD_PLAINTEXT, - /* Returns a randomly generatede structure. */ + /* Returns a randomly generated structure. */ ATS_RANDOM, /* * X.690: diff --git a/lib/asn1c/common/asn_bit_data.h b/lib/asn1c/common/asn_bit_data.h index 59de7af5f..f14714bbd 100644 --- a/lib/asn1c/common/asn_bit_data.h +++ b/lib/asn1c/common/asn_bit_data.h @@ -36,7 +36,7 @@ asn_bit_data_t *asn_bit_data_new_contiguous(const void *data, size_t size_bits); */ int32_t asn_get_few_bits(asn_bit_data_t *, int get_nbits); -/* Undo the immediately preceeding "get_few_bits" operation */ +/* Undo the immediately preceding "get_few_bits" operation */ void asn_get_undo(asn_bit_data_t *, int get_nbits); /* diff --git a/lib/asn1c/common/asn_codecs_prim.c b/lib/asn1c/common/asn_codecs_prim.c index 78448a8ec..fc2424773 100644 --- a/lib/asn1c/common/asn_codecs_prim.c +++ b/lib/asn1c/common/asn_codecs_prim.c @@ -84,7 +84,7 @@ asn_enc_rval_t der_encode_primitive(const asn_TYPE_descriptor_t *td, const void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; const ASN__PRIMITIVE_TYPE_t *st = (const ASN__PRIMITIVE_TYPE_t *)sptr; ASN_DEBUG("%s %s as a primitive type (tm=%d)", diff --git a/lib/asn1c/common/asn_internal.c b/lib/asn1c/common/asn_internal.c index 91e537c48..c2a8108e7 100644 --- a/lib/asn1c/common/asn_internal.c +++ b/lib/asn1c/common/asn_internal.c @@ -14,6 +14,7 @@ asn__format_to_callback(int (*cb)(const void *, size_t, void *key), void *key, va_start(args, fmt); wrote = vsnprintf(buf, buf_size, fmt, args); + va_end(args); if(wrote < (ssize_t)buf_size) { if(wrote < 0) { if(buf != scratch) FREEMEM(buf); diff --git a/lib/asn1c/common/asn_internal.h b/lib/asn1c/common/asn_internal.h index 3358c36c5..a8bb73171 100644 --- a/lib/asn1c/common/asn_internal.h +++ b/lib/asn1c/common/asn_internal.h @@ -7,7 +7,9 @@ */ #ifndef ASN_INTERNAL_H #define ASN_INTERNAL_H +#ifndef __EXTENSIONS__ #define __EXTENSIONS__ /* for Sun */ +#endif #include "asn_application.h" /* Application-visible API */ @@ -30,10 +32,10 @@ int get_asn1c_environment_version(void); /* Run-time version */ #define FREEMEM(ptr) free(ptr) #else #include "ogs-core.h" -#define CALLOC(nmemb, size) ogs_calloc(nmemb, size) -#define MALLOC(size) ogs_malloc(size) -#define REALLOC(oldptr, size) ogs_realloc(oldptr, size) -#define FREEMEM(ptr) ogs_free(ptr) +#define CALLOC(nmemb, size) ogs_calloc(nmemb, size) +#define MALLOC(size) ogs_malloc(size) +#define REALLOC(oldptr, size) ogs_realloc(oldptr, size) +#define FREEMEM(ptr) ogs_free(ptr) #endif #define asn_debug_indent 0 diff --git a/lib/asn1c/common/ber_tlv_tag.c b/lib/asn1c/common/ber_tlv_tag.c index 4a7d732f8..64ec14f07 100644 --- a/lib/asn1c/common/ber_tlv_tag.c +++ b/lib/asn1c/common/ber_tlv_tag.c @@ -42,7 +42,7 @@ ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { */ if(val >> ((8 * sizeof(val)) - 9)) { /* - * We would not be able to accomodate + * We would not be able to accommodate * any more tag bits. */ return -1; diff --git a/lib/asn1c/common/constr_CHOICE.c b/lib/asn1c/common/constr_CHOICE.c index 402b6be9a..721409213 100644 --- a/lib/asn1c/common/constr_CHOICE.c +++ b/lib/asn1c/common/constr_CHOICE.c @@ -65,7 +65,7 @@ static unsigned _fetch_present_idx(const void *struct_ptr, unsigned off, unsigned size); static void _set_present_idx(void *sptr, unsigned offset, unsigned size, - unsigned pres); + unsigned present); static const void *_get_member_ptr(const asn_TYPE_descriptor_t *, const void *sptr, asn_TYPE_member_t **elm, unsigned *present); @@ -162,7 +162,7 @@ CHOICE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, } if(ctx->left >= 0) { - /* ?Substracted below! */ + /* ?Subtracted below! */ ctx->left += rval.consumed; } ADVANCE(rval.consumed); @@ -365,7 +365,7 @@ CHOICE_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, void *app_key) { const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics; asn_TYPE_member_t *elm; /* CHOICE element */ - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; const void *memb_ptr; size_t computed_size = 0; unsigned present; @@ -779,10 +779,10 @@ asn_enc_rval_t CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - const asn_CHOICE_specifics_t *specs = - (const asn_CHOICE_specifics_t *)td->specifics; - asn_enc_rval_t er; - unsigned present; + const asn_CHOICE_specifics_t *specs = + (const asn_CHOICE_specifics_t *)td->specifics; + asn_enc_rval_t er = {0,0,0}; + unsigned present = 0; if(!sptr) ASN__ENCODE_FAILED; @@ -795,9 +795,9 @@ CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, if(present == 0 || present > td->elements_count) { ASN__ENCODE_FAILED; } else { - asn_enc_rval_t tmper; + asn_enc_rval_t tmper = {0,0,0}; asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + const void *memb_ptr = NULL; const char *mname = elm->name; unsigned int mlen = strlen(mname); @@ -920,7 +920,7 @@ asn_enc_rval_t CHOICE_encode_uper(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_per_outp_t *po) { - const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics; + const asn_CHOICE_specifics_t *specs = (const asn_CHOICE_specifics_t *)td->specifics; asn_TYPE_member_t *elm; /* CHOICE's element */ const asn_per_constraint_t *ct; const void *memb_ptr; @@ -997,7 +997,7 @@ CHOICE_encode_uper(const asn_TYPE_descriptor_t *td, return elm->type->op->uper_encoder( elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po); } else { - asn_enc_rval_t rval; + asn_enc_rval_t rval = {0,0,0}; if(specs->ext_start == -1) ASN__ENCODE_FAILED; if(uper_put_nsnnwn(po, present_enc - specs->ext_start)) ASN__ENCODE_FAILED; @@ -1083,7 +1083,7 @@ CHOICE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, rv = elm->type->op->aper_decoder(opt_codec_ctx, elm->type, elm->encoding_constraints.per_constraints, memb_ptr2, pd); } else { - rv = uper_open_type_get(opt_codec_ctx, elm->type, + rv = aper_open_type_get(opt_codec_ctx, elm->type, elm->encoding_constraints.per_constraints, memb_ptr2, pd); } @@ -1163,10 +1163,14 @@ CHOICE_encode_aper(const asn_TYPE_descriptor_t *td, return elm->type->op->aper_encoder(elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po); } else { - asn_enc_rval_t rval; + asn_enc_rval_t rval = {0,0,0}; if(specs->ext_start == -1) ASN__ENCODE_FAILED; - if(aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start)) + int n = present - specs->ext_start; + if(n <= 63) { + if(n < 0) ASN__ENCODE_FAILED; + if(per_put_few_bits(po, n, 7)) ASN__ENCODE_FAILED; + } else ASN__ENCODE_FAILED; if(aper_open_type_put(elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po)) diff --git a/lib/asn1c/common/constr_CHOICE_oer.c b/lib/asn1c/common/constr_CHOICE_oer.c index 6480a9610..18f148609 100644 --- a/lib/asn1c/common/constr_CHOICE_oer.c +++ b/lib/asn1c/common/constr_CHOICE_oer.c @@ -109,7 +109,7 @@ oer_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { */ if(val >> ((8 * sizeof(val)) - 9)) { /* - * We would not be able to accomodate + * We would not be able to accommodate * any more tag bits. */ return -1; @@ -216,7 +216,7 @@ CHOICE_decode_oer(const asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_member_t *elm = &elements[ctx->step]; /* CHOICE's element */ void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ - asn_dec_rval_t rval; + asn_dec_rval_t rval = {0,0}; /* * Compute the position of the member inside a structure, diff --git a/lib/asn1c/common/constr_SEQUENCE.c b/lib/asn1c/common/constr_SEQUENCE.c index 85c5eaa9c..ed7c7015c 100644 --- a/lib/asn1c/common/constr_SEQUENCE.c +++ b/lib/asn1c/common/constr_SEQUENCE.c @@ -167,7 +167,7 @@ SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, } if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Substracted below! */ + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); NEXT_PHASE(ctx); @@ -512,7 +512,7 @@ SEQUENCE_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { size_t computed_size = 0; - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; ssize_t ret; size_t edx; @@ -574,7 +574,7 @@ SEQUENCE_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; - asn_enc_rval_t tmperval; + asn_enc_rval_t tmperval = {0,0,0}; const void *memb_ptr; /* Pointer to the member */ const void *const *memb_ptr2; /* Pointer to that pointer */ @@ -868,18 +868,18 @@ asn_enc_rval_t SEQUENCE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; int xcan = (flags & XER_F_CANONICAL); asn_TYPE_descriptor_t *tmp_def_val_td = 0; void *tmp_def_val = 0; - size_t edx; + size_t edx; if(!sptr) ASN__ENCODE_FAILED; er.encoded = 0; for(edx = 0; edx < td->elements_count; edx++) { - asn_enc_rval_t tmper; + asn_enc_rval_t tmper = {0,0,0}; asn_TYPE_member_t *elm = &td->elements[edx]; const void *memb_ptr; const char *mname = elm->name; @@ -1357,7 +1357,7 @@ SEQUENCE_encode_uper(const asn_TYPE_descriptor_t *td, asn_per_outp_t *po) { const asn_SEQUENCE_specifics_t *specs = (const asn_SEQUENCE_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; int n_extensions; size_t edx; size_t i; @@ -1641,6 +1641,10 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, ASN_DEBUG("Read in extensions bitmap for %s of %ld bits (%x..)", td->name, bmlength, *epres); + /* Deal with padding */ + if (aper_get_align(pd) < 0) + ASN__DECODE_STARVED; + /* Go over extensions and read them in */ for(edx = specs->first_extension; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; @@ -1785,7 +1789,7 @@ SEQUENCE_encode_aper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const asn_SEQUENCE_specifics_t *specs = (const asn_SEQUENCE_specifics_t *)td->specifics; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; int n_extensions; size_t edx; size_t i; @@ -1835,7 +1839,7 @@ SEQUENCE_encode_aper(const asn_TYPE_descriptor_t *td, /* Eliminate default values */ if(present && elm->default_value_cmp - && elm->default_value_cmp(memb_ptr2) == 1) + && elm->default_value_cmp(*memb_ptr2) == 0) present = 0; ASN_DEBUG("Element %s %s %s->%s is %s", @@ -1881,7 +1885,7 @@ SEQUENCE_encode_aper(const asn_TYPE_descriptor_t *td, } /* Eliminate default values */ - if(elm->default_value_cmp && elm->default_value_cmp(memb_ptr2) == 1) + if(elm->default_value_cmp && elm->default_value_cmp(*memb_ptr2) == 0) continue; ASN_DEBUG("Encoding %s->%s", td->name, elm->name); diff --git a/lib/asn1c/common/constr_SEQUENCE_OF.c b/lib/asn1c/common/constr_SEQUENCE_OF.c index 2a500c367..2fff0924e 100644 --- a/lib/asn1c/common/constr_SEQUENCE_OF.c +++ b/lib/asn1c/common/constr_SEQUENCE_OF.c @@ -18,7 +18,7 @@ SEQUENCE_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr, const asn_anonymous_sequence_ *list = _A_CSEQUENCE_FROM_VOID(ptr); size_t computed_size = 0; ssize_t encoding_size = 0; - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; int edx; ASN_DEBUG("Estimating size of SEQUENCE OF %s", td->name); @@ -91,7 +91,7 @@ asn_enc_rval_t SEQUENCE_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics; const asn_TYPE_member_t *elm = td->elements; const asn_anonymous_sequence_ *list = _A_CSEQUENCE_FROM_VOID(sptr); @@ -107,7 +107,7 @@ SEQUENCE_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, er.encoded = 0; for(i = 0; i < list->count; i++) { - asn_enc_rval_t tmper; + asn_enc_rval_t tmper = {0,0,0}; void *memb_ptr = list->array[i]; if(!memb_ptr) continue; @@ -147,7 +147,7 @@ SEQUENCE_OF_encode_uper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const asn_anonymous_sequence_ *list; const asn_per_constraint_t *ct; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const asn_TYPE_member_t *elm = td->elements; size_t encoded_edx; @@ -231,7 +231,7 @@ SEQUENCE_OF_encode_aper(const asn_TYPE_descriptor_t *td, const void *sptr, asn_per_outp_t *po) { const asn_anonymous_sequence_ *list; const asn_per_constraint_t *ct; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; asn_TYPE_member_t *elm = td->elements; int seq; @@ -269,17 +269,20 @@ SEQUENCE_OF_encode_aper(const asn_TYPE_descriptor_t *td, ct->effective_bits)) ASN__ENCODE_FAILED; */ - if (aper_put_length(po, ct->upper_bound - ct->lower_bound + 1, list->count - ct->lower_bound) < 0) + if (ct->lower_bound == ct->upper_bound && ct->upper_bound < 65536) { + /* No length determinant */ + } else if (aper_put_length(po, ct->upper_bound - ct->lower_bound + 1, list->count - ct->lower_bound, 0) < 0) ASN__ENCODE_FAILED; } for(seq = -1; seq < list->count;) { ssize_t mayEncode; + int need_eom = 0; if(seq < 0) seq = 0; if(ct && ct->effective_bits >= 0) { mayEncode = list->count; } else { - mayEncode = aper_put_length(po, -1, list->count - seq); + mayEncode = aper_put_length(po, -1, list->count - seq, &need_eom); if(mayEncode < 0) ASN__ENCODE_FAILED; } @@ -291,6 +294,9 @@ SEQUENCE_OF_encode_aper(const asn_TYPE_descriptor_t *td, if(er.encoded == -1) ASN__ENCODE_FAILED; } + + if(need_eom && aper_put_length(po, -1, 0, 0)) + ASN__ENCODE_FAILED; /* End of Message length */ } ASN__ENCODED_OK(er); diff --git a/lib/asn1c/common/constr_SEQUENCE_oer.c b/lib/asn1c/common/constr_SEQUENCE_oer.c index 4f290a12c..02e241365 100644 --- a/lib/asn1c/common/constr_SEQUENCE_oer.c +++ b/lib/asn1c/common/constr_SEQUENCE_oer.c @@ -453,7 +453,7 @@ SEQUENCE_encode_oer(const asn_TYPE_descriptor_t *td, */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const void *memb_ptr; if(IN_EXTENSION_GROUP(specs, edx)) break; @@ -486,7 +486,7 @@ SEQUENCE_encode_oer(const asn_TYPE_descriptor_t *td, } /* - * Before encode extensions, encode extensions additions presense bitmap + * Before encode extensions, encode extensions additions presence bitmap # X.696 (08/2015) #16.4. */ if(has_extensions) { diff --git a/lib/asn1c/common/constr_SET_OF.c b/lib/asn1c/common/constr_SET_OF.c index 3de902011..f07bcb8d0 100644 --- a/lib/asn1c/common/constr_SET_OF.c +++ b/lib/asn1c/common/constr_SET_OF.c @@ -123,7 +123,7 @@ SET_OF_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, } if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Substracted below! */ + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); ASN_DEBUG("Structure consumes %ld bytes, " @@ -349,14 +349,15 @@ SET_OF__encode_sorted_free(struct _el_buffer *el_buf, size_t count) { enum SET_OF__encode_method { SOES_DER, /* Distinguished Encoding Rules */ - SOES_CUPER /* Canonical Unaligned Packed Encoding Rules */ + SOES_CUPER, /* Canonical Unaligned Packed Encoding Rules */ + SOES_CAPER /* Canonical Aligned Packed Encoding Rules */ }; static struct _el_buffer * SET_OF__encode_sorted(const asn_TYPE_member_t *elm, const asn_anonymous_set_ *list, enum SET_OF__encode_method method) { - static struct _el_buffer *encoded_els; + struct _el_buffer *encoded_els; int edx; encoded_els = @@ -371,7 +372,7 @@ SET_OF__encode_sorted(const asn_TYPE_member_t *elm, for(edx = 0; edx < list->count; edx++) { const void *memb_ptr = list->array[edx]; struct _el_buffer *encoding_el = &encoded_els[edx]; - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; if(!memb_ptr) break; @@ -393,6 +394,19 @@ SET_OF__encode_sorted(const asn_TYPE_member_t *elm, encoding_el->bits_unused = (8 - extra_bits) & 0x7; } break; + case SOES_CAPER: + erval = aper_encode(elm->type, + elm->encoding_constraints.per_constraints, + memb_ptr, _el_addbytes, encoding_el); + + if(erval.encoded != -1) { + size_t extra_bits = erval.encoded % 8; + assert(encoding_el->length == (size_t)(erval.encoded + 7) / 8); + encoding_el->bits_unused = (8 - extra_bits) & 0x7; + } + + break; + default: assert(!"Unreachable"); break; @@ -435,7 +449,7 @@ SET_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, */ for(edx = 0; edx < list->count; edx++) { void *memb_ptr = list->array[edx]; - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; if(!memb_ptr) ASN__ENCODE_FAILED; @@ -457,7 +471,7 @@ SET_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, computed_size += encoding_size; if(!cb || list->count == 0) { - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; erval.encoded = computed_size; ASN__ENCODED_OK(erval); } @@ -488,7 +502,7 @@ SET_OF_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr, SET_OF__encode_sorted_free(encoded_els, list->count); if(edx == list->count) { - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; assert(computed_size == (size_t)encoding_size); erval.encoded = computed_size; ASN__ENCODED_OK(erval); @@ -526,7 +540,7 @@ SET_OF_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value from a decoder */ + asn_dec_rval_t rval = {RC_OK, 0};/* Return value from a decoder */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ /* @@ -565,7 +579,7 @@ SET_OF_decode_xer(const asn_codec_ctx_t *opt_codec_ctx, * Go inside the inner member of a set. */ if(ctx->phase == 2) { - asn_dec_rval_t tmprval; + asn_dec_rval_t tmprval = {RC_OK, 0}; /* Invoke the inner type decoder, m.b. multiple times */ ASN_DEBUG("XER/SET OF element [%s]", elm_tag); @@ -697,7 +711,7 @@ asn_enc_rval_t SET_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics; const asn_TYPE_member_t *elm = td->elements; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); @@ -722,7 +736,7 @@ SET_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, er.encoded = 0; for(i = 0; i < list->count; i++) { - asn_enc_rval_t tmper; + asn_enc_rval_t tmper = {0,0,0}; void *memb_ptr = list->array[i]; if(!memb_ptr) continue; @@ -909,7 +923,7 @@ SET_OF_decode_uper(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - asn_dec_rval_t rv; + asn_dec_rval_t rv = {RC_OK, 0}; const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics; const asn_TYPE_member_t *elm = td->elements; /* Single one */ void *st = *sptr; @@ -1007,7 +1021,7 @@ SET_OF_encode_uper(const asn_TYPE_descriptor_t *td, const asn_per_constraint_t *ct; const asn_TYPE_member_t *elm = td->elements; struct _el_buffer *encoded_els; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; size_t encoded_edx; if(!sptr) ASN__ENCODE_FAILED; @@ -1097,11 +1111,95 @@ SET_OF_encode_uper(const asn_TYPE_descriptor_t *td, } } +asn_enc_rval_t +SET_OF_encode_aper(const asn_TYPE_descriptor_t *td, + const asn_per_constraints_t *constraints, const void *sptr, + asn_per_outp_t *po) { + const asn_anonymous_set_ *list; + const asn_per_constraint_t *ct; + const asn_TYPE_member_t *elm = td->elements; + struct _el_buffer *encoded_els; + asn_enc_rval_t er = {0,0,0}; + int seq; + + if(!sptr) ASN__ENCODE_FAILED; + + list = _A_CSET_FROM_VOID(sptr); + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SET OF (%d)", td->name, list->count); + + if(constraints) ct = &constraints->size; + else if(td->encoding_constraints.per_constraints) + ct = &td->encoding_constraints.per_constraints->size; + else ct = 0; + + /* If extensible constraint, check if size is in root */ + if(ct) { + int not_in_root = + (list->count < ct->lower_bound || list->count > ct->upper_bound); + ASN_DEBUG("lb %ld ub %ld %s", ct->lower_bound, ct->upper_bound, + ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); + if(ct->flags & APC_EXTENSIBLE) { + /* Declare whether size is in extension root */ + if(per_put_few_bits(po, not_in_root, 1)) ASN__ENCODE_FAILED; + if(not_in_root) ct = 0; + } else if(not_in_root && ct->effective_bits >= 0) { + ASN__ENCODE_FAILED; + } + + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ + /*if(per_put_few_bits(po, list->count - ct->lower_bound, + ct->effective_bits)) + ASN__ENCODE_FAILED;*/ + + if (aper_put_length(po, ct->upper_bound - ct->lower_bound + 1, list->count - ct->lower_bound, 0) < 0) { + ASN__ENCODE_FAILED; + } + } + + /* + * Canonical PER #22.1 mandates dynamic sorting of the SET OF elements + * according to their encodings. Build an array of the encoded elements. + */ + encoded_els = SET_OF__encode_sorted(elm, list, SOES_CAPER); + + for(seq = 0; seq < list->count;) { + ssize_t may_encode; + int need_eom = 0; + if(ct && ct->effective_bits >= 0) { + may_encode = list->count; + } else { + may_encode = + aper_put_length(po, -1, list->count - seq, &need_eom); + if(may_encode < 0) ASN__ENCODE_FAILED; + } + + while(may_encode--) { + const struct _el_buffer *el = &encoded_els[seq++]; + if(asn_put_many_bits(po, el->buf, + (8 * el->length) - el->bits_unused) < 0) { + break; + } + } + if(need_eom && aper_put_length(po, -1, 0, 0)) + ASN__ENCODE_FAILED; /* End of Message length */ + } + + SET_OF__encode_sorted_free(encoded_els, list->count); + + ASN__ENCODED_OK(er); +} + asn_dec_rval_t SET_OF_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - asn_dec_rval_t rv; + asn_dec_rval_t rv = {RC_OK, 0}; const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics; const asn_TYPE_member_t *elm = td->elements; /* Single one */ void *st = *sptr; @@ -1293,7 +1391,7 @@ asn_TYPE_operation_t asn_OP_SET_OF = { SET_OF_decode_uper, SET_OF_encode_uper, SET_OF_decode_aper, - 0, /* SET_OF_encode_aper */ + SET_OF_encode_aper, #endif /* ASN_DISABLE_PER_SUPPORT */ SET_OF_random_fill, 0 /* Use generic outmost tag fetcher */ diff --git a/lib/asn1c/common/constr_SET_OF_oer.c b/lib/asn1c/common/constr_SET_OF_oer.c index 88d7a2a1b..520051811 100644 --- a/lib/asn1c/common/constr_SET_OF_oer.c +++ b/lib/asn1c/common/constr_SET_OF_oer.c @@ -264,7 +264,7 @@ SET_OF_encode_oer(const asn_TYPE_descriptor_t *td, for(n = 0; n < list->count; n++) { void *memb_ptr = list->array[n]; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; er = elm->type->op->oer_encoder( elm->type, elm->encoding_constraints.oer_constraints, memb_ptr, cb, app_key); @@ -276,7 +276,7 @@ SET_OF_encode_oer(const asn_TYPE_descriptor_t *td, } { - asn_enc_rval_t erval; + asn_enc_rval_t erval = {0,0,0}; erval.encoded = computed_size; ASN__ENCODED_OK(erval); } diff --git a/lib/asn1c/common/constr_TYPE.h b/lib/asn1c/common/constr_TYPE.h index d80dea5a3..567a75cbe 100644 --- a/lib/asn1c/common/constr_TYPE.h +++ b/lib/asn1c/common/constr_TYPE.h @@ -239,8 +239,8 @@ typedef struct asn_TYPE_member_s { typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ unsigned el_no; /* Index of the associated member, base 0 */ - int toff_first; /* First occurence of the el_tag, relative */ - int toff_last; /* Last occurence of the el_tag, relative */ + int toff_first; /* First occurrence of the el_tag, relative */ + int toff_last; /* Last occurrence of the el_tag, relative */ } asn_TYPE_tag2member_t; /* diff --git a/lib/asn1c/common/meson.build b/lib/asn1c/common/meson.build index 7348aa40a..1c1a0f3f3 100644 --- a/lib/asn1c/common/meson.build +++ b/lib/asn1c/common/meson.build @@ -20,12 +20,13 @@ libasn1c_common_sources = files(''' OCTET_STRING.h OPEN_TYPE.h constr_CHOICE.h - BOOLEAN.h + GraphicString.h INTEGER.h NULL.h NativeEnumerated.h NativeInteger.h OBJECT_IDENTIFIER.h + ObjectDescriptor.h PrintableString.h asn_SEQUENCE_OF.h asn_SET_OF.h @@ -60,12 +61,13 @@ libasn1c_common_sources = files(''' ANY.c OPEN_TYPE.c - BOOLEAN.c + GraphicString.c INTEGER.c NULL.c NativeEnumerated.c NativeInteger.c OBJECT_IDENTIFIER.c + ObjectDescriptor.c PrintableString.c asn_SEQUENCE_OF.c asn_SET_OF.c diff --git a/lib/asn1c/common/oer_encoder.c b/lib/asn1c/common/oer_encoder.c index 895aed4ec..a284cc2f3 100644 --- a/lib/asn1c/common/oer_encoder.c +++ b/lib/asn1c/common/oer_encoder.c @@ -121,7 +121,7 @@ oer_open_type_put(const asn_TYPE_descriptor_t *td, const asn_oer_constraints_t *constraints, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { size_t serialized_byte_count = 0; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; ssize_t len_len; er = td->op->oer_encoder(td, constraints, sptr, oer__count_bytes, diff --git a/lib/asn1c/common/per_encoder.c b/lib/asn1c/common/per_encoder.c index a5d73ced0..9d0c6febc 100644 --- a/lib/asn1c/common/per_encoder.c +++ b/lib/asn1c/common/per_encoder.c @@ -17,7 +17,7 @@ uper_encode(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { asn_per_outp_t po; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; /* * Invoke type-specific encoder. @@ -114,7 +114,7 @@ ssize_t uper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, void **buffer_r) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; enc_dyn_arg key; memset(&key, 0, sizeof(key)); @@ -181,7 +181,7 @@ ssize_t aper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, void **buffer_r) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; enc_dyn_arg key; memset(&key, 0, sizeof(key)); @@ -233,7 +233,7 @@ aper_encode(const asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, const void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { asn_per_outp_t po; - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; /* * Invoke type-specific encoder. @@ -244,7 +244,7 @@ aper_encode(const asn_TYPE_descriptor_t *td, po.buffer = po.tmpspace; po.nboff = 0; po.nbits = 8 * sizeof(po.tmpspace); - po.output = cb; + po.output = cb ? cb : ignore_output; po.op_key = app_key; po.flushed_bytes = 0; diff --git a/lib/asn1c/common/per_opentype.c b/lib/asn1c/common/per_opentype.c index 28f3cb67d..253aaa508 100644 --- a/lib/asn1c/common/per_opentype.c +++ b/lib/asn1c/common/per_opentype.c @@ -137,7 +137,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx, } else { FREEMEM(buf); /* rv.code could be RC_WMORE, nonsense in this context */ - rv.code = RC_FAIL; /* Noone would give us more */ + rv.code = RC_FAIL; /* No one would give us more */ } return rv; @@ -487,11 +487,16 @@ aper_open_type_put(const asn_TYPE_descriptor_t *td, if(size <= 0) return -1; for(bptr = buf, toGo = size; toGo;) { - ssize_t maySave = aper_put_length(po, -1, toGo); + int need_eom = 0; + ssize_t maySave = aper_put_length(po, -1, toGo, &need_eom); if(maySave < 0) break; if(per_put_many_bits(po, bptr, maySave * 8)) break; bptr = (char *)bptr + maySave; toGo -= maySave; + if(need_eom && aper_put_length(po, -1, 0, 0)) { + FREEMEM(buf); + return -1; + } } FREEMEM(buf); diff --git a/lib/asn1c/common/per_support.c b/lib/asn1c/common/per_support.c index 228567760..090ecd1f6 100644 --- a/lib/asn1c/common/per_support.c +++ b/lib/asn1c/common/per_support.c @@ -121,9 +121,9 @@ uper_put_nsnnwn(asn_per_outp_t *po, int n) { /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { - unsigned long lhalf; /* Lower half of the number*/ - long half; +int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *out_value, int nbits) { + uintmax_t lhalf; /* Lower half of the number*/ + intmax_t half; if(nbits <= 31) { half = per_get_few_bits(pd, nbits); @@ -141,7 +141,7 @@ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_val if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) return -1; - *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; + *out_value = ((uintmax_t)half << (nbits - 31)) | lhalf; return 0; } @@ -216,13 +216,13 @@ uper_put_nslength(asn_per_outp_t *po, size_t length) { } static int -per__long_range(long lb, long ub, unsigned long *range_r) { - unsigned long bounds_range; +per__imax_range(intmax_t lb, intmax_t ub, uintmax_t *range_r) { + uintmax_t bounds_range; if((ub < 0) == (lb < 0)) { bounds_range = ub - lb; } else if(lb < 0) { assert(ub >= 0); - bounds_range = 1 + ((unsigned long)ub + (unsigned long)-(lb + 1)); + bounds_range = 1 + ((uintmax_t)ub + (uintmax_t)-(lb + 1)); } else { assert(!"Unreachable"); return -1; @@ -232,12 +232,12 @@ per__long_range(long lb, long ub, unsigned long *range_r) { } int -per_long_range_rebase(long v, long lb, long ub, unsigned long *output) { - unsigned long range; +per_imax_range_rebase(intmax_t v, intmax_t lb, intmax_t ub, uintmax_t *output) { + uintmax_t range; assert(lb <= ub); - if(v < lb || v > ub || per__long_range(lb, ub, &range) < 0) { + if(v < lb || v > ub || per__imax_range(lb, ub, &range) < 0) { /* Range error. */ return -1; } @@ -253,12 +253,12 @@ per_long_range_rebase(long v, long lb, long ub, unsigned long *output) { *output = v-lb; return 0; } else if(v < 0) { - unsigned long rebased = 1 + (unsigned long)-(v+1) + (unsigned long)lb; + uintmax_t rebased = 1 + (uintmax_t)-(v+1) + (uintmax_t)lb; assert(rebased <= range); /* By construction */ *output = rebased; return 0; } else if(lb < 0) { - unsigned long rebased = 1 + (unsigned long)-(lb+1) + (unsigned long)v; + uintmax_t rebased = 1 + (uintmax_t)-(lb+1) + (uintmax_t)v; assert(rebased <= range); /* By construction */ *output = rebased; return 0; @@ -269,10 +269,18 @@ per_long_range_rebase(long v, long lb, long ub, unsigned long *output) { } int -per_long_range_unrebase(unsigned long inp, long lb, long ub, long *outp) { - unsigned long range; +per_long_range_rebase(long v, intmax_t lb, intmax_t ub, unsigned long *output) { + uintmax_t tmp = *output; + int rc = per_imax_range_rebase((intmax_t)v, lb, ub, &tmp); + *output = tmp; + return rc; +} - if(per__long_range(lb, ub, &range) != 0) { +int +per_imax_range_unrebase(uintmax_t inp, intmax_t lb, intmax_t ub, intmax_t *outp) { + uintmax_t range; + + if(per__imax_range(lb, ub, &range) != 0) { return -1; } @@ -285,15 +293,23 @@ per_long_range_unrebase(unsigned long inp, long lb, long ub, long *outp) { return -1; } - if(inp <= LONG_MAX) { + if(inp <= INTMAX_MAX) { *outp = (long)inp + lb; } else { - *outp = (lb + LONG_MAX + 1) + (long)((inp - LONG_MAX) - 1); + *outp = (lb + INTMAX_MAX + 1) + (intmax_t)((inp - INTMAX_MAX) - 1); } return 0; } +int +per_long_range_unrebase(unsigned long inp, intmax_t lb, intmax_t ub, long *outp) { + intmax_t tmp = *outp; + int rc = per_imax_range_unrebase((uintmax_t)inp, lb, ub, &tmp); + *outp = tmp; + return rc; +} + int32_t aper_get_align(asn_per_data_t *pd) { @@ -353,6 +369,7 @@ aper_get_nslength(asn_per_data_t *pd) { } } +#if !defined(USE_OLDER_APER_NSNNWN) ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range) { ssize_t value; @@ -379,13 +396,56 @@ aper_get_nsnnwn(asn_per_data_t *pd, int range) { /* 2 bytes */ bytes = 2; } else { - return -1; + //return -1; + int length; + + /* handle indefinite range */ + length = per_get_few_bits(pd, 1); + if (length == 0) + return per_get_few_bits(pd, 6); + + if (aper_get_align(pd) < 0) + return -1; + + length = per_get_few_bits(pd, 8); + /* the length is not likely to be that big */ + if (length > 4) + return -1; + value = 0; + if (per_get_many_bits(pd, (uint8_t *)&value, 0, length * 8) < 0) + return -1; + return value; } if (aper_get_align(pd) < 0) return -1; value = per_get_few_bits(pd, 8 * bytes); return value; } +#else /* old APER codec */ +ssize_t +aper_get_nsnnwn(asn_per_data_t *pd, int dummy_range) { + ssize_t value; + + ASN_DEBUG("Get the normally small non-negative whole number APER"); + + value = per_get_few_bits(pd, 7); + if(value & 64) { /* implicit (value < 0) */ + value &= 63; + value <<= 2; + value |= per_get_few_bits(pd, 2); + if(value & 128) /* implicit (value < 0) */ + return -1; + if(value == 0) + return 0; + if(value >= 3) + return -1; + value = per_get_few_bits(pd, 8 * value); + return value; + } + + return value; +} +#endif /* don't use old APER */ int aper_put_align(asn_per_outp_t *po) { @@ -398,7 +458,11 @@ int aper_put_align(asn_per_outp_t *po) { } ssize_t -aper_put_length(asn_per_outp_t *po, int range, size_t length) { +aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) { + int dummy = 0; + if(!need_eom) need_eom = &dummy; + + *need_eom = 0; ASN_DEBUG("APER put length %zu with range %d", length, range); @@ -417,8 +481,12 @@ aper_put_length(asn_per_outp_t *po, int range, size_t length) { return per_put_few_bits(po, length|0x8000, 16) ? -1 : (ssize_t)length; + *need_eom = 0 == (length & 16383); length >>= 14; - if(length > 4) length = 4; + if(length > 4) { + *need_eom = 0; + length = 4; + } return per_put_few_bits(po, 0xC0 | length, 8) ? -1 : (ssize_t)(length << 14); @@ -433,7 +501,7 @@ aper_put_nslength(asn_per_outp_t *po, size_t length) { if(length == 0) return -1; return per_put_few_bits(po, length-1, 7) ? -1 : 0; } else { - if(aper_put_length(po, -1, length) != (ssize_t)length) { + if(aper_put_length(po, -1, length, 0) != (ssize_t)length) { /* This might happen in case of >16K extensions */ return -1; } @@ -442,6 +510,7 @@ aper_put_nslength(asn_per_outp_t *po, size_t length) { return 0; } +#if !defined(USE_OLDER_APER_NSNNWN) int aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { int bytes; @@ -487,3 +556,28 @@ aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { */ return per_put_few_bits(po, number, 8 * bytes); } +#else /* preserve old code base in case */ +int +aper_put_nsnnwn(asn_per_outp_t *po, int dummy_range, int n) { + int bytes; + + ASN_DEBUG("aper_put_nsnnwn"); + + if(n <= 63) { + if(n < 0) return -1; + return per_put_few_bits(po, n, 7); + } + if(n < 256) + bytes = 1; + else if(n < 65536) + bytes = 2; + else if(n < 256 * 65536) + bytes = 3; + else + return -1; /* This is not a "normally small" value */ + if(per_put_few_bits(po, bytes, 8)) + return -1; + + return per_put_few_bits(po, n, 8 * bytes); +} +#endif /* which aper_put_nsnnwn() */ diff --git a/lib/asn1c/common/per_support.h b/lib/asn1c/common/per_support.h index 23079c94f..d13f50415 100644 --- a/lib/asn1c/common/per_support.h +++ b/lib/asn1c/common/per_support.h @@ -24,8 +24,8 @@ typedef struct asn_per_constraint_s { } flags; int range_bits; /* Full number of bits in the range */ int effective_bits; /* Effective bits */ - long lower_bound; /* "lb" value */ - long upper_bound; /* "ub" value */ + intmax_t lower_bound; /* "lb" value */ + intmax_t upper_bound; /* "ub" value */ } asn_per_constraint_t; typedef struct asn_per_constraints_s { asn_per_constraint_t value; @@ -64,7 +64,7 @@ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range); /* X.691-2008/11, #11.5.6 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); +int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *v, int nbits); /* Temporary compatibility layer. Will get removed. */ @@ -81,9 +81,11 @@ typedef struct asn_bit_outp_s asn_per_outp_t; * -1: Conversion failed due to range problems. * 0: Conversion was successful. */ -int per_long_range_rebase(long v, long lb, long ub, unsigned long *output); +int per_long_range_rebase(long, intmax_t lb, intmax_t ub, unsigned long *output); +int per_imax_range_rebase(intmax_t v, intmax_t lb, intmax_t ub, uintmax_t *output); /* The inverse operation: restores the value by the offset and its bounds. */ -int per_long_range_unrebase(unsigned long inp, long lb, long ub, long *outp); +int per_long_range_unrebase(unsigned long inp, intmax_t lb, intmax_t ub, long *outp); +int per_imax_range_unrebase(uintmax_t inp, intmax_t lb, intmax_t ub, intmax_t *outp); /* X.691-2008/11, #11.5 */ int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); @@ -99,7 +101,8 @@ int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length, int *opt_need_eom); -ssize_t aper_put_length(asn_per_outp_t *po, int range, size_t length); +ssize_t aper_put_length(asn_per_outp_t *po, int range, size_t length, + int *opt_need_eom); /* Align the current bit position to octet bundary */ int aper_put_align(asn_per_outp_t *po); diff --git a/lib/asn1c/common/xer_encoder.c b/lib/asn1c/common/xer_encoder.c index dff3c44e8..4177ede5c 100644 --- a/lib/asn1c/common/xer_encoder.c +++ b/lib/asn1c/common/xer_encoder.c @@ -53,7 +53,7 @@ xer__print2fp(const void *buffer, size_t size, void *app_key) { int xer_fprint(FILE *stream, const asn_TYPE_descriptor_t *td, const void *sptr) { - asn_enc_rval_t er; + asn_enc_rval_t er = {0,0,0}; if(!stream) stream = stdout; if(!td || !sptr) diff --git a/lib/asn1c/common/xer_encoder.h b/lib/asn1c/common/xer_encoder.h index 9d75922c5..6cfc505fa 100644 --- a/lib/asn1c/common/xer_encoder.h +++ b/lib/asn1c/common/xer_encoder.h @@ -54,7 +54,7 @@ int xer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td, enum xer_equivalence_e { XEQ_SUCCESS, /* The only completely positive return value */ XEQ_FAILURE, /* General failure */ - XEQ_ENCODE1_FAILED, /* First sructure XER encoding failed */ + XEQ_ENCODE1_FAILED, /* First structure XER encoding failed */ XEQ_ENCODE2_FAILED, /* Second structure XER encoding failed */ XEQ_DIFFERENT, /* Structures encoded into different XER */ XEQ_DECODE_FAILED, /* Decode of the XER data failed */ diff --git a/lib/asn1c/common/xer_support.h b/lib/asn1c/common/xer_support.h index c3a36e720..2c3f369b8 100644 --- a/lib/asn1c/common/xer_support.h +++ b/lib/asn1c/common/xer_support.h @@ -40,8 +40,8 @@ typedef int (pxml_callback_f)(pxml_chunk_type_e _type, /* * Parse the given buffer as it were a chunk of XML data. - * Invoke the specified callback each time the meaninful data is found. - * This function returns number of bytes consumed from the bufer. + * Invoke the specified callback each time the meaningful data is found. + * This function returns number of bytes consumed from the buffer. * It will always be lesser than or equal to the specified _size. * The next invocation of this function must account the difference. */ diff --git a/lib/asn1c/ngap/NGAP_EXTERNAL.c b/lib/asn1c/ngap/NGAP_EXTERNAL.c new file mode 100644 index 000000000..5db79fa09 --- /dev/null +++ b/lib/asn1c/ngap/NGAP_EXTERNAL.c @@ -0,0 +1,152 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "ASN1C-UsefulInformationObjectClasses" + * found in "../../../../my/asn1c/asn1c/../skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1" + * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` + */ + +#include "NGAP_EXTERNAL.h" + +static asn_oer_constraints_t asn_OER_type_NGAP_encoding_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_NGAP_encoding_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_NGAP_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct NGAP_EXTERNAL__encoding, choice.single_ASN1_type), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_ANY, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct NGAP_EXTERNAL__encoding, choice.octet_aligned), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct NGAP_EXTERNAL__encoding, choice.arbitrary), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_NGAP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_NGAP_encoding_specs_5 = { + sizeof(struct NGAP_EXTERNAL__encoding), + offsetof(struct NGAP_EXTERNAL__encoding, _asn_ctx), + offsetof(struct NGAP_EXTERNAL__encoding, present), + sizeof(((struct NGAP_EXTERNAL__encoding *)0)->present), + asn_MAP_NGAP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_NGAP_encoding_5 = { + "encoding", + "encoding", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_NGAP_encoding_constr_5, &asn_PER_type_NGAP_encoding_constr_5, CHOICE_constraint }, + asn_MBR_NGAP_encoding_5, + 3, /* Elements count */ + &asn_SPC_NGAP_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_NGAP_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct NGAP_EXTERNAL, direct_reference), + (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + 0, + &asn_DEF_OBJECT_IDENTIFIER, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct NGAP_EXTERNAL, indirect_reference), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct NGAP_EXTERNAL, data_value_descriptor), + (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + 0, + &asn_DEF_ObjectDescriptor, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct NGAP_EXTERNAL, encoding), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_NGAP_encoding_5, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "encoding" + }, +}; +static const int asn_MAP_NGAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_NGAP_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_NGAP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_NGAP_EXTERNAL_specs_1 = { + sizeof(struct NGAP_EXTERNAL), + offsetof(struct NGAP_EXTERNAL, _asn_ctx), + asn_MAP_NGAP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_NGAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_NGAP_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + &asn_OP_SEQUENCE, + asn_DEF_NGAP_EXTERNAL_tags_1, + sizeof(asn_DEF_NGAP_EXTERNAL_tags_1) + /sizeof(asn_DEF_NGAP_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_NGAP_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_NGAP_EXTERNAL_tags_1) + /sizeof(asn_DEF_NGAP_EXTERNAL_tags_1[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_NGAP_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_NGAP_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/lib/asn1c/ngap/NGAP_EXTERNAL.h b/lib/asn1c/ngap/NGAP_EXTERNAL.h new file mode 100644 index 000000000..d130b4210 --- /dev/null +++ b/lib/asn1c/ngap/NGAP_EXTERNAL.h @@ -0,0 +1,65 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "ASN1C-UsefulInformationObjectClasses" + * found in "../../../../my/asn1c/asn1c/../skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1" + * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` + */ + +#ifndef _NGAP_EXTERNAL_H_ +#define _NGAP_EXTERNAL_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum NGAP_EXTERNAL__encoding_PR { + NGAP_EXTERNAL__encoding_PR_NOTHING, /* No components present */ + NGAP_EXTERNAL__encoding_PR_single_ASN1_type, + NGAP_EXTERNAL__encoding_PR_octet_aligned, + NGAP_EXTERNAL__encoding_PR_arbitrary +} NGAP_EXTERNAL__encoding_PR; + +/* NGAP_EXTERNAL */ +typedef struct NGAP_EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference; /* OPTIONAL */ + long *indirect_reference; /* OPTIONAL */ + ObjectDescriptor_t *data_value_descriptor; /* OPTIONAL */ + struct NGAP_EXTERNAL__encoding { + NGAP_EXTERNAL__encoding_PR present; + union NGAP_EXTERNAL__NGAP_encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NGAP_EXTERNAL_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NGAP_EXTERNAL; + +#ifdef __cplusplus +} +#endif + +#endif /* _NGAP_EXTERNAL_H_ */ +#include diff --git a/lib/asn1c/ngap/NGAP_ProtocolIE-Field.c b/lib/asn1c/ngap/NGAP_ProtocolIE-Field.c index f93036fd9..3a16c2108 100644 --- a/lib/asn1c/ngap/NGAP_ProtocolIE-Field.c +++ b/lib/asn1c/ngap/NGAP_ProtocolIE-Field.c @@ -21747,6 +21747,15 @@ static asn_TYPE_member_t asn_MBR_NGAP_value_168[] = { 0, 0, /* No default value */ "EmergencyFallbackIndicator" }, + { ATF_NOFLAGS, 0, offsetof(struct NGAP_UEContextModificationRequestIEs__value, choice.AMF_UE_NGAP_ID_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NGAP_AMF_UE_NGAP_ID, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "AMF-UE-NGAP-ID" + }, { ATF_NOFLAGS, 0, offsetof(struct NGAP_UEContextModificationRequestIEs__value, choice.RRCInactiveTransitionReportRequest), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, @@ -21784,22 +21793,23 @@ static asn_TYPE_member_t asn_MBR_NGAP_value_168[] = { "SRVCCOperationPossible" }, }; -static const unsigned asn_MAP_NGAP_value_to_canonical_168[] = { 0, 1, 2, 4, 3, 9, 12, 5, 6, 7, 8, 10, 11 }; -static const unsigned asn_MAP_NGAP_value_from_canonical_168[] = { 0, 1, 2, 4, 3, 7, 8, 9, 10, 5, 11, 12, 6 }; +static const unsigned asn_MAP_NGAP_value_to_canonical_168[] = { 0, 1, 2, 4, 9, 3, 10, 13, 5, 6, 7, 8, 11, 12 }; +static const unsigned asn_MAP_NGAP_value_from_canonical_168[] = { 0, 1, 2, 5, 3, 8, 9, 10, 11, 4, 6, 12, 13, 7 }; static const asn_TYPE_tag2member_t asn_MAP_NGAP_value_tag2el_168[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 3 }, /* AMF-UE-NGAP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 2 }, /* RAN-UE-NGAP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 1 }, /* RANPagingPriority */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 4, -3, 0 }, /* IndexToRFSP */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 4 }, /* AMF-UE-NGAP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 3 }, /* RAN-UE-NGAP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 2 }, /* RANPagingPriority */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 4, -3, 1 }, /* IndexToRFSP */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 9, -4, 0 }, /* AMF-UE-NGAP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 3, 0, 0 }, /* SecurityKey */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 9, 0, 1 }, /* RRCInactiveTransitionReportRequest */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 12, -1, 0 }, /* SRVCCOperationPossible */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 10, 0, 1 }, /* RRCInactiveTransitionReportRequest */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 13, -1, 0 }, /* SRVCCOperationPossible */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, 0, 5 }, /* UEAggregateMaximumBitRate */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 6, -1, 4 }, /* UESecurityCapabilities */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 7, -2, 3 }, /* CoreNetworkAssistanceInformationForInactive */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 8, -3, 2 }, /* EmergencyFallbackIndicator */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 10, -4, 1 }, /* GUAMI */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, -5, 0 } /* CNAssistedRANTuning */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, -4, 1 }, /* GUAMI */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 12, -5, 0 } /* CNAssistedRANTuning */ }; static asn_CHOICE_specifics_t asn_SPC_NGAP_value_specs_168 = { sizeof(struct NGAP_UEContextModificationRequestIEs__value), @@ -21807,7 +21817,7 @@ static asn_CHOICE_specifics_t asn_SPC_NGAP_value_specs_168 = { offsetof(struct NGAP_UEContextModificationRequestIEs__value, present), sizeof(((struct NGAP_UEContextModificationRequestIEs__value *)0)->present), asn_MAP_NGAP_value_tag2el_168, - 13, /* Count of tags in the map */ + 14, /* Count of tags in the map */ asn_MAP_NGAP_value_to_canonical_168, asn_MAP_NGAP_value_from_canonical_168, -1 /* Extensions start */ @@ -21823,7 +21833,7 @@ asn_TYPE_descriptor_t asn_DEF_NGAP_value_168 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_NGAP_value_168, - 13, /* Elements count */ + 14, /* Elements count */ &asn_SPC_NGAP_value_specs_168 /* Additional specs */ }; diff --git a/lib/asn1c/ngap/NGAP_ProtocolIE-Field.h b/lib/asn1c/ngap/NGAP_ProtocolIE-Field.h index c4764fabe..486a3af1e 100644 --- a/lib/asn1c/ngap/NGAP_ProtocolIE-Field.h +++ b/lib/asn1c/ngap/NGAP_ProtocolIE-Field.h @@ -420,6 +420,7 @@ typedef enum NGAP_UEContextModificationRequestIEs__value_PR { NGAP_UEContextModificationRequestIEs__value_PR_UESecurityCapabilities, NGAP_UEContextModificationRequestIEs__value_PR_CoreNetworkAssistanceInformationForInactive, NGAP_UEContextModificationRequestIEs__value_PR_EmergencyFallbackIndicator, + NGAP_UEContextModificationRequestIEs__value_PR_AMF_UE_NGAP_ID_1, NGAP_UEContextModificationRequestIEs__value_PR_RRCInactiveTransitionReportRequest, NGAP_UEContextModificationRequestIEs__value_PR_GUAMI, NGAP_UEContextModificationRequestIEs__value_PR_CNAssistedRANTuning, @@ -1646,6 +1647,7 @@ typedef struct NGAP_UEContextModificationRequestIEs { NGAP_UESecurityCapabilities_t UESecurityCapabilities; NGAP_CoreNetworkAssistanceInformationForInactive_t CoreNetworkAssistanceInformationForInactive; NGAP_EmergencyFallbackIndicator_t EmergencyFallbackIndicator; + NGAP_AMF_UE_NGAP_ID_t AMF_UE_NGAP_ID_1; NGAP_RRCInactiveTransitionReportRequest_t RRCInactiveTransitionReportRequest; NGAP_GUAMI_t GUAMI; NGAP_CNAssistedRANTuning_t CNAssistedRANTuning; diff --git a/lib/asn1c/ngap/meson.build b/lib/asn1c/ngap/meson.build index 597337fe5..886681104 100644 --- a/lib/asn1c/ngap/meson.build +++ b/lib/asn1c/ngap/meson.build @@ -621,6 +621,7 @@ libasn1c_ngap_sources = files(''' NGAP_ProtocolExtensionField.c NGAP_PrivateIE-Container.c NGAP_PrivateIE-Field.c + NGAP_EXTERNAL.c '''.split()) libasn1c_ngap_inc = include_directories('.') diff --git a/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c index b86ec1a8a..f63a71bda 100644 --- a/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c +++ b/lib/asn1c/s1ap/S1AP_E-RAB-IE-ContainerList.c @@ -24,7 +24,7 @@ S1AP_E_RAB_IE_ContainerList_1199P0_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -54,7 +54,7 @@ S1AP_E_RAB_IE_ContainerList_1199P1_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -84,7 +84,7 @@ S1AP_E_RAB_IE_ContainerList_1199P2_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -114,7 +114,7 @@ S1AP_E_RAB_IE_ContainerList_1199P3_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -144,7 +144,7 @@ S1AP_E_RAB_IE_ContainerList_1199P4_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -174,7 +174,7 @@ S1AP_E_RAB_IE_ContainerList_1199P5_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -204,7 +204,7 @@ S1AP_E_RAB_IE_ContainerList_1199P6_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -234,7 +234,7 @@ S1AP_E_RAB_IE_ContainerList_1199P7_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -264,7 +264,7 @@ S1AP_E_RAB_IE_ContainerList_1199P8_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", @@ -294,7 +294,7 @@ S1AP_E_RAB_IE_ContainerList_1199P9_constraint(const asn_TYPE_descriptor_t *td, c if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c b/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c index 4cf6557a5..09a0d3465 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABAdmittedList.c @@ -24,7 +24,7 @@ S1AP_E_RABAdmittedList_constraint(const asn_TYPE_descriptor_t *td, const void *s if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c index 0c38d633c..f5fc36e70 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeReq.c @@ -24,7 +24,7 @@ S1AP_E_RABFailedToResumeListResumeReq_constraint(const asn_TYPE_descriptor_t *td if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c index baa704250..9b6498487 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedToResumeListResumeRes.c @@ -24,7 +24,7 @@ S1AP_E_RABFailedToResumeListResumeRes_constraint(const asn_TYPE_descriptor_t *td if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c b/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c index d07555705..4bfbc09ed 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c +++ b/lib/asn1c/s1ap/S1AP_E-RABFailedtoSetupListHOReqAck.c @@ -24,7 +24,7 @@ S1AP_E_RABFailedtoSetupListHOReqAck_constraint(const asn_TYPE_descriptor_t *td, if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c index d245f0a58..f10f21fac 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c +++ b/lib/asn1c/s1ap/S1AP_E-RABNotToBeModifiedListBearerModInd.c @@ -24,7 +24,7 @@ S1AP_E_RABNotToBeModifiedListBearerModInd_constraint(const asn_TYPE_descriptor_t if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c b/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c index 559150108..74e5d4435 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABSubjecttoDataForwardingList.c @@ -24,7 +24,7 @@ S1AP_E_RABSubjecttoDataForwardingList_constraint(const asn_TYPE_descriptor_t *td if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c index b59eca8b1..594ba8297 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeModifiedListBearerModInd.c @@ -24,7 +24,7 @@ S1AP_E_RABToBeModifiedListBearerModInd_constraint(const asn_TYPE_descriptor_t *t if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c index 37151a65b..e0978092f 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSetupListHOReq.c @@ -24,7 +24,7 @@ S1AP_E_RABToBeSetupListHOReq_constraint(const asn_TYPE_descriptor_t *td, const v if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c index 9b14ea792..7d89944c0 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedDLList.c @@ -24,7 +24,7 @@ S1AP_E_RABToBeSwitchedDLList_constraint(const asn_TYPE_descriptor_t *td, const v if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c index 4262d4873..68a8c890e 100644 --- a/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c +++ b/lib/asn1c/s1ap/S1AP_E-RABToBeSwitchedULList.c @@ -24,7 +24,7 @@ S1AP_E_RABToBeSwitchedULList_constraint(const asn_TYPE_descriptor_t *td, const v if((size >= 1 && size <= 256)) { /* Perform validation of the inner elements */ - return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key); + return SEQUENCE_OF_constraint(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", diff --git a/lib/asn1c/s1ap/S1AP_EXTERNAL.c b/lib/asn1c/s1ap/S1AP_EXTERNAL.c new file mode 100644 index 000000000..f99d7c5fd --- /dev/null +++ b/lib/asn1c/s1ap/S1AP_EXTERNAL.c @@ -0,0 +1,152 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "ASN1C-UsefulInformationObjectClasses" + * found in "../../../../my/asn1c/asn1c/../skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1" + * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` + */ + +#include "S1AP_EXTERNAL.h" + +static asn_oer_constraints_t asn_OER_type_S1AP_encoding_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +static asn_per_constraints_t asn_PER_type_S1AP_encoding_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_S1AP_encoding_5[] = { + { ATF_NOFLAGS, 0, offsetof(struct S1AP_EXTERNAL__encoding, choice.single_ASN1_type), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_ANY, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "single-ASN1-type" + }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_EXTERNAL__encoding, choice.octet_aligned), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "octet-aligned" + }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_EXTERNAL__encoding, choice.arbitrary), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "arbitrary" + }, +}; +static const asn_TYPE_tag2member_t asn_MAP_S1AP_encoding_tag2el_5[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* arbitrary */ +}; +static asn_CHOICE_specifics_t asn_SPC_S1AP_encoding_specs_5 = { + sizeof(struct S1AP_EXTERNAL__encoding), + offsetof(struct S1AP_EXTERNAL__encoding, _asn_ctx), + offsetof(struct S1AP_EXTERNAL__encoding, present), + sizeof(((struct S1AP_EXTERNAL__encoding *)0)->present), + asn_MAP_S1AP_encoding_tag2el_5, + 3, /* Count of tags in the map */ + 0, 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_S1AP_encoding_5 = { + "encoding", + "encoding", + &asn_OP_CHOICE, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + { &asn_OER_type_S1AP_encoding_constr_5, &asn_PER_type_S1AP_encoding_constr_5, CHOICE_constraint }, + asn_MBR_S1AP_encoding_5, + 3, /* Elements count */ + &asn_SPC_S1AP_encoding_specs_5 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_S1AP_EXTERNAL_1[] = { + { ATF_POINTER, 3, offsetof(struct S1AP_EXTERNAL, direct_reference), + (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), + 0, + &asn_DEF_OBJECT_IDENTIFIER, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "direct-reference" + }, + { ATF_POINTER, 2, offsetof(struct S1AP_EXTERNAL, indirect_reference), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "indirect-reference" + }, + { ATF_POINTER, 1, offsetof(struct S1AP_EXTERNAL, data_value_descriptor), + (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), + 0, + &asn_DEF_ObjectDescriptor, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "data-value-descriptor" + }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_EXTERNAL, encoding), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_S1AP_encoding_5, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "encoding" + }, +}; +static const int asn_MAP_S1AP_EXTERNAL_oms_1[] = { 0, 1, 2 }; +static const ber_tlv_tag_t asn_DEF_S1AP_EXTERNAL_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_S1AP_EXTERNAL_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* indirect-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* direct-reference */ + { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), 2, 0, 0 }, /* data-value-descriptor */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* single-ASN1-type */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* octet-aligned */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 3, 0, 0 } /* arbitrary */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_S1AP_EXTERNAL_specs_1 = { + sizeof(struct S1AP_EXTERNAL), + offsetof(struct S1AP_EXTERNAL, _asn_ctx), + asn_MAP_S1AP_EXTERNAL_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_S1AP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_S1AP_EXTERNAL = { + "EXTERNAL", + "EXTERNAL", + &asn_OP_SEQUENCE, + asn_DEF_S1AP_EXTERNAL_tags_1, + sizeof(asn_DEF_S1AP_EXTERNAL_tags_1) + /sizeof(asn_DEF_S1AP_EXTERNAL_tags_1[0]) - 1, /* 1 */ + asn_DEF_S1AP_EXTERNAL_tags_1, /* Same as above */ + sizeof(asn_DEF_S1AP_EXTERNAL_tags_1) + /sizeof(asn_DEF_S1AP_EXTERNAL_tags_1[0]), /* 2 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_S1AP_EXTERNAL_1, + 4, /* Elements count */ + &asn_SPC_S1AP_EXTERNAL_specs_1 /* Additional specs */ +}; + diff --git a/lib/asn1c/s1ap/S1AP_EXTERNAL.h b/lib/asn1c/s1ap/S1AP_EXTERNAL.h new file mode 100644 index 000000000..f5d6ff29f --- /dev/null +++ b/lib/asn1c/s1ap/S1AP_EXTERNAL.h @@ -0,0 +1,65 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "ASN1C-UsefulInformationObjectClasses" + * found in "../../../../my/asn1c/asn1c/../skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1" + * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` + */ + +#ifndef _S1AP_EXTERNAL_H_ +#define _S1AP_EXTERNAL_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum S1AP_EXTERNAL__encoding_PR { + S1AP_EXTERNAL__encoding_PR_NOTHING, /* No components present */ + S1AP_EXTERNAL__encoding_PR_single_ASN1_type, + S1AP_EXTERNAL__encoding_PR_octet_aligned, + S1AP_EXTERNAL__encoding_PR_arbitrary +} S1AP_EXTERNAL__encoding_PR; + +/* S1AP_EXTERNAL */ +typedef struct S1AP_EXTERNAL { + OBJECT_IDENTIFIER_t *direct_reference; /* OPTIONAL */ + long *indirect_reference; /* OPTIONAL */ + ObjectDescriptor_t *data_value_descriptor; /* OPTIONAL */ + struct S1AP_EXTERNAL__encoding { + S1AP_EXTERNAL__encoding_PR present; + union S1AP_EXTERNAL__S1AP_encoding_u { + ANY_t single_ASN1_type; + OCTET_STRING_t octet_aligned; + BIT_STRING_t arbitrary; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } encoding; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} S1AP_EXTERNAL_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_S1AP_EXTERNAL; + +#ifdef __cplusplus +} +#endif + +#endif /* _S1AP_EXTERNAL_H_ */ +#include diff --git a/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c index 0ff66e9f3..04e3ddf4b 100644 --- a/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.c @@ -15243,6 +15243,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_28[] = { 0, 0, /* No default value */ "Correlation-ID" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue, choice.Correlation_ID_1), + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), + 0, + &asn_DEF_S1AP_Correlation_ID, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "Correlation-ID" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue, choice.BearerType), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, @@ -15254,8 +15263,9 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_28[] = { }, }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_extensionValue_tag2el_28[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 }, /* Correlation-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 } /* BearerType */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 1 }, /* Correlation-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, -1, 0 }, /* Correlation-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 } /* BearerType */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_28 = { sizeof(struct S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue), @@ -15263,7 +15273,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_28 = { offsetof(struct S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue, present), sizeof(((struct S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue *)0)->present), asn_MAP_S1AP_extensionValue_tag2el_28, - 2, /* Count of tags in the map */ + 3, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; @@ -15278,7 +15288,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_extensionValue_28 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_extensionValue_28, - 2, /* Elements count */ + 3, /* Elements count */ &asn_SPC_S1AP_extensionValue_specs_28 /* Additional specs */ }; @@ -15708,6 +15718,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_48[] = { 0, 0, /* No default value */ "Correlation-ID" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue, choice.Correlation_ID_1), + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), + 0, + &asn_DEF_S1AP_Correlation_ID, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "Correlation-ID" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue, choice.BearerType), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, @@ -15719,8 +15738,9 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_48[] = { }, }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_extensionValue_tag2el_48[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 }, /* Correlation-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 } /* BearerType */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 1 }, /* Correlation-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, -1, 0 }, /* Correlation-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 } /* BearerType */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_48 = { sizeof(struct S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue), @@ -15728,7 +15748,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_48 = { offsetof(struct S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue, present), sizeof(((struct S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue *)0)->present), asn_MAP_S1AP_extensionValue_tag2el_48, - 2, /* Count of tags in the map */ + 3, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; @@ -15743,7 +15763,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_extensionValue_48 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_extensionValue_48, - 2, /* Elements count */ + 3, /* Elements count */ &asn_SPC_S1AP_extensionValue_specs_48 /* Additional specs */ }; @@ -16923,6 +16943,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_104[] = { 0, 0, /* No default value */ "COUNTValueExtended" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue, choice.COUNTValueExtended_1), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_S1AP_COUNTValueExtended, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "COUNTValueExtended" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue, choice.ReceiveStatusOfULPDCPSDUsExtended), (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, @@ -16941,6 +16970,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_104[] = { 0, 0, /* No default value */ "COUNTvaluePDCP-SNlength18" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue, choice.COUNTvaluePDCP_SNlength18_1), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_S1AP_COUNTvaluePDCP_SNlength18, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "COUNTvaluePDCP-SNlength18" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue, choice.ReceiveStatusOfULPDCPSDUsPDCP_SNlength18), (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, @@ -16951,13 +16989,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_104[] = { "ReceiveStatusOfULPDCPSDUsPDCP-SNlength18" }, }; -static const unsigned asn_MAP_S1AP_extensionValue_to_canonical_104[] = { 1, 3, 0, 2 }; -static const unsigned asn_MAP_S1AP_extensionValue_from_canonical_104[] = { 2, 0, 3, 1 }; +static const unsigned asn_MAP_S1AP_extensionValue_to_canonical_104[] = { 2, 5, 0, 1, 3, 4 }; +static const unsigned asn_MAP_S1AP_extensionValue_from_canonical_104[] = { 2, 3, 0, 4, 5, 1 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_extensionValue_tag2el_104[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 1, 0, 1 }, /* ReceiveStatusOfULPDCPSDUsExtended */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 3, -1, 0 }, /* ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* COUNTValueExtended */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 0 } /* COUNTvaluePDCP-SNlength18 */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 2, 0, 1 }, /* ReceiveStatusOfULPDCPSDUsExtended */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 5, -1, 0 }, /* ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 3 }, /* COUNTValueExtended */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 2 }, /* COUNTValueExtended */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -2, 1 }, /* COUNTvaluePDCP-SNlength18 */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -3, 0 } /* COUNTvaluePDCP-SNlength18 */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_104 = { sizeof(struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue), @@ -16965,7 +17005,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_104 = { offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue, present), sizeof(((struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue *)0)->present), asn_MAP_S1AP_extensionValue_tag2el_104, - 4, /* Count of tags in the map */ + 6, /* Count of tags in the map */ asn_MAP_S1AP_extensionValue_to_canonical_104, asn_MAP_S1AP_extensionValue_from_canonical_104, -1 /* Extensions start */ @@ -16981,7 +17021,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_extensionValue_104 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_extensionValue_104, - 4, /* Elements count */ + 6, /* Elements count */ &asn_SPC_S1AP_extensionValue_specs_104 /* Additional specs */ }; @@ -20116,9 +20156,19 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_252[] = { 0, 0, /* No default value */ "Packet-LossRate" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABQoSParameters_ExtIEs__extensionValue, choice.Packet_LossRate_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_Packet_LossRate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "Packet-LossRate" + }, }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_extensionValue_tag2el_252[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* Packet-LossRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* Packet-LossRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* Packet-LossRate */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_252 = { sizeof(struct S1AP_E_RABQoSParameters_ExtIEs__extensionValue), @@ -20126,7 +20176,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_252 = { offsetof(struct S1AP_E_RABQoSParameters_ExtIEs__extensionValue, present), sizeof(((struct S1AP_E_RABQoSParameters_ExtIEs__extensionValue *)0)->present), asn_MAP_S1AP_extensionValue_tag2el_252, - 1, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; @@ -20141,7 +20191,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_extensionValue_252 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_extensionValue_252, - 1, /* Elements count */ + 2, /* Elements count */ &asn_SPC_S1AP_extensionValue_specs_252 /* Additional specs */ }; @@ -20811,9 +20861,39 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_284[] = { 0, 0, /* No default value */ "ExtendedBitRate" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_GBR_QosInformation_ExtIEs__extensionValue, choice.ExtendedBitRate_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_ExtendedBitRate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ExtendedBitRate" + }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_GBR_QosInformation_ExtIEs__extensionValue, choice.ExtendedBitRate_2), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_ExtendedBitRate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ExtendedBitRate" + }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_GBR_QosInformation_ExtIEs__extensionValue, choice.ExtendedBitRate_3), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_ExtendedBitRate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ExtendedBitRate" + }, }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_extensionValue_tag2el_284[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* ExtendedBitRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 3 }, /* ExtendedBitRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 2 }, /* ExtendedBitRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 1 }, /* ExtendedBitRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 3, -3, 0 } /* ExtendedBitRate */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_284 = { sizeof(struct S1AP_GBR_QosInformation_ExtIEs__extensionValue), @@ -20821,7 +20901,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_284 = { offsetof(struct S1AP_GBR_QosInformation_ExtIEs__extensionValue, present), sizeof(((struct S1AP_GBR_QosInformation_ExtIEs__extensionValue *)0)->present), asn_MAP_S1AP_extensionValue_tag2el_284, - 1, /* Count of tags in the map */ + 4, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; @@ -20836,7 +20916,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_extensionValue_284 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_extensionValue_284, - 1, /* Elements count */ + 4, /* Elements count */ &asn_SPC_S1AP_extensionValue_specs_284 /* Additional specs */ }; @@ -26774,9 +26854,19 @@ static asn_TYPE_member_t asn_MBR_S1AP_extensionValue_544[] = { 0, 0, /* No default value */ "ExtendedBitRate" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue, choice.ExtendedBitRate_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_ExtendedBitRate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ExtendedBitRate" + }, }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_extensionValue_tag2el_544[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* ExtendedBitRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* ExtendedBitRate */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* ExtendedBitRate */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_544 = { sizeof(struct S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue), @@ -26784,7 +26874,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_extensionValue_specs_544 = { offsetof(struct S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue, present), sizeof(((struct S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue *)0)->present), asn_MAP_S1AP_extensionValue_tag2el_544, - 1, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; @@ -26799,7 +26889,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_extensionValue_544 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_extensionValue_544, - 1, /* Elements count */ + 2, /* Elements count */ &asn_SPC_S1AP_extensionValue_specs_544 /* Additional specs */ }; diff --git a/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h index aa8b0a8fd..7cb4dfb71 100644 --- a/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolExtensionField.h @@ -100,6 +100,7 @@ typedef enum S1AP_E_RABToBeSwitchedULItem_ExtIEs__extensionValue_PR { typedef enum S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR { S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR_NOTHING, /* No components present */ S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR_Correlation_ID, + S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR_Correlation_ID_1, S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR_BearerType } S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR; typedef enum S1AP_E_RABSetupItemBearerSUResExtIEs__extensionValue_PR { @@ -121,6 +122,7 @@ typedef enum S1AP_E_RABReleaseItemBearerRelCompExtIEs__extensionValue_PR { typedef enum S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR { S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR_NOTHING, /* No components present */ S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR_Correlation_ID, + S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR_Correlation_ID_1, S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR_BearerType } S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR; typedef enum S1AP_E_RABSetupItemCtxtSUResExtIEs__extensionValue_PR { @@ -178,8 +180,10 @@ typedef enum S1AP_AssistanceDataForRecommendedCells_ExtIEs__extensionValue_PR { typedef enum S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR { S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_NOTHING, /* No components present */ S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_COUNTValueExtended, + S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_COUNTValueExtended_1, S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_ReceiveStatusOfULPDCPSDUsExtended, S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_COUNTvaluePDCP_SNlength18, + S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_COUNTvaluePDCP_SNlength18_1, S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18 } S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR; typedef enum S1AP_BluetoothMeasurementConfiguration_ExtIEs__extensionValue_PR { @@ -328,7 +332,8 @@ typedef enum S1AP_E_RABItem_ExtIEs__extensionValue_PR { } S1AP_E_RABItem_ExtIEs__extensionValue_PR; typedef enum S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR { S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR_NOTHING, /* No components present */ - S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR_Packet_LossRate + S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR_Packet_LossRate, + S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR_Packet_LossRate_1 } S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR; typedef enum S1AP_E_RABUsageReportItem_ExtIEs__extensionValue_PR { S1AP_E_RABUsageReportItem_ExtIEs__extensionValue_PR_NOTHING /* No components present */ @@ -360,7 +365,10 @@ typedef enum S1AP_ForbiddenLAs_Item_ExtIEs__extensionValue_PR { } S1AP_ForbiddenLAs_Item_ExtIEs__extensionValue_PR; typedef enum S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR { S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR_NOTHING, /* No components present */ - S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR_ExtendedBitRate + S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR_ExtendedBitRate, + S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR_ExtendedBitRate_1, + S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR_ExtendedBitRate_2, + S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR_ExtendedBitRate_3 } S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR; typedef enum S1AP_GUMMEI_ExtIEs__extensionValue_PR { S1AP_GUMMEI_ExtIEs__extensionValue_PR_NOTHING /* No components present */ @@ -640,7 +648,8 @@ typedef enum S1AP_Tunnel_Information_ExtIEs__extensionValue_PR { } S1AP_Tunnel_Information_ExtIEs__extensionValue_PR; typedef enum S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR { S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR_NOTHING, /* No components present */ - S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR_ExtendedBitRate + S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR_ExtendedBitRate, + S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR_ExtendedBitRate_1 } S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR; typedef enum S1AP_UEAppLayerMeasConfig_ExtIEs__extensionValue_PR { S1AP_UEAppLayerMeasConfig_ExtIEs__extensionValue_PR_NOTHING, /* No components present */ @@ -788,6 +797,7 @@ typedef struct S1AP_E_RABToBeSetupItemBearerSUReqExtIEs { S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__extensionValue_PR present; union S1AP_E_RABToBeSetupItemBearerSUReqExtIEs__S1AP_extensionValue_u { S1AP_Correlation_ID_t Correlation_ID; + S1AP_Correlation_ID_t Correlation_ID_1; S1AP_BearerType_t BearerType; } choice; @@ -866,6 +876,7 @@ typedef struct S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs { S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__extensionValue_PR present; union S1AP_E_RABToBeSetupItemCtxtSUReqExtIEs__S1AP_extensionValue_u { S1AP_Correlation_ID_t Correlation_ID; + S1AP_Correlation_ID_t Correlation_ID_1; S1AP_BearerType_t BearerType; } choice; @@ -1078,8 +1089,10 @@ typedef struct S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs { S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__extensionValue_PR present; union S1AP_Bearers_SubjectToStatusTransfer_ItemExtIEs__S1AP_extensionValue_u { S1AP_COUNTValueExtended_t COUNTValueExtended; + S1AP_COUNTValueExtended_t COUNTValueExtended_1; S1AP_ReceiveStatusOfULPDCPSDUsExtended_t ReceiveStatusOfULPDCPSDUsExtended; S1AP_COUNTvaluePDCP_SNlength18_t COUNTvaluePDCP_SNlength18; + S1AP_COUNTvaluePDCP_SNlength18_t COUNTvaluePDCP_SNlength18_1; S1AP_ReceiveStatusOfULPDCPSDUsPDCP_SNlength18_t ReceiveStatusOfULPDCPSDUsPDCP_SNlength18; } choice; @@ -1637,6 +1650,7 @@ typedef struct S1AP_E_RABQoSParameters_ExtIEs { S1AP_E_RABQoSParameters_ExtIEs__extensionValue_PR present; union S1AP_E_RABQoSParameters_ExtIEs__S1AP_extensionValue_u { S1AP_Packet_LossRate_t Packet_LossRate; + S1AP_Packet_LossRate_t Packet_LossRate_1; } choice; /* Context for parsing across buffer boundaries */ @@ -1758,6 +1772,9 @@ typedef struct S1AP_GBR_QosInformation_ExtIEs { S1AP_GBR_QosInformation_ExtIEs__extensionValue_PR present; union S1AP_GBR_QosInformation_ExtIEs__S1AP_extensionValue_u { S1AP_ExtendedBitRate_t ExtendedBitRate; + S1AP_ExtendedBitRate_t ExtendedBitRate_1; + S1AP_ExtendedBitRate_t ExtendedBitRate_2; + S1AP_ExtendedBitRate_t ExtendedBitRate_3; } choice; /* Context for parsing across buffer boundaries */ @@ -2768,6 +2785,7 @@ typedef struct S1AP_UEAggregate_MaximumBitrates_ExtIEs { S1AP_UEAggregate_MaximumBitrates_ExtIEs__extensionValue_PR present; union S1AP_UEAggregate_MaximumBitrates_ExtIEs__S1AP_extensionValue_u { S1AP_ExtendedBitRate_t ExtendedBitRate; + S1AP_ExtendedBitRate_t ExtendedBitRate_1; } choice; /* Context for parsing across buffer boundaries */ diff --git a/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c index 38aaf79b0..43645ea69 100644 --- a/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.c @@ -23959,6 +23959,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_84[] = { 0, 0, /* No default value */ "Source-ToTarget-TransparentContainer" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_HandoverRequiredIEs__value, choice.Source_ToTarget_TransparentContainer_1), + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), + 0, + &asn_DEF_S1AP_Source_ToTarget_TransparentContainer, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "Source-ToTarget-TransparentContainer" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_HandoverRequiredIEs__value, choice.MSClassmark2), (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, @@ -24005,20 +24014,21 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_84[] = { "PS-ServiceNotAvailable" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_84[] = { 0, 1, 10, 7, 8, 9, 2, 5, 6, 11, 12, 3, 4 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_84[] = { 0, 1, 6, 11, 12, 7, 8, 3, 4, 5, 2, 9, 10 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_84[] = { 0, 1, 11, 7, 8, 9, 10, 2, 5, 6, 12, 13, 3, 4 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_84[] = { 0, 1, 7, 12, 13, 8, 9, 3, 4, 5, 6, 2, 10, 11 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_84[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* MME-UE-S1AP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 10, 0, 0 }, /* CSG-Id */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 7, 0, 2 }, /* Source-ToTarget-TransparentContainer */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 8, -1, 1 }, /* MSClassmark2 */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 9, -2, 0 }, /* MSClassmark3 */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 11, 0, 0 }, /* CSG-Id */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 7, 0, 3 }, /* Source-ToTarget-TransparentContainer */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 8, -1, 2 }, /* Source-ToTarget-TransparentContainer */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 9, -2, 1 }, /* MSClassmark2 */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 10, -3, 0 }, /* MSClassmark3 */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 4 }, /* HandoverType */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 5, -1, 3 }, /* Direct-Forwarding-Path-Availability */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 6, -2, 2 }, /* SRVCCHOIndication */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 11, -3, 1 }, /* CellAccessMode */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 12, -4, 0 }, /* PS-ServiceNotAvailable */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 12, -3, 1 }, /* CellAccessMode */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 13, -4, 0 }, /* PS-ServiceNotAvailable */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 1 }, /* radioNetwork */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 4, -1, 0 }, /* targeteNB-ID */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 1 }, /* transport */ @@ -24035,7 +24045,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_84 = { offsetof(struct S1AP_HandoverRequiredIEs__value, present), sizeof(((struct S1AP_HandoverRequiredIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_84, - 20, /* Count of tags in the map */ + 21, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_84, asn_MAP_S1AP_value_from_canonical_84, -1 /* Extensions start */ @@ -24051,7 +24061,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_84 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_84, - 13, /* Elements count */ + 14, /* Elements count */ &asn_SPC_S1AP_value_specs_84 /* Additional specs */ }; @@ -24180,6 +24190,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_88[] = { 0, 0, /* No default value */ "Target-ToSource-TransparentContainer" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_HandoverCommandIEs__value, choice.Target_ToSource_TransparentContainer_1), + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), + 0, + &asn_DEF_S1AP_Target_ToSource_TransparentContainer, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "Target-ToSource-TransparentContainer" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_HandoverCommandIEs__value, choice.CriticalityDiagnostics), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, @@ -24190,17 +24209,18 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_88[] = { "CriticalityDiagnostics" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_88[] = { 0, 1, 3, 6, 2, 4, 5, 7 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_88[] = { 0, 1, 4, 2, 5, 6, 3, 7 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_88[] = { 0, 1, 3, 6, 7, 2, 4, 5, 8 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_88[] = { 0, 1, 5, 2, 6, 7, 3, 4, 8 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_88[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* MME-UE-S1AP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 3, 0, 1 }, /* NASSecurityParametersfromE-UTRAN */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 6, -1, 0 }, /* Target-ToSource-TransparentContainer */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 3, 0, 2 }, /* NASSecurityParametersfromE-UTRAN */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 6, -1, 1 }, /* Target-ToSource-TransparentContainer */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 7, -2, 0 }, /* Target-ToSource-TransparentContainer */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 0 }, /* HandoverType */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, 0, 2 }, /* E-RABSubjecttoDataForwardingList */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, -1, 1 }, /* E-RABList */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 7, -2, 0 } /* CriticalityDiagnostics */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 8, -2, 0 } /* CriticalityDiagnostics */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_88 = { sizeof(struct S1AP_HandoverCommandIEs__value), @@ -24208,7 +24228,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_88 = { offsetof(struct S1AP_HandoverCommandIEs__value, present), sizeof(((struct S1AP_HandoverCommandIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_88, - 8, /* Count of tags in the map */ + 9, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_88, asn_MAP_S1AP_value_from_canonical_88, -1 /* Extensions start */ @@ -24224,7 +24244,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_88 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_88, - 8, /* Elements count */ + 9, /* Elements count */ &asn_SPC_S1AP_value_specs_88 /* Additional specs */ }; @@ -24571,6 +24591,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_96[] = { 0, 0, /* No default value */ "GUMMEI" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_HandoverRequestIEs__value, choice.MME_UE_S1AP_ID_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_MME_UE_S1AP_ID, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "MME-UE-S1AP-ID" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_HandoverRequestIEs__value, choice.ManagementBasedMDTAllowed), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, @@ -24707,24 +24736,25 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_96[] = { "AdditionalRRMPriorityIndex" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_96[] = { 0, 13, 18, 30, 5, 12, 1, 10, 14, 16, 21, 24, 26, 27, 28, 3, 4, 6, 7, 8, 9, 11, 15, 17, 19, 20, 22, 23, 25, 29, 2 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_96[] = { 0, 6, 30, 15, 16, 4, 17, 18, 19, 20, 7, 21, 5, 1, 8, 22, 9, 23, 2, 24, 25, 10, 26, 27, 11, 28, 12, 13, 14, 29, 3 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_96[] = { 0, 16, 13, 19, 31, 5, 12, 1, 10, 14, 17, 22, 25, 27, 28, 29, 3, 4, 6, 7, 8, 9, 11, 15, 18, 20, 21, 23, 24, 26, 30, 2 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_96[] = { 0, 7, 31, 16, 17, 5, 18, 19, 20, 21, 8, 22, 6, 2, 9, 23, 1, 10, 24, 3, 25, 26, 11, 27, 28, 12, 29, 13, 14, 15, 30, 4 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_96[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* MME-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* MME-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 16, -1, 0 }, /* MME-UE-S1AP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 13, 0, 2 }, /* CSG-Id */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 18, -1, 1 }, /* Masked-IMEISV */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 30, -2, 0 }, /* AdditionalRRMPriorityIndex */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 19, -1, 1 }, /* Masked-IMEISV */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 31, -2, 0 }, /* AdditionalRRMPriorityIndex */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 5, 0, 1 }, /* Source-ToTarget-TransparentContainer */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 12, -1, 0 }, /* NASSecurityParameterstoE-UTRAN */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 8 }, /* HandoverType */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 10, -1, 7 }, /* SRVCCOperationPossible */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 14, -2, 6 }, /* CSGMembershipStatus */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 16, -3, 5 }, /* ManagementBasedMDTAllowed */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 21, -4, 4 }, /* UEUserPlaneCIoTSupportIndicator */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 24, -5, 3 }, /* EnhancedCoverageRestricted */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 26, -6, 2 }, /* CE-ModeBRestricted */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 27, -7, 1 }, /* AerialUEsubscriptionInformation */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 28, -8, 0 }, /* PendingDataIndication */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 17, -3, 5 }, /* ManagementBasedMDTAllowed */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 22, -4, 4 }, /* UEUserPlaneCIoTSupportIndicator */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 25, -5, 3 }, /* EnhancedCoverageRestricted */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 27, -6, 2 }, /* CE-ModeBRestricted */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 28, -7, 1 }, /* AerialUEsubscriptionInformation */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 29, -8, 0 }, /* PendingDataIndication */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, 0, 14 }, /* UEAggregateMaximumBitrate */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -1, 13 }, /* E-RABToBeSetupListHOReq */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 6, -2, 12 }, /* UESecurityCapabilities */ @@ -24733,13 +24763,13 @@ static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_96[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 9, -5, 9 }, /* RequestType */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, -6, 8 }, /* SecurityContext */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 15, -7, 7 }, /* GUMMEI */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 17, -8, 6 }, /* MDTPLMNList */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 19, -9, 5 }, /* ExpectedUEBehaviour */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 20, -10, 4 }, /* ProSeAuthorized */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 22, -11, 3 }, /* V2XServicesAuthorized */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 23, -12, 2 }, /* UESidelinkAggregateMaximumBitrate */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 25, -13, 1 }, /* NRUESecurityCapabilities */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 29, -14, 0 }, /* Subscription-Based-UE-DifferentiationInfo */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 18, -8, 6 }, /* MDTPLMNList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 20, -9, 5 }, /* ExpectedUEBehaviour */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 21, -10, 4 }, /* ProSeAuthorized */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 23, -11, 3 }, /* V2XServicesAuthorized */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 24, -12, 2 }, /* UESidelinkAggregateMaximumBitrate */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 26, -13, 1 }, /* NRUESecurityCapabilities */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 30, -14, 0 }, /* Subscription-Based-UE-DifferentiationInfo */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* radioNetwork */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 }, /* transport */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* nas */ @@ -24752,7 +24782,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_96 = { offsetof(struct S1AP_HandoverRequestIEs__value, present), sizeof(((struct S1AP_HandoverRequestIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_96, - 35, /* Count of tags in the map */ + 36, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_96, asn_MAP_S1AP_value_from_canonical_96, -1 /* Extensions start */ @@ -24768,7 +24798,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_96 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_96, - 31, /* Elements count */ + 32, /* Elements count */ &asn_SPC_S1AP_value_specs_96 /* Additional specs */ }; @@ -25613,6 +25643,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_116[] = { 0, 0, /* No default value */ "CriticalityDiagnostics" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_PathSwitchRequestAcknowledgeIEs__value, choice.MME_UE_S1AP_ID_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_MME_UE_S1AP_ID, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "MME-UE-S1AP-ID" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_PathSwitchRequestAcknowledgeIEs__value, choice.CSGMembershipStatus), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, @@ -25731,29 +25770,30 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_116[] = { "AdditionalRRMPriorityIndex" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_116[] = { 0, 1, 19, 7, 9, 12, 14, 15, 16, 2, 3, 4, 5, 6, 8, 10, 11, 13, 17, 18 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_116[] = { 0, 1, 9, 10, 11, 12, 13, 3, 14, 4, 15, 16, 5, 17, 6, 7, 8, 18, 19, 2 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_116[] = { 0, 1, 7, 20, 8, 10, 13, 15, 16, 17, 2, 3, 4, 5, 6, 9, 11, 12, 14, 18, 19 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_116[] = { 0, 1, 10, 11, 12, 13, 14, 2, 4, 15, 5, 16, 17, 6, 18, 7, 8, 9, 19, 20, 3 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_116[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* MME-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 19, 0, 0 }, /* AdditionalRRMPriorityIndex */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 7, 0, 5 }, /* CSGMembershipStatus */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 9, -1, 4 }, /* UEUserPlaneCIoTSupportIndicator */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 12, -2, 3 }, /* EnhancedCoverageRestricted */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 14, -3, 2 }, /* CE-ModeBRestricted */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 15, -4, 1 }, /* AerialUEsubscriptionInformation */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 16, -5, 0 }, /* PendingDataIndication */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* MME-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* ENB-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 7, -2, 0 }, /* MME-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 20, 0, 0 }, /* AdditionalRRMPriorityIndex */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 8, 0, 5 }, /* CSGMembershipStatus */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 10, -1, 4 }, /* UEUserPlaneCIoTSupportIndicator */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 13, -2, 3 }, /* EnhancedCoverageRestricted */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 15, -3, 2 }, /* CE-ModeBRestricted */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 16, -4, 1 }, /* AerialUEsubscriptionInformation */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 17, -5, 0 }, /* PendingDataIndication */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 10 }, /* UEAggregateMaximumBitrate */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -1, 9 }, /* E-RABToBeSwitchedULList */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -2, 8 }, /* E-RABList */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, -3, 7 }, /* SecurityContext */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 6, -4, 6 }, /* CriticalityDiagnostics */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 8, -5, 5 }, /* ProSeAuthorized */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 10, -6, 4 }, /* V2XServicesAuthorized */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, -7, 3 }, /* UESidelinkAggregateMaximumBitrate */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 13, -8, 2 }, /* NRUESecurityCapabilities */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 17, -9, 1 }, /* Subscription-Based-UE-DifferentiationInfo */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 18, -10, 0 } /* HandoverRestrictionList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 9, -5, 5 }, /* ProSeAuthorized */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, -6, 4 }, /* V2XServicesAuthorized */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 12, -7, 3 }, /* UESidelinkAggregateMaximumBitrate */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 14, -8, 2 }, /* NRUESecurityCapabilities */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 18, -9, 1 }, /* Subscription-Based-UE-DifferentiationInfo */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 19, -10, 0 } /* HandoverRestrictionList */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_116 = { sizeof(struct S1AP_PathSwitchRequestAcknowledgeIEs__value), @@ -25761,7 +25801,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_116 = { offsetof(struct S1AP_PathSwitchRequestAcknowledgeIEs__value, present), sizeof(((struct S1AP_PathSwitchRequestAcknowledgeIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_116, - 20, /* Count of tags in the map */ + 21, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_116, asn_MAP_S1AP_value_from_canonical_116, -1 /* Extensions start */ @@ -25777,7 +25817,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_116 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_116, - 20, /* Elements count */ + 21, /* Elements count */ &asn_SPC_S1AP_value_specs_116 /* Additional specs */ }; @@ -27365,6 +27405,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_160[] = { 0, 0, /* No default value */ "GUMMEI" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_InitialContextSetupRequestIEs__value, choice.MME_UE_S1AP_ID_1), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_S1AP_MME_UE_S1AP_ID, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "MME-UE-S1AP-ID" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_InitialContextSetupRequestIEs__value, choice.ManagementBasedMDTAllowed), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, @@ -27510,26 +27559,27 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_160[] = { "AdditionalRRMPriorityIndex" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_160[] = { 0, 1, 9, 5, 18, 30, 8, 10, 11, 12, 15, 17, 21, 24, 26, 27, 28, 2, 3, 4, 6, 7, 13, 14, 16, 19, 20, 22, 23, 25, 29 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_160[] = { 0, 1, 17, 18, 19, 3, 20, 21, 6, 2, 7, 8, 9, 22, 23, 10, 24, 11, 4, 25, 26, 12, 27, 28, 13, 29, 14, 15, 16, 30, 5 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_160[] = { 0, 1, 9, 15, 5, 19, 31, 8, 10, 11, 12, 16, 18, 22, 25, 27, 28, 29, 2, 3, 4, 6, 7, 13, 14, 17, 20, 21, 23, 24, 26, 30 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_160[] = { 0, 1, 18, 19, 20, 4, 21, 22, 7, 2, 8, 9, 10, 23, 24, 3, 11, 25, 12, 5, 26, 27, 13, 28, 29, 14, 30, 15, 16, 17, 31, 6 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_160[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* MME-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 9, -2, 0 }, /* SubscriberProfileIDforRFP */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 3 }, /* MME-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 2 }, /* ENB-UE-S1AP-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 9, -2, 1 }, /* SubscriberProfileIDforRFP */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 15, -3, 0 }, /* MME-UE-S1AP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 5, 0, 2 }, /* SecurityKey */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 18, -1, 1 }, /* Masked-IMEISV */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 30, -2, 0 }, /* AdditionalRRMPriorityIndex */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 19, -1, 1 }, /* Masked-IMEISV */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 31, -2, 0 }, /* AdditionalRRMPriorityIndex */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 8, 0, 0 }, /* UERadioCapability */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 10, 0, 9 }, /* CSFallbackIndicator */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 11, -1, 8 }, /* SRVCCOperationPossible */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 12, -2, 7 }, /* CSGMembershipStatus */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 15, -3, 6 }, /* ManagementBasedMDTAllowed */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 17, -4, 5 }, /* AdditionalCSFallbackIndicator */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 21, -5, 4 }, /* UEUserPlaneCIoTSupportIndicator */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 24, -6, 3 }, /* EnhancedCoverageRestricted */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 26, -7, 2 }, /* CE-ModeBRestricted */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 27, -8, 1 }, /* AerialUEsubscriptionInformation */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 28, -9, 0 }, /* PendingDataIndication */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 16, -3, 6 }, /* ManagementBasedMDTAllowed */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 18, -4, 5 }, /* AdditionalCSFallbackIndicator */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 22, -5, 4 }, /* UEUserPlaneCIoTSupportIndicator */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 25, -6, 3 }, /* EnhancedCoverageRestricted */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 27, -7, 2 }, /* CE-ModeBRestricted */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 28, -8, 1 }, /* AerialUEsubscriptionInformation */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 29, -9, 0 }, /* PendingDataIndication */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 13 }, /* UEAggregateMaximumBitrate */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -1, 12 }, /* E-RABToBeSetupListCtxtSUReq */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -2, 11 }, /* UESecurityCapabilities */ @@ -27537,13 +27587,13 @@ static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_160[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 7, -4, 9 }, /* HandoverRestrictionList */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 13, -5, 8 }, /* LAI */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 14, -6, 7 }, /* GUMMEI */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 16, -7, 6 }, /* MDTPLMNList */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 19, -8, 5 }, /* ExpectedUEBehaviour */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 20, -9, 4 }, /* ProSeAuthorized */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 22, -10, 3 }, /* V2XServicesAuthorized */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 23, -11, 2 }, /* UESidelinkAggregateMaximumBitrate */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 25, -12, 1 }, /* NRUESecurityCapabilities */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 29, -13, 0 } /* Subscription-Based-UE-DifferentiationInfo */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 17, -7, 6 }, /* MDTPLMNList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 20, -8, 5 }, /* ExpectedUEBehaviour */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 21, -9, 4 }, /* ProSeAuthorized */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 23, -10, 3 }, /* V2XServicesAuthorized */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 24, -11, 2 }, /* UESidelinkAggregateMaximumBitrate */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 26, -12, 1 }, /* NRUESecurityCapabilities */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 30, -13, 0 } /* Subscription-Based-UE-DifferentiationInfo */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_160 = { sizeof(struct S1AP_InitialContextSetupRequestIEs__value), @@ -27551,7 +27601,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_160 = { offsetof(struct S1AP_InitialContextSetupRequestIEs__value, present), sizeof(((struct S1AP_InitialContextSetupRequestIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_160, - 31, /* Count of tags in the map */ + 32, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_160, asn_MAP_S1AP_value_from_canonical_160, -1 /* Extensions start */ @@ -27567,7 +27617,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_160 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_160, - 31, /* Elements count */ + 32, /* Elements count */ &asn_SPC_S1AP_value_specs_160 /* Additional specs */ }; @@ -29739,6 +29789,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_212[] = { 0, 0, /* No default value */ "TunnelInformation" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_InitialUEMessage_IEs__value, choice.TransportLayerAddress_1), + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), + 0, + &asn_DEF_S1AP_TransportLayerAddress, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "TransportLayerAddress" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_InitialUEMessage_IEs__value, choice.LHN_ID), (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, @@ -29812,25 +29871,26 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_212[] = { "EDT-Session" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_212[] = { 0, 15, 17, 6, 9, 19, 1, 13, 14, 4, 8, 10, 11, 16, 18, 20, 2, 3, 5, 7, 12 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_212[] = { 0, 6, 16, 17, 9, 18, 3, 19, 10, 4, 11, 12, 20, 7, 8, 1, 13, 2, 14, 5, 15 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_212[] = { 0, 16, 18, 6, 9, 13, 20, 1, 14, 15, 4, 8, 10, 11, 17, 19, 21, 2, 3, 5, 7, 12 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_212[] = { 0, 7, 17, 18, 10, 19, 3, 20, 11, 4, 12, 13, 21, 5, 8, 9, 1, 14, 2, 15, 6, 16 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_212[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 15, -1, 1 }, /* UE-Usage-Type */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 17, -2, 0 }, /* DCN-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 6, 0, 2 }, /* CSG-Id */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 9, -1, 1 }, /* TransportLayerAddress */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 19, -2, 0 }, /* UE-Application-Layer-Measurement-Capability */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 16, -1, 1 }, /* UE-Usage-Type */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 18, -2, 0 }, /* DCN-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 6, 0, 3 }, /* CSG-Id */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 9, -1, 2 }, /* TransportLayerAddress */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 13, -2, 1 }, /* TransportLayerAddress */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 20, -3, 0 }, /* UE-Application-Layer-Measurement-Capability */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 2 }, /* NAS-PDU */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 13, -1, 1 }, /* LHN-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 14, -2, 0 }, /* MME-Group-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 14, -1, 1 }, /* LHN-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 15, -2, 0 }, /* MME-Group-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 6 }, /* RRC-Establishment-Cause */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 8, -1, 5 }, /* CellAccessMode */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 10, -2, 4 }, /* RelayNode-Indicator */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 11, -3, 3 }, /* GUMMEIType */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 16, -4, 2 }, /* CE-mode-B-SupportIndicator */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 18, -5, 1 }, /* Coverage-Level */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 20, -6, 0 }, /* EDT-Session */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 17, -4, 2 }, /* CE-mode-B-SupportIndicator */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 19, -5, 1 }, /* Coverage-Level */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 21, -6, 0 }, /* EDT-Session */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 4 }, /* TAI */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -1, 3 }, /* EUTRAN-CGI */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, -2, 2 }, /* S-TMSI */ @@ -29843,7 +29903,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_212 = { offsetof(struct S1AP_InitialUEMessage_IEs__value, present), sizeof(((struct S1AP_InitialUEMessage_IEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_212, - 21, /* Count of tags in the map */ + 22, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_212, asn_MAP_S1AP_value_from_canonical_212, -1 /* Extensions start */ @@ -29859,7 +29919,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_212 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_212, - 21, /* Elements count */ + 22, /* Elements count */ &asn_SPC_S1AP_value_specs_212 /* Additional specs */ }; @@ -29979,6 +30039,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_216[] = { 0, 0, /* No default value */ "TransportLayerAddress" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_UplinkNASTransport_IEs__value, choice.TransportLayerAddress_1), + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), + 0, + &asn_DEF_S1AP_TransportLayerAddress, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "TransportLayerAddress" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_UplinkNASTransport_IEs__value, choice.LHN_ID), (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, @@ -29998,17 +30067,18 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_216[] = { "PSCellInformation" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_216[] = { 0, 1, 5, 2, 6, 3, 4, 7 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_216[] = { 0, 1, 3, 5, 6, 2, 4, 7 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_216[] = { 0, 1, 5, 6, 2, 7, 3, 4, 8 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_216[] = { 0, 1, 4, 6, 7, 2, 3, 5, 8 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_216[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* MME-UE-S1AP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 5, 0, 0 }, /* TransportLayerAddress */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 5, 0, 1 }, /* TransportLayerAddress */ + { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 6, -1, 0 }, /* TransportLayerAddress */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 2, 0, 1 }, /* NAS-PDU */ - { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 6, -1, 0 }, /* LHN-ID */ + { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 7, -1, 0 }, /* LHN-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, 0, 2 }, /* EUTRAN-CGI */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -1, 1 }, /* TAI */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 7, -2, 0 } /* PSCellInformation */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 8, -2, 0 } /* PSCellInformation */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_216 = { sizeof(struct S1AP_UplinkNASTransport_IEs__value), @@ -30016,7 +30086,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_216 = { offsetof(struct S1AP_UplinkNASTransport_IEs__value, present), sizeof(((struct S1AP_UplinkNASTransport_IEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_216, - 8, /* Count of tags in the map */ + 9, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_216, asn_MAP_S1AP_value_from_canonical_216, -1 /* Extensions start */ @@ -30032,7 +30102,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_216 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_216, - 8, /* Elements count */ + 9, /* Elements count */ &asn_SPC_S1AP_value_specs_216 /* Additional specs */ }; @@ -31384,15 +31454,25 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_256[] = { 0, 0, /* No default value */ "ConnectedengNBList" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_ENBConfigurationUpdateIEs__value, choice.ConnectedengNBList_1), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_S1AP_ConnectedengNBList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ConnectedengNBList" + }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_256[] = { 3, 4, 1, 2, 5, 0 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_256[] = { 5, 2, 3, 0, 1, 4 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_256[] = { 3, 4, 1, 2, 5, 6, 0 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_256[] = { 6, 2, 3, 0, 1, 4, 5 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_256[] = { { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 3, 0, 1 }, /* PagingDRX */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, -1, 0 }, /* NB-IoT-DefaultPagingDRX */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 2 }, /* SupportedTAs */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 1 }, /* CSG-IdList */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, -2, 0 }, /* ConnectedengNBList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 3 }, /* SupportedTAs */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 2 }, /* CSG-IdList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, -2, 1 }, /* ConnectedengNBList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 6, -3, 0 }, /* ConnectedengNBList */ { (ASN_TAG_CLASS_UNIVERSAL | (19 << 2)), 0, 0, 0 } /* ENBname */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_256 = { @@ -31401,7 +31481,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_256 = { offsetof(struct S1AP_ENBConfigurationUpdateIEs__value, present), sizeof(((struct S1AP_ENBConfigurationUpdateIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_256, - 6, /* Count of tags in the map */ + 7, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_256, asn_MAP_S1AP_value_from_canonical_256, -1 /* Extensions start */ @@ -31417,7 +31497,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_256 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_256, - 6, /* Elements count */ + 7, /* Elements count */ &asn_SPC_S1AP_value_specs_256 /* Additional specs */ }; @@ -35909,6 +35989,15 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_396[] = { 0, 0, /* No default value */ "E-RABList" }, + { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABModificationConfirmIEs__value, choice.E_RABList_1), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_S1AP_E_RABList, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "E-RABList" + }, { ATF_NOFLAGS, 0, offsetof(struct S1AP_E_RABModificationConfirmIEs__value, choice.CriticalityDiagnostics), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, @@ -35928,15 +36017,16 @@ static asn_TYPE_member_t asn_MBR_S1AP_value_396[] = { "CSGMembershipStatus" }, }; -static const unsigned asn_MAP_S1AP_value_to_canonical_396[] = { 0, 1, 5, 2, 3, 4 }; -static const unsigned asn_MAP_S1AP_value_from_canonical_396[] = { 0, 1, 3, 4, 5, 2 }; +static const unsigned asn_MAP_S1AP_value_to_canonical_396[] = { 0, 1, 6, 2, 3, 4, 5 }; +static const unsigned asn_MAP_S1AP_value_from_canonical_396[] = { 0, 1, 3, 4, 5, 6, 2 }; static const asn_TYPE_tag2member_t asn_MAP_S1AP_value_tag2el_396[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* MME-UE-S1AP-ID */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* ENB-UE-S1AP-ID */ - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 5, 0, 0 }, /* CSGMembershipStatus */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 2 }, /* E-RABModifyListBearerModConf */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -1, 1 }, /* E-RABList */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -2, 0 } /* CriticalityDiagnostics */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 6, 0, 0 }, /* CSGMembershipStatus */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 3 }, /* E-RABModifyListBearerModConf */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -1, 2 }, /* E-RABList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 4, -2, 1 }, /* E-RABList */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 5, -3, 0 } /* CriticalityDiagnostics */ }; static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_396 = { sizeof(struct S1AP_E_RABModificationConfirmIEs__value), @@ -35944,7 +36034,7 @@ static asn_CHOICE_specifics_t asn_SPC_S1AP_value_specs_396 = { offsetof(struct S1AP_E_RABModificationConfirmIEs__value, present), sizeof(((struct S1AP_E_RABModificationConfirmIEs__value *)0)->present), asn_MAP_S1AP_value_tag2el_396, - 6, /* Count of tags in the map */ + 7, /* Count of tags in the map */ asn_MAP_S1AP_value_to_canonical_396, asn_MAP_S1AP_value_from_canonical_396, -1 /* Extensions start */ @@ -35960,7 +36050,7 @@ asn_TYPE_descriptor_t asn_DEF_S1AP_value_396 = { 0, /* No tags (count) */ { 0, 0, OPEN_TYPE_constraint }, asn_MBR_S1AP_value_396, - 6, /* Elements count */ + 7, /* Elements count */ &asn_SPC_S1AP_value_specs_396 /* Additional specs */ }; diff --git a/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h index 726ce28b3..a4bce2fd2 100644 --- a/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h +++ b/lib/asn1c/s1ap/S1AP_ProtocolIE-Field.h @@ -315,6 +315,7 @@ typedef enum S1AP_HandoverRequiredIEs__value_PR { S1AP_HandoverRequiredIEs__value_PR_Direct_Forwarding_Path_Availability, S1AP_HandoverRequiredIEs__value_PR_SRVCCHOIndication, S1AP_HandoverRequiredIEs__value_PR_Source_ToTarget_TransparentContainer, + S1AP_HandoverRequiredIEs__value_PR_Source_ToTarget_TransparentContainer_1, S1AP_HandoverRequiredIEs__value_PR_MSClassmark2, S1AP_HandoverRequiredIEs__value_PR_MSClassmark3, S1AP_HandoverRequiredIEs__value_PR_CSG_Id, @@ -330,6 +331,7 @@ typedef enum S1AP_HandoverCommandIEs__value_PR { S1AP_HandoverCommandIEs__value_PR_E_RABSubjecttoDataForwardingList, S1AP_HandoverCommandIEs__value_PR_E_RABList, S1AP_HandoverCommandIEs__value_PR_Target_ToSource_TransparentContainer, + S1AP_HandoverCommandIEs__value_PR_Target_ToSource_TransparentContainer_1, S1AP_HandoverCommandIEs__value_PR_CriticalityDiagnostics } S1AP_HandoverCommandIEs__value_PR; typedef enum S1AP_HandoverPreparationFailureIEs__value_PR { @@ -357,6 +359,7 @@ typedef enum S1AP_HandoverRequestIEs__value_PR { S1AP_HandoverRequestIEs__value_PR_CSG_Id, S1AP_HandoverRequestIEs__value_PR_CSGMembershipStatus, S1AP_HandoverRequestIEs__value_PR_GUMMEI, + S1AP_HandoverRequestIEs__value_PR_MME_UE_S1AP_ID_1, S1AP_HandoverRequestIEs__value_PR_ManagementBasedMDTAllowed, S1AP_HandoverRequestIEs__value_PR_MDTPLMNList, S1AP_HandoverRequestIEs__value_PR_Masked_IMEISV, @@ -428,6 +431,7 @@ typedef enum S1AP_PathSwitchRequestAcknowledgeIEs__value_PR { S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_E_RABList, S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_SecurityContext, S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_CriticalityDiagnostics, + S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_MME_UE_S1AP_ID_1, S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_CSGMembershipStatus, S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_ProSeAuthorized, S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_UEUserPlaneCIoTSupportIndicator, @@ -536,6 +540,7 @@ typedef enum S1AP_InitialContextSetupRequestIEs__value_PR { S1AP_InitialContextSetupRequestIEs__value_PR_CSGMembershipStatus, S1AP_InitialContextSetupRequestIEs__value_PR_LAI, S1AP_InitialContextSetupRequestIEs__value_PR_GUMMEI, + S1AP_InitialContextSetupRequestIEs__value_PR_MME_UE_S1AP_ID_1, S1AP_InitialContextSetupRequestIEs__value_PR_ManagementBasedMDTAllowed, S1AP_InitialContextSetupRequestIEs__value_PR_MDTPLMNList, S1AP_InitialContextSetupRequestIEs__value_PR_AdditionalCSFallbackIndicator, @@ -691,6 +696,7 @@ typedef enum S1AP_InitialUEMessage_IEs__value_PR { S1AP_InitialUEMessage_IEs__value_PR_RelayNode_Indicator, S1AP_InitialUEMessage_IEs__value_PR_GUMMEIType, S1AP_InitialUEMessage_IEs__value_PR_TunnelInformation, + S1AP_InitialUEMessage_IEs__value_PR_TransportLayerAddress_1, S1AP_InitialUEMessage_IEs__value_PR_LHN_ID, S1AP_InitialUEMessage_IEs__value_PR_MME_Group_ID, S1AP_InitialUEMessage_IEs__value_PR_UE_Usage_Type, @@ -708,6 +714,7 @@ typedef enum S1AP_UplinkNASTransport_IEs__value_PR { S1AP_UplinkNASTransport_IEs__value_PR_EUTRAN_CGI, S1AP_UplinkNASTransport_IEs__value_PR_TAI, S1AP_UplinkNASTransport_IEs__value_PR_TransportLayerAddress, + S1AP_UplinkNASTransport_IEs__value_PR_TransportLayerAddress_1, S1AP_UplinkNASTransport_IEs__value_PR_LHN_ID, S1AP_UplinkNASTransport_IEs__value_PR_PSCellInformation } S1AP_UplinkNASTransport_IEs__value_PR; @@ -784,7 +791,8 @@ typedef enum S1AP_ENBConfigurationUpdateIEs__value_PR { S1AP_ENBConfigurationUpdateIEs__value_PR_CSG_IdList, S1AP_ENBConfigurationUpdateIEs__value_PR_PagingDRX, S1AP_ENBConfigurationUpdateIEs__value_PR_NB_IoT_DefaultPagingDRX, - S1AP_ENBConfigurationUpdateIEs__value_PR_ConnectedengNBList + S1AP_ENBConfigurationUpdateIEs__value_PR_ConnectedengNBList, + S1AP_ENBConfigurationUpdateIEs__value_PR_ConnectedengNBList_1 } S1AP_ENBConfigurationUpdateIEs__value_PR; typedef enum S1AP_ENBConfigurationUpdateAcknowledgeIEs__value_PR { S1AP_ENBConfigurationUpdateAcknowledgeIEs__value_PR_NOTHING, /* No components present */ @@ -1021,6 +1029,7 @@ typedef enum S1AP_E_RABModificationConfirmIEs__value_PR { S1AP_E_RABModificationConfirmIEs__value_PR_ENB_UE_S1AP_ID, S1AP_E_RABModificationConfirmIEs__value_PR_E_RABModifyListBearerModConf, S1AP_E_RABModificationConfirmIEs__value_PR_E_RABList, + S1AP_E_RABModificationConfirmIEs__value_PR_E_RABList_1, S1AP_E_RABModificationConfirmIEs__value_PR_CriticalityDiagnostics, S1AP_E_RABModificationConfirmIEs__value_PR_CSGMembershipStatus } S1AP_E_RABModificationConfirmIEs__value_PR; @@ -1499,6 +1508,7 @@ typedef struct S1AP_HandoverRequiredIEs { S1AP_Direct_Forwarding_Path_Availability_t Direct_Forwarding_Path_Availability; S1AP_SRVCCHOIndication_t SRVCCHOIndication; S1AP_Source_ToTarget_TransparentContainer_t Source_ToTarget_TransparentContainer; + S1AP_Source_ToTarget_TransparentContainer_t Source_ToTarget_TransparentContainer_1; S1AP_MSClassmark2_t MSClassmark2; S1AP_MSClassmark3_t MSClassmark3; S1AP_CSG_Id_t CSG_Id; @@ -1526,6 +1536,7 @@ typedef struct S1AP_HandoverCommandIEs { S1AP_E_RABSubjecttoDataForwardingList_t E_RABSubjecttoDataForwardingList; S1AP_E_RABList_t E_RABList; S1AP_Target_ToSource_TransparentContainer_t Target_ToSource_TransparentContainer; + S1AP_Target_ToSource_TransparentContainer_t Target_ToSource_TransparentContainer_1; S1AP_CriticalityDiagnostics_t CriticalityDiagnostics; } choice; @@ -1577,6 +1588,7 @@ typedef struct S1AP_HandoverRequestIEs { S1AP_CSG_Id_t CSG_Id; S1AP_CSGMembershipStatus_t CSGMembershipStatus; S1AP_GUMMEI_t GUMMEI; + S1AP_MME_UE_S1AP_ID_t MME_UE_S1AP_ID_1; S1AP_ManagementBasedMDTAllowed_t ManagementBasedMDTAllowed; S1AP_MDTPLMNList_t MDTPLMNList; S1AP_Masked_IMEISV_t Masked_IMEISV; @@ -1708,6 +1720,7 @@ typedef struct S1AP_PathSwitchRequestAcknowledgeIEs { S1AP_E_RABList_t E_RABList; S1AP_SecurityContext_t SecurityContext; S1AP_CriticalityDiagnostics_t CriticalityDiagnostics; + S1AP_MME_UE_S1AP_ID_t MME_UE_S1AP_ID_1; S1AP_CSGMembershipStatus_t CSGMembershipStatus; S1AP_ProSeAuthorized_t ProSeAuthorized; S1AP_UEUserPlaneCIoTSupportIndicator_t UEUserPlaneCIoTSupportIndicator; @@ -1948,6 +1961,7 @@ typedef struct S1AP_InitialContextSetupRequestIEs { S1AP_CSGMembershipStatus_t CSGMembershipStatus; S1AP_LAI_t LAI; S1AP_GUMMEI_t GUMMEI; + S1AP_MME_UE_S1AP_ID_t MME_UE_S1AP_ID_1; S1AP_ManagementBasedMDTAllowed_t ManagementBasedMDTAllowed; S1AP_MDTPLMNList_t MDTPLMNList; S1AP_AdditionalCSFallbackIndicator_t AdditionalCSFallbackIndicator; @@ -2259,6 +2273,7 @@ typedef struct S1AP_InitialUEMessage_IEs { S1AP_RelayNode_Indicator_t RelayNode_Indicator; S1AP_GUMMEIType_t GUMMEIType; S1AP_TunnelInformation_t TunnelInformation; + S1AP_TransportLayerAddress_t TransportLayerAddress_1; S1AP_LHN_ID_t LHN_ID; S1AP_MME_Group_ID_t MME_Group_ID; S1AP_UE_Usage_Type_t UE_Usage_Type; @@ -2288,6 +2303,7 @@ typedef struct S1AP_UplinkNASTransport_IEs { S1AP_EUTRAN_CGI_t EUTRAN_CGI; S1AP_TAI_t TAI; S1AP_TransportLayerAddress_t TransportLayerAddress; + S1AP_TransportLayerAddress_t TransportLayerAddress_1; S1AP_LHN_ID_t LHN_ID; S1AP_PSCellInformation_t PSCellInformation; } choice; @@ -2485,6 +2501,7 @@ typedef struct S1AP_ENBConfigurationUpdateIEs { S1AP_PagingDRX_t PagingDRX; S1AP_NB_IoT_DefaultPagingDRX_t NB_IoT_DefaultPagingDRX; S1AP_ConnectedengNBList_t ConnectedengNBList; + S1AP_ConnectedengNBList_t ConnectedengNBList_1; } choice; /* Context for parsing across buffer boundaries */ @@ -3141,6 +3158,7 @@ typedef struct S1AP_E_RABModificationConfirmIEs { S1AP_ENB_UE_S1AP_ID_t ENB_UE_S1AP_ID; S1AP_E_RABModifyListBearerModConf_t E_RABModifyListBearerModConf; S1AP_E_RABList_t E_RABList; + S1AP_E_RABList_t E_RABList_1; S1AP_CriticalityDiagnostics_t CriticalityDiagnostics; S1AP_CSGMembershipStatus_t CSGMembershipStatus; } choice; diff --git a/lib/asn1c/s1ap/meson.build b/lib/asn1c/s1ap/meson.build index 6bec6427e..b6d47e667 100644 --- a/lib/asn1c/s1ap/meson.build +++ b/lib/asn1c/s1ap/meson.build @@ -613,6 +613,7 @@ libasn1c_s1ap_sources = files(''' S1AP_ProtocolExtensionField.h S1AP_PrivateIE-Container.h S1AP_PrivateIE-Field.h + S1AP_EXTERNAL.h S1AP_S1AP-PDU.c S1AP_InitiatingMessage.c @@ -1206,6 +1207,7 @@ libasn1c_s1ap_sources = files(''' S1AP_ProtocolExtensionField.c S1AP_PrivateIE-Container.c S1AP_PrivateIE-Field.c + S1AP_EXTERNAL.c '''.split()) libasn1c_s1ap_inc = include_directories('.') diff --git a/lib/asn1c/support/README.md b/lib/asn1c/support/README.md index 22798c9cd..d0097d4ed 100644 --- a/lib/asn1c/support/README.md +++ b/lib/asn1c/support/README.md @@ -1,9 +1,15 @@ -Use velichkov git's fork for asn1c +Use mounse07410(vlm_master) git's fork for asn1c =========================================== user@host ~/Documents/git/my$ \ - git clone https://github.com/velichkov/asn1c.git + git clone https://github.com/mouse07410/asn1c.git user@host ~/Documents/git/my$ \ - git checkout s1ap + git checkout ca3d87a0a3e27ce71b3800210f58d2a3c759f573 + +OR + +user@host ~/Documents/git/my$ \ + git clone https://github.com/open5gs/asn1c.git + user@host Documents/git/my/asn1c$ \ autoreconf -fi;./configure;make -j4 @@ -143,7 +149,9 @@ user@host ~/Documents/git/open5gs/lib/asn1c/s1ap$ \ user@host ~/Documents/git/open5gs/lib/asn1c/ngap$ \ rm -f NGAP_ProtocolIE-ContainerPair.c NGAP_ProtocolIE-FieldPair.c \ - NGAP_ProtocolIE-ContainerPairList.c + NGAP_ProtocolIE-ContainerPairList.c \ + NGAP_ProtocolIE-ContainerPair.h NGAP_ProtocolIE-ContainerPairList.h \ + NGAP_ProtocolIE-FieldPair.h user@host ~/Documents/git/open5gs/lib/asn1c/s1ap$ \ rm -f Makefile.am.asn1convert Makefile.am.libasncodec diff --git a/lib/ngap/ogs-ngap.h b/lib/ngap/ogs-ngap.h index f79a52c95..58de3fb53 100644 --- a/lib/ngap/ogs-ngap.h +++ b/lib/ngap/ogs-ngap.h @@ -628,6 +628,7 @@ #include "NGAP_XnGTP-TLAs.h" #include "NGAP_XnTLAs.h" #include "NGAP_XnTNLConfigurationInfo.h" +#include "NGAP_EXTERNAL.h" #include "asn1c/util/conv.h" #include "asn1c/util/message.h" diff --git a/lib/s1ap/ogs-s1ap.h b/lib/s1ap/ogs-s1ap.h index adadd24ef..a743eb8d6 100644 --- a/lib/s1ap/ogs-s1ap.h +++ b/lib/s1ap/ogs-s1ap.h @@ -540,6 +540,7 @@ #include "S1AP_WriteReplaceWarningResponse.h" #include "S1AP_X2TNLConfigurationInfo.h" #include "S1AP_asn_constant.h" +#include "S1AP_EXTERNAL.h" #include "asn1c/util/conv.h" #include "asn1c/util/message.h" diff --git a/tests/23504/r16-test.c b/tests/23504/r16-test.c index 3ea3fce30..4a15dc957 100644 --- a/tests/23504/r16-test.c +++ b/tests/23504/r16-test.c @@ -395,22 +395,16 @@ static void test2_func(abts_case *tc, void *data) rv = testenb_s1ap_send(s1ap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); -#if 0 /* Send Attach Complete + Activate default EPS bearer cotext accept */ rv = tests1ap_build_attach_complete(&sendbuf, msgindex); ABTS_INT_EQUAL(tc, OGS_OK, rv); rv = testenb_s1ap_send(s1ap, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); -#endif - ogs_msleep(50); - -#if 0 /* Receive EMM information */ recvbuf = testenb_s1ap_read(s1ap); ABTS_PTR_NOTNULL(tc, recvbuf); ogs_pkbuf_free(recvbuf); -#endif /********** Remove Subscriber in Database */ doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi)); diff --git a/tests/unit/crash-test.c b/tests/unit/crash-test.c index 5f94178ce..b6d176e44 100644 --- a/tests/unit/crash-test.c +++ b/tests/unit/crash-test.c @@ -382,6 +382,221 @@ static void test3_func(abts_case *tc, void *data) ogs_pkbuf_free(enb_pkbuf); } +static void test4_func(abts_case *tc, void *data) +{ + const char *payload = + "000d" + "4037000005000000 0200640008000200 01001a000e0d277a 6f1f5b0107430003" + "5200c20064400800 32f5400020001000 4340060032f54000 01"; + + ogs_s1ap_message_t message; + ogs_pkbuf_t *enb_pkbuf; + int result; + char hexbuf[OGS_MAX_SDU_LEN]; + + enb_pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); + ogs_pkbuf_put_data(enb_pkbuf, + OGS_HEX(payload, strlen(payload), hexbuf), 59); + + result = ogs_s1ap_decode(&message, enb_pkbuf); + ABTS_INT_EQUAL(tc, 0, result); + + ogs_s1ap_free(&message); + ogs_pkbuf_free(enb_pkbuf); +} + +static void test5_func(abts_case *tc, void *data) +{ + const char *payload = + "000d404400000600 0000020001000800 020001001a000e0d 2728e58e6d010743" + "00035200c2006440 080009f107000200 10004340060009f1 0700010120400900" + "09f1070012345020"; + + ogs_s1ap_message_t message; + ogs_pkbuf_t *enb_pkbuf; + int result; + char hexbuf[OGS_MAX_SDU_LEN]; + + enb_pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); + ogs_pkbuf_put_data(enb_pkbuf, + OGS_HEX(payload, strlen(payload), hexbuf), 72); + + result = ogs_s1ap_decode(&message, enb_pkbuf); + ABTS_INT_EQUAL(tc, 0, result); + + ogs_s1ap_free(&message); + ogs_pkbuf_free(enb_pkbuf); +} + +static ogs_pkbuf_t *test_build_uplink_nas_transport( + uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, ogs_pkbuf_t *emmbuf) +{ + ogs_pkbuf_t *s1apbuf = NULL; + + S1AP_S1AP_PDU_t pdu; + S1AP_InitiatingMessage_t *initiatingMessage = NULL; + S1AP_UplinkNASTransport_t *UplinkNASTransport = NULL; + + S1AP_UplinkNASTransport_IEs_t *ie = NULL; + S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL; + S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL; + S1AP_NAS_PDU_t *NAS_PDU = NULL; + S1AP_EUTRAN_CGI_t *EUTRAN_CGI = NULL; + S1AP_TAI_t *TAI = NULL; + S1AP_PSCellInformation_t *PSCellInformation = NULL; + S1AP_NR_CGI_t *nCGI = NULL; + + ogs_plmn_id_t plmn_id; + uint32_t e_cell_id; /* 28 bit */ + uint64_t nr_cell_id; /* 36 bit */ + uint16_t tac; + + ogs_assert(emmbuf); + + memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage = + CALLOC(1, sizeof(S1AP_InitiatingMessage_t)); + + initiatingMessage = pdu.choice.initiatingMessage; + initiatingMessage->procedureCode = + S1AP_ProcedureCode_id_uplinkNASTransport; + initiatingMessage->criticality = S1AP_Criticality_ignore; + initiatingMessage->value.present = + S1AP_InitiatingMessage__value_PR_UplinkNASTransport; + + UplinkNASTransport = &initiatingMessage->value.choice.UplinkNASTransport; + + ie = CALLOC(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ASN_SEQUENCE_ADD(&UplinkNASTransport->protocolIEs, ie); + + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = + S1AP_UplinkNASTransport_IEs__value_PR_MME_UE_S1AP_ID; + + MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID; + + ie = CALLOC(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ASN_SEQUENCE_ADD(&UplinkNASTransport->protocolIEs, ie); + + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = + S1AP_UplinkNASTransport_IEs__value_PR_ENB_UE_S1AP_ID; + + ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID; + + ie = CALLOC(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ASN_SEQUENCE_ADD(&UplinkNASTransport->protocolIEs, ie); + + ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_NAS_PDU; + + NAS_PDU = &ie->value.choice.NAS_PDU; + + NAS_PDU->size = emmbuf->len; + NAS_PDU->buf = CALLOC(NAS_PDU->size, sizeof(uint8_t)); + memcpy(NAS_PDU->buf, emmbuf->data, NAS_PDU->size); + ogs_pkbuf_free(emmbuf); + + *MME_UE_S1AP_ID = mme_ue_s1ap_id; + *ENB_UE_S1AP_ID = enb_ue_s1ap_id; + + ie = CALLOC(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ASN_SEQUENCE_ADD(&UplinkNASTransport->protocolIEs, ie); + + ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_EUTRAN_CGI; + + EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI; + + ogs_plmn_id_build(&plmn_id, 901, 70, 2); + + ogs_s1ap_buffer_to_OCTET_STRING( + &plmn_id, OGS_PLMN_ID_LEN, &EUTRAN_CGI->pLMNidentity); + EUTRAN_CGI->cell_ID.size = 4; + EUTRAN_CGI->cell_ID.buf = CALLOC( + EUTRAN_CGI->cell_ID.size, sizeof(uint8_t)); + ogs_assert(EUTRAN_CGI->cell_ID.buf); + + e_cell_id = 0x20010; + + EUTRAN_CGI->cell_ID.buf[0] = (e_cell_id >> 24); + EUTRAN_CGI->cell_ID.buf[1] = (e_cell_id >> 16); + EUTRAN_CGI->cell_ID.buf[2] = (e_cell_id >> 8); + EUTRAN_CGI->cell_ID.buf[3] = (e_cell_id); + EUTRAN_CGI->cell_ID.bits_unused = 4; + + ie = CALLOC(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ASN_SEQUENCE_ADD(&UplinkNASTransport->protocolIEs, ie); + + ie->id = S1AP_ProtocolIE_ID_id_TAI; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_TAI; + + TAI = &ie->value.choice.TAI; + + tac = 1; + ogs_asn_uint16_to_OCTET_STRING(tac, &TAI->tAC); + ogs_s1ap_buffer_to_OCTET_STRING( + &plmn_id, OGS_PLMN_ID_LEN, &TAI->pLMNidentity); + + ie = CALLOC(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ASN_SEQUENCE_ADD(&UplinkNASTransport->protocolIEs, ie); + + ie->id = S1AP_ProtocolIE_ID_id_PSCellInformation; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_PSCellInformation; + + PSCellInformation = &ie->value.choice.PSCellInformation; + nCGI = &PSCellInformation->nCGI; + + ogs_s1ap_buffer_to_OCTET_STRING( + &plmn_id, OGS_PLMN_ID_LEN, &nCGI->pLMNIdentity); + + nr_cell_id = 0x0012345020; + nCGI->nRCellIdentity.size = 5; + nCGI->nRCellIdentity.buf = CALLOC( + nCGI->nRCellIdentity.size, sizeof(uint8_t)); + ogs_assert(nCGI->nRCellIdentity.buf); + nCGI->nRCellIdentity.buf[0] = (nr_cell_id >> 32); + nCGI->nRCellIdentity.buf[1] = (nr_cell_id >> 24); + nCGI->nRCellIdentity.buf[2] = (nr_cell_id >> 16); + nCGI->nRCellIdentity.buf[3] = (nr_cell_id >> 8); + nCGI->nRCellIdentity.buf[4] = (nr_cell_id); + nCGI->nRCellIdentity.bits_unused = 4; + + return ogs_s1ap_encode(&pdu); +} + +static void test6_func(abts_case *tc, void *data) +{ + const char *nas_payload = "2728 e58e6d0107430003 5200c2"; + + ogs_s1ap_message_t message; + int result; + + ogs_pkbuf_t *s1apbuf = NULL; + ogs_pkbuf_t *emmbuf = NULL; + char hexbuf[OGS_MAX_SDU_LEN]; + + emmbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN); + ogs_pkbuf_put_data(emmbuf, + OGS_HEX(nas_payload, strlen(nas_payload), hexbuf), 13); + + s1apbuf = test_build_uplink_nas_transport(1, 1, emmbuf); + ABTS_PTR_NOTNULL(tc, s1apbuf); + + result = ogs_s1ap_decode(&message, s1apbuf); + ABTS_INT_EQUAL(tc, 0, result); + + ogs_s1ap_free(&message); + ogs_pkbuf_free(s1apbuf); +} + abts_suite *test_crash(abts_suite *suite) { suite = ADD_SUITE(suite) @@ -389,6 +604,9 @@ abts_suite *test_crash(abts_suite *suite) abts_run_test(suite, test1_func, NULL); abts_run_test(suite, test2_func, NULL); abts_run_test(suite, test3_func, NULL); + abts_run_test(suite, test4_func, NULL); + abts_run_test(suite, test5_func, NULL); + abts_run_test(suite, test6_func, NULL); return suite; }