diff --git a/src/core/libs/supl/CMakeLists.txt b/src/core/libs/supl/CMakeLists.txt new file mode 100644 index 000000000..7ea283696 --- /dev/null +++ b/src/core/libs/supl/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (C) 2012-2013 (see AUTHORS file for a list of contributors) +# +# This file is part of GNSS-SDR. +# +# GNSS-SDR is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# at your option) any later version. +# +# GNSS-SDR is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNSS-SDR. If not, see . +# + +file(GLOB ASN_RRLP_SOURCES "${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp/*.c") +file(GLOB ASN_SUPL_SOURCES "${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl/*.c") + +set (SUPL_SOURCES + supl.c + ) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/src/core/libs/supl + ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp + ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ) + + + +add_library (supl_library STATIC ${ASN_RRLP_SOURCES} ${ASN_SUPL_SOURCES} ${SUPL_SOURCES}) +target_link_libraries (supl_library ssl) +SET_TARGET_PROPERTIES(supl_library PROPERTIES LINKER_LANGUAGE C) \ No newline at end of file diff --git a/src/core/libs/supl/asn-rrlp/Accuracy.c b/src/core/libs/supl/asn-rrlp/Accuracy.c new file mode 100644 index 000000000..b3609c7ef --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Accuracy.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Accuracy.h" + +int +Accuracy_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +Accuracy_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +Accuracy_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Accuracy_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Accuracy_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Accuracy_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Accuracy_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Accuracy_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Accuracy_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +Accuracy_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +Accuracy_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Accuracy_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_Accuracy_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_Accuracy_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Accuracy = { + "Accuracy", + "Accuracy", + Accuracy_free, + Accuracy_print, + Accuracy_constraint, + Accuracy_decode_ber, + Accuracy_encode_der, + Accuracy_decode_xer, + Accuracy_encode_xer, + Accuracy_decode_uper, + Accuracy_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Accuracy_tags_1, + sizeof(asn_DEF_Accuracy_tags_1) + /sizeof(asn_DEF_Accuracy_tags_1[0]), /* 1 */ + asn_DEF_Accuracy_tags_1, /* Same as above */ + sizeof(asn_DEF_Accuracy_tags_1) + /sizeof(asn_DEF_Accuracy_tags_1[0]), /* 1 */ + &asn_PER_type_Accuracy_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Accuracy.h b/src/core/libs/supl/asn-rrlp/Accuracy.h new file mode 100644 index 000000000..5ac421785 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Accuracy.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Accuracy_H_ +#define _Accuracy_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Accuracy */ +typedef long Accuracy_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Accuracy; +asn_struct_free_f Accuracy_free; +asn_struct_print_f Accuracy_print; +asn_constr_check_f Accuracy_constraint; +ber_type_decoder_f Accuracy_decode_ber; +der_type_encoder_f Accuracy_encode_der; +xer_type_decoder_f Accuracy_decode_xer; +xer_type_encoder_f Accuracy_encode_xer; +per_type_decoder_f Accuracy_decode_uper; +per_type_encoder_f Accuracy_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Accuracy_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AccuracyOpt.c b/src/core/libs/supl/asn-rrlp/AccuracyOpt.c new file mode 100644 index 000000000..5515ee62d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AccuracyOpt.c @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AccuracyOpt.h" + +static asn_TYPE_member_t asn_MBR_AccuracyOpt_1[] = { + { ATF_POINTER, 1, offsetof(struct AccuracyOpt, accuracy), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "accuracy" + }, +}; +static int asn_MAP_AccuracyOpt_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_AccuracyOpt_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AccuracyOpt_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* accuracy at 125 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AccuracyOpt_specs_1 = { + sizeof(struct AccuracyOpt), + offsetof(struct AccuracyOpt, _asn_ctx), + asn_MAP_AccuracyOpt_tag2el_1, + 1, /* Count of tags in the map */ + asn_MAP_AccuracyOpt_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AccuracyOpt = { + "AccuracyOpt", + "AccuracyOpt", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AccuracyOpt_tags_1, + sizeof(asn_DEF_AccuracyOpt_tags_1) + /sizeof(asn_DEF_AccuracyOpt_tags_1[0]), /* 1 */ + asn_DEF_AccuracyOpt_tags_1, /* Same as above */ + sizeof(asn_DEF_AccuracyOpt_tags_1) + /sizeof(asn_DEF_AccuracyOpt_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AccuracyOpt_1, + 1, /* Elements count */ + &asn_SPC_AccuracyOpt_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AccuracyOpt.h b/src/core/libs/supl/asn-rrlp/AccuracyOpt.h new file mode 100644 index 000000000..d5605fe1d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AccuracyOpt.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AccuracyOpt_H_ +#define _AccuracyOpt_H_ + + +#include + +/* Including external dependencies */ +#include "Accuracy.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AccuracyOpt */ +typedef struct AccuracyOpt { + Accuracy_t *accuracy /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AccuracyOpt_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AccuracyOpt; + +#ifdef __cplusplus +} +#endif + +#endif /* _AccuracyOpt_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AcquisAssist.c b/src/core/libs/supl/asn-rrlp/AcquisAssist.c new file mode 100644 index 000000000..9dc1721e8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AcquisAssist.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AcquisAssist.h" + +static asn_TYPE_member_t asn_MBR_AcquisAssist_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AcquisAssist, timeRelation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeRelation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeRelation" + }, + { ATF_NOFLAGS, 0, offsetof(struct AcquisAssist, acquisList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfAcquisElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "acquisList" + }, +}; +static ber_tlv_tag_t asn_DEF_AcquisAssist_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AcquisAssist_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* timeRelation at 817 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* acquisList at 822 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AcquisAssist_specs_1 = { + sizeof(struct AcquisAssist), + offsetof(struct AcquisAssist, _asn_ctx), + asn_MAP_AcquisAssist_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AcquisAssist = { + "AcquisAssist", + "AcquisAssist", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AcquisAssist_tags_1, + sizeof(asn_DEF_AcquisAssist_tags_1) + /sizeof(asn_DEF_AcquisAssist_tags_1[0]), /* 1 */ + asn_DEF_AcquisAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_AcquisAssist_tags_1) + /sizeof(asn_DEF_AcquisAssist_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AcquisAssist_1, + 2, /* Elements count */ + &asn_SPC_AcquisAssist_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AcquisAssist.h b/src/core/libs/supl/asn-rrlp/AcquisAssist.h new file mode 100644 index 000000000..cf9ab7c55 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AcquisAssist.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AcquisAssist_H_ +#define _AcquisAssist_H_ + + +#include + +/* Including external dependencies */ +#include "TimeRelation.h" +#include "SeqOfAcquisElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AcquisAssist */ +typedef struct AcquisAssist { + TimeRelation_t timeRelation; + SeqOfAcquisElement_t acquisList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AcquisAssist_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AcquisAssist; + +#ifdef __cplusplus +} +#endif + +#endif /* _AcquisAssist_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AcquisElement.c b/src/core/libs/supl/asn-rrlp/AcquisElement.c new file mode 100644 index 000000000..506e7ad3a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AcquisElement.c @@ -0,0 +1,281 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AcquisElement.h" + +static int +memb_doppler0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -2048 && value <= 2047)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1022)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_intCodePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 19)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_gpsBitNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_codePhaseSearchWindow_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_doppler0_constr_3 = { + { APC_CONSTRAINED, 12, 12, -2048, 2047 } /* (-2048..2047) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_codePhase_constr_5 = { + { APC_CONSTRAINED, 10, 10, 0, 1022 } /* (0..1022) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_intCodePhase_constr_6 = { + { APC_CONSTRAINED, 5, 5, 0, 19 } /* (0..19) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_gpsBitNumber_constr_7 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_codePhaseSearchWindow_constr_8 = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_AcquisElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, svid), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svid" + }, + { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, doppler0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_doppler0_constraint_1, + &asn_PER_memb_doppler0_constr_3, + 0, + "doppler0" + }, + { ATF_POINTER, 1, offsetof(struct AcquisElement, addionalDoppler), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AddionalDopplerFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "addionalDoppler" + }, + { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, codePhase), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_codePhase_constraint_1, + &asn_PER_memb_codePhase_constr_5, + 0, + "codePhase" + }, + { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, intCodePhase), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_intCodePhase_constraint_1, + &asn_PER_memb_intCodePhase_constr_6, + 0, + "intCodePhase" + }, + { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, gpsBitNumber), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gpsBitNumber_constraint_1, + &asn_PER_memb_gpsBitNumber_constr_7, + 0, + "gpsBitNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, codePhaseSearchWindow), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_codePhaseSearchWindow_constraint_1, + &asn_PER_memb_codePhaseSearchWindow_constr_8, + 0, + "codePhaseSearchWindow" + }, + { ATF_POINTER, 1, offsetof(struct AcquisElement, addionalAngle), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AddionalAngleFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "addionalAngle" + }, +}; +static int asn_MAP_AcquisElement_oms_1[] = { 2, 7 }; +static ber_tlv_tag_t asn_DEF_AcquisElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AcquisElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svid at 834 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* doppler0 at 838 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* addionalDoppler at 839 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* codePhase at 840 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* intCodePhase at 841 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* gpsBitNumber at 842 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* codePhaseSearchWindow at 843 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* addionalAngle at 844 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AcquisElement_specs_1 = { + sizeof(struct AcquisElement), + offsetof(struct AcquisElement, _asn_ctx), + asn_MAP_AcquisElement_tag2el_1, + 8, /* Count of tags in the map */ + asn_MAP_AcquisElement_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AcquisElement = { + "AcquisElement", + "AcquisElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AcquisElement_tags_1, + sizeof(asn_DEF_AcquisElement_tags_1) + /sizeof(asn_DEF_AcquisElement_tags_1[0]), /* 1 */ + asn_DEF_AcquisElement_tags_1, /* Same as above */ + sizeof(asn_DEF_AcquisElement_tags_1) + /sizeof(asn_DEF_AcquisElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AcquisElement_1, + 8, /* Elements count */ + &asn_SPC_AcquisElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AcquisElement.h b/src/core/libs/supl/asn-rrlp/AcquisElement.h new file mode 100644 index 000000000..cf5b31e54 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AcquisElement.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AcquisElement_H_ +#define _AcquisElement_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct AddionalDopplerFields; +struct AddionalAngleFields; + +/* AcquisElement */ +typedef struct AcquisElement { + SatelliteID_t svid; + long doppler0; + struct AddionalDopplerFields *addionalDoppler /* OPTIONAL */; + long codePhase; + long intCodePhase; + long gpsBitNumber; + long codePhaseSearchWindow; + struct AddionalAngleFields *addionalAngle /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AcquisElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AcquisElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "AddionalDopplerFields.h" +#include "AddionalAngleFields.h" + +#endif /* _AcquisElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c new file mode 100644 index 000000000..5de86fe61 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c @@ -0,0 +1,129 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AddionalAngleFields.h" + +static int +memb_azimuth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_elevation_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_azimuth_constr_2 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_elevation_constr_3 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_AddionalAngleFields_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AddionalAngleFields, azimuth), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_azimuth_constraint_1, + &asn_PER_memb_azimuth_constr_2, + 0, + "azimuth" + }, + { ATF_NOFLAGS, 0, offsetof(struct AddionalAngleFields, elevation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_elevation_constraint_1, + &asn_PER_memb_elevation_constr_3, + 0, + "elevation" + }, +}; +static ber_tlv_tag_t asn_DEF_AddionalAngleFields_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AddionalAngleFields_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* azimuth at 858 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* elevation at 860 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AddionalAngleFields_specs_1 = { + sizeof(struct AddionalAngleFields), + offsetof(struct AddionalAngleFields, _asn_ctx), + asn_MAP_AddionalAngleFields_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AddionalAngleFields = { + "AddionalAngleFields", + "AddionalAngleFields", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AddionalAngleFields_tags_1, + sizeof(asn_DEF_AddionalAngleFields_tags_1) + /sizeof(asn_DEF_AddionalAngleFields_tags_1[0]), /* 1 */ + asn_DEF_AddionalAngleFields_tags_1, /* Same as above */ + sizeof(asn_DEF_AddionalAngleFields_tags_1) + /sizeof(asn_DEF_AddionalAngleFields_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AddionalAngleFields_1, + 2, /* Elements count */ + &asn_SPC_AddionalAngleFields_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h new file mode 100644 index 000000000..896e4d219 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AddionalAngleFields_H_ +#define _AddionalAngleFields_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AddionalAngleFields */ +typedef struct AddionalAngleFields { + long azimuth; + long elevation; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AddionalAngleFields_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AddionalAngleFields; + +#ifdef __cplusplus +} +#endif + +#endif /* _AddionalAngleFields_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c new file mode 100644 index 000000000..4b0b58a30 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c @@ -0,0 +1,129 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AddionalDopplerFields.h" + +static int +memb_doppler1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_dopplerUncertainty_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_doppler1_constr_2 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_dopplerUncertainty_constr_3 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_AddionalDopplerFields_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AddionalDopplerFields, doppler1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_doppler1_constraint_1, + &asn_PER_memb_doppler1_constr_2, + 0, + "doppler1" + }, + { ATF_NOFLAGS, 0, offsetof(struct AddionalDopplerFields, dopplerUncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_dopplerUncertainty_constraint_1, + &asn_PER_memb_dopplerUncertainty_constr_3, + 0, + "dopplerUncertainty" + }, +}; +static ber_tlv_tag_t asn_DEF_AddionalDopplerFields_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AddionalDopplerFields_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* doppler1 at 850 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* dopplerUncertainty at 851 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AddionalDopplerFields_specs_1 = { + sizeof(struct AddionalDopplerFields), + offsetof(struct AddionalDopplerFields, _asn_ctx), + asn_MAP_AddionalDopplerFields_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AddionalDopplerFields = { + "AddionalDopplerFields", + "AddionalDopplerFields", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AddionalDopplerFields_tags_1, + sizeof(asn_DEF_AddionalDopplerFields_tags_1) + /sizeof(asn_DEF_AddionalDopplerFields_tags_1[0]), /* 1 */ + asn_DEF_AddionalDopplerFields_tags_1, /* Same as above */ + sizeof(asn_DEF_AddionalDopplerFields_tags_1) + /sizeof(asn_DEF_AddionalDopplerFields_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AddionalDopplerFields_1, + 2, /* Elements count */ + &asn_SPC_AddionalDopplerFields_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h new file mode 100644 index 000000000..73f7a8589 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AddionalDopplerFields_H_ +#define _AddionalDopplerFields_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AddionalDopplerFields */ +typedef struct AddionalDopplerFields { + long doppler1; + long dopplerUncertainty; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AddionalDopplerFields_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AddionalDopplerFields; + +#ifdef __cplusplus +} +#endif + +#endif /* _AddionalDopplerFields_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c new file mode 100644 index 000000000..af10b0ccc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AdditionalAssistanceData.h" + +static asn_TYPE_member_t asn_MBR_AdditionalAssistanceData_1[] = { + { ATF_POINTER, 3, offsetof(struct AdditionalAssistanceData, gpsAssistanceData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSAssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsAssistanceData" + }, + { ATF_POINTER, 2, offsetof(struct AdditionalAssistanceData, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extensionContainer" + }, + { ATF_POINTER, 1, offsetof(struct AdditionalAssistanceData, ganssAssistanceData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSAssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssAssistanceData" + }, +}; +static int asn_MAP_AdditionalAssistanceData_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_AdditionalAssistanceData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AdditionalAssistanceData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsAssistanceData at 520 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* extensionContainer at 521 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssAssistanceData at 523 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AdditionalAssistanceData_specs_1 = { + sizeof(struct AdditionalAssistanceData), + offsetof(struct AdditionalAssistanceData, _asn_ctx), + asn_MAP_AdditionalAssistanceData_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_AdditionalAssistanceData_oms_1, /* Optional members */ + 2, 1, /* Root/Additions */ + 1, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AdditionalAssistanceData = { + "AdditionalAssistanceData", + "AdditionalAssistanceData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AdditionalAssistanceData_tags_1, + sizeof(asn_DEF_AdditionalAssistanceData_tags_1) + /sizeof(asn_DEF_AdditionalAssistanceData_tags_1[0]), /* 1 */ + asn_DEF_AdditionalAssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_AdditionalAssistanceData_tags_1) + /sizeof(asn_DEF_AdditionalAssistanceData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AdditionalAssistanceData_1, + 3, /* Elements count */ + &asn_SPC_AdditionalAssistanceData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h new file mode 100644 index 000000000..44518e35b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AdditionalAssistanceData_H_ +#define _AdditionalAssistanceData_H_ + + +#include + +/* Including external dependencies */ +#include "GPSAssistanceData.h" +#include "ExtensionContainer.h" +#include "GANSSAssistanceData.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AdditionalAssistanceData */ +typedef struct AdditionalAssistanceData { + GPSAssistanceData_t *gpsAssistanceData /* OPTIONAL */; + ExtensionContainer_t *extensionContainer /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + GANSSAssistanceData_t *ganssAssistanceData /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AdditionalAssistanceData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AdditionalAssistanceData; + +#ifdef __cplusplus +} +#endif + +#endif /* _AdditionalAssistanceData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c new file mode 100644 index 000000000..e62840073 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c @@ -0,0 +1,129 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AdditionalDopplerFields.h" + +static int +memb_doppler1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_dopplerUncertainty_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_doppler1_constr_2 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_dopplerUncertainty_constr_3 = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_AdditionalDopplerFields_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AdditionalDopplerFields, doppler1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_doppler1_constraint_1, + &asn_PER_memb_doppler1_constr_2, + 0, + "doppler1" + }, + { ATF_NOFLAGS, 0, offsetof(struct AdditionalDopplerFields, dopplerUncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_dopplerUncertainty_constraint_1, + &asn_PER_memb_dopplerUncertainty_constr_3, + 0, + "dopplerUncertainty" + }, +}; +static ber_tlv_tag_t asn_DEF_AdditionalDopplerFields_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AdditionalDopplerFields_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* doppler1 at 1342 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* dopplerUncertainty at 1343 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AdditionalDopplerFields_specs_1 = { + sizeof(struct AdditionalDopplerFields), + offsetof(struct AdditionalDopplerFields, _asn_ctx), + asn_MAP_AdditionalDopplerFields_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AdditionalDopplerFields = { + "AdditionalDopplerFields", + "AdditionalDopplerFields", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AdditionalDopplerFields_tags_1, + sizeof(asn_DEF_AdditionalDopplerFields_tags_1) + /sizeof(asn_DEF_AdditionalDopplerFields_tags_1[0]), /* 1 */ + asn_DEF_AdditionalDopplerFields_tags_1, /* Same as above */ + sizeof(asn_DEF_AdditionalDopplerFields_tags_1) + /sizeof(asn_DEF_AdditionalDopplerFields_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AdditionalDopplerFields_1, + 2, /* Elements count */ + &asn_SPC_AdditionalDopplerFields_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h new file mode 100644 index 000000000..7b2fe47bd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AdditionalDopplerFields_H_ +#define _AdditionalDopplerFields_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AdditionalDopplerFields */ +typedef struct AdditionalDopplerFields { + long doppler1; + long dopplerUncertainty; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AdditionalDopplerFields_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AdditionalDopplerFields; + +#ifdef __cplusplus +} +#endif + +#endif /* _AdditionalDopplerFields_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AlertFlag.c b/src/core/libs/supl/asn-rrlp/AlertFlag.c new file mode 100644 index 000000000..52eaeeadb --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AlertFlag.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AlertFlag.h" + +int +AlertFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +AlertFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +AlertFlag_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + AlertFlag_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +AlertFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +AlertFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +AlertFlag_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +AlertFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +AlertFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +AlertFlag_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +AlertFlag_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + AlertFlag_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_AlertFlag_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_AlertFlag_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_AlertFlag = { + "AlertFlag", + "AlertFlag", + AlertFlag_free, + AlertFlag_print, + AlertFlag_constraint, + AlertFlag_decode_ber, + AlertFlag_encode_der, + AlertFlag_decode_xer, + AlertFlag_encode_xer, + AlertFlag_decode_uper, + AlertFlag_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AlertFlag_tags_1, + sizeof(asn_DEF_AlertFlag_tags_1) + /sizeof(asn_DEF_AlertFlag_tags_1[0]), /* 1 */ + asn_DEF_AlertFlag_tags_1, /* Same as above */ + sizeof(asn_DEF_AlertFlag_tags_1) + /sizeof(asn_DEF_AlertFlag_tags_1[0]), /* 1 */ + &asn_PER_type_AlertFlag_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AlertFlag.h b/src/core/libs/supl/asn-rrlp/AlertFlag.h new file mode 100644 index 000000000..5f74f10c4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AlertFlag.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AlertFlag_H_ +#define _AlertFlag_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AlertFlag */ +typedef long AlertFlag_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AlertFlag; +asn_struct_free_f AlertFlag_free; +asn_struct_print_f AlertFlag_print; +asn_constr_check_f AlertFlag_constraint; +ber_type_decoder_f AlertFlag_decode_ber; +der_type_encoder_f AlertFlag_encode_der; +xer_type_decoder_f AlertFlag_decode_xer; +xer_type_encoder_f AlertFlag_encode_xer; +per_type_decoder_f AlertFlag_decode_uper; +per_type_encoder_f AlertFlag_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _AlertFlag_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c new file mode 100644 index 000000000..c63036c97 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c @@ -0,0 +1,449 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Almanac-KeplerianSet.h" + +static int +memb_kepAlmanacE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2047)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacDeltaI_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -1024 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacOmegaDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -1024 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepSVHealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacAPowerHalf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -65536 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacOmega0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8192 && value <= 8191)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_kepAlmanacAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -1024 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_kepAlmanacE_constr_2 = { + { APC_CONSTRAINED, 11, 11, 0, 2047 } /* (0..2047) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacDeltaI_constr_3 = { + { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacOmegaDot_constr_4 = { + { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepSVHealth_constr_5 = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacAPowerHalf_constr_6 = { + { APC_CONSTRAINED, 17, -1, -65536, 65535 } /* (-65536..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacOmega0_constr_7 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacW_constr_8 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacM0_constr_9 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacAF0_constr_10 = { + { APC_CONSTRAINED, 14, 14, -8192, 8191 } /* (-8192..8191) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_kepAlmanacAF1_constr_11 = { + { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Almanac_KeplerianSet_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacE), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacE_constraint_1, + &asn_PER_memb_kepAlmanacE_constr_2, + 0, + "kepAlmanacE" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacDeltaI), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacDeltaI_constraint_1, + &asn_PER_memb_kepAlmanacDeltaI_constr_3, + 0, + "kepAlmanacDeltaI" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacOmegaDot), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacOmegaDot_constraint_1, + &asn_PER_memb_kepAlmanacOmegaDot_constr_4, + 0, + "kepAlmanacOmegaDot" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepSVHealth), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepSVHealth_constraint_1, + &asn_PER_memb_kepSVHealth_constr_5, + 0, + "kepSVHealth" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAPowerHalf), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacAPowerHalf_constraint_1, + &asn_PER_memb_kepAlmanacAPowerHalf_constr_6, + 0, + "kepAlmanacAPowerHalf" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacOmega0), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacOmega0_constraint_1, + &asn_PER_memb_kepAlmanacOmega0_constr_7, + 0, + "kepAlmanacOmega0" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacW), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacW_constraint_1, + &asn_PER_memb_kepAlmanacW_constr_8, + 0, + "kepAlmanacW" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacM0), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacM0_constraint_1, + &asn_PER_memb_kepAlmanacM0_constr_9, + 0, + "kepAlmanacM0" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAF0), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacAF0_constraint_1, + &asn_PER_memb_kepAlmanacAF0_constr_10, + 0, + "kepAlmanacAF0" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAF1), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_kepAlmanacAF1_constraint_1, + &asn_PER_memb_kepAlmanacAF1_constr_11, + 0, + "kepAlmanacAF1" + }, +}; +static ber_tlv_tag_t asn_DEF_Almanac_KeplerianSet_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Almanac_KeplerianSet_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* kepAlmanacE at 1368 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* kepAlmanacDeltaI at 1369 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* kepAlmanacOmegaDot at 1370 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* kepSVHealth at 1371 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* kepAlmanacAPowerHalf at 1372 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* kepAlmanacOmega0 at 1373 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* kepAlmanacW at 1374 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* kepAlmanacM0 at 1375 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* kepAlmanacAF0 at 1376 */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* kepAlmanacAF1 at 1377 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Almanac_KeplerianSet_specs_1 = { + sizeof(struct Almanac_KeplerianSet), + offsetof(struct Almanac_KeplerianSet, _asn_ctx), + asn_MAP_Almanac_KeplerianSet_tag2el_1, + 10, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Almanac_KeplerianSet = { + "Almanac-KeplerianSet", + "Almanac-KeplerianSet", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Almanac_KeplerianSet_tags_1, + sizeof(asn_DEF_Almanac_KeplerianSet_tags_1) + /sizeof(asn_DEF_Almanac_KeplerianSet_tags_1[0]), /* 1 */ + asn_DEF_Almanac_KeplerianSet_tags_1, /* Same as above */ + sizeof(asn_DEF_Almanac_KeplerianSet_tags_1) + /sizeof(asn_DEF_Almanac_KeplerianSet_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Almanac_KeplerianSet_1, + 10, /* Elements count */ + &asn_SPC_Almanac_KeplerianSet_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h new file mode 100644 index 000000000..c450e6d8e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Almanac_KeplerianSet_H_ +#define _Almanac_KeplerianSet_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Almanac-KeplerianSet */ +typedef struct Almanac_KeplerianSet { + long kepAlmanacE; + long kepAlmanacDeltaI; + long kepAlmanacOmegaDot; + long kepSVHealth; + long kepAlmanacAPowerHalf; + long kepAlmanacOmega0; + long kepAlmanacW; + long kepAlmanacM0; + long kepAlmanacAF0; + long kepAlmanacAF1; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Almanac_KeplerianSet_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Almanac_KeplerianSet; + +#ifdef __cplusplus +} +#endif + +#endif /* _Almanac_KeplerianSet_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Almanac.c b/src/core/libs/supl/asn-rrlp/Almanac.c new file mode 100644 index 000000000..a886c36b9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Almanac.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Almanac.h" + +static int +memb_alamanacWNa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_alamanacWNa_constr_2 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Almanac_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Almanac, alamanacWNa), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_alamanacWNa_constraint_1, + &asn_PER_memb_alamanacWNa_constr_2, + 0, + "alamanacWNa" + }, + { ATF_NOFLAGS, 0, offsetof(struct Almanac, almanacList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfAlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "almanacList" + }, +}; +static ber_tlv_tag_t asn_DEF_Almanac_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Almanac_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* alamanacWNa at 789 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* almanacList at 794 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Almanac_specs_1 = { + sizeof(struct Almanac), + offsetof(struct Almanac, _asn_ctx), + asn_MAP_Almanac_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Almanac = { + "Almanac", + "Almanac", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Almanac_tags_1, + sizeof(asn_DEF_Almanac_tags_1) + /sizeof(asn_DEF_Almanac_tags_1[0]), /* 1 */ + asn_DEF_Almanac_tags_1, /* Same as above */ + sizeof(asn_DEF_Almanac_tags_1) + /sizeof(asn_DEF_Almanac_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Almanac_1, + 2, /* Elements count */ + &asn_SPC_Almanac_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Almanac.h b/src/core/libs/supl/asn-rrlp/Almanac.h new file mode 100644 index 000000000..a5d81542e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Almanac.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Almanac_H_ +#define _Almanac_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SeqOfAlmanacElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Almanac */ +typedef struct Almanac { + long alamanacWNa; + SeqOfAlmanacElement_t almanacList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Almanac_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Almanac; + +#ifdef __cplusplus +} +#endif + +#endif /* _Almanac_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AlmanacElement.c b/src/core/libs/supl/asn-rrlp/AlmanacElement.c new file mode 100644 index 000000000..702107187 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AlmanacElement.c @@ -0,0 +1,499 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AlmanacElement.h" + +static int +memb_almanacE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_alamanacToa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacKsii_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacOmegaDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacSVhealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacAPowerHalf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16777215)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacOmega0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -1024 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_almanacAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -1024 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_almanacE_constr_3 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_alamanacToa_constr_4 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacKsii_constr_5 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacOmegaDot_constr_6 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacSVhealth_constr_7 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacAPowerHalf_constr_8 = { + { APC_CONSTRAINED, 24, -1, 0, 16777215 } /* (0..16777215) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacOmega0_constr_9 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacW_constr_10 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacM0_constr_11 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacAF0_constr_12 = { + { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_almanacAF1_constr_13 = { + { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_AlmanacElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satelliteID" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacE), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacE_constraint_1, + &asn_PER_memb_almanacE_constr_3, + 0, + "almanacE" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, alamanacToa), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_alamanacToa_constraint_1, + &asn_PER_memb_alamanacToa_constr_4, + 0, + "alamanacToa" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacKsii), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacKsii_constraint_1, + &asn_PER_memb_almanacKsii_constr_5, + 0, + "almanacKsii" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacOmegaDot), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacOmegaDot_constraint_1, + &asn_PER_memb_almanacOmegaDot_constr_6, + 0, + "almanacOmegaDot" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacSVhealth), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacSVhealth_constraint_1, + &asn_PER_memb_almanacSVhealth_constr_7, + 0, + "almanacSVhealth" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAPowerHalf), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacAPowerHalf_constraint_1, + &asn_PER_memb_almanacAPowerHalf_constr_8, + 0, + "almanacAPowerHalf" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacOmega0), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacOmega0_constraint_1, + &asn_PER_memb_almanacOmega0_constr_9, + 0, + "almanacOmega0" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacW), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacW_constraint_1, + &asn_PER_memb_almanacW_constr_10, + 0, + "almanacW" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacM0), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacM0_constraint_1, + &asn_PER_memb_almanacM0_constr_11, + 0, + "almanacM0" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAF0), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacAF0_constraint_1, + &asn_PER_memb_almanacAF0_constr_12, + 0, + "almanacAF0" + }, + { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAF1), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_almanacAF1_constraint_1, + &asn_PER_memb_almanacAF1_constr_13, + 0, + "almanacAF1" + }, +}; +static ber_tlv_tag_t asn_DEF_AlmanacElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AlmanacElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 799 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* almanacE at 800 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* alamanacToa at 801 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* almanacKsii at 802 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* almanacOmegaDot at 803 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* almanacSVhealth at 804 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* almanacAPowerHalf at 805 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* almanacOmega0 at 806 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* almanacW at 807 */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* almanacM0 at 808 */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* almanacAF0 at 809 */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 } /* almanacAF1 at 810 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AlmanacElement_specs_1 = { + sizeof(struct AlmanacElement), + offsetof(struct AlmanacElement, _asn_ctx), + asn_MAP_AlmanacElement_tag2el_1, + 12, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AlmanacElement = { + "AlmanacElement", + "AlmanacElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AlmanacElement_tags_1, + sizeof(asn_DEF_AlmanacElement_tags_1) + /sizeof(asn_DEF_AlmanacElement_tags_1[0]), /* 1 */ + asn_DEF_AlmanacElement_tags_1, /* Same as above */ + sizeof(asn_DEF_AlmanacElement_tags_1) + /sizeof(asn_DEF_AlmanacElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AlmanacElement_1, + 12, /* Elements count */ + &asn_SPC_AlmanacElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AlmanacElement.h b/src/core/libs/supl/asn-rrlp/AlmanacElement.h new file mode 100644 index 000000000..5273848e6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AlmanacElement.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AlmanacElement_H_ +#define _AlmanacElement_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AlmanacElement */ +typedef struct AlmanacElement { + SatelliteID_t satelliteID; + long almanacE; + long alamanacToa; + long almanacKsii; + long almanacOmegaDot; + long almanacSVhealth; + long almanacAPowerHalf; + long almanacOmega0; + long almanacW; + long almanacM0; + long almanacAF0; + long almanacAF1; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AlmanacElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AlmanacElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _AlmanacElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c new file mode 100644 index 000000000..5b1d648b8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AntiSpoofFlag.h" + +int +AntiSpoofFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +AntiSpoofFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +AntiSpoofFlag_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +AntiSpoofFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +AntiSpoofFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +AntiSpoofFlag_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +AntiSpoofFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +AntiSpoofFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +AntiSpoofFlag_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +AntiSpoofFlag_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + AntiSpoofFlag_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_AntiSpoofFlag_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_AntiSpoofFlag_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_AntiSpoofFlag = { + "AntiSpoofFlag", + "AntiSpoofFlag", + AntiSpoofFlag_free, + AntiSpoofFlag_print, + AntiSpoofFlag_constraint, + AntiSpoofFlag_decode_ber, + AntiSpoofFlag_encode_der, + AntiSpoofFlag_decode_xer, + AntiSpoofFlag_encode_xer, + AntiSpoofFlag_decode_uper, + AntiSpoofFlag_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AntiSpoofFlag_tags_1, + sizeof(asn_DEF_AntiSpoofFlag_tags_1) + /sizeof(asn_DEF_AntiSpoofFlag_tags_1[0]), /* 1 */ + asn_DEF_AntiSpoofFlag_tags_1, /* Same as above */ + sizeof(asn_DEF_AntiSpoofFlag_tags_1) + /sizeof(asn_DEF_AntiSpoofFlag_tags_1[0]), /* 1 */ + &asn_PER_type_AntiSpoofFlag_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h new file mode 100644 index 000000000..0a08e4cb3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AntiSpoofFlag_H_ +#define _AntiSpoofFlag_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AntiSpoofFlag */ +typedef long AntiSpoofFlag_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AntiSpoofFlag; +asn_struct_free_f AntiSpoofFlag_free; +asn_struct_print_f AntiSpoofFlag_print; +asn_constr_check_f AntiSpoofFlag_constraint; +ber_type_decoder_f AntiSpoofFlag_decode_ber; +der_type_encoder_f AntiSpoofFlag_encode_der; +xer_type_decoder_f AntiSpoofFlag_decode_xer; +xer_type_encoder_f AntiSpoofFlag_encode_xer; +per_type_decoder_f AntiSpoofFlag_decode_uper; +per_type_encoder_f AntiSpoofFlag_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _AntiSpoofFlag_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c new file mode 100644 index 000000000..72cf031c8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AssistBTSData-R98-ExpOTD.h" + +static asn_TYPE_member_t asn_MBR_AssistBTSData_R98_ExpOTD_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData_R98_ExpOTD, expectedOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpectedOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "expectedOTD" + }, + { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData_R98_ExpOTD, expOTDuncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpOTDUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "expOTDuncertainty" + }, +}; +static ber_tlv_tag_t asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AssistBTSData_R98_ExpOTD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* expectedOTD at 933 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* expOTDuncertainty at 935 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AssistBTSData_R98_ExpOTD_specs_1 = { + sizeof(struct AssistBTSData_R98_ExpOTD), + offsetof(struct AssistBTSData_R98_ExpOTD, _asn_ctx), + asn_MAP_AssistBTSData_R98_ExpOTD_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AssistBTSData_R98_ExpOTD = { + "AssistBTSData-R98-ExpOTD", + "AssistBTSData-R98-ExpOTD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AssistBTSData_R98_ExpOTD_tags_1, + sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_AssistBTSData_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AssistBTSData_R98_ExpOTD_1, + 2, /* Elements count */ + &asn_SPC_AssistBTSData_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h new file mode 100644 index 000000000..e39a21090 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AssistBTSData_R98_ExpOTD_H_ +#define _AssistBTSData_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include "ExpectedOTD.h" +#include "ExpOTDUncertainty.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* AssistBTSData-R98-ExpOTD */ +typedef struct AssistBTSData_R98_ExpOTD { + ExpectedOTD_t expectedOTD; + ExpOTDUncertainty_t expOTDuncertainty; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AssistBTSData_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AssistBTSData_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +#endif /* _AssistBTSData_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData.c b/src/core/libs/supl/asn-rrlp/AssistBTSData.c new file mode 100644 index 000000000..9091fb0ca --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData.c @@ -0,0 +1,101 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AssistBTSData.h" + +static asn_TYPE_member_t asn_MBR_AssistBTSData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, bsic), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsic" + }, + { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, multiFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "multiFrameOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, timeSlotScheme), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlotScheme, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeSlotScheme" + }, + { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, roughRTD), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RoughRTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "roughRTD" + }, + { ATF_POINTER, 1, offsetof(struct AssistBTSData, calcAssistanceBTS), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CalcAssistanceBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "calcAssistanceBTS" + }, +}; +static int asn_MAP_AssistBTSData_oms_1[] = { 4 }; +static ber_tlv_tag_t asn_DEF_AssistBTSData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AssistBTSData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bsic at 229 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* multiFrameOffset at 230 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* timeSlotScheme at 231 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* roughRTD at 232 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* calcAssistanceBTS at 235 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AssistBTSData_specs_1 = { + sizeof(struct AssistBTSData), + offsetof(struct AssistBTSData, _asn_ctx), + asn_MAP_AssistBTSData_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_AssistBTSData_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AssistBTSData = { + "AssistBTSData", + "AssistBTSData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AssistBTSData_tags_1, + sizeof(asn_DEF_AssistBTSData_tags_1) + /sizeof(asn_DEF_AssistBTSData_tags_1[0]), /* 1 */ + asn_DEF_AssistBTSData_tags_1, /* Same as above */ + sizeof(asn_DEF_AssistBTSData_tags_1) + /sizeof(asn_DEF_AssistBTSData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AssistBTSData_1, + 5, /* Elements count */ + &asn_SPC_AssistBTSData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData.h b/src/core/libs/supl/asn-rrlp/AssistBTSData.h new file mode 100644 index 000000000..31372e6ab --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AssistBTSData_H_ +#define _AssistBTSData_H_ + + +#include + +/* Including external dependencies */ +#include "BSIC.h" +#include "MultiFrameOffset.h" +#include "TimeSlotScheme.h" +#include "RoughRTD.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct CalcAssistanceBTS; + +/* AssistBTSData */ +typedef struct AssistBTSData { + BSIC_t bsic; + MultiFrameOffset_t multiFrameOffset; + TimeSlotScheme_t timeSlotScheme; + RoughRTD_t roughRTD; + struct CalcAssistanceBTS *calcAssistanceBTS /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AssistBTSData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AssistBTSData; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "CalcAssistanceBTS.h" + +#endif /* _AssistBTSData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/AssistanceData.c b/src/core/libs/supl/asn-rrlp/AssistanceData.c new file mode 100644 index 000000000..3c2f29c5a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AssistanceData.c @@ -0,0 +1,131 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "AssistanceData.h" + +static asn_TYPE_member_t asn_MBR_AssistanceData_1[] = { + { ATF_POINTER, 8, offsetof(struct AssistanceData, referenceAssistData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceAssistData" + }, + { ATF_POINTER, 7, offsetof(struct AssistanceData, msrAssistData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrAssistData" + }, + { ATF_POINTER, 6, offsetof(struct AssistanceData, systemInfoAssistData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoAssistData" + }, + { ATF_POINTER, 5, offsetof(struct AssistanceData, gps_AssistData), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gps-AssistData" + }, + { ATF_POINTER, 4, offsetof(struct AssistanceData, moreAssDataToBeSent), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MoreAssDataToBeSent, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "moreAssDataToBeSent" + }, + { ATF_POINTER, 3, offsetof(struct AssistanceData, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extensionContainer" + }, + { ATF_POINTER, 2, offsetof(struct AssistanceData, rel98_AssistanceData_Extension), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_AssistanceData_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel98-AssistanceData-Extension" + }, + { ATF_POINTER, 1, offsetof(struct AssistanceData, rel5_AssistanceData_Extension), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel5_AssistanceData_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel5-AssistanceData-Extension" + }, +}; +static int asn_MAP_AssistanceData_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static ber_tlv_tag_t asn_DEF_AssistanceData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AssistanceData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceAssistData at 75 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msrAssistData at 76 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* systemInfoAssistData at 77 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* gps-AssistData at 78 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* moreAssDataToBeSent at 79 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* extensionContainer at 83 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* rel98-AssistanceData-Extension at 86 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* rel5-AssistanceData-Extension at 87 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AssistanceData_specs_1 = { + sizeof(struct AssistanceData), + offsetof(struct AssistanceData, _asn_ctx), + asn_MAP_AssistanceData_tag2el_1, + 8, /* Count of tags in the map */ + asn_MAP_AssistanceData_oms_1, /* Optional members */ + 6, 2, /* Root/Additions */ + 5, /* Start extensions */ + 9 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AssistanceData = { + "AssistanceData", + "AssistanceData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AssistanceData_tags_1, + sizeof(asn_DEF_AssistanceData_tags_1) + /sizeof(asn_DEF_AssistanceData_tags_1[0]), /* 1 */ + asn_DEF_AssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_AssistanceData_tags_1) + /sizeof(asn_DEF_AssistanceData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AssistanceData_1, + 8, /* Elements count */ + &asn_SPC_AssistanceData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/AssistanceData.h b/src/core/libs/supl/asn-rrlp/AssistanceData.h new file mode 100644 index 000000000..645814709 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/AssistanceData.h @@ -0,0 +1,65 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _AssistanceData_H_ +#define _AssistanceData_H_ + + +#include + +/* Including external dependencies */ +#include "MoreAssDataToBeSent.h" +#include "ExtensionContainer.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ReferenceAssistData; +struct MsrAssistData; +struct SystemInfoAssistData; +struct GPS_AssistData; +struct Rel98_AssistanceData_Extension; +struct Rel5_AssistanceData_Extension; + +/* AssistanceData */ +typedef struct AssistanceData { + struct ReferenceAssistData *referenceAssistData /* OPTIONAL */; + struct MsrAssistData *msrAssistData /* OPTIONAL */; + struct SystemInfoAssistData *systemInfoAssistData /* OPTIONAL */; + struct GPS_AssistData *gps_AssistData /* OPTIONAL */; + MoreAssDataToBeSent_t *moreAssDataToBeSent /* OPTIONAL */; + ExtensionContainer_t *extensionContainer /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + struct Rel98_AssistanceData_Extension *rel98_AssistanceData_Extension /* OPTIONAL */; + struct Rel5_AssistanceData_Extension *rel5_AssistanceData_Extension /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AssistanceData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_AssistanceData; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "ReferenceAssistData.h" +#include "MsrAssistData.h" +#include "SystemInfoAssistData.h" +#include "GPS-AssistData.h" +#include "Rel98-AssistanceData-Extension.h" +#include "Rel5-AssistanceData-Extension.h" + +#endif /* _AssistanceData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/BCCHCarrier.c b/src/core/libs/supl/asn-rrlp/BCCHCarrier.c new file mode 100644 index 000000000..72388ca5b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BCCHCarrier.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "BCCHCarrier.h" + +int +BCCHCarrier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +BCCHCarrier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +BCCHCarrier_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +BCCHCarrier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +BCCHCarrier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +BCCHCarrier_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +BCCHCarrier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +BCCHCarrier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +BCCHCarrier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +BCCHCarrier_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + BCCHCarrier_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_BCCHCarrier_constr_1 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_BCCHCarrier_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BCCHCarrier = { + "BCCHCarrier", + "BCCHCarrier", + BCCHCarrier_free, + BCCHCarrier_print, + BCCHCarrier_constraint, + BCCHCarrier_decode_ber, + BCCHCarrier_encode_der, + BCCHCarrier_decode_xer, + BCCHCarrier_encode_xer, + BCCHCarrier_decode_uper, + BCCHCarrier_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BCCHCarrier_tags_1, + sizeof(asn_DEF_BCCHCarrier_tags_1) + /sizeof(asn_DEF_BCCHCarrier_tags_1[0]), /* 1 */ + asn_DEF_BCCHCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_BCCHCarrier_tags_1) + /sizeof(asn_DEF_BCCHCarrier_tags_1[0]), /* 1 */ + &asn_PER_type_BCCHCarrier_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/BCCHCarrier.h b/src/core/libs/supl/asn-rrlp/BCCHCarrier.h new file mode 100644 index 000000000..5afac5098 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BCCHCarrier.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _BCCHCarrier_H_ +#define _BCCHCarrier_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* BCCHCarrier */ +typedef long BCCHCarrier_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BCCHCarrier; +asn_struct_free_f BCCHCarrier_free; +asn_struct_print_f BCCHCarrier_print; +asn_constr_check_f BCCHCarrier_constraint; +ber_type_decoder_f BCCHCarrier_decode_ber; +der_type_encoder_f BCCHCarrier_encode_der; +xer_type_decoder_f BCCHCarrier_decode_xer; +xer_type_encoder_f BCCHCarrier_encode_xer; +per_type_decoder_f BCCHCarrier_decode_uper; +per_type_encoder_f BCCHCarrier_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BCCHCarrier_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/BIT_STRING.c b/src/core/libs/supl/asn-rrlp/BIT_STRING.c new file mode 100644 index 000000000..9b9827127 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BIT_STRING.c @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * BIT STRING basic type description. + */ +static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = { + sizeof(BIT_STRING_t), + offsetof(BIT_STRING_t, _asn_ctx), + ASN_OSUBV_BIT +}; +asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { + "BIT STRING", + "BIT_STRING", + OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ + BIT_STRING_print, + BIT_STRING_constraint, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_xer_binary, + BIT_STRING_encode_xer, + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BIT_STRING_tags, + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + asn_DEF_BIT_STRING_tags, /* Same as above */ + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_DEF_BIT_STRING_specs +}; + +/* + * BIT STRING generic constraint. + */ +int +BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + + if(st && st->buf) { + if((st->size == 0 && st->bits_unused) + || st->bits_unused < 0 || st->bits_unused > 7) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: invalid padding byte (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} + +static char *_bit_pattern[16] = { + "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", + "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" +}; + +asn_enc_rval_t +BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + char scratch[128]; + char *p = scratch; + char *scend = scratch + (sizeof(scratch) - 10); + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + int xcan = (flags & XER_F_CANONICAL); + uint8_t *buf; + uint8_t *end; + + if(!st || !st->buf) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + buf = st->buf; + end = buf + st->size - 1; /* Last byte is special */ + + /* + * Binary dump + */ + for(; buf < end; buf++) { + int v = *buf; + int nline = xcan?0:(((buf - st->buf) % 8) == 0); + if(p >= scend || nline) { + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + p = scratch; + if(nline) _i_ASN_TEXT_INDENT(1, ilevel); + } + memcpy(p + 0, _bit_pattern[v >> 4], 4); + memcpy(p + 4, _bit_pattern[v & 0x0f], 4); + p += 8; + } + + if(!xcan && ((buf - st->buf) % 8) == 0) + _i_ASN_TEXT_INDENT(1, ilevel); + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + p = scratch; + + if(buf == end) { + int v = *buf; + int ubits = st->bits_unused; + int i; + for(i = 7; i >= ubits; i--) + *p++ = (v & (1 << i)) ? 0x31 : 0x30; + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + + +/* + * BIT STRING specific contents printer. + */ +int +BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + static const char *h2c = "0123456789ABCDEF"; + char scratch[64]; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + uint8_t *buf; + uint8_t *end; + char *p = scratch; + + (void)td; /* Unused argument */ + + if(!st || !st->buf) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + ilevel++; + buf = st->buf; + end = buf + st->size; + + /* + * Hexadecimal dump. + */ + for(; buf < end; buf++) { + if((buf - st->buf) % 16 == 0 && (st->size > 16) + && buf != st->buf) { + _i_INDENT(1); + /* Dump the string */ + if(cb(scratch, p - scratch, app_key) < 0) return -1; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Eat the tailing space */ + + if((st->size > 16)) { + _i_INDENT(1); + } + + /* Dump the incomplete 16-bytes row */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + return 0; +} + diff --git a/src/core/libs/supl/asn-rrlp/BIT_STRING.h b/src/core/libs/supl/asn-rrlp/BIT_STRING.h new file mode 100644 index 000000000..732e878bc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BIT_STRING.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BIT_STRING_H_ +#define _BIT_STRING_H_ + +#include /* Some help from OCTET STRING */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct BIT_STRING_s { + uint8_t *buf; /* BIT STRING body */ + int size; /* Size of the above buffer */ + + int bits_unused;/* Unused trailing bits in the last octet (0..7) */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} BIT_STRING_t; + +extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING; + +asn_struct_print_f BIT_STRING_print; /* Human-readable output */ +asn_constr_check_f BIT_STRING_constraint; +xer_type_encoder_f BIT_STRING_encode_xer; + +#ifdef __cplusplus +} +#endif + +#endif /* _BIT_STRING_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/BOOLEAN.c b/src/core/libs/supl/asn-rrlp/BOOLEAN.c new file mode 100644 index 000000000..2c2bbcf2f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BOOLEAN.c @@ -0,0 +1,284 @@ +/*- + * 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 ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { + "BOOLEAN", + "BOOLEAN", + BOOLEAN_free, + BOOLEAN_print, + asn_generic_no_constraint, + BOOLEAN_decode_ber, + BOOLEAN_encode_der, + BOOLEAN_decode_xer, + BOOLEAN_encode_xer, + BOOLEAN_decode_uper, /* Unaligned PER decoder */ + BOOLEAN_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + 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, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode BOOLEAN type. + */ +asn_dec_rval_t +BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + 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(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval; + BOOLEAN_t *st = (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(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 { + if(xer_is_whitespace(chunk_buf, chunk_size)) + return XPBD_NOT_BODY_IGNORE; + else + return XPBD_BROKEN_ENCODING; + } +} + + +asn_dec_rval_t +BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + 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(asn_TYPE_descriptor_t *td, 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; + + (void)ilevel; + (void)flags; + + if(!st) _ASN_ENCODE_FAILED; + + if(*st) { + _ASN_CALLBACK("", 7); + er.encoded = 7; + } else { + _ASN_CALLBACK("", 8); + er.encoded = 8; + } + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +int +BOOLEAN_print(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(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + if(td && ptr && !contents_only) { + FREEMEM(ptr); + } +} + +asn_dec_rval_t +BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + 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; + + 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(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; + asn_enc_rval_t er; + + (void)constraints; + + if(!st) _ASN_ENCODE_FAILED; + + per_put_few_bits(po, *st ? 1 : 0, 1); + + _ASN_ENCODED_OK(er); +} diff --git a/src/core/libs/supl/asn-rrlp/BOOLEAN.h b/src/core/libs/supl/asn-rrlp/BOOLEAN.h new file mode 100644 index 000000000..217d0f163 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BOOLEAN.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2003 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; + +asn_struct_free_f BOOLEAN_free; +asn_struct_print_f BOOLEAN_print; +ber_type_decoder_f BOOLEAN_decode_ber; +der_type_encoder_f BOOLEAN_encode_der; +xer_type_decoder_f BOOLEAN_decode_xer; +xer_type_encoder_f BOOLEAN_encode_xer; +per_type_decoder_f BOOLEAN_decode_uper; +per_type_encoder_f BOOLEAN_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BOOLEAN_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/BSIC.c b/src/core/libs/supl/asn-rrlp/BSIC.c new file mode 100644 index 000000000..378aac7ab --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BSIC.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "BSIC.h" + +int +BSIC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +BSIC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +BSIC_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + BSIC_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +BSIC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +BSIC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +BSIC_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +BSIC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +BSIC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +BSIC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +BSIC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + BSIC_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_BSIC_constr_1 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_BSIC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BSIC = { + "BSIC", + "BSIC", + BSIC_free, + BSIC_print, + BSIC_constraint, + BSIC_decode_ber, + BSIC_encode_der, + BSIC_decode_xer, + BSIC_encode_xer, + BSIC_decode_uper, + BSIC_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BSIC_tags_1, + sizeof(asn_DEF_BSIC_tags_1) + /sizeof(asn_DEF_BSIC_tags_1[0]), /* 1 */ + asn_DEF_BSIC_tags_1, /* Same as above */ + sizeof(asn_DEF_BSIC_tags_1) + /sizeof(asn_DEF_BSIC_tags_1[0]), /* 1 */ + &asn_PER_type_BSIC_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/BSIC.h b/src/core/libs/supl/asn-rrlp/BSIC.h new file mode 100644 index 000000000..8ae54f8f0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BSIC.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _BSIC_H_ +#define _BSIC_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* BSIC */ +typedef long BSIC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BSIC; +asn_struct_free_f BSIC_free; +asn_struct_print_f BSIC_print; +asn_constr_check_f BSIC_constraint; +ber_type_decoder_f BSIC_decode_ber; +der_type_encoder_f BSIC_encode_der; +xer_type_decoder_f BSIC_decode_xer; +xer_type_encoder_f BSIC_encode_xer; +per_type_decoder_f BSIC_decode_uper; +per_type_encoder_f BSIC_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BSIC_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c new file mode 100644 index 000000000..ebd1888fe --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "BSICAndCarrier.h" + +static asn_TYPE_member_t asn_MBR_BSICAndCarrier_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct BSICAndCarrier, carrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "carrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct BSICAndCarrier, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsic" + }, +}; +static ber_tlv_tag_t asn_DEF_BSICAndCarrier_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_BSICAndCarrier_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* carrier at 304 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* bsic at 306 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_BSICAndCarrier_specs_1 = { + sizeof(struct BSICAndCarrier), + offsetof(struct BSICAndCarrier, _asn_ctx), + asn_MAP_BSICAndCarrier_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_BSICAndCarrier = { + "BSICAndCarrier", + "BSICAndCarrier", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BSICAndCarrier_tags_1, + sizeof(asn_DEF_BSICAndCarrier_tags_1) + /sizeof(asn_DEF_BSICAndCarrier_tags_1[0]), /* 1 */ + asn_DEF_BSICAndCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_BSICAndCarrier_tags_1) + /sizeof(asn_DEF_BSICAndCarrier_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_BSICAndCarrier_1, + 2, /* Elements count */ + &asn_SPC_BSICAndCarrier_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h new file mode 100644 index 000000000..dda3b01b2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _BSICAndCarrier_H_ +#define _BSICAndCarrier_H_ + + +#include + +/* Including external dependencies */ +#include "BCCHCarrier.h" +#include "BSIC.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* BSICAndCarrier */ +typedef struct BSICAndCarrier { + BCCHCarrier_t carrier; + BSIC_t bsic; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} BSICAndCarrier_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BSICAndCarrier; + +#ifdef __cplusplus +} +#endif + +#endif /* _BSICAndCarrier_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/BTSPosition.c b/src/core/libs/supl/asn-rrlp/BTSPosition.c new file mode 100644 index 000000000..12d5b95b4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BTSPosition.c @@ -0,0 +1,141 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "BTSPosition.h" + +int +BTSPosition_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const Ext_GeographicalInformation_t *st = (const Ext_GeographicalInformation_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 20)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using Ext_GeographicalInformation, + * so here we adjust the DEF accordingly. + */ +static void +BTSPosition_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_Ext_GeographicalInformation.free_struct; + td->print_struct = asn_DEF_Ext_GeographicalInformation.print_struct; + td->ber_decoder = asn_DEF_Ext_GeographicalInformation.ber_decoder; + td->der_encoder = asn_DEF_Ext_GeographicalInformation.der_encoder; + td->xer_decoder = asn_DEF_Ext_GeographicalInformation.xer_decoder; + td->xer_encoder = asn_DEF_Ext_GeographicalInformation.xer_encoder; + td->uper_decoder = asn_DEF_Ext_GeographicalInformation.uper_decoder; + td->uper_encoder = asn_DEF_Ext_GeographicalInformation.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_Ext_GeographicalInformation.per_constraints; + td->elements = asn_DEF_Ext_GeographicalInformation.elements; + td->elements_count = asn_DEF_Ext_GeographicalInformation.elements_count; + td->specifics = asn_DEF_Ext_GeographicalInformation.specifics; +} + +void +BTSPosition_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + BTSPosition_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +BTSPosition_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +BTSPosition_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +BTSPosition_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +BTSPosition_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +BTSPosition_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +BTSPosition_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +BTSPosition_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + BTSPosition_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static ber_tlv_tag_t asn_DEF_BTSPosition_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BTSPosition = { + "BTSPosition", + "BTSPosition", + BTSPosition_free, + BTSPosition_print, + BTSPosition_constraint, + BTSPosition_decode_ber, + BTSPosition_encode_der, + BTSPosition_decode_xer, + BTSPosition_encode_xer, + BTSPosition_decode_uper, + BTSPosition_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BTSPosition_tags_1, + sizeof(asn_DEF_BTSPosition_tags_1) + /sizeof(asn_DEF_BTSPosition_tags_1[0]), /* 1 */ + asn_DEF_BTSPosition_tags_1, /* Same as above */ + sizeof(asn_DEF_BTSPosition_tags_1) + /sizeof(asn_DEF_BTSPosition_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/BTSPosition.h b/src/core/libs/supl/asn-rrlp/BTSPosition.h new file mode 100644 index 000000000..dd52ebea6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BTSPosition.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _BTSPosition_H_ +#define _BTSPosition_H_ + + +#include + +/* Including external dependencies */ +#include "Ext-GeographicalInformation.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* BTSPosition */ +typedef Ext_GeographicalInformation_t BTSPosition_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BTSPosition; +asn_struct_free_f BTSPosition_free; +asn_struct_print_f BTSPosition_print; +asn_constr_check_f BTSPosition_constraint; +ber_type_decoder_f BTSPosition_decode_ber; +der_type_encoder_f BTSPosition_encode_der; +xer_type_decoder_f BTSPosition_decode_xer; +xer_type_encoder_f BTSPosition_encode_xer; +per_type_decoder_f BTSPosition_decode_uper; +per_type_encoder_f BTSPosition_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BTSPosition_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/BadSignalElement.c b/src/core/libs/supl/asn-rrlp/BadSignalElement.c new file mode 100644 index 000000000..b0ff80566 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BadSignalElement.c @@ -0,0 +1,101 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "BadSignalElement.h" + +static int +memb_badSignalID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_badSignalID_constr_3 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_BadSignalElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct BadSignalElement, badSVID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "badSVID" + }, + { ATF_POINTER, 1, offsetof(struct BadSignalElement, badSignalID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_badSignalID_constraint_1, + &asn_PER_memb_badSignalID_constr_3, + 0, + "badSignalID" + }, +}; +static int asn_MAP_BadSignalElement_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_BadSignalElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_BadSignalElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* badSVID at 1300 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* badSignalID at 1301 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_BadSignalElement_specs_1 = { + sizeof(struct BadSignalElement), + offsetof(struct BadSignalElement, _asn_ctx), + asn_MAP_BadSignalElement_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_BadSignalElement_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_BadSignalElement = { + "BadSignalElement", + "BadSignalElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BadSignalElement_tags_1, + sizeof(asn_DEF_BadSignalElement_tags_1) + /sizeof(asn_DEF_BadSignalElement_tags_1[0]), /* 1 */ + asn_DEF_BadSignalElement_tags_1, /* Same as above */ + sizeof(asn_DEF_BadSignalElement_tags_1) + /sizeof(asn_DEF_BadSignalElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_BadSignalElement_1, + 2, /* Elements count */ + &asn_SPC_BadSignalElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/BadSignalElement.h b/src/core/libs/supl/asn-rrlp/BadSignalElement.h new file mode 100644 index 000000000..1b758e069 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BadSignalElement.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _BadSignalElement_H_ +#define _BadSignalElement_H_ + + +#include + +/* Including external dependencies */ +#include "SVID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* BadSignalElement */ +typedef struct BadSignalElement { + SVID_t badSVID; + long *badSignalID /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} BadSignalElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BadSignalElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _BadSignalElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/BitNumber.c b/src/core/libs/supl/asn-rrlp/BitNumber.c new file mode 100644 index 000000000..36c17f637 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BitNumber.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "BitNumber.h" + +int +BitNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 156)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +BitNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +BitNumber_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + BitNumber_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +BitNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +BitNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +BitNumber_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +BitNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +BitNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +BitNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +BitNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + BitNumber_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_BitNumber_constr_1 = { + { APC_CONSTRAINED, 8, 8, 0, 156 } /* (0..156) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_BitNumber_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BitNumber = { + "BitNumber", + "BitNumber", + BitNumber_free, + BitNumber_print, + BitNumber_constraint, + BitNumber_decode_ber, + BitNumber_encode_der, + BitNumber_decode_xer, + BitNumber_encode_xer, + BitNumber_decode_uper, + BitNumber_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BitNumber_tags_1, + sizeof(asn_DEF_BitNumber_tags_1) + /sizeof(asn_DEF_BitNumber_tags_1[0]), /* 1 */ + asn_DEF_BitNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_BitNumber_tags_1) + /sizeof(asn_DEF_BitNumber_tags_1[0]), /* 1 */ + &asn_PER_type_BitNumber_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/BitNumber.h b/src/core/libs/supl/asn-rrlp/BitNumber.h new file mode 100644 index 000000000..1584ca01e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/BitNumber.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _BitNumber_H_ +#define _BitNumber_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* BitNumber */ +typedef long BitNumber_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_BitNumber; +asn_struct_free_f BitNumber_free; +asn_struct_print_f BitNumber_print; +asn_constr_check_f BitNumber_constraint; +ber_type_decoder_f BitNumber_decode_ber; +der_type_encoder_f BitNumber_encode_der; +xer_type_decoder_f BitNumber_decode_xer; +xer_type_encoder_f BitNumber_encode_xer; +per_type_decoder_f BitNumber_decode_uper; +per_type_encoder_f BitNumber_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BitNumber_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c new file mode 100644 index 000000000..aa6150457 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "CalcAssistanceBTS.h" + +static asn_TYPE_member_t asn_MBR_CalcAssistanceBTS_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CalcAssistanceBTS, fineRTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FineRTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fineRTD" + }, + { ATF_NOFLAGS, 0, offsetof(struct CalcAssistanceBTS, referenceWGS84), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceWGS84, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceWGS84" + }, +}; +static ber_tlv_tag_t asn_DEF_CalcAssistanceBTS_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CalcAssistanceBTS_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fineRTD at 241 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* referenceWGS84 at 243 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CalcAssistanceBTS_specs_1 = { + sizeof(struct CalcAssistanceBTS), + offsetof(struct CalcAssistanceBTS, _asn_ctx), + asn_MAP_CalcAssistanceBTS_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CalcAssistanceBTS = { + "CalcAssistanceBTS", + "CalcAssistanceBTS", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CalcAssistanceBTS_tags_1, + sizeof(asn_DEF_CalcAssistanceBTS_tags_1) + /sizeof(asn_DEF_CalcAssistanceBTS_tags_1[0]), /* 1 */ + asn_DEF_CalcAssistanceBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_CalcAssistanceBTS_tags_1) + /sizeof(asn_DEF_CalcAssistanceBTS_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_CalcAssistanceBTS_1, + 2, /* Elements count */ + &asn_SPC_CalcAssistanceBTS_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h new file mode 100644 index 000000000..6c046b8c6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _CalcAssistanceBTS_H_ +#define _CalcAssistanceBTS_H_ + + +#include + +/* Including external dependencies */ +#include "FineRTD.h" +#include "ReferenceWGS84.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CalcAssistanceBTS */ +typedef struct CalcAssistanceBTS { + FineRTD_t fineRTD; + ReferenceWGS84_t referenceWGS84; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CalcAssistanceBTS_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CalcAssistanceBTS; + +#ifdef __cplusplus +} +#endif + +#endif /* _CalcAssistanceBTS_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/CellID.c b/src/core/libs/supl/asn-rrlp/CellID.c new file mode 100644 index 000000000..a66eca167 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/CellID.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "CellID.h" + +int +CellID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +CellID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +CellID_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + CellID_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +CellID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + CellID_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +CellID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + CellID_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +CellID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + CellID_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +CellID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + CellID_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +CellID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + CellID_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +CellID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CellID_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +CellID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CellID_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_CellID_constr_1 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_CellID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_CellID = { + "CellID", + "CellID", + CellID_free, + CellID_print, + CellID_constraint, + CellID_decode_ber, + CellID_encode_der, + CellID_decode_xer, + CellID_encode_xer, + CellID_decode_uper, + CellID_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CellID_tags_1, + sizeof(asn_DEF_CellID_tags_1) + /sizeof(asn_DEF_CellID_tags_1[0]), /* 1 */ + asn_DEF_CellID_tags_1, /* Same as above */ + sizeof(asn_DEF_CellID_tags_1) + /sizeof(asn_DEF_CellID_tags_1[0]), /* 1 */ + &asn_PER_type_CellID_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/CellID.h b/src/core/libs/supl/asn-rrlp/CellID.h new file mode 100644 index 000000000..e71a1e30a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/CellID.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _CellID_H_ +#define _CellID_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CellID */ +typedef long CellID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CellID; +asn_struct_free_f CellID_free; +asn_struct_print_f CellID_print; +asn_constr_check_f CellID_constraint; +ber_type_decoder_f CellID_decode_ber; +der_type_encoder_f CellID_encode_der; +xer_type_decoder_f CellID_decode_xer; +xer_type_encoder_f CellID_encode_xer; +per_type_decoder_f CellID_decode_uper; +per_type_encoder_f CellID_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CellID_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c new file mode 100644 index 000000000..2325ee78e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "CellIDAndLAC.h" + +static asn_TYPE_member_t asn_MBR_CellIDAndLAC_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CellIDAndLAC, referenceLAC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_LAC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceLAC" + }, + { ATF_NOFLAGS, 0, offsetof(struct CellIDAndLAC, referenceCI), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceCI" + }, +}; +static ber_tlv_tag_t asn_DEF_CellIDAndLAC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CellIDAndLAC_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceLAC at 313 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* referenceCI at 315 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CellIDAndLAC_specs_1 = { + sizeof(struct CellIDAndLAC), + offsetof(struct CellIDAndLAC, _asn_ctx), + asn_MAP_CellIDAndLAC_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CellIDAndLAC = { + "CellIDAndLAC", + "CellIDAndLAC", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CellIDAndLAC_tags_1, + sizeof(asn_DEF_CellIDAndLAC_tags_1) + /sizeof(asn_DEF_CellIDAndLAC_tags_1[0]), /* 1 */ + asn_DEF_CellIDAndLAC_tags_1, /* Same as above */ + sizeof(asn_DEF_CellIDAndLAC_tags_1) + /sizeof(asn_DEF_CellIDAndLAC_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_CellIDAndLAC_1, + 2, /* Elements count */ + &asn_SPC_CellIDAndLAC_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h new file mode 100644 index 000000000..e2811df15 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _CellIDAndLAC_H_ +#define _CellIDAndLAC_H_ + + +#include + +/* Including external dependencies */ +#include "LAC.h" +#include "CellID.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CellIDAndLAC */ +typedef struct CellIDAndLAC { + LAC_t referenceLAC; + CellID_t referenceCI; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CellIDAndLAC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CellIDAndLAC; + +#ifdef __cplusplus +} +#endif + +#endif /* _CellIDAndLAC_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ControlHeader.c b/src/core/libs/supl/asn-rrlp/ControlHeader.c new file mode 100644 index 000000000..6d64accb4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ControlHeader.c @@ -0,0 +1,141 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ControlHeader.h" + +static asn_TYPE_member_t asn_MBR_ControlHeader_1[] = { + { ATF_POINTER, 9, offsetof(struct ControlHeader, referenceTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceTime" + }, + { ATF_POINTER, 8, offsetof(struct ControlHeader, refLocation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RefLocation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "refLocation" + }, + { ATF_POINTER, 7, offsetof(struct ControlHeader, dgpsCorrections), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_DGPSCorrections, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dgpsCorrections" + }, + { ATF_POINTER, 6, offsetof(struct ControlHeader, navigationModel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NavigationModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "navigationModel" + }, + { ATF_POINTER, 5, offsetof(struct ControlHeader, ionosphericModel), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_IonosphericModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ionosphericModel" + }, + { ATF_POINTER, 4, offsetof(struct ControlHeader, utcModel), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTCModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "utcModel" + }, + { ATF_POINTER, 3, offsetof(struct ControlHeader, almanac), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Almanac, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "almanac" + }, + { ATF_POINTER, 2, offsetof(struct ControlHeader, acquisAssist), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AcquisAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "acquisAssist" + }, + { ATF_POINTER, 1, offsetof(struct ControlHeader, realTimeIntegrity), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOf_BadSatelliteSet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "realTimeIntegrity" + }, +}; +static int asn_MAP_ControlHeader_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static ber_tlv_tag_t asn_DEF_ControlHeader_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ControlHeader_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceTime at 574 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refLocation at 575 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* dgpsCorrections at 576 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* navigationModel at 577 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ionosphericModel at 578 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* utcModel at 579 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* almanac at 580 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* acquisAssist at 581 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* realTimeIntegrity at 582 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ControlHeader_specs_1 = { + sizeof(struct ControlHeader), + offsetof(struct ControlHeader, _asn_ctx), + asn_MAP_ControlHeader_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_ControlHeader_oms_1, /* Optional members */ + 9, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ControlHeader = { + "ControlHeader", + "ControlHeader", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ControlHeader_tags_1, + sizeof(asn_DEF_ControlHeader_tags_1) + /sizeof(asn_DEF_ControlHeader_tags_1[0]), /* 1 */ + asn_DEF_ControlHeader_tags_1, /* Same as above */ + sizeof(asn_DEF_ControlHeader_tags_1) + /sizeof(asn_DEF_ControlHeader_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ControlHeader_1, + 9, /* Elements count */ + &asn_SPC_ControlHeader_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ControlHeader.h b/src/core/libs/supl/asn-rrlp/ControlHeader.h new file mode 100644 index 000000000..3471f8a77 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ControlHeader.h @@ -0,0 +1,66 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ControlHeader_H_ +#define _ControlHeader_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ReferenceTime; +struct RefLocation; +struct DGPSCorrections; +struct NavigationModel; +struct IonosphericModel; +struct UTCModel; +struct Almanac; +struct AcquisAssist; +struct SeqOf_BadSatelliteSet; + +/* ControlHeader */ +typedef struct ControlHeader { + struct ReferenceTime *referenceTime /* OPTIONAL */; + struct RefLocation *refLocation /* OPTIONAL */; + struct DGPSCorrections *dgpsCorrections /* OPTIONAL */; + struct NavigationModel *navigationModel /* OPTIONAL */; + struct IonosphericModel *ionosphericModel /* OPTIONAL */; + struct UTCModel *utcModel /* OPTIONAL */; + struct Almanac *almanac /* OPTIONAL */; + struct AcquisAssist *acquisAssist /* OPTIONAL */; + struct SeqOf_BadSatelliteSet *realTimeIntegrity /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ControlHeader_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ControlHeader; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "ReferenceTime.h" +#include "RefLocation.h" +#include "DGPSCorrections.h" +#include "NavigationModel.h" +#include "IonosphericModel.h" +#include "UTCModel.h" +#include "Almanac.h" +#include "AcquisAssist.h" +#include "SeqOf-BadSatelliteSet.h" + +#endif /* _ControlHeader_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c new file mode 100644 index 000000000..96fd70a6e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c @@ -0,0 +1,219 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "DGANSSSgnElement.h" + +static int +memb_iod_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_udre_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_pseudoRangeCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -2047 && value <= 2047)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_rangeRateCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -127 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_iod_constr_3 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_udre_constr_4 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_pseudoRangeCor_constr_5 = { + { APC_CONSTRAINED, 12, 12, -2047, 2047 } /* (-2047..2047) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_rangeRateCor_constr_6 = { + { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_DGANSSSgnElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svID" + }, + { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, iod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_iod_constraint_1, + &asn_PER_memb_iod_constr_3, + 0, + "iod" + }, + { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, udre), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_udre_constraint_1, + &asn_PER_memb_udre_constr_4, + 0, + "udre" + }, + { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, pseudoRangeCor), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_pseudoRangeCor_constraint_1, + &asn_PER_memb_pseudoRangeCor_constr_5, + 0, + "pseudoRangeCor" + }, + { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, rangeRateCor), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_rangeRateCor_constraint_1, + &asn_PER_memb_rangeRateCor_constr_6, + 0, + "rangeRateCor" + }, +}; +static ber_tlv_tag_t asn_DEF_DGANSSSgnElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_DGANSSSgnElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1207 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* iod at 1210 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* udre at 1213 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pseudoRangeCor at 1217 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* rangeRateCor at 1221 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_DGANSSSgnElement_specs_1 = { + sizeof(struct DGANSSSgnElement), + offsetof(struct DGANSSSgnElement, _asn_ctx), + asn_MAP_DGANSSSgnElement_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_DGANSSSgnElement = { + "DGANSSSgnElement", + "DGANSSSgnElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_DGANSSSgnElement_tags_1, + sizeof(asn_DEF_DGANSSSgnElement_tags_1) + /sizeof(asn_DEF_DGANSSSgnElement_tags_1[0]), /* 1 */ + asn_DEF_DGANSSSgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_DGANSSSgnElement_tags_1) + /sizeof(asn_DEF_DGANSSSgnElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_DGANSSSgnElement_1, + 5, /* Elements count */ + &asn_SPC_DGANSSSgnElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h new file mode 100644 index 000000000..0ba005e0b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _DGANSSSgnElement_H_ +#define _DGANSSSgnElement_H_ + + +#include + +/* Including external dependencies */ +#include "SVID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* DGANSSSgnElement */ +typedef struct DGANSSSgnElement { + SVID_t svID; + long iod; + long udre; + long pseudoRangeCor; + long rangeRateCor; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} DGANSSSgnElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DGANSSSgnElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _DGANSSSgnElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/DGPSCorrections.c b/src/core/libs/supl/asn-rrlp/DGPSCorrections.c new file mode 100644 index 000000000..781d41f61 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/DGPSCorrections.c @@ -0,0 +1,139 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "DGPSCorrections.h" + +static int +memb_gpsTOW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 604799)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_status_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_gpsTOW_constr_2 = { + { APC_CONSTRAINED, 20, -1, 0, 604799 } /* (0..604799) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_status_constr_3 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_DGPSCorrections_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gpsTOW_constraint_1, + &asn_PER_memb_gpsTOW_constr_2, + 0, + "gpsTOW" + }, + { ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, status), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_status_constraint_1, + &asn_PER_memb_status_constr_3, + 0, + "status" + }, + { ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, satList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSatElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satList" + }, +}; +static ber_tlv_tag_t asn_DEF_DGPSCorrections_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_DGPSCorrections_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTOW at 655 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* status at 656 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* satList at 659 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_DGPSCorrections_specs_1 = { + sizeof(struct DGPSCorrections), + offsetof(struct DGPSCorrections, _asn_ctx), + asn_MAP_DGPSCorrections_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_DGPSCorrections = { + "DGPSCorrections", + "DGPSCorrections", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_DGPSCorrections_tags_1, + sizeof(asn_DEF_DGPSCorrections_tags_1) + /sizeof(asn_DEF_DGPSCorrections_tags_1[0]), /* 1 */ + asn_DEF_DGPSCorrections_tags_1, /* Same as above */ + sizeof(asn_DEF_DGPSCorrections_tags_1) + /sizeof(asn_DEF_DGPSCorrections_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_DGPSCorrections_1, + 3, /* Elements count */ + &asn_SPC_DGPSCorrections_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/DGPSCorrections.h b/src/core/libs/supl/asn-rrlp/DGPSCorrections.h new file mode 100644 index 000000000..24f0b5076 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/DGPSCorrections.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _DGPSCorrections_H_ +#define _DGPSCorrections_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SeqOfSatElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* DGPSCorrections */ +typedef struct DGPSCorrections { + long gpsTOW; + long status; + SeqOfSatElement_t satList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} DGPSCorrections_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DGPSCorrections; + +#ifdef __cplusplus +} +#endif + +#endif /* _DGPSCorrections_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ENUMERATED.c b/src/core/libs/supl/asn-rrlp/ENUMERATED.c new file mode 100644 index 000000000..90761a2d7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ENUMERATED.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2003, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include /* Encoder and decoder of a primitive type */ + +/* + * ENUMERATED basic type description. + */ +static ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { + "ENUMERATED", + "ENUMERATED", + ASN__PRIMITIVE_TYPE_free, + INTEGER_print, /* Implemented in terms of INTEGER */ + asn_generic_no_constraint, + ber_decode_primitive, + INTEGER_encode_der, /* Implemented in terms of INTEGER */ + INTEGER_decode_xer, /* This is temporary! */ + INTEGER_encode_xer, + ENUMERATED_decode_uper, /* Unaligned PER decoder */ + ENUMERATED_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ENUMERATED_tags, + sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), + asn_DEF_ENUMERATED_tags, /* Same as above */ + sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_dec_rval_t +ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rval; + ENUMERATED_t *st = (ENUMERATED_t *)*sptr; + long value; + void *vptr = &value; + + if(!st) { + st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) _ASN_DECODE_FAILED; + } + + rval = NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, + (void **)&vptr, pd); + if(rval.code == RC_OK) + if(asn_long2INTEGER(st, value)) + rval.code = RC_FAIL; + return rval; +} + +asn_enc_rval_t +ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + ENUMERATED_t *st = (ENUMERATED_t *)sptr; + long value; + + if(asn_INTEGER2long(st, &value)) + _ASN_ENCODE_FAILED; + + return NativeEnumerated_encode_uper(td, constraints, &value, po); +} + diff --git a/src/core/libs/supl/asn-rrlp/ENUMERATED.h b/src/core/libs/supl/asn-rrlp/ENUMERATED.h new file mode 100644 index 000000000..542dcae94 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ENUMERATED.h @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ENUMERATED_H_ +#define _ENUMERATED_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef INTEGER_t ENUMERATED_t; /* Implemented via INTEGER */ + +extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED; + +per_type_decoder_f ENUMERATED_decode_uper; +per_type_encoder_f ENUMERATED_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ENUMERATED_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/EOTDQuality.c b/src/core/libs/supl/asn-rrlp/EOTDQuality.c new file mode 100644 index 000000000..17fcacfe8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/EOTDQuality.c @@ -0,0 +1,129 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "EOTDQuality.h" + +static int +memb_nbrOfMeasurements_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stdOfEOTD_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_nbrOfMeasurements_constr_2 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stdOfEOTD_constr_3 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_EOTDQuality_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct EOTDQuality, nbrOfMeasurements), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_nbrOfMeasurements_constraint_1, + &asn_PER_memb_nbrOfMeasurements_constr_2, + 0, + "nbrOfMeasurements" + }, + { ATF_NOFLAGS, 0, offsetof(struct EOTDQuality, stdOfEOTD), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stdOfEOTD_constraint_1, + &asn_PER_memb_stdOfEOTD_constr_3, + 0, + "stdOfEOTD" + }, +}; +static ber_tlv_tag_t asn_DEF_EOTDQuality_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_EOTDQuality_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nbrOfMeasurements at 393 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* stdOfEOTD at 394 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EOTDQuality_specs_1 = { + sizeof(struct EOTDQuality), + offsetof(struct EOTDQuality, _asn_ctx), + asn_MAP_EOTDQuality_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EOTDQuality = { + "EOTDQuality", + "EOTDQuality", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EOTDQuality_tags_1, + sizeof(asn_DEF_EOTDQuality_tags_1) + /sizeof(asn_DEF_EOTDQuality_tags_1[0]), /* 1 */ + asn_DEF_EOTDQuality_tags_1, /* Same as above */ + sizeof(asn_DEF_EOTDQuality_tags_1) + /sizeof(asn_DEF_EOTDQuality_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_EOTDQuality_1, + 2, /* Elements count */ + &asn_SPC_EOTDQuality_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/EOTDQuality.h b/src/core/libs/supl/asn-rrlp/EOTDQuality.h new file mode 100644 index 000000000..a249955f0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/EOTDQuality.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _EOTDQuality_H_ +#define _EOTDQuality_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EOTDQuality */ +typedef struct EOTDQuality { + long nbrOfMeasurements; + long stdOfEOTD; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EOTDQuality_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_EOTDQuality; + +#ifdef __cplusplus +} +#endif + +#endif /* _EOTDQuality_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c new file mode 100644 index 000000000..d3d05c10f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "EnvironmentCharacter.h" + +int +EnvironmentCharacter_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +EnvironmentCharacter_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +EnvironmentCharacter_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +EnvironmentCharacter_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +EnvironmentCharacter_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +EnvironmentCharacter_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +EnvironmentCharacter_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +EnvironmentCharacter_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +EnvironmentCharacter_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +EnvironmentCharacter_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + EnvironmentCharacter_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_EnvironmentCharacter_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_EnvironmentCharacter_value2enum_1[] = { + { 0, 7, "badArea" }, + { 1, 10, "notBadArea" }, + { 2, 9, "mixedArea" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_EnvironmentCharacter_enum2value_1[] = { + 0, /* badArea(0) */ + 2, /* mixedArea(2) */ + 1 /* notBadArea(1) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_EnvironmentCharacter_specs_1 = { + asn_MAP_EnvironmentCharacter_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_EnvironmentCharacter_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 4, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_EnvironmentCharacter_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_EnvironmentCharacter = { + "EnvironmentCharacter", + "EnvironmentCharacter", + EnvironmentCharacter_free, + EnvironmentCharacter_print, + EnvironmentCharacter_constraint, + EnvironmentCharacter_decode_ber, + EnvironmentCharacter_encode_der, + EnvironmentCharacter_decode_xer, + EnvironmentCharacter_encode_xer, + EnvironmentCharacter_decode_uper, + EnvironmentCharacter_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EnvironmentCharacter_tags_1, + sizeof(asn_DEF_EnvironmentCharacter_tags_1) + /sizeof(asn_DEF_EnvironmentCharacter_tags_1[0]), /* 1 */ + asn_DEF_EnvironmentCharacter_tags_1, /* Same as above */ + sizeof(asn_DEF_EnvironmentCharacter_tags_1) + /sizeof(asn_DEF_EnvironmentCharacter_tags_1[0]), /* 1 */ + &asn_PER_type_EnvironmentCharacter_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_EnvironmentCharacter_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h new file mode 100644 index 000000000..5a37be9c9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _EnvironmentCharacter_H_ +#define _EnvironmentCharacter_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum EnvironmentCharacter { + EnvironmentCharacter_badArea = 0, + EnvironmentCharacter_notBadArea = 1, + EnvironmentCharacter_mixedArea = 2 + /* + * Enumeration is extensible + */ +} e_EnvironmentCharacter; + +/* EnvironmentCharacter */ +typedef ENUMERATED_t EnvironmentCharacter_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_EnvironmentCharacter; +asn_struct_free_f EnvironmentCharacter_free; +asn_struct_print_f EnvironmentCharacter_print; +asn_constr_check_f EnvironmentCharacter_constraint; +ber_type_decoder_f EnvironmentCharacter_decode_ber; +der_type_encoder_f EnvironmentCharacter_encode_der; +xer_type_decoder_f EnvironmentCharacter_decode_xer; +xer_type_encoder_f EnvironmentCharacter_encode_xer; +per_type_decoder_f EnvironmentCharacter_decode_uper; +per_type_encoder_f EnvironmentCharacter_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _EnvironmentCharacter_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c new file mode 100644 index 000000000..5177a8615 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c @@ -0,0 +1,209 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "EphemerisSubframe1Reserved.h" + +static int +memb_reserved1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_reserved2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16777215)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_reserved3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16777215)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_reserved4_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_reserved1_constr_2 = { + { APC_CONSTRAINED, 23, -1, 0, 8388607 } /* (0..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_reserved2_constr_3 = { + { APC_CONSTRAINED, 24, -1, 0, 16777215 } /* (0..16777215) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_reserved3_constr_4 = { + { APC_CONSTRAINED, 24, -1, 0, 16777215 } /* (0..16777215) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_reserved4_constr_5 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_EphemerisSubframe1Reserved_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_reserved1_constraint_1, + &asn_PER_memb_reserved1_constr_2, + 0, + "reserved1" + }, + { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_reserved2_constraint_1, + &asn_PER_memb_reserved2_constr_3, + 0, + "reserved2" + }, + { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved3), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_reserved3_constraint_1, + &asn_PER_memb_reserved3_constr_4, + 0, + "reserved3" + }, + { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved4), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_reserved4_constraint_1, + &asn_PER_memb_reserved4_constr_5, + 0, + "reserved4" + }, +}; +static ber_tlv_tag_t asn_DEF_EphemerisSubframe1Reserved_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_EphemerisSubframe1Reserved_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* reserved1 at 755 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* reserved2 at 756 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* reserved3 at 757 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* reserved4 at 758 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_EphemerisSubframe1Reserved_specs_1 = { + sizeof(struct EphemerisSubframe1Reserved), + offsetof(struct EphemerisSubframe1Reserved, _asn_ctx), + asn_MAP_EphemerisSubframe1Reserved_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_EphemerisSubframe1Reserved = { + "EphemerisSubframe1Reserved", + "EphemerisSubframe1Reserved", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EphemerisSubframe1Reserved_tags_1, + sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1) + /sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1[0]), /* 1 */ + asn_DEF_EphemerisSubframe1Reserved_tags_1, /* Same as above */ + sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1) + /sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_EphemerisSubframe1Reserved_1, + 4, /* Elements count */ + &asn_SPC_EphemerisSubframe1Reserved_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h new file mode 100644 index 000000000..156c7f0f8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _EphemerisSubframe1Reserved_H_ +#define _EphemerisSubframe1Reserved_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EphemerisSubframe1Reserved */ +typedef struct EphemerisSubframe1Reserved { + long reserved1; + long reserved2; + long reserved3; + long reserved4; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} EphemerisSubframe1Reserved_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_EphemerisSubframe1Reserved; + +#ifdef __cplusplus +} +#endif + +#endif /* _EphemerisSubframe1Reserved_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ErrorCodes.c b/src/core/libs/supl/asn-rrlp/ErrorCodes.c new file mode 100644 index 000000000..d8b61e5d2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ErrorCodes.c @@ -0,0 +1,155 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ErrorCodes.h" + +int +ErrorCodes_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +ErrorCodes_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +ErrorCodes_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ErrorCodes_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ErrorCodes_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ErrorCodes_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ErrorCodes_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ErrorCodes_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +ErrorCodes_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +ErrorCodes_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ErrorCodes_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_ErrorCodes_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5 } /* (0..5,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_ErrorCodes_value2enum_1[] = { + { 0, 9, "unDefined" }, + { 1, 15, "missingComponet" }, + { 2, 13, "incorrectData" }, + { 3, 27, "missingIEorComponentElement" }, + { 4, 15, "messageTooShort" }, + { 5, 21, "unknowReferenceNumber" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_ErrorCodes_enum2value_1[] = { + 2, /* incorrectData(2) */ + 4, /* messageTooShort(4) */ + 1, /* missingComponet(1) */ + 3, /* missingIEorComponentElement(3) */ + 0, /* unDefined(0) */ + 5 /* unknowReferenceNumber(5) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_ErrorCodes_specs_1 = { + asn_MAP_ErrorCodes_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_ErrorCodes_enum2value_1, /* N => "tag"; sorted by N */ + 6, /* Number of elements in the maps */ + 7, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_ErrorCodes_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ErrorCodes = { + "ErrorCodes", + "ErrorCodes", + ErrorCodes_free, + ErrorCodes_print, + ErrorCodes_constraint, + ErrorCodes_decode_ber, + ErrorCodes_encode_der, + ErrorCodes_decode_xer, + ErrorCodes_encode_xer, + ErrorCodes_decode_uper, + ErrorCodes_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ErrorCodes_tags_1, + sizeof(asn_DEF_ErrorCodes_tags_1) + /sizeof(asn_DEF_ErrorCodes_tags_1[0]), /* 1 */ + asn_DEF_ErrorCodes_tags_1, /* Same as above */ + sizeof(asn_DEF_ErrorCodes_tags_1) + /sizeof(asn_DEF_ErrorCodes_tags_1[0]), /* 1 */ + &asn_PER_type_ErrorCodes_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ErrorCodes_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ErrorCodes.h b/src/core/libs/supl/asn-rrlp/ErrorCodes.h new file mode 100644 index 000000000..c2e1f6b4a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ErrorCodes.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ErrorCodes_H_ +#define _ErrorCodes_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ErrorCodes { + ErrorCodes_unDefined = 0, + ErrorCodes_missingComponet = 1, + ErrorCodes_incorrectData = 2, + ErrorCodes_missingIEorComponentElement = 3, + ErrorCodes_messageTooShort = 4, + ErrorCodes_unknowReferenceNumber = 5 + /* + * Enumeration is extensible + */ +} e_ErrorCodes; + +/* ErrorCodes */ +typedef ENUMERATED_t ErrorCodes_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ErrorCodes; +asn_struct_free_f ErrorCodes_free; +asn_struct_print_f ErrorCodes_print; +asn_constr_check_f ErrorCodes_constraint; +ber_type_decoder_f ErrorCodes_decode_ber; +der_type_encoder_f ErrorCodes_encode_der; +xer_type_decoder_f ErrorCodes_decode_xer; +xer_type_encoder_f ErrorCodes_encode_xer; +per_type_decoder_f ErrorCodes_decode_uper; +per_type_encoder_f ErrorCodes_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ErrorCodes_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c new file mode 100644 index 000000000..ff557e3d1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ExpOTDUncertainty.h" + +int +ExpOTDUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +ExpOTDUncertainty_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +ExpOTDUncertainty_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ExpOTDUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ExpOTDUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ExpOTDUncertainty_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ExpOTDUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ExpOTDUncertainty_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +ExpOTDUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +ExpOTDUncertainty_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_ExpOTDUncertainty_constr_1 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_ExpOTDUncertainty_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ExpOTDUncertainty = { + "ExpOTDUncertainty", + "ExpOTDUncertainty", + ExpOTDUncertainty_free, + ExpOTDUncertainty_print, + ExpOTDUncertainty_constraint, + ExpOTDUncertainty_decode_ber, + ExpOTDUncertainty_encode_der, + ExpOTDUncertainty_decode_xer, + ExpOTDUncertainty_encode_xer, + ExpOTDUncertainty_decode_uper, + ExpOTDUncertainty_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ExpOTDUncertainty_tags_1, + sizeof(asn_DEF_ExpOTDUncertainty_tags_1) + /sizeof(asn_DEF_ExpOTDUncertainty_tags_1[0]), /* 1 */ + asn_DEF_ExpOTDUncertainty_tags_1, /* Same as above */ + sizeof(asn_DEF_ExpOTDUncertainty_tags_1) + /sizeof(asn_DEF_ExpOTDUncertainty_tags_1[0]), /* 1 */ + &asn_PER_type_ExpOTDUncertainty_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h new file mode 100644 index 000000000..c35d42cc0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ExpOTDUncertainty_H_ +#define _ExpOTDUncertainty_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ExpOTDUncertainty */ +typedef long ExpOTDUncertainty_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ExpOTDUncertainty; +asn_struct_free_f ExpOTDUncertainty_free; +asn_struct_print_f ExpOTDUncertainty_print; +asn_constr_check_f ExpOTDUncertainty_constraint; +ber_type_decoder_f ExpOTDUncertainty_decode_ber; +der_type_encoder_f ExpOTDUncertainty_encode_der; +xer_type_decoder_f ExpOTDUncertainty_decode_xer; +xer_type_encoder_f ExpOTDUncertainty_encode_xer; +per_type_decoder_f ExpOTDUncertainty_decode_uper; +per_type_encoder_f ExpOTDUncertainty_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ExpOTDUncertainty_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ExpectedOTD.c b/src/core/libs/supl/asn-rrlp/ExpectedOTD.c new file mode 100644 index 000000000..947c22734 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ExpectedOTD.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ExpectedOTD.h" + +int +ExpectedOTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1250)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +ExpectedOTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +ExpectedOTD_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ExpectedOTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ExpectedOTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ExpectedOTD_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ExpectedOTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ExpectedOTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +ExpectedOTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +ExpectedOTD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ExpectedOTD_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_ExpectedOTD_constr_1 = { + { APC_CONSTRAINED, 11, 11, 0, 1250 } /* (0..1250) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_ExpectedOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ExpectedOTD = { + "ExpectedOTD", + "ExpectedOTD", + ExpectedOTD_free, + ExpectedOTD_print, + ExpectedOTD_constraint, + ExpectedOTD_decode_ber, + ExpectedOTD_encode_der, + ExpectedOTD_decode_xer, + ExpectedOTD_encode_xer, + ExpectedOTD_decode_uper, + ExpectedOTD_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ExpectedOTD_tags_1, + sizeof(asn_DEF_ExpectedOTD_tags_1) + /sizeof(asn_DEF_ExpectedOTD_tags_1[0]), /* 1 */ + asn_DEF_ExpectedOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_ExpectedOTD_tags_1) + /sizeof(asn_DEF_ExpectedOTD_tags_1[0]), /* 1 */ + &asn_PER_type_ExpectedOTD_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ExpectedOTD.h b/src/core/libs/supl/asn-rrlp/ExpectedOTD.h new file mode 100644 index 000000000..6f2a869e3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ExpectedOTD.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ExpectedOTD_H_ +#define _ExpectedOTD_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ExpectedOTD */ +typedef long ExpectedOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ExpectedOTD; +asn_struct_free_f ExpectedOTD_free; +asn_struct_print_f ExpectedOTD_print; +asn_constr_check_f ExpectedOTD_constraint; +ber_type_decoder_f ExpectedOTD_decode_ber; +der_type_encoder_f ExpectedOTD_encode_der; +xer_type_decoder_f ExpectedOTD_decode_xer; +xer_type_encoder_f ExpectedOTD_encode_xer; +per_type_decoder_f ExpectedOTD_decode_uper; +per_type_encoder_f ExpectedOTD_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ExpectedOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c new file mode 100644 index 000000000..9df50f61d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c @@ -0,0 +1,146 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Ext-GeographicalInformation.h" + +int +Ext_GeographicalInformation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 20)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using OCTET_STRING, + * so here we adjust the DEF accordingly. + */ +static void +Ext_GeographicalInformation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_OCTET_STRING.free_struct; + td->print_struct = asn_DEF_OCTET_STRING.print_struct; + td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; + td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; + td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; + td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; + td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; + td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; + td->elements = asn_DEF_OCTET_STRING.elements; + td->elements_count = asn_DEF_OCTET_STRING.elements_count; + td->specifics = asn_DEF_OCTET_STRING.specifics; +} + +void +Ext_GeographicalInformation_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Ext_GeographicalInformation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Ext_GeographicalInformation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Ext_GeographicalInformation_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Ext_GeographicalInformation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Ext_GeographicalInformation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +Ext_GeographicalInformation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +Ext_GeographicalInformation_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_Ext_GeographicalInformation_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 20 } /* (SIZE(1..20)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_Ext_GeographicalInformation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Ext_GeographicalInformation = { + "Ext-GeographicalInformation", + "Ext-GeographicalInformation", + Ext_GeographicalInformation_free, + Ext_GeographicalInformation_print, + Ext_GeographicalInformation_constraint, + Ext_GeographicalInformation_decode_ber, + Ext_GeographicalInformation_encode_der, + Ext_GeographicalInformation_decode_xer, + Ext_GeographicalInformation_encode_xer, + Ext_GeographicalInformation_decode_uper, + Ext_GeographicalInformation_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Ext_GeographicalInformation_tags_1, + sizeof(asn_DEF_Ext_GeographicalInformation_tags_1) + /sizeof(asn_DEF_Ext_GeographicalInformation_tags_1[0]), /* 1 */ + asn_DEF_Ext_GeographicalInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_Ext_GeographicalInformation_tags_1) + /sizeof(asn_DEF_Ext_GeographicalInformation_tags_1[0]), /* 1 */ + &asn_PER_type_Ext_GeographicalInformation_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h new file mode 100644 index 000000000..47165fd83 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Ext_GeographicalInformation_H_ +#define _Ext_GeographicalInformation_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Ext-GeographicalInformation */ +typedef OCTET_STRING_t Ext_GeographicalInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Ext_GeographicalInformation; +asn_struct_free_f Ext_GeographicalInformation_free; +asn_struct_print_f Ext_GeographicalInformation_print; +asn_constr_check_f Ext_GeographicalInformation_constraint; +ber_type_decoder_f Ext_GeographicalInformation_decode_ber; +der_type_encoder_f Ext_GeographicalInformation_encode_der; +xer_type_decoder_f Ext_GeographicalInformation_decode_xer; +xer_type_encoder_f Ext_GeographicalInformation_encode_xer; +per_type_decoder_f Ext_GeographicalInformation_decode_uper; +per_type_encoder_f Ext_GeographicalInformation_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Ext_GeographicalInformation_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Extended-reference.c b/src/core/libs/supl/asn-rrlp/Extended-reference.c new file mode 100644 index 000000000..12ca01ebe --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Extended-reference.c @@ -0,0 +1,129 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Extended-reference.h" + +static int +memb_smlc_code_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_transaction_ID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 262143)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_smlc_code_constr_2 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_transaction_ID_constr_3 = { + { APC_CONSTRAINED, 18, -1, 0, 262143 } /* (0..262143) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Extended_reference_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Extended_reference, smlc_code), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_smlc_code_constraint_1, + &asn_PER_memb_smlc_code_constr_2, + 0, + "smlc-code" + }, + { ATF_NOFLAGS, 0, offsetof(struct Extended_reference, transaction_ID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_transaction_ID_constraint_1, + &asn_PER_memb_transaction_ID_constr_3, + 0, + "transaction-ID" + }, +}; +static ber_tlv_tag_t asn_DEF_Extended_reference_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Extended_reference_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* smlc-code at 999 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* transaction-ID at 1000 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Extended_reference_specs_1 = { + sizeof(struct Extended_reference), + offsetof(struct Extended_reference, _asn_ctx), + asn_MAP_Extended_reference_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Extended_reference = { + "Extended-reference", + "Extended-reference", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Extended_reference_tags_1, + sizeof(asn_DEF_Extended_reference_tags_1) + /sizeof(asn_DEF_Extended_reference_tags_1[0]), /* 1 */ + asn_DEF_Extended_reference_tags_1, /* Same as above */ + sizeof(asn_DEF_Extended_reference_tags_1) + /sizeof(asn_DEF_Extended_reference_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Extended_reference_1, + 2, /* Elements count */ + &asn_SPC_Extended_reference_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Extended-reference.h b/src/core/libs/supl/asn-rrlp/Extended-reference.h new file mode 100644 index 000000000..f4ea28d2c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Extended-reference.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Extended_reference_H_ +#define _Extended_reference_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Extended-reference */ +typedef struct Extended_reference { + long smlc_code; + long transaction_ID; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Extended_reference_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Extended_reference; + +#ifdef __cplusplus +} +#endif + +#endif /* _Extended_reference_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ExtensionContainer.c b/src/core/libs/supl/asn-rrlp/ExtensionContainer.c new file mode 100644 index 000000000..43295c47b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ExtensionContainer.c @@ -0,0 +1,123 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ExtensionContainer.h" + +int +ExtensionContainer_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +ExtensionContainer_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_INTEGER.per_constraints; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +ExtensionContainer_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ExtensionContainer_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ExtensionContainer_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ExtensionContainer_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ExtensionContainer_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ExtensionContainer_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +ExtensionContainer_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +ExtensionContainer_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ExtensionContainer_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static ber_tlv_tag_t asn_DEF_ExtensionContainer_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ExtensionContainer = { + "ExtensionContainer", + "ExtensionContainer", + ExtensionContainer_free, + ExtensionContainer_print, + ExtensionContainer_constraint, + ExtensionContainer_decode_ber, + ExtensionContainer_encode_der, + ExtensionContainer_decode_xer, + ExtensionContainer_encode_xer, + ExtensionContainer_decode_uper, + ExtensionContainer_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ExtensionContainer_tags_1, + sizeof(asn_DEF_ExtensionContainer_tags_1) + /sizeof(asn_DEF_ExtensionContainer_tags_1[0]), /* 1 */ + asn_DEF_ExtensionContainer_tags_1, /* Same as above */ + sizeof(asn_DEF_ExtensionContainer_tags_1) + /sizeof(asn_DEF_ExtensionContainer_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ExtensionContainer.h b/src/core/libs/supl/asn-rrlp/ExtensionContainer.h new file mode 100644 index 000000000..a88437df8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ExtensionContainer.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ExtensionContainer_H_ +#define _ExtensionContainer_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ExtensionContainer */ +typedef INTEGER_t ExtensionContainer_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ExtensionContainer; +asn_struct_free_f ExtensionContainer_free; +asn_struct_print_f ExtensionContainer_print; +asn_constr_check_f ExtensionContainer_constraint; +ber_type_decoder_f ExtensionContainer_decode_ber; +der_type_encoder_f ExtensionContainer_encode_der; +xer_type_decoder_f ExtensionContainer_decode_xer; +xer_type_encoder_f ExtensionContainer_encode_xer; +per_type_decoder_f ExtensionContainer_decode_uper; +per_type_encoder_f ExtensionContainer_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ExtensionContainer_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/FineRTD.c b/src/core/libs/supl/asn-rrlp/FineRTD.c new file mode 100644 index 000000000..6a31fa718 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FineRTD.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "FineRTD.h" + +int +FineRTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FineRTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FineRTD_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FineRTD_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FineRTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FineRTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FineRTD_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FineRTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FineRTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FineRTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FineRTD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FineRTD_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FineRTD_constr_1 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_FineRTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FineRTD = { + "FineRTD", + "FineRTD", + FineRTD_free, + FineRTD_print, + FineRTD_constraint, + FineRTD_decode_ber, + FineRTD_encode_der, + FineRTD_decode_xer, + FineRTD_encode_xer, + FineRTD_decode_uper, + FineRTD_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FineRTD_tags_1, + sizeof(asn_DEF_FineRTD_tags_1) + /sizeof(asn_DEF_FineRTD_tags_1[0]), /* 1 */ + asn_DEF_FineRTD_tags_1, /* Same as above */ + sizeof(asn_DEF_FineRTD_tags_1) + /sizeof(asn_DEF_FineRTD_tags_1[0]), /* 1 */ + &asn_PER_type_FineRTD_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/FineRTD.h b/src/core/libs/supl/asn-rrlp/FineRTD.h new file mode 100644 index 000000000..7738c6b57 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FineRTD.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _FineRTD_H_ +#define _FineRTD_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FineRTD */ +typedef long FineRTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FineRTD; +asn_struct_free_f FineRTD_free; +asn_struct_print_f FineRTD_print; +asn_constr_check_f FineRTD_constraint; +ber_type_decoder_f FineRTD_decode_ber; +der_type_encoder_f FineRTD_encode_der; +xer_type_decoder_f FineRTD_decode_xer; +xer_type_encoder_f FineRTD_encode_xer; +per_type_decoder_f FineRTD_decode_uper; +per_type_encoder_f FineRTD_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FineRTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/FixType.c b/src/core/libs/supl/asn-rrlp/FixType.c new file mode 100644 index 000000000..d413f29c7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FixType.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "FixType.h" + +int +FixType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FixType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FixType_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FixType_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FixType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FixType_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FixType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FixType_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FixType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FixType_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FixType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FixType_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FixType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FixType_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FixType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FixType_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FixType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FixType_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FixType_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_FixType_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FixType = { + "FixType", + "FixType", + FixType_free, + FixType_print, + FixType_constraint, + FixType_decode_ber, + FixType_encode_der, + FixType_decode_xer, + FixType_encode_xer, + FixType_decode_uper, + FixType_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FixType_tags_1, + sizeof(asn_DEF_FixType_tags_1) + /sizeof(asn_DEF_FixType_tags_1[0]), /* 1 */ + asn_DEF_FixType_tags_1, /* Same as above */ + sizeof(asn_DEF_FixType_tags_1) + /sizeof(asn_DEF_FixType_tags_1[0]), /* 1 */ + &asn_PER_type_FixType_constr_1, + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/FixType.h b/src/core/libs/supl/asn-rrlp/FixType.h new file mode 100644 index 000000000..498fda8bf --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FixType.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _FixType_H_ +#define _FixType_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FixType { + FixType_twoDFix = 0, + FixType_threeDFix = 1 +} e_FixType; + +/* FixType */ +typedef long FixType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FixType; +asn_struct_free_f FixType_free; +asn_struct_print_f FixType_print; +asn_constr_check_f FixType_constraint; +ber_type_decoder_f FixType_decode_ber; +der_type_encoder_f FixType_encode_der; +xer_type_decoder_f FixType_decode_xer; +xer_type_encoder_f FixType_encode_xer; +per_type_decoder_f FixType_decode_uper; +per_type_encoder_f FixType_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FixType_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/FrameDrift.c b/src/core/libs/supl/asn-rrlp/FrameDrift.c new file mode 100644 index 000000000..0a0238c9f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FrameDrift.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "FrameDrift.h" + +int +FrameDrift_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -64 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FrameDrift_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FrameDrift_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FrameDrift_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FrameDrift_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FrameDrift_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FrameDrift_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FrameDrift_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FrameDrift_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FrameDrift_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FrameDrift_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FrameDrift_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FrameDrift_constr_1 = { + { APC_CONSTRAINED, 7, 7, -64, 63 } /* (-64..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_FrameDrift_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FrameDrift = { + "FrameDrift", + "FrameDrift", + FrameDrift_free, + FrameDrift_print, + FrameDrift_constraint, + FrameDrift_decode_ber, + FrameDrift_encode_der, + FrameDrift_decode_xer, + FrameDrift_encode_xer, + FrameDrift_decode_uper, + FrameDrift_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FrameDrift_tags_1, + sizeof(asn_DEF_FrameDrift_tags_1) + /sizeof(asn_DEF_FrameDrift_tags_1[0]), /* 1 */ + asn_DEF_FrameDrift_tags_1, /* Same as above */ + sizeof(asn_DEF_FrameDrift_tags_1) + /sizeof(asn_DEF_FrameDrift_tags_1[0]), /* 1 */ + &asn_PER_type_FrameDrift_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/FrameDrift.h b/src/core/libs/supl/asn-rrlp/FrameDrift.h new file mode 100644 index 000000000..48c5f17ea --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FrameDrift.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _FrameDrift_H_ +#define _FrameDrift_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FrameDrift */ +typedef long FrameDrift_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FrameDrift; +asn_struct_free_f FrameDrift_free; +asn_struct_print_f FrameDrift_print; +asn_constr_check_f FrameDrift_constraint; +ber_type_decoder_f FrameDrift_decode_ber; +der_type_encoder_f FrameDrift_encode_der; +xer_type_decoder_f FrameDrift_decode_xer; +xer_type_encoder_f FrameDrift_encode_xer; +per_type_decoder_f FrameDrift_decode_uper; +per_type_encoder_f FrameDrift_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrameDrift_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/FrameNumber.c b/src/core/libs/supl/asn-rrlp/FrameNumber.c new file mode 100644 index 000000000..b8778f7f8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FrameNumber.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "FrameNumber.h" + +int +FrameNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2097151)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +FrameNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +FrameNumber_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FrameNumber_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FrameNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FrameNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FrameNumber_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FrameNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FrameNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FrameNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FrameNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FrameNumber_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FrameNumber_constr_1 = { + { APC_CONSTRAINED, 21, -1, 0, 2097151 } /* (0..2097151) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_FrameNumber_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FrameNumber = { + "FrameNumber", + "FrameNumber", + FrameNumber_free, + FrameNumber_print, + FrameNumber_constraint, + FrameNumber_decode_ber, + FrameNumber_encode_der, + FrameNumber_decode_xer, + FrameNumber_encode_xer, + FrameNumber_decode_uper, + FrameNumber_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FrameNumber_tags_1, + sizeof(asn_DEF_FrameNumber_tags_1) + /sizeof(asn_DEF_FrameNumber_tags_1[0]), /* 1 */ + asn_DEF_FrameNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_FrameNumber_tags_1) + /sizeof(asn_DEF_FrameNumber_tags_1[0]), /* 1 */ + &asn_PER_type_FrameNumber_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/FrameNumber.h b/src/core/libs/supl/asn-rrlp/FrameNumber.h new file mode 100644 index 000000000..152b2d4d7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/FrameNumber.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _FrameNumber_H_ +#define _FrameNumber_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FrameNumber */ +typedef long FrameNumber_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FrameNumber; +asn_struct_free_f FrameNumber_free; +asn_struct_print_f FrameNumber_print; +asn_constr_check_f FrameNumber_constraint; +ber_type_decoder_f FrameNumber_decode_ber; +der_type_encoder_f FrameNumber_encode_der; +xer_type_decoder_f FrameNumber_decode_xer; +xer_type_encoder_f FrameNumber_encode_xer; +per_type_decoder_f FrameNumber_decode_uper; +per_type_encoder_f FrameNumber_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrameNumber_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c new file mode 100644 index 000000000..9c63d2874 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSS-AssistData.h" + +static asn_TYPE_member_t asn_MBR_GANSS_AssistData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSS_AssistData, ganss_controlHeader), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSS_ControlHeader, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganss-controlHeader" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSS_AssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSS_AssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ganss-controlHeader at 1062 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSS_AssistData_specs_1 = { + sizeof(struct GANSS_AssistData), + offsetof(struct GANSS_AssistData, _asn_ctx), + asn_MAP_GANSS_AssistData_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSS_AssistData = { + "GANSS-AssistData", + "GANSS-AssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSS_AssistData_tags_1, + sizeof(asn_DEF_GANSS_AssistData_tags_1) + /sizeof(asn_DEF_GANSS_AssistData_tags_1[0]), /* 1 */ + asn_DEF_GANSS_AssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_AssistData_tags_1) + /sizeof(asn_DEF_GANSS_AssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSS_AssistData_1, + 1, /* Elements count */ + &asn_SPC_GANSS_AssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h new file mode 100644 index 000000000..cdb0960d8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSS_AssistData_H_ +#define _GANSS_AssistData_H_ + + +#include + +/* Including external dependencies */ +#include "GANSS-ControlHeader.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSS-AssistData */ +typedef struct GANSS_AssistData { + GANSS_ControlHeader_t ganss_controlHeader; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSS_AssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSS_AssistData; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSS_AssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c new file mode 100644 index 000000000..5fbe0f0ba --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSS-ControlHeader.h" + +static asn_TYPE_member_t asn_MBR_GANSS_ControlHeader_1[] = { + { ATF_POINTER, 2, offsetof(struct GANSS_ControlHeader, ganssCommonAssistData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSCommonAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssCommonAssistData" + }, + { ATF_POINTER, 1, offsetof(struct GANSS_ControlHeader, ganssGenericAssistDataList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSGenericAssistDataElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssGenericAssistDataList" + }, +}; +static int asn_MAP_GANSS_ControlHeader_oms_1[] = { 0, 1 }; +static ber_tlv_tag_t asn_DEF_GANSS_ControlHeader_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSS_ControlHeader_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssCommonAssistData at 1065 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssGenericAssistDataList at 1066 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSS_ControlHeader_specs_1 = { + sizeof(struct GANSS_ControlHeader), + offsetof(struct GANSS_ControlHeader, _asn_ctx), + asn_MAP_GANSS_ControlHeader_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_GANSS_ControlHeader_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSS_ControlHeader = { + "GANSS-ControlHeader", + "GANSS-ControlHeader", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSS_ControlHeader_tags_1, + sizeof(asn_DEF_GANSS_ControlHeader_tags_1) + /sizeof(asn_DEF_GANSS_ControlHeader_tags_1[0]), /* 1 */ + asn_DEF_GANSS_ControlHeader_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_ControlHeader_tags_1) + /sizeof(asn_DEF_GANSS_ControlHeader_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSS_ControlHeader_1, + 2, /* Elements count */ + &asn_SPC_GANSS_ControlHeader_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h new file mode 100644 index 000000000..96e98b022 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSS_ControlHeader_H_ +#define _GANSS_ControlHeader_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSCommonAssistData; +struct SeqOfGANSSGenericAssistDataElement; + +/* GANSS-ControlHeader */ +typedef struct GANSS_ControlHeader { + struct GANSSCommonAssistData *ganssCommonAssistData /* OPTIONAL */; + struct SeqOfGANSSGenericAssistDataElement *ganssGenericAssistDataList /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSS_ControlHeader_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSS_ControlHeader; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSCommonAssistData.h" +#include "SeqOfGANSSGenericAssistDataElement.h" + +#endif /* _GANSS_ControlHeader_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c new file mode 100644 index 000000000..229783ca8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c @@ -0,0 +1,131 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSS-MsrSetElement.h" + +static int +memb_deltaGNASSTOD_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_deltaGNASSTOD_constr_4 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSS_MsrSetElement_1[] = { + { ATF_POINTER, 4, offsetof(struct GANSS_MsrSetElement, referenceFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceFrame, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceFrame" + }, + { ATF_POINTER, 3, offsetof(struct GANSS_MsrSetElement, ganssTODm), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODm, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODm" + }, + { ATF_POINTER, 2, offsetof(struct GANSS_MsrSetElement, deltaGNASSTOD), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_deltaGNASSTOD_constraint_1, + &asn_PER_memb_deltaGNASSTOD_constr_4, + 0, + "deltaGNASSTOD" + }, + { ATF_POINTER, 1, offsetof(struct GANSS_MsrSetElement, ganssTODUncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODUncertainty" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSS_MsrSetElement, ganss_SgnTypeList), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSS_SgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganss-SgnTypeList" + }, +}; +static int asn_MAP_GANSS_MsrSetElement_oms_1[] = { 0, 1, 2, 3 }; +static ber_tlv_tag_t asn_DEF_GANSS_MsrSetElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSS_MsrSetElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFrame at 1456 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTODm at 1457 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* deltaGNASSTOD at 1458 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssTODUncertainty at 1459 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganss-SgnTypeList at 1463 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSS_MsrSetElement_specs_1 = { + sizeof(struct GANSS_MsrSetElement), + offsetof(struct GANSS_MsrSetElement, _asn_ctx), + asn_MAP_GANSS_MsrSetElement_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_GANSS_MsrSetElement_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSS_MsrSetElement = { + "GANSS-MsrSetElement", + "GANSS-MsrSetElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSS_MsrSetElement_tags_1, + sizeof(asn_DEF_GANSS_MsrSetElement_tags_1) + /sizeof(asn_DEF_GANSS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_GANSS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_MsrSetElement_tags_1) + /sizeof(asn_DEF_GANSS_MsrSetElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSS_MsrSetElement_1, + 5, /* Elements count */ + &asn_SPC_GANSS_MsrSetElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h new file mode 100644 index 000000000..a6579b16e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSS_MsrSetElement_H_ +#define _GANSS_MsrSetElement_H_ + + +#include + +/* Including external dependencies */ +#include "GANSSTODm.h" +#include +#include "GANSSTODUncertainty.h" +#include "SeqOfGANSS-SgnTypeElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ReferenceFrame; + +/* GANSS-MsrSetElement */ +typedef struct GANSS_MsrSetElement { + struct ReferenceFrame *referenceFrame /* OPTIONAL */; + GANSSTODm_t *ganssTODm /* OPTIONAL */; + long *deltaGNASSTOD /* OPTIONAL */; + GANSSTODUncertainty_t *ganssTODUncertainty /* OPTIONAL */; + SeqOfGANSS_SgnTypeElement_t ganss_SgnTypeList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSS_MsrSetElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSS_MsrSetElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "ReferenceFrame.h" + +#endif /* _GANSS_MsrSetElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c new file mode 100644 index 000000000..6f31ab9b9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c @@ -0,0 +1,351 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSS-SgnElement.h" + +static int +memb_cNo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_carrierQualityInd_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2097151)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_integerCodePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_codePhaseRMSError_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_doppler_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_adr_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 33554431)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_cNo_constr_3 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_carrierQualityInd_constr_5 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_codePhase_constr_6 = { + { APC_CONSTRAINED, 21, -1, 0, 2097151 } /* (0..2097151) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_integerCodePhase_constr_7 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_codePhaseRMSError_constr_8 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_doppler_constr_9 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_adr_constr_10 = { + { APC_CONSTRAINED, 25, -1, 0, 33554431 } /* (0..33554431) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSS_SgnElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, cNo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_cNo_constraint_1, + &asn_PER_memb_cNo_constr_3, + 0, + "cNo" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, mpathDet), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MpathIndic, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "mpathDet" + }, + { ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, carrierQualityInd), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_carrierQualityInd_constraint_1, + &asn_PER_memb_carrierQualityInd_constr_5, + 0, + "carrierQualityInd" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, codePhase), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_codePhase_constraint_1, + &asn_PER_memb_codePhase_constr_6, + 0, + "codePhase" + }, + { ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, integerCodePhase), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_integerCodePhase_constraint_1, + &asn_PER_memb_integerCodePhase_constr_7, + 0, + "integerCodePhase" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, codePhaseRMSError), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_codePhaseRMSError_constraint_1, + &asn_PER_memb_codePhaseRMSError_constr_8, + 0, + "codePhaseRMSError" + }, + { ATF_POINTER, 2, offsetof(struct GANSS_SgnElement, doppler), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_doppler_constraint_1, + &asn_PER_memb_doppler_constr_9, + 0, + "doppler" + }, + { ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, adr), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_adr_constraint_1, + &asn_PER_memb_adr_constr_10, + 0, + "adr" + }, +}; +static int asn_MAP_GANSS_SgnElement_oms_1[] = { 3, 5, 7, 8 }; +static ber_tlv_tag_t asn_DEF_GANSS_SgnElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSS_SgnElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1479 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cNo at 1480 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* mpathDet at 1481 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* carrierQualityInd at 1482 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* codePhase at 1483 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* integerCodePhase at 1484 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* codePhaseRMSError at 1485 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* doppler at 1486 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* adr at 1487 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSS_SgnElement_specs_1 = { + sizeof(struct GANSS_SgnElement), + offsetof(struct GANSS_SgnElement, _asn_ctx), + asn_MAP_GANSS_SgnElement_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_GANSS_SgnElement_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSS_SgnElement = { + "GANSS-SgnElement", + "GANSS-SgnElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSS_SgnElement_tags_1, + sizeof(asn_DEF_GANSS_SgnElement_tags_1) + /sizeof(asn_DEF_GANSS_SgnElement_tags_1[0]), /* 1 */ + asn_DEF_GANSS_SgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_SgnElement_tags_1) + /sizeof(asn_DEF_GANSS_SgnElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSS_SgnElement_1, + 9, /* Elements count */ + &asn_SPC_GANSS_SgnElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h new file mode 100644 index 000000000..d2727b544 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSS_SgnElement_H_ +#define _GANSS_SgnElement_H_ + + +#include + +/* Including external dependencies */ +#include "SVID.h" +#include +#include "MpathIndic.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSS-SgnElement */ +typedef struct GANSS_SgnElement { + SVID_t svID; + long cNo; + MpathIndic_t mpathDet; + long *carrierQualityInd /* OPTIONAL */; + long codePhase; + long *integerCodePhase /* OPTIONAL */; + long codePhaseRMSError; + long *doppler /* OPTIONAL */; + long *adr /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSS_SgnElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSS_SgnElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSS_SgnElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c new file mode 100644 index 000000000..cffb812c8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSS-SgnTypeElement.h" + +static int +memb_ganssSignalID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssSignalID_constr_2 = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSS_SgnTypeElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnTypeElement, ganssSignalID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssSignalID_constraint_1, + &asn_PER_memb_ganssSignalID_constr_2, + 0, + "ganssSignalID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnTypeElement, ganss_SgnList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSS_SgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganss-SgnList" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSS_SgnTypeElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSS_SgnTypeElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssSignalID at 1469 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganss-SgnList at 1472 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSS_SgnTypeElement_specs_1 = { + sizeof(struct GANSS_SgnTypeElement), + offsetof(struct GANSS_SgnTypeElement, _asn_ctx), + asn_MAP_GANSS_SgnTypeElement_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSS_SgnTypeElement = { + "GANSS-SgnTypeElement", + "GANSS-SgnTypeElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSS_SgnTypeElement_tags_1, + sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1) + /sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_GANSS_SgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1) + /sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSS_SgnTypeElement_1, + 2, /* Elements count */ + &asn_SPC_GANSS_SgnTypeElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h new file mode 100644 index 000000000..d4b43c852 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSS_SgnTypeElement_H_ +#define _GANSS_SgnTypeElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SeqOfGANSS-SgnElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSS-SgnTypeElement */ +typedef struct GANSS_SgnTypeElement { + long ganssSignalID; + SeqOfGANSS_SgnElement_t ganss_SgnList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSS_SgnTypeElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSS_SgnTypeElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSS_SgnTypeElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c new file mode 100644 index 000000000..c41627282 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSAlmanacElement.h" + +static asn_per_constraints_t asn_PER_type_GANSSAlmanacElement_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSAlmanacElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacElement, choice.keplerianAlmanacSet), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Almanac_KeplerianSet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "keplerianAlmanacSet" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSAlmanacElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* keplerianAlmanacSet at 1362 */ +}; +static asn_CHOICE_specifics_t asn_SPC_GANSSAlmanacElement_specs_1 = { + sizeof(struct GANSSAlmanacElement), + offsetof(struct GANSSAlmanacElement, _asn_ctx), + offsetof(struct GANSSAlmanacElement, present), + sizeof(((struct GANSSAlmanacElement *)0)->present), + asn_MAP_GANSSAlmanacElement_tag2el_1, + 1, /* Count of tags in the map */ + 0, + 1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacElement = { + "GANSSAlmanacElement", + "GANSSAlmanacElement", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_GANSSAlmanacElement_constr_1, + asn_MBR_GANSSAlmanacElement_1, + 1, /* Elements count */ + &asn_SPC_GANSSAlmanacElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h new file mode 100644 index 000000000..508f08a00 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSAlmanacElement_H_ +#define _GANSSAlmanacElement_H_ + + +#include + +/* Including external dependencies */ +#include "Almanac-KeplerianSet.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum GANSSAlmanacElement_PR { + GANSSAlmanacElement_PR_NOTHING, /* No components present */ + GANSSAlmanacElement_PR_keplerianAlmanacSet, + /* Extensions may appear below */ + +} GANSSAlmanacElement_PR; + +/* GANSSAlmanacElement */ +typedef struct GANSSAlmanacElement { + GANSSAlmanacElement_PR present; + union GANSSAlmanacElement_u { + Almanac_KeplerianSet_t keplerianAlmanacSet; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSAlmanacElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSAlmanacElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c new file mode 100644 index 000000000..3fb9dff20 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c @@ -0,0 +1,191 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSAlmanacModel.h" + +static int +memb_weekNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_toa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ioda_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_weekNumber_constr_2 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_toa_constr_4 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ioda_constr_5 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSAlmanacModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, weekNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_weekNumber_constraint_1, + &asn_PER_memb_weekNumber_constr_2, + 0, + "weekNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, svIDMask), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVIDMASK, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svIDMask" + }, + { ATF_POINTER, 2, offsetof(struct GANSSAlmanacModel, toa), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_toa_constraint_1, + &asn_PER_memb_toa_constr_4, + 0, + "toa" + }, + { ATF_POINTER, 1, offsetof(struct GANSSAlmanacModel, ioda), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ioda_constraint_1, + &asn_PER_memb_ioda_constr_5, + 0, + "ioda" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, ganssAlmanacList), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSAlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssAlmanacList" + }, +}; +static int asn_MAP_GANSSAlmanacModel_oms_1[] = { 2, 3 }; +static ber_tlv_tag_t asn_DEF_GANSSAlmanacModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSAlmanacModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* weekNumber at 1348 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* svIDMask at 1349 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toa at 1350 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ioda at 1351 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganssAlmanacList at 1353 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSAlmanacModel_specs_1 = { + sizeof(struct GANSSAlmanacModel), + offsetof(struct GANSSAlmanacModel, _asn_ctx), + asn_MAP_GANSSAlmanacModel_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_GANSSAlmanacModel_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacModel = { + "GANSSAlmanacModel", + "GANSSAlmanacModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSAlmanacModel_tags_1, + sizeof(asn_DEF_GANSSAlmanacModel_tags_1) + /sizeof(asn_DEF_GANSSAlmanacModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSAlmanacModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSAlmanacModel_tags_1) + /sizeof(asn_DEF_GANSSAlmanacModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSAlmanacModel_1, + 5, /* Elements count */ + &asn_SPC_GANSSAlmanacModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h new file mode 100644 index 000000000..237ad6217 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSAlmanacModel_H_ +#define _GANSSAlmanacModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SVIDMASK.h" +#include "SeqOfGANSSAlmanacElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSAlmanacModel */ +typedef struct GANSSAlmanacModel { + long weekNumber; + SVIDMASK_t svIDMask; + long *toa /* OPTIONAL */; + long *ioda /* OPTIONAL */; + SeqOfGANSSAlmanacElement_t ganssAlmanacList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSAlmanacModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSAlmanacModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c new file mode 100644 index 000000000..dbf9340b3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c @@ -0,0 +1,146 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSAssistanceData.h" + +int +GANSSAssistanceData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 40)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using OCTET_STRING, + * so here we adjust the DEF accordingly. + */ +static void +GANSSAssistanceData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_OCTET_STRING.free_struct; + td->print_struct = asn_DEF_OCTET_STRING.print_struct; + td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; + td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; + td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; + td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; + td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; + td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; + td->elements = asn_DEF_OCTET_STRING.elements; + td->elements_count = asn_DEF_OCTET_STRING.elements_count; + td->specifics = asn_DEF_OCTET_STRING.specifics; +} + +void +GANSSAssistanceData_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSAssistanceData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSAssistanceData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSAssistanceData_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSAssistanceData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSAssistanceData_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSAssistanceData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSAssistanceData_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSAssistanceData_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 40 } /* (SIZE(1..40)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSAssistanceData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSAssistanceData = { + "GANSSAssistanceData", + "GANSSAssistanceData", + GANSSAssistanceData_free, + GANSSAssistanceData_print, + GANSSAssistanceData_constraint, + GANSSAssistanceData_decode_ber, + GANSSAssistanceData_encode_der, + GANSSAssistanceData_decode_xer, + GANSSAssistanceData_encode_xer, + GANSSAssistanceData_decode_uper, + GANSSAssistanceData_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSAssistanceData_tags_1, + sizeof(asn_DEF_GANSSAssistanceData_tags_1) + /sizeof(asn_DEF_GANSSAssistanceData_tags_1[0]), /* 1 */ + asn_DEF_GANSSAssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSAssistanceData_tags_1) + /sizeof(asn_DEF_GANSSAssistanceData_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSAssistanceData_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h new file mode 100644 index 000000000..58d37c051 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSAssistanceData_H_ +#define _GANSSAssistanceData_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSAssistanceData */ +typedef OCTET_STRING_t GANSSAssistanceData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSAssistanceData; +asn_struct_free_f GANSSAssistanceData_free; +asn_struct_print_f GANSSAssistanceData_print; +asn_constr_check_f GANSSAssistanceData_constraint; +ber_type_decoder_f GANSSAssistanceData_decode_ber; +der_type_encoder_f GANSSAssistanceData_encode_der; +xer_type_decoder_f GANSSAssistanceData_decode_xer; +xer_type_encoder_f GANSSAssistanceData_encode_xer; +per_type_decoder_f GANSSAssistanceData_decode_uper; +per_type_encoder_f GANSSAssistanceData_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSAssistanceData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSClockModel.c b/src/core/libs/supl/asn-rrlp/GANSSClockModel.c new file mode 100644 index 000000000..3dd4501e7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSClockModel.c @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSClockModel.h" + +static asn_per_constraints_t asn_PER_type_GANSSClockModel_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSClockModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSClockModel, choice.standardClockModelList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfStandardClockModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "standardClockModelList" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSClockModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* standardClockModelList at 1274 */ +}; +static asn_CHOICE_specifics_t asn_SPC_GANSSClockModel_specs_1 = { + sizeof(struct GANSSClockModel), + offsetof(struct GANSSClockModel, _asn_ctx), + offsetof(struct GANSSClockModel, present), + sizeof(((struct GANSSClockModel *)0)->present), + asn_MAP_GANSSClockModel_tag2el_1, + 1, /* Count of tags in the map */ + 0, + 1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSClockModel = { + "GANSSClockModel", + "GANSSClockModel", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_GANSSClockModel_constr_1, + asn_MBR_GANSSClockModel_1, + 1, /* Elements count */ + &asn_SPC_GANSSClockModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSClockModel.h b/src/core/libs/supl/asn-rrlp/GANSSClockModel.h new file mode 100644 index 000000000..4fd80e0b7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSClockModel.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSClockModel_H_ +#define _GANSSClockModel_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfStandardClockModelElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum GANSSClockModel_PR { + GANSSClockModel_PR_NOTHING, /* No components present */ + GANSSClockModel_PR_standardClockModelList, + /* Extensions may appear below */ + +} GANSSClockModel_PR; + +/* GANSSClockModel */ +typedef struct GANSSClockModel { + GANSSClockModel_PR present; + union GANSSClockModel_u { + SeqOfStandardClockModelElement_t standardClockModelList; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSClockModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSClockModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSClockModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c new file mode 100644 index 000000000..b819eb959 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSCommonAssistData.h" + +static asn_TYPE_member_t asn_MBR_GANSSCommonAssistData_1[] = { + { ATF_POINTER, 3, offsetof(struct GANSSCommonAssistData, ganssReferenceTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSReferenceTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssReferenceTime" + }, + { ATF_POINTER, 2, offsetof(struct GANSSCommonAssistData, ganssRefLocation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRefLocation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssRefLocation" + }, + { ATF_POINTER, 1, offsetof(struct GANSSCommonAssistData, ganssIonosphericModel), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSIonosphericModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssIonosphericModel" + }, +}; +static int asn_MAP_GANSSCommonAssistData_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_GANSSCommonAssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSCommonAssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssReferenceTime at 1071 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssRefLocation at 1072 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssIonosphericModel at 1073 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSCommonAssistData_specs_1 = { + sizeof(struct GANSSCommonAssistData), + offsetof(struct GANSSCommonAssistData, _asn_ctx), + asn_MAP_GANSSCommonAssistData_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_GANSSCommonAssistData_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSCommonAssistData = { + "GANSSCommonAssistData", + "GANSSCommonAssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSCommonAssistData_tags_1, + sizeof(asn_DEF_GANSSCommonAssistData_tags_1) + /sizeof(asn_DEF_GANSSCommonAssistData_tags_1[0]), /* 1 */ + asn_DEF_GANSSCommonAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSCommonAssistData_tags_1) + /sizeof(asn_DEF_GANSSCommonAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSCommonAssistData_1, + 3, /* Elements count */ + &asn_SPC_GANSSCommonAssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h new file mode 100644 index 000000000..383d368ac --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSCommonAssistData_H_ +#define _GANSSCommonAssistData_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSReferenceTime; +struct GANSSRefLocation; +struct GANSSIonosphericModel; + +/* GANSSCommonAssistData */ +typedef struct GANSSCommonAssistData { + struct GANSSReferenceTime *ganssReferenceTime /* OPTIONAL */; + struct GANSSRefLocation *ganssRefLocation /* OPTIONAL */; + struct GANSSIonosphericModel *ganssIonosphericModel /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSCommonAssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSCommonAssistData; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSReferenceTime.h" +#include "GANSSRefLocation.h" +#include "GANSSIonosphericModel.h" + +#endif /* _GANSSCommonAssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBit.c b/src/core/libs/supl/asn-rrlp/GANSSDataBit.c new file mode 100644 index 000000000..67e8a5f0a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBit.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSDataBit.h" + +int +GANSSDataBit_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GANSSDataBit_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GANSSDataBit_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSDataBit_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSDataBit_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSDataBit_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSDataBit_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSDataBit_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSDataBit_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSDataBit_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSDataBit_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSDataBit_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSDataBit_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSDataBit = { + "GANSSDataBit", + "GANSSDataBit", + GANSSDataBit_free, + GANSSDataBit_print, + GANSSDataBit_constraint, + GANSSDataBit_decode_ber, + GANSSDataBit_encode_der, + GANSSDataBit_decode_xer, + GANSSDataBit_encode_xer, + GANSSDataBit_decode_uper, + GANSSDataBit_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSDataBit_tags_1, + sizeof(asn_DEF_GANSSDataBit_tags_1) + /sizeof(asn_DEF_GANSSDataBit_tags_1[0]), /* 1 */ + asn_DEF_GANSSDataBit_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSDataBit_tags_1) + /sizeof(asn_DEF_GANSSDataBit_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSDataBit_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBit.h b/src/core/libs/supl/asn-rrlp/GANSSDataBit.h new file mode 100644 index 000000000..008d80e82 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBit.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSDataBit_H_ +#define _GANSSDataBit_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSDataBit */ +typedef long GANSSDataBit_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSDataBit; +asn_struct_free_f GANSSDataBit_free; +asn_struct_print_f GANSSDataBit_print; +asn_constr_check_f GANSSDataBit_constraint; +ber_type_decoder_f GANSSDataBit_decode_ber; +der_type_encoder_f GANSSDataBit_encode_der; +xer_type_decoder_f GANSSDataBit_decode_xer; +xer_type_encoder_f GANSSDataBit_encode_xer; +per_type_decoder_f GANSSDataBit_decode_uper; +per_type_encoder_f GANSSDataBit_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSDataBit_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c new file mode 100644 index 000000000..83aae91c6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSDataBitAssist.h" + +static int +memb_ganssTOD_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 59)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssDataTypeID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 2)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssTOD_constr_2 = { + { APC_CONSTRAINED, 6, 6, 0, 59 } /* (0..59) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssDataTypeID_constr_4 = { + { 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_GANSSDataBitAssist_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssTOD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssTOD_constraint_1, + &asn_PER_memb_ganssTOD_constr_2, + 0, + "ganssTOD" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, svID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssDataTypeID), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssDataTypeID_constraint_1, + &asn_PER_memb_ganssDataTypeID_constr_4, + 0, + "ganssDataTypeID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssDataBits), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOf_GANSSDataBits, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssDataBits" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSDataBitAssist_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSDataBitAssist_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssTOD at 1307 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* svID at 1308 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssDataTypeID at 1309 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ganssDataBits at 1313 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSDataBitAssist_specs_1 = { + sizeof(struct GANSSDataBitAssist), + offsetof(struct GANSSDataBitAssist, _asn_ctx), + asn_MAP_GANSSDataBitAssist_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSDataBitAssist = { + "GANSSDataBitAssist", + "GANSSDataBitAssist", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSDataBitAssist_tags_1, + sizeof(asn_DEF_GANSSDataBitAssist_tags_1) + /sizeof(asn_DEF_GANSSDataBitAssist_tags_1[0]), /* 1 */ + asn_DEF_GANSSDataBitAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSDataBitAssist_tags_1) + /sizeof(asn_DEF_GANSSDataBitAssist_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSDataBitAssist_1, + 4, /* Elements count */ + &asn_SPC_GANSSDataBitAssist_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h new file mode 100644 index 000000000..ae97a6315 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSDataBitAssist_H_ +#define _GANSSDataBitAssist_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SVID.h" +#include "SeqOf-GANSSDataBits.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSDataBitAssist */ +typedef struct GANSSDataBitAssist { + long ganssTOD; + SVID_t svID; + long ganssDataTypeID; + SeqOf_GANSSDataBits_t ganssDataBits; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSDataBitAssist_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSDataBitAssist; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSDataBitAssist_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c new file mode 100644 index 000000000..4492d1eba --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSDiffCorrections.h" + +static int +memb_dganssRefTime_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 119)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_dganssRefTime_constr_2 = { + { APC_CONSTRAINED, 7, 7, 0, 119 } /* (0..119) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSDiffCorrections_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSDiffCorrections, dganssRefTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_dganssRefTime_constraint_1, + &asn_PER_memb_dganssRefTime_constr_2, + 0, + "dganssRefTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSDiffCorrections, sgnTypeList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sgnTypeList" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSDiffCorrections_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSDiffCorrections_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dganssRefTime at 1186 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* sgnTypeList at 1190 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSDiffCorrections_specs_1 = { + sizeof(struct GANSSDiffCorrections), + offsetof(struct GANSSDiffCorrections, _asn_ctx), + asn_MAP_GANSSDiffCorrections_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSDiffCorrections = { + "GANSSDiffCorrections", + "GANSSDiffCorrections", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSDiffCorrections_tags_1, + sizeof(asn_DEF_GANSSDiffCorrections_tags_1) + /sizeof(asn_DEF_GANSSDiffCorrections_tags_1[0]), /* 1 */ + asn_DEF_GANSSDiffCorrections_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSDiffCorrections_tags_1) + /sizeof(asn_DEF_GANSSDiffCorrections_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSDiffCorrections_1, + 2, /* Elements count */ + &asn_SPC_GANSSDiffCorrections_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h new file mode 100644 index 000000000..b499c3918 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSDiffCorrections_H_ +#define _GANSSDiffCorrections_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SeqOfSgnTypeElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSDiffCorrections */ +typedef struct GANSSDiffCorrections { + long dganssRefTime; + SeqOfSgnTypeElement_t sgnTypeList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSDiffCorrections_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSDiffCorrections; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSDiffCorrections_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c new file mode 100644 index 000000000..f9ee75d4f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c @@ -0,0 +1,171 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSGenericAssistDataElement.h" + +static int +memb_ganssID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssID_constr_2 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSGenericAssistDataElement_1[] = { + { ATF_POINTER, 9, offsetof(struct GANSSGenericAssistDataElement, ganssID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssID_constraint_1, + &asn_PER_memb_ganssID_constr_2, + 0, + "ganssID" + }, + { ATF_POINTER, 8, offsetof(struct GANSSGenericAssistDataElement, ganssTimeModel), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSTimeModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTimeModel" + }, + { ATF_POINTER, 7, offsetof(struct GANSSGenericAssistDataElement, ganssDiffCorrections), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSDiffCorrections, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssDiffCorrections" + }, + { ATF_POINTER, 6, offsetof(struct GANSSGenericAssistDataElement, ganssNavigationModel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSNavModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssNavigationModel" + }, + { ATF_POINTER, 5, offsetof(struct GANSSGenericAssistDataElement, ganssRealTimeIntegrity), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRealTimeIntegrity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssRealTimeIntegrity" + }, + { ATF_POINTER, 4, offsetof(struct GANSSGenericAssistDataElement, ganssDataBitAssist), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSDataBitAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssDataBitAssist" + }, + { ATF_POINTER, 3, offsetof(struct GANSSGenericAssistDataElement, ganssRefMeasurementAssist), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRefMeasurementAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssRefMeasurementAssist" + }, + { ATF_POINTER, 2, offsetof(struct GANSSGenericAssistDataElement, ganssAlmanacModel), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSAlmanacModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssAlmanacModel" + }, + { ATF_POINTER, 1, offsetof(struct GANSSGenericAssistDataElement, ganssUTCModel), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSUTCModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssUTCModel" + }, +}; +static int asn_MAP_GANSSGenericAssistDataElement_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static ber_tlv_tag_t asn_DEF_GANSSGenericAssistDataElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSGenericAssistDataElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssID at 1082 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTimeModel at 1083 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssDiffCorrections at 1084 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssNavigationModel at 1085 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssRealTimeIntegrity at 1086 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ganssDataBitAssist at 1087 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* ganssRefMeasurementAssist at 1088 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ganssAlmanacModel at 1089 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* ganssUTCModel at 1090 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSGenericAssistDataElement_specs_1 = { + sizeof(struct GANSSGenericAssistDataElement), + offsetof(struct GANSSGenericAssistDataElement, _asn_ctx), + asn_MAP_GANSSGenericAssistDataElement_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_GANSSGenericAssistDataElement_oms_1, /* Optional members */ + 9, 0, /* Root/Additions */ + 8, /* Start extensions */ + 10 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSGenericAssistDataElement = { + "GANSSGenericAssistDataElement", + "GANSSGenericAssistDataElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSGenericAssistDataElement_tags_1, + sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1) + /sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSGenericAssistDataElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1) + /sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSGenericAssistDataElement_1, + 9, /* Elements count */ + &asn_SPC_GANSSGenericAssistDataElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h new file mode 100644 index 000000000..1677de530 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSGenericAssistDataElement_H_ +#define _GANSSGenericAssistDataElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SeqOfGANSSTimeModel; +struct GANSSDiffCorrections; +struct GANSSNavModel; +struct GANSSRealTimeIntegrity; +struct GANSSDataBitAssist; +struct GANSSRefMeasurementAssist; +struct GANSSAlmanacModel; +struct GANSSUTCModel; + +/* GANSSGenericAssistDataElement */ +typedef struct GANSSGenericAssistDataElement { + long *ganssID /* OPTIONAL */; + struct SeqOfGANSSTimeModel *ganssTimeModel /* OPTIONAL */; + struct GANSSDiffCorrections *ganssDiffCorrections /* OPTIONAL */; + struct GANSSNavModel *ganssNavigationModel /* OPTIONAL */; + struct GANSSRealTimeIntegrity *ganssRealTimeIntegrity /* OPTIONAL */; + struct GANSSDataBitAssist *ganssDataBitAssist /* OPTIONAL */; + struct GANSSRefMeasurementAssist *ganssRefMeasurementAssist /* OPTIONAL */; + struct GANSSAlmanacModel *ganssAlmanacModel /* OPTIONAL */; + struct GANSSUTCModel *ganssUTCModel /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSGenericAssistDataElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSGenericAssistDataElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SeqOfGANSSTimeModel.h" +#include "GANSSDiffCorrections.h" +#include "GANSSNavModel.h" +#include "GANSSRealTimeIntegrity.h" +#include "GANSSDataBitAssist.h" +#include "GANSSRefMeasurementAssist.h" +#include "GANSSAlmanacModel.h" +#include "GANSSUTCModel.h" + +#endif /* _GANSSGenericAssistDataElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c new file mode 100644 index 000000000..9f5ad93bc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c @@ -0,0 +1,249 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSIonoStormFlags.h" + +static int +memb_ionoStormFlag1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ionoStormFlag2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ionoStormFlag3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ionoStormFlag4_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ionoStormFlag5_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ionoStormFlag1_constr_2 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ionoStormFlag2_constr_3 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ionoStormFlag3_constr_4 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ionoStormFlag4_constr_5 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ionoStormFlag5_constr_6 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSIonoStormFlags_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ionoStormFlag1_constraint_1, + &asn_PER_memb_ionoStormFlag1_constr_2, + 0, + "ionoStormFlag1" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ionoStormFlag2_constraint_1, + &asn_PER_memb_ionoStormFlag2_constr_3, + 0, + "ionoStormFlag2" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag3), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ionoStormFlag3_constraint_1, + &asn_PER_memb_ionoStormFlag3_constr_4, + 0, + "ionoStormFlag3" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag4), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ionoStormFlag4_constraint_1, + &asn_PER_memb_ionoStormFlag4_constr_5, + 0, + "ionoStormFlag4" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag5), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ionoStormFlag5_constraint_1, + &asn_PER_memb_ionoStormFlag5_constr_6, + 0, + "ionoStormFlag5" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSIonoStormFlags_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSIonoStormFlags_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ionoStormFlag1 at 1152 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ionoStormFlag2 at 1153 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ionoStormFlag3 at 1154 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ionoStormFlag4 at 1155 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ionoStormFlag5 at 1156 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSIonoStormFlags_specs_1 = { + sizeof(struct GANSSIonoStormFlags), + offsetof(struct GANSSIonoStormFlags, _asn_ctx), + asn_MAP_GANSSIonoStormFlags_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSIonoStormFlags = { + "GANSSIonoStormFlags", + "GANSSIonoStormFlags", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSIonoStormFlags_tags_1, + sizeof(asn_DEF_GANSSIonoStormFlags_tags_1) + /sizeof(asn_DEF_GANSSIonoStormFlags_tags_1[0]), /* 1 */ + asn_DEF_GANSSIonoStormFlags_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSIonoStormFlags_tags_1) + /sizeof(asn_DEF_GANSSIonoStormFlags_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSIonoStormFlags_1, + 5, /* Elements count */ + &asn_SPC_GANSSIonoStormFlags_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h new file mode 100644 index 000000000..b55e8a32e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSIonoStormFlags_H_ +#define _GANSSIonoStormFlags_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSIonoStormFlags */ +typedef struct GANSSIonoStormFlags { + long ionoStormFlag1; + long ionoStormFlag2; + long ionoStormFlag3; + long ionoStormFlag4; + long ionoStormFlag5; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSIonoStormFlags_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSIonoStormFlags; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSIonoStormFlags_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c new file mode 100644 index 000000000..10e7c67f0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c @@ -0,0 +1,169 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSIonosphereModel.h" + +static int +memb_ai0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4095)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ai1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4095)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ai2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4095)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ai0_constr_2 = { + { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ai1_constr_3 = { + { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ai2_constr_4 = { + { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSIonosphereModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai0), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ai0_constraint_1, + &asn_PER_memb_ai0_constr_2, + 0, + "ai0" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai1), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ai1_constraint_1, + &asn_PER_memb_ai1_constr_3, + 0, + "ai1" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai2), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ai2_constraint_1, + &asn_PER_memb_ai2_constr_4, + 0, + "ai2" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSIonosphereModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSIonosphereModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ai0 at 1145 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ai1 at 1146 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ai2 at 1147 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSIonosphereModel_specs_1 = { + sizeof(struct GANSSIonosphereModel), + offsetof(struct GANSSIonosphereModel, _asn_ctx), + asn_MAP_GANSSIonosphereModel_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSIonosphereModel = { + "GANSSIonosphereModel", + "GANSSIonosphereModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSIonosphereModel_tags_1, + sizeof(asn_DEF_GANSSIonosphereModel_tags_1) + /sizeof(asn_DEF_GANSSIonosphereModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSIonosphereModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSIonosphereModel_tags_1) + /sizeof(asn_DEF_GANSSIonosphereModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSIonosphereModel_1, + 3, /* Elements count */ + &asn_SPC_GANSSIonosphereModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h new file mode 100644 index 000000000..a30c4d2e2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSIonosphereModel_H_ +#define _GANSSIonosphereModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSIonosphereModel */ +typedef struct GANSSIonosphereModel { + long ai0; + long ai1; + long ai2; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSIonosphereModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSIonosphereModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSIonosphereModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c new file mode 100644 index 000000000..41ac3a7cc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSIonosphericModel.h" + +static asn_TYPE_member_t asn_MBR_GANSSIonosphericModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphericModel, ganssIonoModel), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSIonosphereModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssIonoModel" + }, + { ATF_POINTER, 1, offsetof(struct GANSSIonosphericModel, ganssIonoStormFlags), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSIonoStormFlags, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssIonoStormFlags" + }, +}; +static int asn_MAP_GANSSIonosphericModel_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_GANSSIonosphericModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSIonosphericModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssIonoModel at 1138 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssIonoStormFlags at 1139 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSIonosphericModel_specs_1 = { + sizeof(struct GANSSIonosphericModel), + offsetof(struct GANSSIonosphericModel, _asn_ctx), + asn_MAP_GANSSIonosphericModel_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_GANSSIonosphericModel_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSIonosphericModel = { + "GANSSIonosphericModel", + "GANSSIonosphericModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSIonosphericModel_tags_1, + sizeof(asn_DEF_GANSSIonosphericModel_tags_1) + /sizeof(asn_DEF_GANSSIonosphericModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSIonosphericModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSIonosphericModel_tags_1) + /sizeof(asn_DEF_GANSSIonosphericModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSIonosphericModel_1, + 2, /* Elements count */ + &asn_SPC_GANSSIonosphericModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h new file mode 100644 index 000000000..e96ff7635 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSIonosphericModel_H_ +#define _GANSSIonosphericModel_H_ + + +#include + +/* Including external dependencies */ +#include "GANSSIonosphereModel.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSIonoStormFlags; + +/* GANSSIonosphericModel */ +typedef struct GANSSIonosphericModel { + GANSSIonosphereModel_t ganssIonoModel; + struct GANSSIonoStormFlags *ganssIonoStormFlags /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSIonosphericModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSIonosphericModel; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSIonoStormFlags.h" + +#endif /* _GANSSIonosphericModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c new file mode 100644 index 000000000..c98360895 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c @@ -0,0 +1,231 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSLocationInfo.h" + +static int +memb_ganssTODFrac_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16384)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssTimeID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stationaryIndication_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssTODFrac_constr_4 = { + { APC_CONSTRAINED, 15, 15, 0, 16384 } /* (0..16384) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssTimeID_constr_6 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stationaryIndication_constr_9 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSLocationInfo_1[] = { + { ATF_POINTER, 5, offsetof(struct GANSSLocationInfo, referenceFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceFrame, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceFrame" + }, + { ATF_POINTER, 4, offsetof(struct GANSSLocationInfo, ganssTODm), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODm, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODm" + }, + { ATF_POINTER, 3, offsetof(struct GANSSLocationInfo, ganssTODFrac), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssTODFrac_constraint_1, + &asn_PER_memb_ganssTODFrac_constr_4, + 0, + "ganssTODFrac" + }, + { ATF_POINTER, 2, offsetof(struct GANSSLocationInfo, ganssTODUncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODUncertainty" + }, + { ATF_POINTER, 1, offsetof(struct GANSSLocationInfo, ganssTimeID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssTimeID_constraint_1, + &asn_PER_memb_ganssTimeID_constr_6, + 0, + "ganssTimeID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, fixType), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FixType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixType" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, posData), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posData" + }, + { ATF_POINTER, 1, offsetof(struct GANSSLocationInfo, stationaryIndication), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stationaryIndication_constraint_1, + &asn_PER_memb_stationaryIndication_constr_9, + 0, + "stationaryIndication" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, posEstimate), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posEstimate" + }, +}; +static int asn_MAP_GANSSLocationInfo_oms_1[] = { 0, 1, 2, 3, 4, 7 }; +static ber_tlv_tag_t asn_DEF_GANSSLocationInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSLocationInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFrame at 1411 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTODm at 1412 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssTODFrac at 1413 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssTODUncertainty at 1414 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssTimeID at 1415 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* fixType at 1416 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* posData at 1417 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* stationaryIndication at 1418 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* posEstimate at 1424 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSLocationInfo_specs_1 = { + sizeof(struct GANSSLocationInfo), + offsetof(struct GANSSLocationInfo, _asn_ctx), + asn_MAP_GANSSLocationInfo_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_GANSSLocationInfo_oms_1, /* Optional members */ + 6, 0, /* Root/Additions */ + 8, /* Start extensions */ + 10 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSLocationInfo = { + "GANSSLocationInfo", + "GANSSLocationInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSLocationInfo_tags_1, + sizeof(asn_DEF_GANSSLocationInfo_tags_1) + /sizeof(asn_DEF_GANSSLocationInfo_tags_1[0]), /* 1 */ + asn_DEF_GANSSLocationInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSLocationInfo_tags_1) + /sizeof(asn_DEF_GANSSLocationInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSLocationInfo_1, + 9, /* Elements count */ + &asn_SPC_GANSSLocationInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h new file mode 100644 index 000000000..b1cc1c866 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSLocationInfo_H_ +#define _GANSSLocationInfo_H_ + + +#include + +/* Including external dependencies */ +#include "GANSSTODm.h" +#include +#include "GANSSTODUncertainty.h" +#include "FixType.h" +#include "PositionData.h" +#include "Ext-GeographicalInformation.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ReferenceFrame; + +/* GANSSLocationInfo */ +typedef struct GANSSLocationInfo { + struct ReferenceFrame *referenceFrame /* OPTIONAL */; + GANSSTODm_t *ganssTODm /* OPTIONAL */; + long *ganssTODFrac /* OPTIONAL */; + GANSSTODUncertainty_t *ganssTODUncertainty /* OPTIONAL */; + long *ganssTimeID /* OPTIONAL */; + FixType_t fixType; + PositionData_t posData; + long *stationaryIndication /* OPTIONAL */; + Ext_GeographicalInformation_t posEstimate; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSLocationInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSLocationInfo; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "ReferenceFrame.h" + +#endif /* _GANSSLocationInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c new file mode 100644 index 000000000..bbd5b5eaa --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSMeasureInfo.h" + +static asn_TYPE_member_t asn_MBR_GANSSMeasureInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSMeasureInfo, ganssMsrSetList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssMsrSetList" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSMeasureInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSMeasureInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ganssMsrSetList at 1451 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSMeasureInfo_specs_1 = { + sizeof(struct GANSSMeasureInfo), + offsetof(struct GANSSMeasureInfo, _asn_ctx), + asn_MAP_GANSSMeasureInfo_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSMeasureInfo = { + "GANSSMeasureInfo", + "GANSSMeasureInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSMeasureInfo_tags_1, + sizeof(asn_DEF_GANSSMeasureInfo_tags_1) + /sizeof(asn_DEF_GANSSMeasureInfo_tags_1[0]), /* 1 */ + asn_DEF_GANSSMeasureInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSMeasureInfo_tags_1) + /sizeof(asn_DEF_GANSSMeasureInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSMeasureInfo_1, + 1, /* Elements count */ + &asn_SPC_GANSSMeasureInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h new file mode 100644 index 000000000..fa03e8726 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSMeasureInfo_H_ +#define _GANSSMeasureInfo_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfGANSS-MsrSetElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSMeasureInfo */ +typedef struct GANSSMeasureInfo { + SeqOfGANSS_MsrSetElement_t ganssMsrSetList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSMeasureInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSMeasureInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSMeasureInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSNavModel.c b/src/core/libs/supl/asn-rrlp/GANSSNavModel.c new file mode 100644 index 000000000..46c7cc984 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSNavModel.c @@ -0,0 +1,221 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSNavModel.h" + +static int +memb_nonBroadcastIndFlag_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_toeMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_eMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_sqrtAMBS_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_nonBroadcastIndFlag_constr_2 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_toeMSB_constr_3 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_eMSB_constr_4 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_sqrtAMBS_constr_5 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSNavModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSNavModel, nonBroadcastIndFlag), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_nonBroadcastIndFlag_constraint_1, + &asn_PER_memb_nonBroadcastIndFlag_constr_2, + 0, + "nonBroadcastIndFlag" + }, + { ATF_POINTER, 3, offsetof(struct GANSSNavModel, toeMSB), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_toeMSB_constraint_1, + &asn_PER_memb_toeMSB_constr_3, + 0, + "toeMSB" + }, + { ATF_POINTER, 2, offsetof(struct GANSSNavModel, eMSB), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_eMSB_constraint_1, + &asn_PER_memb_eMSB_constr_4, + 0, + "eMSB" + }, + { ATF_POINTER, 1, offsetof(struct GANSSNavModel, sqrtAMBS), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_sqrtAMBS_constraint_1, + &asn_PER_memb_sqrtAMBS_constr_5, + 0, + "sqrtAMBS" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSNavModel, ganssSatelliteList), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSSatelliteElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssSatelliteList" + }, +}; +static int asn_MAP_GANSSNavModel_oms_1[] = { 1, 2, 3 }; +static ber_tlv_tag_t asn_DEF_GANSSNavModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSNavModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nonBroadcastIndFlag at 1228 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* toeMSB at 1229 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* eMSB at 1230 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sqrtAMBS at 1231 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganssSatelliteList at 1233 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSNavModel_specs_1 = { + sizeof(struct GANSSNavModel), + offsetof(struct GANSSNavModel, _asn_ctx), + asn_MAP_GANSSNavModel_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_GANSSNavModel_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSNavModel = { + "GANSSNavModel", + "GANSSNavModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSNavModel_tags_1, + sizeof(asn_DEF_GANSSNavModel_tags_1) + /sizeof(asn_DEF_GANSSNavModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSNavModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSNavModel_tags_1) + /sizeof(asn_DEF_GANSSNavModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSNavModel_1, + 5, /* Elements count */ + &asn_SPC_GANSSNavModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSNavModel.h b/src/core/libs/supl/asn-rrlp/GANSSNavModel.h new file mode 100644 index 000000000..d49b75a44 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSNavModel.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSNavModel_H_ +#define _GANSSNavModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SeqOfGANSSSatelliteElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSNavModel */ +typedef struct GANSSNavModel { + long nonBroadcastIndFlag; + long *toeMSB /* OPTIONAL */; + long *eMSB /* OPTIONAL */; + long *sqrtAMBS /* OPTIONAL */; + SeqOfGANSSSatelliteElement_t ganssSatelliteList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSNavModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSNavModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSNavModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c new file mode 100644 index 000000000..5bd45837a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSOrbitModel.h" + +static asn_per_constraints_t asn_PER_type_GANSSOrbitModel_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSOrbitModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSOrbitModel, choice.keplerianSet), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NavModel_KeplerianSet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "keplerianSet" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSOrbitModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* keplerianSet at 1248 */ +}; +static asn_CHOICE_specifics_t asn_SPC_GANSSOrbitModel_specs_1 = { + sizeof(struct GANSSOrbitModel), + offsetof(struct GANSSOrbitModel, _asn_ctx), + offsetof(struct GANSSOrbitModel, present), + sizeof(((struct GANSSOrbitModel *)0)->present), + asn_MAP_GANSSOrbitModel_tag2el_1, + 1, /* Count of tags in the map */ + 0, + 1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSOrbitModel = { + "GANSSOrbitModel", + "GANSSOrbitModel", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_GANSSOrbitModel_constr_1, + asn_MBR_GANSSOrbitModel_1, + 1, /* Elements count */ + &asn_SPC_GANSSOrbitModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h new file mode 100644 index 000000000..b1e6cbb48 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSOrbitModel_H_ +#define _GANSSOrbitModel_H_ + + +#include + +/* Including external dependencies */ +#include "NavModel-KeplerianSet.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum GANSSOrbitModel_PR { + GANSSOrbitModel_PR_NOTHING, /* No components present */ + GANSSOrbitModel_PR_keplerianSet, + /* Extensions may appear below */ + +} GANSSOrbitModel_PR; + +/* GANSSOrbitModel */ +typedef struct GANSSOrbitModel { + GANSSOrbitModel_PR present; + union GANSSOrbitModel_u { + NavModel_KeplerianSet_t keplerianSet; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSOrbitModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSOrbitModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSOrbitModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c new file mode 100644 index 000000000..aaff620c7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSPositioningMethod.h" + +int +GANSSPositioningMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size >= 2 && size <= 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +GANSSPositioningMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +GANSSPositioningMethod_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSPositioningMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSPositioningMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSPositioningMethod_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSPositioningMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSPositioningMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSPositioningMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSPositioningMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSPositioningMethod_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 2, 16 } /* (SIZE(2..16)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSPositioningMethod_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSPositioningMethod = { + "GANSSPositioningMethod", + "GANSSPositioningMethod", + GANSSPositioningMethod_free, + GANSSPositioningMethod_print, + GANSSPositioningMethod_constraint, + GANSSPositioningMethod_decode_ber, + GANSSPositioningMethod_encode_der, + GANSSPositioningMethod_decode_xer, + GANSSPositioningMethod_encode_xer, + GANSSPositioningMethod_decode_uper, + GANSSPositioningMethod_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSPositioningMethod_tags_1, + sizeof(asn_DEF_GANSSPositioningMethod_tags_1) + /sizeof(asn_DEF_GANSSPositioningMethod_tags_1[0]), /* 1 */ + asn_DEF_GANSSPositioningMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSPositioningMethod_tags_1) + /sizeof(asn_DEF_GANSSPositioningMethod_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSPositioningMethod_constr_1, + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h new file mode 100644 index 000000000..334d978ce --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSPositioningMethod_H_ +#define _GANSSPositioningMethod_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum GANSSPositioningMethod { + GANSSPositioningMethod_gps = 0, + GANSSPositioningMethod_galileo = 1 +} e_GANSSPositioningMethod; + +/* GANSSPositioningMethod */ +typedef BIT_STRING_t GANSSPositioningMethod_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSPositioningMethod; +asn_struct_free_f GANSSPositioningMethod_free; +asn_struct_print_f GANSSPositioningMethod_print; +asn_constr_check_f GANSSPositioningMethod_constraint; +ber_type_decoder_f GANSSPositioningMethod_decode_ber; +der_type_encoder_f GANSSPositioningMethod_encode_der; +xer_type_decoder_f GANSSPositioningMethod_decode_xer; +xer_type_encoder_f GANSSPositioningMethod_encode_xer; +per_type_decoder_f GANSSPositioningMethod_decode_uper; +per_type_encoder_f GANSSPositioningMethod_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSPositioningMethod_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c new file mode 100644 index 000000000..03b725abc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSRealTimeIntegrity.h" + +static asn_TYPE_member_t asn_MBR_GANSSRealTimeIntegrity_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSRealTimeIntegrity, ganssBadSignalList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfBadSignalElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssBadSignalList" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSRealTimeIntegrity_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSRealTimeIntegrity_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ganssBadSignalList at 1295 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSRealTimeIntegrity_specs_1 = { + sizeof(struct GANSSRealTimeIntegrity), + offsetof(struct GANSSRealTimeIntegrity, _asn_ctx), + asn_MAP_GANSSRealTimeIntegrity_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSRealTimeIntegrity = { + "GANSSRealTimeIntegrity", + "GANSSRealTimeIntegrity", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSRealTimeIntegrity_tags_1, + sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1) + /sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1[0]), /* 1 */ + asn_DEF_GANSSRealTimeIntegrity_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1) + /sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSRealTimeIntegrity_1, + 1, /* Elements count */ + &asn_SPC_GANSSRealTimeIntegrity_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h new file mode 100644 index 000000000..d3fa6649a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSRealTimeIntegrity_H_ +#define _GANSSRealTimeIntegrity_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfBadSignalElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSRealTimeIntegrity */ +typedef struct GANSSRealTimeIntegrity { + SeqOfBadSignalElement_t ganssBadSignalList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSRealTimeIntegrity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSRealTimeIntegrity; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSRealTimeIntegrity_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c new file mode 100644 index 000000000..54e59f04f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSRefLocation.h" + +static asn_TYPE_member_t asn_MBR_GANSSRefLocation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefLocation, threeDLocation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "threeDLocation" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSRefLocation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSRefLocation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* threeDLocation at 1132 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefLocation_specs_1 = { + sizeof(struct GANSSRefLocation), + offsetof(struct GANSSRefLocation, _asn_ctx), + asn_MAP_GANSSRefLocation_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSRefLocation = { + "GANSSRefLocation", + "GANSSRefLocation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSRefLocation_tags_1, + sizeof(asn_DEF_GANSSRefLocation_tags_1) + /sizeof(asn_DEF_GANSSRefLocation_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefLocation_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefLocation_tags_1) + /sizeof(asn_DEF_GANSSRefLocation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSRefLocation_1, + 1, /* Elements count */ + &asn_SPC_GANSSRefLocation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h new file mode 100644 index 000000000..ea8ab7bb8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSRefLocation_H_ +#define _GANSSRefLocation_H_ + + +#include + +/* Including external dependencies */ +#include "Ext-GeographicalInformation.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSRefLocation */ +typedef struct GANSSRefLocation { + Ext_GeographicalInformation_t threeDLocation; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSRefLocation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSRefLocation; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSRefLocation_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c new file mode 100644 index 000000000..9a5a09290 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c @@ -0,0 +1,101 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSRefMeasurementAssist.h" + +static int +memb_ganssSignalID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssSignalID_constr_2 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSRefMeasurementAssist_1[] = { + { ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementAssist, ganssSignalID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssSignalID_constraint_1, + &asn_PER_memb_ganssSignalID_constr_2, + 0, + "ganssSignalID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementAssist, ganssRefMeasAssitList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSRefMeasurementElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssRefMeasAssitList" + }, +}; +static int asn_MAP_GANSSRefMeasurementAssist_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_GANSSRefMeasurementAssist_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSRefMeasurementAssist_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssSignalID at 1321 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssRefMeasAssitList at 1323 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefMeasurementAssist_specs_1 = { + sizeof(struct GANSSRefMeasurementAssist), + offsetof(struct GANSSRefMeasurementAssist, _asn_ctx), + asn_MAP_GANSSRefMeasurementAssist_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_GANSSRefMeasurementAssist_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementAssist = { + "GANSSRefMeasurementAssist", + "GANSSRefMeasurementAssist", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSRefMeasurementAssist_tags_1, + sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1) + /sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefMeasurementAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1) + /sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSRefMeasurementAssist_1, + 2, /* Elements count */ + &asn_SPC_GANSSRefMeasurementAssist_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h new file mode 100644 index 000000000..0fc7a48f7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSRefMeasurementAssist_H_ +#define _GANSSRefMeasurementAssist_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SeqOfGANSSRefMeasurementElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSRefMeasurementAssist */ +typedef struct GANSSRefMeasurementAssist { + long *ganssSignalID /* OPTIONAL */; + SeqOfGANSSRefMeasurementElement_t ganssRefMeasAssitList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSRefMeasurementAssist_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementAssist; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSRefMeasurementAssist_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c new file mode 100644 index 000000000..f67633244 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c @@ -0,0 +1,241 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSRefMeasurementElement.h" + +static int +memb_doppler0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -2048 && value <= 2047)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1022)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_intCodePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_codePhaseSearchWindow_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_doppler0_constr_3 = { + { APC_CONSTRAINED, 12, 12, -2048, 2047 } /* (-2048..2047) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_codePhase_constr_5 = { + { APC_CONSTRAINED, 10, 10, 0, 1022 } /* (0..1022) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_intCodePhase_constr_6 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_codePhaseSearchWindow_constr_7 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSRefMeasurementElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, doppler0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_doppler0_constraint_1, + &asn_PER_memb_doppler0_constr_3, + 0, + "doppler0" + }, + { ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementElement, additionalDoppler), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AdditionalDopplerFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "additionalDoppler" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, codePhase), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_codePhase_constraint_1, + &asn_PER_memb_codePhase_constr_5, + 0, + "codePhase" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, intCodePhase), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_intCodePhase_constraint_1, + &asn_PER_memb_intCodePhase_constr_6, + 0, + "intCodePhase" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, codePhaseSearchWindow), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_codePhaseSearchWindow_constraint_1, + &asn_PER_memb_codePhaseSearchWindow_constr_7, + 0, + "codePhaseSearchWindow" + }, + { ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementElement, additionalAngle), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AddionalAngleFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "additionalAngle" + }, +}; +static int asn_MAP_GANSSRefMeasurementElement_oms_1[] = { 2, 6 }; +static ber_tlv_tag_t asn_DEF_GANSSRefMeasurementElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSRefMeasurementElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1328 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* doppler0 at 1331 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* additionalDoppler at 1332 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* codePhase at 1333 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* intCodePhase at 1334 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* codePhaseSearchWindow at 1335 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* additionalAngle at 1336 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefMeasurementElement_specs_1 = { + sizeof(struct GANSSRefMeasurementElement), + offsetof(struct GANSSRefMeasurementElement, _asn_ctx), + asn_MAP_GANSSRefMeasurementElement_tag2el_1, + 7, /* Count of tags in the map */ + asn_MAP_GANSSRefMeasurementElement_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + 6, /* Start extensions */ + 8 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementElement = { + "GANSSRefMeasurementElement", + "GANSSRefMeasurementElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSRefMeasurementElement_tags_1, + sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1) + /sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefMeasurementElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1) + /sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSRefMeasurementElement_1, + 7, /* Elements count */ + &asn_SPC_GANSSRefMeasurementElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h new file mode 100644 index 000000000..2c98266fb --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSRefMeasurementElement_H_ +#define _GANSSRefMeasurementElement_H_ + + +#include + +/* Including external dependencies */ +#include "SVID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct AdditionalDopplerFields; +struct AddionalAngleFields; + +/* GANSSRefMeasurementElement */ +typedef struct GANSSRefMeasurementElement { + SVID_t svID; + long doppler0; + struct AdditionalDopplerFields *additionalDoppler /* OPTIONAL */; + long codePhase; + long intCodePhase; + long codePhaseSearchWindow; + struct AddionalAngleFields *additionalAngle /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSRefMeasurementElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "AdditionalDopplerFields.h" +#include "AddionalAngleFields.h" + +#endif /* _GANSSRefMeasurementElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c new file mode 100644 index 000000000..406523ba9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSRefTimeInfo.h" + +static int +memb_ganssDay_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8191)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssTimeID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssDay_constr_2 = { + { APC_CONSTRAINED, 13, 13, 0, 8191 } /* (0..8191) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssTimeID_constr_5 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSRefTimeInfo_1[] = { + { ATF_POINTER, 1, offsetof(struct GANSSRefTimeInfo, ganssDay), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssDay_constraint_1, + &asn_PER_memb_ganssDay_constr_2, + 0, + "ganssDay" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSRefTimeInfo, ganssTOD), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTOD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTOD" + }, + { ATF_POINTER, 2, offsetof(struct GANSSRefTimeInfo, ganssTODUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODUncertainty" + }, + { ATF_POINTER, 1, offsetof(struct GANSSRefTimeInfo, ganssTimeID), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssTimeID_constraint_1, + &asn_PER_memb_ganssTimeID_constr_5, + 0, + "ganssTimeID" + }, +}; +static int asn_MAP_GANSSRefTimeInfo_oms_1[] = { 0, 2, 3 }; +static ber_tlv_tag_t asn_DEF_GANSSRefTimeInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSRefTimeInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssDay at 1104 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTOD at 1105 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssTODUncertainty at 1106 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ganssTimeID at 1107 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefTimeInfo_specs_1 = { + sizeof(struct GANSSRefTimeInfo), + offsetof(struct GANSSRefTimeInfo, _asn_ctx), + asn_MAP_GANSSRefTimeInfo_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_GANSSRefTimeInfo_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSRefTimeInfo = { + "GANSSRefTimeInfo", + "GANSSRefTimeInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSRefTimeInfo_tags_1, + sizeof(asn_DEF_GANSSRefTimeInfo_tags_1) + /sizeof(asn_DEF_GANSSRefTimeInfo_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefTimeInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefTimeInfo_tags_1) + /sizeof(asn_DEF_GANSSRefTimeInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSRefTimeInfo_1, + 4, /* Elements count */ + &asn_SPC_GANSSRefTimeInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h new file mode 100644 index 000000000..58139a317 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSRefTimeInfo_H_ +#define _GANSSRefTimeInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include "GANSSTOD.h" +#include "GANSSTODUncertainty.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSRefTimeInfo */ +typedef struct GANSSRefTimeInfo { + long *ganssDay /* OPTIONAL */; + GANSSTOD_t ganssTOD; + GANSSTODUncertainty_t *ganssTODUncertainty /* OPTIONAL */; + long *ganssTimeID /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSRefTimeInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSRefTimeInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSRefTimeInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c new file mode 100644 index 000000000..bb6148046 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSReferenceTime.h" + +static asn_TYPE_member_t asn_MBR_GANSSReferenceTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSReferenceTime, ganssRefTimeInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRefTimeInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssRefTimeInfo" + }, + { ATF_POINTER, 1, offsetof(struct GANSSReferenceTime, ganssTOD_GSMTimeAssociation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTOD_GSMTimeAssociation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTOD-GSMTimeAssociation" + }, +}; +static int asn_MAP_GANSSReferenceTime_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_GANSSReferenceTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSReferenceTime_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssRefTimeInfo at 1098 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssTOD-GSMTimeAssociation at 1099 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSReferenceTime_specs_1 = { + sizeof(struct GANSSReferenceTime), + offsetof(struct GANSSReferenceTime, _asn_ctx), + asn_MAP_GANSSReferenceTime_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_GANSSReferenceTime_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSReferenceTime = { + "GANSSReferenceTime", + "GANSSReferenceTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSReferenceTime_tags_1, + sizeof(asn_DEF_GANSSReferenceTime_tags_1) + /sizeof(asn_DEF_GANSSReferenceTime_tags_1[0]), /* 1 */ + asn_DEF_GANSSReferenceTime_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSReferenceTime_tags_1) + /sizeof(asn_DEF_GANSSReferenceTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSReferenceTime_1, + 2, /* Elements count */ + &asn_SPC_GANSSReferenceTime_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h new file mode 100644 index 000000000..e58e47069 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSReferenceTime_H_ +#define _GANSSReferenceTime_H_ + + +#include + +/* Including external dependencies */ +#include "GANSSRefTimeInfo.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSTOD_GSMTimeAssociation; + +/* GANSSReferenceTime */ +typedef struct GANSSReferenceTime { + GANSSRefTimeInfo_t ganssRefTimeInfo; + struct GANSSTOD_GSMTimeAssociation *ganssTOD_GSMTimeAssociation /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSReferenceTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSReferenceTime; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSTOD-GSMTimeAssociation.h" + +#endif /* _GANSSReferenceTime_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c new file mode 100644 index 000000000..d32e86bf5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c @@ -0,0 +1,159 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSSatelliteElement.h" + +static int +memb_svHealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -7 && value <= 13)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_iod_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_svHealth_constr_3 = { + { APC_CONSTRAINED, 5, 5, -7, 13 } /* (-7..13) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_iod_constr_4 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSSatelliteElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "svID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, svHealth), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_svHealth_constraint_1, + &asn_PER_memb_svHealth_constr_3, + 0, + "svHealth" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, iod), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_iod_constraint_1, + &asn_PER_memb_iod_constr_4, + 0, + "iod" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, ganssClockModel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_GANSSClockModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssClockModel" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, ganssOrbitModel), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_GANSSOrbitModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssOrbitModel" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSSatelliteElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSSatelliteElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1238 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* svHealth at 1239 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* iod at 1240 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssClockModel at 1241 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganssOrbitModel at 1242 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSSatelliteElement_specs_1 = { + sizeof(struct GANSSSatelliteElement), + offsetof(struct GANSSSatelliteElement, _asn_ctx), + asn_MAP_GANSSSatelliteElement_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 4, /* Start extensions */ + 6 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSSatelliteElement = { + "GANSSSatelliteElement", + "GANSSSatelliteElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSSatelliteElement_tags_1, + sizeof(asn_DEF_GANSSSatelliteElement_tags_1) + /sizeof(asn_DEF_GANSSSatelliteElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSSatelliteElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSSatelliteElement_tags_1) + /sizeof(asn_DEF_GANSSSatelliteElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSSatelliteElement_1, + 5, /* Elements count */ + &asn_SPC_GANSSSatelliteElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h new file mode 100644 index 000000000..4027c41c5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSSatelliteElement_H_ +#define _GANSSSatelliteElement_H_ + + +#include + +/* Including external dependencies */ +#include "SVID.h" +#include +#include "GANSSClockModel.h" +#include "GANSSOrbitModel.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSSatelliteElement */ +typedef struct GANSSSatelliteElement { + SVID_t svID; + long svHealth; + long iod; + GANSSClockModel_t ganssClockModel; + GANSSOrbitModel_t ganssOrbitModel; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSSatelliteElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSSatelliteElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSSatelliteElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSSignalID.c b/src/core/libs/supl/asn-rrlp/GANSSSignalID.c new file mode 100644 index 000000000..dfcdb15da --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSSignalID.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSSignalID.h" + +int +GANSSSignalID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GANSSSignalID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GANSSSignalID_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSSignalID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSSignalID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSSignalID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSSignalID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSSignalID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSSignalID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSSignalID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSSignalID_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSSignalID_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSSignalID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSSignalID = { + "GANSSSignalID", + "GANSSSignalID", + GANSSSignalID_free, + GANSSSignalID_print, + GANSSSignalID_constraint, + GANSSSignalID_decode_ber, + GANSSSignalID_encode_der, + GANSSSignalID_decode_xer, + GANSSSignalID_encode_xer, + GANSSSignalID_decode_uper, + GANSSSignalID_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSSignalID_tags_1, + sizeof(asn_DEF_GANSSSignalID_tags_1) + /sizeof(asn_DEF_GANSSSignalID_tags_1[0]), /* 1 */ + asn_DEF_GANSSSignalID_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSSignalID_tags_1) + /sizeof(asn_DEF_GANSSSignalID_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSSignalID_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSSignalID.h b/src/core/libs/supl/asn-rrlp/GANSSSignalID.h new file mode 100644 index 000000000..8788fcf15 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSSignalID.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSSignalID_H_ +#define _GANSSSignalID_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSSignalID */ +typedef long GANSSSignalID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSSignalID; +asn_struct_free_f GANSSSignalID_free; +asn_struct_print_f GANSSSignalID_print; +asn_constr_check_f GANSSSignalID_constraint; +ber_type_decoder_f GANSSSignalID_decode_ber; +der_type_encoder_f GANSSSignalID_encode_der; +xer_type_decoder_f GANSSSignalID_decode_xer; +xer_type_encoder_f GANSSSignalID_encode_xer; +per_type_decoder_f GANSSSignalID_decode_uper; +per_type_encoder_f GANSSSignalID_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSSignalID_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c new file mode 100644 index 000000000..16d88a8b0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSTOD-GSMTimeAssociation.h" + +static asn_TYPE_member_t asn_MBR_GANSSTOD_GSMTimeAssociation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bcchCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsic" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, frameNumber), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrameNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frameNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, timeSlot), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeSlot" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bitNumber), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BitNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bitNumber" + }, + { ATF_POINTER, 1, offsetof(struct GANSSTOD_GSMTimeAssociation, frameDrift), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrameDrift, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frameDrift" + }, +}; +static int asn_MAP_GANSSTOD_GSMTimeAssociation_oms_1[] = { 5 }; +static ber_tlv_tag_t asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSTOD_GSMTimeAssociation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 1118 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 1119 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* frameNumber at 1120 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeSlot at 1121 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* bitNumber at 1122 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* frameDrift at 1123 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSTOD_GSMTimeAssociation_specs_1 = { + sizeof(struct GANSSTOD_GSMTimeAssociation), + offsetof(struct GANSSTOD_GSMTimeAssociation, _asn_ctx), + asn_MAP_GANSSTOD_GSMTimeAssociation_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_GANSSTOD_GSMTimeAssociation_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSTOD_GSMTimeAssociation = { + "GANSSTOD-GSMTimeAssociation", + "GANSSTOD-GSMTimeAssociation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1, + sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1) + /sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[0]), /* 1 */ + asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1) + /sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSTOD_GSMTimeAssociation_1, + 6, /* Elements count */ + &asn_SPC_GANSSTOD_GSMTimeAssociation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h new file mode 100644 index 000000000..2d3f021a2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSTOD_GSMTimeAssociation_H_ +#define _GANSSTOD_GSMTimeAssociation_H_ + + +#include + +/* Including external dependencies */ +#include "BCCHCarrier.h" +#include "BSIC.h" +#include "FrameNumber.h" +#include "TimeSlot.h" +#include "BitNumber.h" +#include "FrameDrift.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSTOD-GSMTimeAssociation */ +typedef struct GANSSTOD_GSMTimeAssociation { + BCCHCarrier_t bcchCarrier; + BSIC_t bsic; + FrameNumber_t frameNumber; + TimeSlot_t timeSlot; + BitNumber_t bitNumber; + FrameDrift_t *frameDrift /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSTOD_GSMTimeAssociation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSTOD_GSMTimeAssociation; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSTOD_GSMTimeAssociation_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD.c b/src/core/libs/supl/asn-rrlp/GANSSTOD.c new file mode 100644 index 000000000..b2007aaa9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSTOD.h" + +int +GANSSTOD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 86399)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GANSSTOD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GANSSTOD_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSTOD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSTOD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSTOD_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSTOD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSTOD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSTOD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSTOD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSTOD_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSTOD_constr_1 = { + { APC_CONSTRAINED, 17, -1, 0, 86399 } /* (0..86399) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSTOD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSTOD = { + "GANSSTOD", + "GANSSTOD", + GANSSTOD_free, + GANSSTOD_print, + GANSSTOD_constraint, + GANSSTOD_decode_ber, + GANSSTOD_encode_der, + GANSSTOD_decode_xer, + GANSSTOD_encode_xer, + GANSSTOD_decode_uper, + GANSSTOD_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSTOD_tags_1, + sizeof(asn_DEF_GANSSTOD_tags_1) + /sizeof(asn_DEF_GANSSTOD_tags_1[0]), /* 1 */ + asn_DEF_GANSSTOD_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTOD_tags_1) + /sizeof(asn_DEF_GANSSTOD_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSTOD_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD.h b/src/core/libs/supl/asn-rrlp/GANSSTOD.h new file mode 100644 index 000000000..ba5ff9342 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSTOD_H_ +#define _GANSSTOD_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSTOD */ +typedef long GANSSTOD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSTOD; +asn_struct_free_f GANSSTOD_free; +asn_struct_print_f GANSSTOD_print; +asn_constr_check_f GANSSTOD_constraint; +ber_type_decoder_f GANSSTOD_decode_ber; +der_type_encoder_f GANSSTOD_encode_der; +xer_type_decoder_f GANSSTOD_decode_xer; +xer_type_encoder_f GANSSTOD_encode_xer; +per_type_decoder_f GANSSTOD_decode_uper; +per_type_encoder_f GANSSTOD_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSTOD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c new file mode 100644 index 000000000..a07695911 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSTODUncertainty.h" + +int +GANSSTODUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GANSSTODUncertainty_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GANSSTODUncertainty_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSTODUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSTODUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSTODUncertainty_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSTODUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSTODUncertainty_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSTODUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSTODUncertainty_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSTODUncertainty_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSTODUncertainty_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSTODUncertainty = { + "GANSSTODUncertainty", + "GANSSTODUncertainty", + GANSSTODUncertainty_free, + GANSSTODUncertainty_print, + GANSSTODUncertainty_constraint, + GANSSTODUncertainty_decode_ber, + GANSSTODUncertainty_encode_der, + GANSSTODUncertainty_decode_xer, + GANSSTODUncertainty_encode_xer, + GANSSTODUncertainty_decode_uper, + GANSSTODUncertainty_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSTODUncertainty_tags_1, + sizeof(asn_DEF_GANSSTODUncertainty_tags_1) + /sizeof(asn_DEF_GANSSTODUncertainty_tags_1[0]), /* 1 */ + asn_DEF_GANSSTODUncertainty_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTODUncertainty_tags_1) + /sizeof(asn_DEF_GANSSTODUncertainty_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSTODUncertainty_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h new file mode 100644 index 000000000..e373153a9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSTODUncertainty_H_ +#define _GANSSTODUncertainty_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSTODUncertainty */ +typedef long GANSSTODUncertainty_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSTODUncertainty; +asn_struct_free_f GANSSTODUncertainty_free; +asn_struct_print_f GANSSTODUncertainty_print; +asn_constr_check_f GANSSTODUncertainty_constraint; +ber_type_decoder_f GANSSTODUncertainty_decode_ber; +der_type_encoder_f GANSSTODUncertainty_encode_der; +xer_type_decoder_f GANSSTODUncertainty_decode_xer; +xer_type_encoder_f GANSSTODUncertainty_encode_xer; +per_type_decoder_f GANSSTODUncertainty_decode_uper; +per_type_encoder_f GANSSTODUncertainty_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSTODUncertainty_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODm.c b/src/core/libs/supl/asn-rrlp/GANSSTODm.c new file mode 100644 index 000000000..02a84dfe7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTODm.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSTODm.h" + +int +GANSSTODm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3599999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GANSSTODm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GANSSTODm_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GANSSTODm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GANSSTODm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GANSSTODm_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GANSSTODm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GANSSTODm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GANSSTODm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GANSSTODm_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GANSSTODm_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GANSSTODm_constr_1 = { + { APC_CONSTRAINED, 22, -1, 0, 3599999 } /* (0..3599999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GANSSTODm_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GANSSTODm = { + "GANSSTODm", + "GANSSTODm", + GANSSTODm_free, + GANSSTODm_print, + GANSSTODm_constraint, + GANSSTODm_decode_ber, + GANSSTODm_encode_der, + GANSSTODm_decode_xer, + GANSSTODm_encode_xer, + GANSSTODm_decode_uper, + GANSSTODm_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSTODm_tags_1, + sizeof(asn_DEF_GANSSTODm_tags_1) + /sizeof(asn_DEF_GANSSTODm_tags_1[0]), /* 1 */ + asn_DEF_GANSSTODm_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTODm_tags_1) + /sizeof(asn_DEF_GANSSTODm_tags_1[0]), /* 1 */ + &asn_PER_type_GANSSTODm_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODm.h b/src/core/libs/supl/asn-rrlp/GANSSTODm.h new file mode 100644 index 000000000..f539c988f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTODm.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSTODm_H_ +#define _GANSSTODm_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSTODm */ +typedef long GANSSTODm_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSTODm; +asn_struct_free_f GANSSTODm_free; +asn_struct_print_f GANSSTODm_print; +asn_constr_check_f GANSSTODm_constraint; +ber_type_decoder_f GANSSTODm_decode_ber; +der_type_encoder_f GANSSTODm_encode_der; +xer_type_decoder_f GANSSTODm_decode_xer; +xer_type_encoder_f GANSSTODm_encode_xer; +per_type_decoder_f GANSSTODm_decode_uper; +per_type_encoder_f GANSSTODm_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSTODm_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c new file mode 100644 index 000000000..6ba69bb30 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c @@ -0,0 +1,201 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSTimeModelElement.h" + +static int +memb_ganssTimeModelRefTime_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_gnssTOID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_weekNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8191)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssTimeModelRefTime_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_gnssTOID_constr_6 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_weekNumber_constr_7 = { + { APC_CONSTRAINED, 13, 13, 0, 8191 } /* (0..8191) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSTimeModelElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, ganssTimeModelRefTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssTimeModelRefTime_constraint_1, + &asn_PER_memb_ganssTimeModelRefTime_constr_2, + 0, + "ganssTimeModelRefTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, tA0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TA0, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tA0" + }, + { ATF_POINTER, 2, offsetof(struct GANSSTimeModelElement, tA1), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TA1, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tA1" + }, + { ATF_POINTER, 1, offsetof(struct GANSSTimeModelElement, tA2), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TA2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tA2" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, gnssTOID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gnssTOID_constraint_1, + &asn_PER_memb_gnssTOID_constr_6, + 0, + "gnssTOID" + }, + { ATF_POINTER, 1, offsetof(struct GANSSTimeModelElement, weekNumber), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_weekNumber_constraint_1, + &asn_PER_memb_weekNumber_constr_7, + 0, + "weekNumber" + }, +}; +static int asn_MAP_GANSSTimeModelElement_oms_1[] = { 2, 3, 5 }; +static ber_tlv_tag_t asn_DEF_GANSSTimeModelElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSTimeModelElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssTimeModelRefTime at 1167 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tA0 at 1168 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* tA1 at 1169 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* tA2 at 1170 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* gnssTOID at 1171 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* weekNumber at 1172 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSTimeModelElement_specs_1 = { + sizeof(struct GANSSTimeModelElement), + offsetof(struct GANSSTimeModelElement, _asn_ctx), + asn_MAP_GANSSTimeModelElement_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_GANSSTimeModelElement_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSTimeModelElement = { + "GANSSTimeModelElement", + "GANSSTimeModelElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSTimeModelElement_tags_1, + sizeof(asn_DEF_GANSSTimeModelElement_tags_1) + /sizeof(asn_DEF_GANSSTimeModelElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSTimeModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTimeModelElement_tags_1) + /sizeof(asn_DEF_GANSSTimeModelElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSTimeModelElement_1, + 6, /* Elements count */ + &asn_SPC_GANSSTimeModelElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h new file mode 100644 index 000000000..f3fe2d398 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSTimeModelElement_H_ +#define _GANSSTimeModelElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include "TA0.h" +#include "TA1.h" +#include "TA2.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSTimeModelElement */ +typedef struct GANSSTimeModelElement { + long ganssTimeModelRefTime; + TA0_t tA0; + TA1_t *tA1 /* OPTIONAL */; + TA2_t *tA2 /* OPTIONAL */; + long gnssTOID; + long *weekNumber /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSTimeModelElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSTimeModelElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSTimeModelElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c new file mode 100644 index 000000000..5366ea85d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c @@ -0,0 +1,369 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GANSSUTCModel.h" + +static int +memb_ganssUtcA1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcTot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcWNt_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcDeltaTls_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcWNlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcDN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ganssUtcDeltaTlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssUtcA1_constr_2 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcA0_constr_3 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcTot_constr_4 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcWNt_constr_5 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcDeltaTls_constr_6 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcWNlsf_constr_7 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcDN_constr_8 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ganssUtcDeltaTlsf_constr_9 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GANSSUTCModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcA1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcA1_constraint_1, + &asn_PER_memb_ganssUtcA1_constr_2, + 0, + "ganssUtcA1" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcA0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcA0_constraint_1, + &asn_PER_memb_ganssUtcA0_constr_3, + 0, + "ganssUtcA0" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcTot), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcTot_constraint_1, + &asn_PER_memb_ganssUtcTot_constr_4, + 0, + "ganssUtcTot" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcWNt), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcWNt_constraint_1, + &asn_PER_memb_ganssUtcWNt_constr_5, + 0, + "ganssUtcWNt" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDeltaTls), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcDeltaTls_constraint_1, + &asn_PER_memb_ganssUtcDeltaTls_constr_6, + 0, + "ganssUtcDeltaTls" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcWNlsf), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcWNlsf_constraint_1, + &asn_PER_memb_ganssUtcWNlsf_constr_7, + 0, + "ganssUtcWNlsf" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDN), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcDN_constraint_1, + &asn_PER_memb_ganssUtcDN_constr_8, + 0, + "ganssUtcDN" + }, + { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDeltaTlsf), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssUtcDeltaTlsf_constraint_1, + &asn_PER_memb_ganssUtcDeltaTlsf_constr_9, + 0, + "ganssUtcDeltaTlsf" + }, +}; +static ber_tlv_tag_t asn_DEF_GANSSUTCModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GANSSUTCModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssUtcA1 at 1382 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssUtcA0 at 1383 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssUtcTot at 1384 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssUtcWNt at 1385 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssUtcDeltaTls at 1386 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ganssUtcWNlsf at 1387 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* ganssUtcDN at 1388 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* ganssUtcDeltaTlsf at 1389 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GANSSUTCModel_specs_1 = { + sizeof(struct GANSSUTCModel), + offsetof(struct GANSSUTCModel, _asn_ctx), + asn_MAP_GANSSUTCModel_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GANSSUTCModel = { + "GANSSUTCModel", + "GANSSUTCModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GANSSUTCModel_tags_1, + sizeof(asn_DEF_GANSSUTCModel_tags_1) + /sizeof(asn_DEF_GANSSUTCModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSUTCModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSUTCModel_tags_1) + /sizeof(asn_DEF_GANSSUTCModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GANSSUTCModel_1, + 8, /* Elements count */ + &asn_SPC_GANSSUTCModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h new file mode 100644 index 000000000..9afaf9886 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GANSSUTCModel_H_ +#define _GANSSUTCModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GANSSUTCModel */ +typedef struct GANSSUTCModel { + long ganssUtcA1; + long ganssUtcA0; + long ganssUtcTot; + long ganssUtcWNt; + long ganssUtcDeltaTls; + long ganssUtcWNlsf; + long ganssUtcDN; + long ganssUtcDeltaTlsf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GANSSUTCModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GANSSUTCModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _GANSSUTCModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPS-AssistData.c b/src/core/libs/supl/asn-rrlp/GPS-AssistData.c new file mode 100644 index 000000000..2e42f0c12 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-AssistData.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPS-AssistData.h" + +static asn_TYPE_member_t asn_MBR_GPS_AssistData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GPS_AssistData, controlHeader), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlHeader, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "controlHeader" + }, +}; +static ber_tlv_tag_t asn_DEF_GPS_AssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPS_AssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* controlHeader at 556 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPS_AssistData_specs_1 = { + sizeof(struct GPS_AssistData), + offsetof(struct GPS_AssistData, _asn_ctx), + asn_MAP_GPS_AssistData_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPS_AssistData = { + "GPS-AssistData", + "GPS-AssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPS_AssistData_tags_1, + sizeof(asn_DEF_GPS_AssistData_tags_1) + /sizeof(asn_DEF_GPS_AssistData_tags_1[0]), /* 1 */ + asn_DEF_GPS_AssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_AssistData_tags_1) + /sizeof(asn_DEF_GPS_AssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPS_AssistData_1, + 1, /* Elements count */ + &asn_SPC_GPS_AssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPS-AssistData.h b/src/core/libs/supl/asn-rrlp/GPS-AssistData.h new file mode 100644 index 000000000..94c27b961 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-AssistData.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPS_AssistData_H_ +#define _GPS_AssistData_H_ + + +#include + +/* Including external dependencies */ +#include "ControlHeader.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPS-AssistData */ +typedef struct GPS_AssistData { + ControlHeader_t controlHeader; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPS_AssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPS_AssistData; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPS_AssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c new file mode 100644 index 000000000..74038fe9f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPS-MeasureInfo.h" + +static asn_TYPE_member_t asn_MBR_GPS_MeasureInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GPS_MeasureInfo, gpsMsrSetList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGPS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsMsrSetList" + }, +}; +static ber_tlv_tag_t asn_DEF_GPS_MeasureInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPS_MeasureInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* gpsMsrSetList at 445 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPS_MeasureInfo_specs_1 = { + sizeof(struct GPS_MeasureInfo), + offsetof(struct GPS_MeasureInfo, _asn_ctx), + asn_MAP_GPS_MeasureInfo_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPS_MeasureInfo = { + "GPS-MeasureInfo", + "GPS-MeasureInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPS_MeasureInfo_tags_1, + sizeof(asn_DEF_GPS_MeasureInfo_tags_1) + /sizeof(asn_DEF_GPS_MeasureInfo_tags_1[0]), /* 1 */ + asn_DEF_GPS_MeasureInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_MeasureInfo_tags_1) + /sizeof(asn_DEF_GPS_MeasureInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPS_MeasureInfo_1, + 1, /* Elements count */ + &asn_SPC_GPS_MeasureInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h new file mode 100644 index 000000000..477bb68da --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPS_MeasureInfo_H_ +#define _GPS_MeasureInfo_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfGPS-MsrSetElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPS-MeasureInfo */ +typedef struct GPS_MeasureInfo { + SeqOfGPS_MsrSetElement_t gpsMsrSetList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPS_MeasureInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPS_MeasureInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPS_MeasureInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c new file mode 100644 index 000000000..96d4d1de7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c @@ -0,0 +1,269 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPS-MsrElement.h" + +static int +memb_cNo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_doppler_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_wholeChips_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1022)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_fracChips_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1024)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_pseuRangeRMSErr_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_cNo_constr_3 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_doppler_constr_4 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_wholeChips_constr_5 = { + { APC_CONSTRAINED, 10, 10, 0, 1022 } /* (0..1022) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_fracChips_constr_6 = { + { APC_CONSTRAINED, 11, 11, 0, 1024 } /* (0..1024) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_pseuRangeRMSErr_constr_8 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GPS_MsrElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satelliteID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, cNo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_cNo_constraint_1, + &asn_PER_memb_cNo_constr_3, + 0, + "cNo" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, doppler), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_doppler_constraint_1, + &asn_PER_memb_doppler_constr_4, + 0, + "doppler" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, wholeChips), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_wholeChips_constraint_1, + &asn_PER_memb_wholeChips_constr_5, + 0, + "wholeChips" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, fracChips), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_fracChips_constraint_1, + &asn_PER_memb_fracChips_constr_6, + 0, + "fracChips" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, mpathIndic), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MpathIndic, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "mpathIndic" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, pseuRangeRMSErr), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_pseuRangeRMSErr_constraint_1, + &asn_PER_memb_pseuRangeRMSErr_constr_8, + 0, + "pseuRangeRMSErr" + }, +}; +static ber_tlv_tag_t asn_DEF_GPS_MsrElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPS_MsrElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 466 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cNo at 467 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* doppler at 468 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* wholeChips at 469 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* fracChips at 470 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* mpathIndic at 474 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* pseuRangeRMSErr at 475 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPS_MsrElement_specs_1 = { + sizeof(struct GPS_MsrElement), + offsetof(struct GPS_MsrElement, _asn_ctx), + asn_MAP_GPS_MsrElement_tag2el_1, + 7, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPS_MsrElement = { + "GPS-MsrElement", + "GPS-MsrElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPS_MsrElement_tags_1, + sizeof(asn_DEF_GPS_MsrElement_tags_1) + /sizeof(asn_DEF_GPS_MsrElement_tags_1[0]), /* 1 */ + asn_DEF_GPS_MsrElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_MsrElement_tags_1) + /sizeof(asn_DEF_GPS_MsrElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPS_MsrElement_1, + 7, /* Elements count */ + &asn_SPC_GPS_MsrElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h new file mode 100644 index 000000000..8c7943be3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPS_MsrElement_H_ +#define _GPS_MsrElement_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include +#include "MpathIndic.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPS-MsrElement */ +typedef struct GPS_MsrElement { + SatelliteID_t satelliteID; + long cNo; + long doppler; + long wholeChips; + long fracChips; + MpathIndic_t mpathIndic; + long pseuRangeRMSErr; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPS_MsrElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPS_MsrElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPS_MsrElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c new file mode 100644 index 000000000..91c0ce711 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPS-MsrSetElement.h" + +static int +memb_refFrame_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refFrame_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GPS_MsrSetElement_1[] = { + { ATF_POINTER, 1, offsetof(struct GPS_MsrSetElement, refFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refFrame_constraint_1, + &asn_PER_memb_refFrame_constr_2, + 0, + "refFrame" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrSetElement, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOW24b, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTOW" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrSetElement, gps_msrList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGPS_MsrElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gps-msrList" + }, +}; +static int asn_MAP_GPS_MsrSetElement_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_GPS_MsrSetElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPS_MsrSetElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrame at 450 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTOW at 451 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gps-msrList at 457 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPS_MsrSetElement_specs_1 = { + sizeof(struct GPS_MsrSetElement), + offsetof(struct GPS_MsrSetElement, _asn_ctx), + asn_MAP_GPS_MsrSetElement_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_GPS_MsrSetElement_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPS_MsrSetElement = { + "GPS-MsrSetElement", + "GPS-MsrSetElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPS_MsrSetElement_tags_1, + sizeof(asn_DEF_GPS_MsrSetElement_tags_1) + /sizeof(asn_DEF_GPS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_GPS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_MsrSetElement_tags_1) + /sizeof(asn_DEF_GPS_MsrSetElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPS_MsrSetElement_1, + 3, /* Elements count */ + &asn_SPC_GPS_MsrSetElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h new file mode 100644 index 000000000..bcb0c7d88 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPS_MsrSetElement_H_ +#define _GPS_MsrSetElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include "GPSTOW24b.h" +#include "SeqOfGPS-MsrElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPS-MsrSetElement */ +typedef struct GPS_MsrSetElement { + long *refFrame /* OPTIONAL */; + GPSTOW24b_t gpsTOW; + SeqOfGPS_MsrElement_t gps_msrList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPS_MsrSetElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPS_MsrSetElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPS_MsrSetElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c new file mode 100644 index 000000000..f2604dbcf --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c @@ -0,0 +1,146 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSAssistanceData.h" + +int +GPSAssistanceData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 40)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using OCTET_STRING, + * so here we adjust the DEF accordingly. + */ +static void +GPSAssistanceData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_OCTET_STRING.free_struct; + td->print_struct = asn_DEF_OCTET_STRING.print_struct; + td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; + td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; + td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; + td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; + td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; + td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; + td->elements = asn_DEF_OCTET_STRING.elements; + td->elements_count = asn_DEF_OCTET_STRING.elements_count; + td->specifics = asn_DEF_OCTET_STRING.specifics; +} + +void +GPSAssistanceData_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GPSAssistanceData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GPSAssistanceData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GPSAssistanceData_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GPSAssistanceData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GPSAssistanceData_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GPSAssistanceData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GPSAssistanceData_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GPSAssistanceData_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GPSAssistanceData_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 40 } /* (SIZE(1..40)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GPSAssistanceData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GPSAssistanceData = { + "GPSAssistanceData", + "GPSAssistanceData", + GPSAssistanceData_free, + GPSAssistanceData_print, + GPSAssistanceData_constraint, + GPSAssistanceData_decode_ber, + GPSAssistanceData_encode_der, + GPSAssistanceData_decode_xer, + GPSAssistanceData_encode_xer, + GPSAssistanceData_decode_uper, + GPSAssistanceData_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSAssistanceData_tags_1, + sizeof(asn_DEF_GPSAssistanceData_tags_1) + /sizeof(asn_DEF_GPSAssistanceData_tags_1[0]), /* 1 */ + asn_DEF_GPSAssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSAssistanceData_tags_1) + /sizeof(asn_DEF_GPSAssistanceData_tags_1[0]), /* 1 */ + &asn_PER_type_GPSAssistanceData_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h new file mode 100644 index 000000000..55a4ffb25 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSAssistanceData_H_ +#define _GPSAssistanceData_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSAssistanceData */ +typedef OCTET_STRING_t GPSAssistanceData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSAssistanceData; +asn_struct_free_f GPSAssistanceData_free; +asn_struct_print_f GPSAssistanceData_print; +asn_constr_check_f GPSAssistanceData_constraint; +ber_type_decoder_f GPSAssistanceData_decode_ber; +der_type_encoder_f GPSAssistanceData_encode_der; +xer_type_decoder_f GPSAssistanceData_decode_xer; +xer_type_encoder_f GPSAssistanceData_encode_xer; +per_type_decoder_f GPSAssistanceData_decode_uper; +per_type_encoder_f GPSAssistanceData_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSAssistanceData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c new file mode 100644 index 000000000..1250731f0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSReferenceTimeUncertainty.h" + +int +GPSReferenceTimeUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GPSReferenceTimeUncertainty_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GPSReferenceTimeUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GPSReferenceTimeUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GPSReferenceTimeUncertainty_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GPSReferenceTimeUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GPSReferenceTimeUncertainty_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GPSReferenceTimeUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GPSReferenceTimeUncertainty_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GPSReferenceTimeUncertainty_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GPSReferenceTimeUncertainty_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GPSReferenceTimeUncertainty = { + "GPSReferenceTimeUncertainty", + "GPSReferenceTimeUncertainty", + GPSReferenceTimeUncertainty_free, + GPSReferenceTimeUncertainty_print, + GPSReferenceTimeUncertainty_constraint, + GPSReferenceTimeUncertainty_decode_ber, + GPSReferenceTimeUncertainty_encode_der, + GPSReferenceTimeUncertainty_decode_xer, + GPSReferenceTimeUncertainty_encode_xer, + GPSReferenceTimeUncertainty_decode_uper, + GPSReferenceTimeUncertainty_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSReferenceTimeUncertainty_tags_1, + sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1) + /sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1[0]), /* 1 */ + asn_DEF_GPSReferenceTimeUncertainty_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1) + /sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1[0]), /* 1 */ + &asn_PER_type_GPSReferenceTimeUncertainty_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h new file mode 100644 index 000000000..7be8ebb31 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSReferenceTimeUncertainty_H_ +#define _GPSReferenceTimeUncertainty_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSReferenceTimeUncertainty */ +typedef long GPSReferenceTimeUncertainty_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSReferenceTimeUncertainty; +asn_struct_free_f GPSReferenceTimeUncertainty_free; +asn_struct_print_f GPSReferenceTimeUncertainty_print; +asn_constr_check_f GPSReferenceTimeUncertainty_constraint; +ber_type_decoder_f GPSReferenceTimeUncertainty_decode_ber; +der_type_encoder_f GPSReferenceTimeUncertainty_encode_der; +xer_type_decoder_f GPSReferenceTimeUncertainty_decode_xer; +xer_type_encoder_f GPSReferenceTimeUncertainty_encode_xer; +per_type_decoder_f GPSReferenceTimeUncertainty_decode_uper; +per_type_encoder_f GPSReferenceTimeUncertainty_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSReferenceTimeUncertainty_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW23b.c b/src/core/libs/supl/asn-rrlp/GPSTOW23b.c new file mode 100644 index 000000000..8ad2591cb --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOW23b.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSTOW23b.h" + +int +GPSTOW23b_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7559999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GPSTOW23b_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GPSTOW23b_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GPSTOW23b_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GPSTOW23b_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GPSTOW23b_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GPSTOW23b_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GPSTOW23b_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GPSTOW23b_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GPSTOW23b_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GPSTOW23b_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GPSTOW23b_constr_1 = { + { APC_CONSTRAINED, 23, -1, 0, 7559999 } /* (0..7559999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GPSTOW23b_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GPSTOW23b = { + "GPSTOW23b", + "GPSTOW23b", + GPSTOW23b_free, + GPSTOW23b_print, + GPSTOW23b_constraint, + GPSTOW23b_decode_ber, + GPSTOW23b_encode_der, + GPSTOW23b_decode_xer, + GPSTOW23b_encode_xer, + GPSTOW23b_decode_uper, + GPSTOW23b_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSTOW23b_tags_1, + sizeof(asn_DEF_GPSTOW23b_tags_1) + /sizeof(asn_DEF_GPSTOW23b_tags_1[0]), /* 1 */ + asn_DEF_GPSTOW23b_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOW23b_tags_1) + /sizeof(asn_DEF_GPSTOW23b_tags_1[0]), /* 1 */ + &asn_PER_type_GPSTOW23b_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW23b.h b/src/core/libs/supl/asn-rrlp/GPSTOW23b.h new file mode 100644 index 000000000..49f34a714 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOW23b.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSTOW23b_H_ +#define _GPSTOW23b_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSTOW23b */ +typedef long GPSTOW23b_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSTOW23b; +asn_struct_free_f GPSTOW23b_free; +asn_struct_print_f GPSTOW23b_print; +asn_constr_check_f GPSTOW23b_constraint; +ber_type_decoder_f GPSTOW23b_decode_ber; +der_type_encoder_f GPSTOW23b_encode_der; +xer_type_decoder_f GPSTOW23b_decode_xer; +xer_type_encoder_f GPSTOW23b_encode_xer; +per_type_decoder_f GPSTOW23b_decode_uper; +per_type_encoder_f GPSTOW23b_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSTOW23b_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW24b.c b/src/core/libs/supl/asn-rrlp/GPSTOW24b.c new file mode 100644 index 000000000..6a110adac --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOW24b.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSTOW24b.h" + +int +GPSTOW24b_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 14399999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GPSTOW24b_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GPSTOW24b_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GPSTOW24b_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GPSTOW24b_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GPSTOW24b_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GPSTOW24b_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GPSTOW24b_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GPSTOW24b_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GPSTOW24b_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GPSTOW24b_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GPSTOW24b_constr_1 = { + { APC_CONSTRAINED, 24, -1, 0, 14399999 } /* (0..14399999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GPSTOW24b_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GPSTOW24b = { + "GPSTOW24b", + "GPSTOW24b", + GPSTOW24b_free, + GPSTOW24b_print, + GPSTOW24b_constraint, + GPSTOW24b_decode_ber, + GPSTOW24b_encode_der, + GPSTOW24b_decode_xer, + GPSTOW24b_encode_xer, + GPSTOW24b_decode_uper, + GPSTOW24b_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSTOW24b_tags_1, + sizeof(asn_DEF_GPSTOW24b_tags_1) + /sizeof(asn_DEF_GPSTOW24b_tags_1[0]), /* 1 */ + asn_DEF_GPSTOW24b_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOW24b_tags_1) + /sizeof(asn_DEF_GPSTOW24b_tags_1[0]), /* 1 */ + &asn_PER_type_GPSTOW24b_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW24b.h b/src/core/libs/supl/asn-rrlp/GPSTOW24b.h new file mode 100644 index 000000000..42ee6847f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOW24b.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSTOW24b_H_ +#define _GPSTOW24b_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSTOW24b */ +typedef long GPSTOW24b_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSTOW24b; +asn_struct_free_f GPSTOW24b_free; +asn_struct_print_f GPSTOW24b_print; +asn_constr_check_f GPSTOW24b_constraint; +ber_type_decoder_f GPSTOW24b_decode_ber; +der_type_encoder_f GPSTOW24b_encode_der; +xer_type_decoder_f GPSTOW24b_decode_xer; +xer_type_encoder_f GPSTOW24b_encode_xer; +per_type_decoder_f GPSTOW24b_decode_uper; +per_type_encoder_f GPSTOW24b_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSTOW24b_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c new file mode 100644 index 000000000..aac3de697 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSTOWAssist.h" + +static asn_per_constraints_t asn_PER_type_GPSTOWAssist_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GPSTOWAssist_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GPSTOWAssistElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_GPSTOWAssist_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_GPSTOWAssist_specs_1 = { + sizeof(struct GPSTOWAssist), + offsetof(struct GPSTOWAssist, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_GPSTOWAssist = { + "GPSTOWAssist", + "GPSTOWAssist", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSTOWAssist_tags_1, + sizeof(asn_DEF_GPSTOWAssist_tags_1) + /sizeof(asn_DEF_GPSTOWAssist_tags_1[0]), /* 1 */ + asn_DEF_GPSTOWAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOWAssist_tags_1) + /sizeof(asn_DEF_GPSTOWAssist_tags_1[0]), /* 1 */ + &asn_PER_type_GPSTOWAssist_constr_1, + asn_MBR_GPSTOWAssist_1, + 1, /* Single element */ + &asn_SPC_GPSTOWAssist_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h new file mode 100644 index 000000000..837e8f635 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSTOWAssist_H_ +#define _GPSTOWAssist_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GPSTOWAssistElement; + +/* GPSTOWAssist */ +typedef struct GPSTOWAssist { + A_SEQUENCE_OF(struct GPSTOWAssistElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPSTOWAssist_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSTOWAssist; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GPSTOWAssistElement.h" + +#endif /* _GPSTOWAssist_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c new file mode 100644 index 000000000..59018c4ad --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSTOWAssistElement.h" + +static asn_TYPE_member_t asn_MBR_GPSTOWAssistElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satelliteID" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, tlmWord), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TLMWord, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tlmWord" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, antiSpoof), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AntiSpoofFlag, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "antiSpoof" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, alert), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AlertFlag, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "alert" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, tlmRsvdBits), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TLMReservedBits, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tlmRsvdBits" + }, +}; +static ber_tlv_tag_t asn_DEF_GPSTOWAssistElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPSTOWAssistElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 610 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tlmWord at 611 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* antiSpoof at 612 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* alert at 613 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* tlmRsvdBits at 615 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPSTOWAssistElement_specs_1 = { + sizeof(struct GPSTOWAssistElement), + offsetof(struct GPSTOWAssistElement, _asn_ctx), + asn_MAP_GPSTOWAssistElement_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPSTOWAssistElement = { + "GPSTOWAssistElement", + "GPSTOWAssistElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSTOWAssistElement_tags_1, + sizeof(asn_DEF_GPSTOWAssistElement_tags_1) + /sizeof(asn_DEF_GPSTOWAssistElement_tags_1[0]), /* 1 */ + asn_DEF_GPSTOWAssistElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOWAssistElement_tags_1) + /sizeof(asn_DEF_GPSTOWAssistElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPSTOWAssistElement_1, + 5, /* Elements count */ + &asn_SPC_GPSTOWAssistElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h new file mode 100644 index 000000000..a3a2f8199 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSTOWAssistElement_H_ +#define _GPSTOWAssistElement_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include "TLMWord.h" +#include "AntiSpoofFlag.h" +#include "AlertFlag.h" +#include "TLMReservedBits.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSTOWAssistElement */ +typedef struct GPSTOWAssistElement { + SatelliteID_t satelliteID; + TLMWord_t tlmWord; + AntiSpoofFlag_t antiSpoof; + AlertFlag_t alert; + TLMReservedBits_t tlmRsvdBits; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPSTOWAssistElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSTOWAssistElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSTOWAssistElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSTime.c b/src/core/libs/supl/asn-rrlp/GPSTime.c new file mode 100644 index 000000000..deaef7717 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTime.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSTime.h" + +static asn_TYPE_member_t asn_MBR_GPSTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GPSTime, gpsTOW23b), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOW23b, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTOW23b" + }, + { ATF_NOFLAGS, 0, offsetof(struct GPSTime, gpsWeek), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSWeek, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsWeek" + }, +}; +static ber_tlv_tag_t asn_DEF_GPSTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPSTime_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTOW23b at 594 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* gpsWeek at 596 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPSTime_specs_1 = { + sizeof(struct GPSTime), + offsetof(struct GPSTime, _asn_ctx), + asn_MAP_GPSTime_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPSTime = { + "GPSTime", + "GPSTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSTime_tags_1, + sizeof(asn_DEF_GPSTime_tags_1) + /sizeof(asn_DEF_GPSTime_tags_1[0]), /* 1 */ + asn_DEF_GPSTime_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTime_tags_1) + /sizeof(asn_DEF_GPSTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPSTime_1, + 2, /* Elements count */ + &asn_SPC_GPSTime_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSTime.h b/src/core/libs/supl/asn-rrlp/GPSTime.h new file mode 100644 index 000000000..bb6a03667 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTime.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSTime_H_ +#define _GPSTime_H_ + + +#include + +/* Including external dependencies */ +#include "GPSTOW23b.h" +#include "GPSWeek.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSTime */ +typedef struct GPSTime { + GPSTOW23b_t gpsTOW23b; + GPSWeek_t gpsWeek; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPSTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSTime; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSTime_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c new file mode 100644 index 000000000..6e7fe01d8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c @@ -0,0 +1,181 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSTimeAssistanceMeasurements.h" + +static int +memb_referenceFrameMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_gpsTowSubms_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 9999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_deltaTow_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_referenceFrameMSB_constr_2 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_gpsTowSubms_constr_3 = { + { APC_CONSTRAINED, 14, 14, 0, 9999 } /* (0..9999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_deltaTow_constr_4 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GPSTimeAssistanceMeasurements_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GPSTimeAssistanceMeasurements, referenceFrameMSB), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_referenceFrameMSB_constraint_1, + &asn_PER_memb_referenceFrameMSB_constr_2, + 0, + "referenceFrameMSB" + }, + { ATF_POINTER, 3, offsetof(struct GPSTimeAssistanceMeasurements, gpsTowSubms), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gpsTowSubms_constraint_1, + &asn_PER_memb_gpsTowSubms_constr_3, + 0, + "gpsTowSubms" + }, + { ATF_POINTER, 2, offsetof(struct GPSTimeAssistanceMeasurements, deltaTow), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_deltaTow_constraint_1, + &asn_PER_memb_deltaTow_constr_4, + 0, + "deltaTow" + }, + { ATF_POINTER, 1, offsetof(struct GPSTimeAssistanceMeasurements, gpsReferenceTimeUncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSReferenceTimeUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsReferenceTimeUncertainty" + }, +}; +static int asn_MAP_GPSTimeAssistanceMeasurements_oms_1[] = { 1, 2, 3 }; +static ber_tlv_tag_t asn_DEF_GPSTimeAssistanceMeasurements_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GPSTimeAssistanceMeasurements_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFrameMSB at 950 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTowSubms at 951 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* deltaTow at 952 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* gpsReferenceTimeUncertainty at 953 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GPSTimeAssistanceMeasurements_specs_1 = { + sizeof(struct GPSTimeAssistanceMeasurements), + offsetof(struct GPSTimeAssistanceMeasurements, _asn_ctx), + asn_MAP_GPSTimeAssistanceMeasurements_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_GPSTimeAssistanceMeasurements_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GPSTimeAssistanceMeasurements = { + "GPSTimeAssistanceMeasurements", + "GPSTimeAssistanceMeasurements", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSTimeAssistanceMeasurements_tags_1, + sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1) + /sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1[0]), /* 1 */ + asn_DEF_GPSTimeAssistanceMeasurements_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1) + /sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GPSTimeAssistanceMeasurements_1, + 4, /* Elements count */ + &asn_SPC_GPSTimeAssistanceMeasurements_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h new file mode 100644 index 000000000..1f30ed0e5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSTimeAssistanceMeasurements_H_ +#define _GPSTimeAssistanceMeasurements_H_ + + +#include + +/* Including external dependencies */ +#include +#include "GPSReferenceTimeUncertainty.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSTimeAssistanceMeasurements */ +typedef struct GPSTimeAssistanceMeasurements { + long referenceFrameMSB; + long *gpsTowSubms /* OPTIONAL */; + long *deltaTow /* OPTIONAL */; + GPSReferenceTimeUncertainty_t *gpsReferenceTimeUncertainty /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GPSTimeAssistanceMeasurements_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSTimeAssistanceMeasurements; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSTimeAssistanceMeasurements_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GPSWeek.c b/src/core/libs/supl/asn-rrlp/GPSWeek.c new file mode 100644 index 000000000..33cb12809 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSWeek.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GPSWeek.h" + +int +GPSWeek_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +GPSWeek_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +GPSWeek_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + GPSWeek_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +GPSWeek_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +GPSWeek_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +GPSWeek_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +GPSWeek_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +GPSWeek_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +GPSWeek_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +GPSWeek_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + GPSWeek_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_GPSWeek_constr_1 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_GPSWeek_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_GPSWeek = { + "GPSWeek", + "GPSWeek", + GPSWeek_free, + GPSWeek_print, + GPSWeek_constraint, + GPSWeek_decode_ber, + GPSWeek_encode_der, + GPSWeek_decode_xer, + GPSWeek_encode_xer, + GPSWeek_decode_uper, + GPSWeek_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GPSWeek_tags_1, + sizeof(asn_DEF_GPSWeek_tags_1) + /sizeof(asn_DEF_GPSWeek_tags_1[0]), /* 1 */ + asn_DEF_GPSWeek_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSWeek_tags_1) + /sizeof(asn_DEF_GPSWeek_tags_1[0]), /* 1 */ + &asn_PER_type_GPSWeek_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GPSWeek.h b/src/core/libs/supl/asn-rrlp/GPSWeek.h new file mode 100644 index 000000000..6bdbc01bf --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GPSWeek.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GPSWeek_H_ +#define _GPSWeek_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GPSWeek */ +typedef long GPSWeek_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GPSWeek; +asn_struct_free_f GPSWeek_free; +asn_struct_print_f GPSWeek_print; +asn_constr_check_f GPSWeek_constraint; +ber_type_decoder_f GPSWeek_decode_ber; +der_type_encoder_f GPSWeek_encode_der; +xer_type_decoder_f GPSWeek_decode_xer; +xer_type_encoder_f GPSWeek_encode_xer; +per_type_decoder_f GPSWeek_decode_uper; +per_type_encoder_f GPSWeek_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _GPSWeek_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/GSMTime.c b/src/core/libs/supl/asn-rrlp/GSMTime.c new file mode 100644 index 000000000..af3f358c0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GSMTime.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "GSMTime.h" + +static asn_TYPE_member_t asn_MBR_GSMTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GSMTime, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bcchCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct GSMTime, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsic" + }, + { ATF_NOFLAGS, 0, offsetof(struct GSMTime, frameNumber), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrameNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frameNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct GSMTime, timeSlot), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeSlot" + }, + { ATF_NOFLAGS, 0, offsetof(struct GSMTime, bitNumber), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BitNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bitNumber" + }, +}; +static ber_tlv_tag_t asn_DEF_GSMTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GSMTime_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 630 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 631 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* frameNumber at 632 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeSlot at 633 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* bitNumber at 635 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GSMTime_specs_1 = { + sizeof(struct GSMTime), + offsetof(struct GSMTime, _asn_ctx), + asn_MAP_GSMTime_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GSMTime = { + "GSMTime", + "GSMTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GSMTime_tags_1, + sizeof(asn_DEF_GSMTime_tags_1) + /sizeof(asn_DEF_GSMTime_tags_1[0]), /* 1 */ + asn_DEF_GSMTime_tags_1, /* Same as above */ + sizeof(asn_DEF_GSMTime_tags_1) + /sizeof(asn_DEF_GSMTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GSMTime_1, + 5, /* Elements count */ + &asn_SPC_GSMTime_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/GSMTime.h b/src/core/libs/supl/asn-rrlp/GSMTime.h new file mode 100644 index 000000000..ea4fd2568 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/GSMTime.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _GSMTime_H_ +#define _GSMTime_H_ + + +#include + +/* Including external dependencies */ +#include "BCCHCarrier.h" +#include "BSIC.h" +#include "FrameNumber.h" +#include "TimeSlot.h" +#include "BitNumber.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* GSMTime */ +typedef struct GSMTime { + BCCHCarrier_t bcchCarrier; + BSIC_t bsic; + FrameNumber_t frameNumber; + TimeSlot_t timeSlot; + BitNumber_t bitNumber; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GSMTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GSMTime; + +#ifdef __cplusplus +} +#endif + +#endif /* _GSMTime_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/INTEGER.c b/src/core/libs/supl/asn-rrlp/INTEGER.c new file mode 100644 index 000000000..f016131a1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/INTEGER.c @@ -0,0 +1,934 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include /* Encoder and decoder of a primitive type */ +#include + +/* + * INTEGER basic type description. + */ +static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_INTEGER = { + "INTEGER", + "INTEGER", + ASN__PRIMITIVE_TYPE_free, + INTEGER_print, + asn_generic_no_constraint, + ber_decode_primitive, + INTEGER_encode_der, + INTEGER_decode_xer, + INTEGER_encode_xer, + INTEGER_decode_uper, /* Unaligned PER decoder */ + INTEGER_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_INTEGER_tags, + sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), + asn_DEF_INTEGER_tags, /* Same as above */ + sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Encode INTEGER type using DER. + */ +asn_enc_rval_t +INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + INTEGER_t *st = (INTEGER_t *)sptr; + + ASN_DEBUG("%s %s as INTEGER (tm=%d)", + cb?"Encoding":"Estimating", td->name, tag_mode); + + /* + * Canonicalize integer in the buffer. + * (Remove too long sign extension, remove some first 0x00 bytes) + */ + if(st->buf) { + uint8_t *buf = st->buf; + uint8_t *end1 = buf + st->size - 1; + int shift; + + /* Compute the number of superfluous leading bytes */ + for(; buf < end1; buf++) { + /* + * If the contents octets of an integer value encoding + * consist of more than one octet, then the bits of the + * first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + switch(*buf) { + case 0x00: if((buf[1] & 0x80) == 0) + continue; + break; + case 0xff: if((buf[1] & 0x80)) + continue; + break; + } + break; + } + + /* Remove leading superfluous bytes from the integer */ + shift = buf - st->buf; + if(shift) { + uint8_t *nb = st->buf; + uint8_t *end; + + st->size -= shift; /* New size, minus bad bytes */ + end = nb + st->size; + + for(; nb < end; nb++, buf++) + *nb = *buf; + } + + } /* if(1) */ + + return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); +} + +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); + +/* + * INTEGER specific human-readable output. + */ +static ssize_t +INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit integer */ + uint8_t *buf = st->buf; + uint8_t *buf_end = st->buf + st->size; + signed long accum; + ssize_t wrote = 0; + char *p; + int ret; + + /* + * Advance buf pointer until the start of the value's body. + * This will make us able to process large integers using simple case, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip the insignificant leading bytes */ + for(; buf < buf_end-1; buf++) { + switch(*buf) { + case 0x00: if((buf[1] & 0x80) == 0) continue; break; + case 0xff: if((buf[1] & 0x80) != 0) continue; break; + } + break; + } + + /* Simple case: the integer size is small */ + if((size_t)(buf_end - buf) <= sizeof(accum)) { + const asn_INTEGER_enum_map_t *el; + size_t scrsize; + char *scr; + + if(buf == buf_end) { + accum = 0; + } else { + accum = (*buf & 0x80) ? -1 : 0; + for(; buf < buf_end; buf++) + accum = (accum << 8) | *buf; + } + + el = INTEGER_map_value2enum(specs, accum); + if(el) { + scrsize = el->enum_len + 32; + scr = (char *)alloca(scrsize); + if(plainOrXER == 0) + ret = snprintf(scr, scrsize, + "%ld (%s)", accum, el->enum_name); + else + ret = snprintf(scr, scrsize, + "<%s/>", el->enum_name); + } else if(plainOrXER && specs && specs->strict_enumeration) { + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } else { + scrsize = sizeof(scratch); + scr = scratch; + ret = snprintf(scr, scrsize, + (specs && specs->field_unsigned) + ?"%lu":"%ld", accum); + } + assert(ret > 0 && (size_t)ret < scrsize); + return (cb(scr, ret, app_key) < 0) ? -1 : ret; + } else if(plainOrXER && specs && specs->strict_enumeration) { + /* + * Here and earlier, we cannot encode the ENUMERATED values + * if there is no corresponding identifier. + */ + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } + + /* Output in the long xx:yy:zz... format */ + /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */ + for(p = scratch; buf < buf_end; buf++) { + static const char *h2c = "0123456789ABCDEF"; + if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) { + /* Flush buffer */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + wrote += p - scratch; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x3a; /* ":" */ + } + if(p != scratch) + p--; /* Remove the last ":" */ + + wrote += p - scratch; + return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote; +} + +/* + * INTEGER specific human-readable output. + */ +int +INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + ssize_t ret; + + (void)td; + (void)ilevel; + + if(!st || !st->buf) + ret = cb("", 8, app_key); + else + ret = INTEGER__dump(td, st, cb, app_key, 0); + + return (ret < 0) ? -1 : 0; +} + +struct e2v_key { + const char *start; + const char *stop; + asn_INTEGER_enum_map_t *vemap; + unsigned int *evmap; +}; +static int +INTEGER__compar_enum2value(const void *kp, const void *am) { + const struct e2v_key *key = (const struct e2v_key *)kp; + const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; + const char *ptr, *end, *name; + + /* Remap the element (sort by different criterion) */ + el = key->vemap + key->evmap[el - key->vemap]; + + /* Compare strings */ + for(ptr = key->start, end = key->stop, name = el->enum_name; + ptr < end; ptr++, name++) { + if(*ptr != *name) + return *(const unsigned char *)ptr + - *(const unsigned char *)name; + } + return name[0] ? -1 : 0; +} + +static const asn_INTEGER_enum_map_t * +INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { + asn_INTEGER_enum_map_t *el_found; + int count = specs ? specs->map_count : 0; + struct e2v_key key; + const char *lp; + + if(!count) return NULL; + + /* Guaranteed: assert(lstart < lstop); */ + /* Figure out the tag name */ + for(lstart++, lp = lstart; lp < lstop; lp++) { + switch(*lp) { + case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */ + case 0x2f: /* '/' */ case 0x3e: /* '>' */ + break; + default: + continue; + } + break; + } + if(lp == lstop) return NULL; /* No tag found */ + lstop = lp; + + key.start = lstart; + key.stop = lstop; + key.vemap = specs->value2enum; + key.evmap = specs->enum2value; + el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, + specs->value2enum, count, sizeof(specs->value2enum[0]), + INTEGER__compar_enum2value); + if(el_found) { + /* Remap enum2value into value2enum */ + el_found = key.vemap + key.evmap[el_found - key.vemap]; + } + return el_found; +} + +static int +INTEGER__compar_value2enum(const void *kp, const void *am) { + long a = *(const long *)kp; + const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; + long b = el->nat_value; + if(a < b) return -1; + else if(a == b) return 0; + else return 1; +} + +const asn_INTEGER_enum_map_t * +INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) { + int count = specs ? specs->map_count : 0; + if(!count) return 0; + return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, + count, sizeof(specs->value2enum[0]), + INTEGER__compar_value2enum); +} + +static int +INTEGER_st_prealloc(INTEGER_t *st, int min_size) { + void *p = MALLOC(min_size + 1); + if(p) { + void *b = st->buf; + st->size = 0; + st->buf = p; + FREEMEM(b); + return 0; + } else { + return -1; + } +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +static enum xer_pbd_rval +INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { + INTEGER_t *st = (INTEGER_t *)sptr; + long sign = 1; + long value; + const char *lp; + const char *lstart = (const char *)chunk_buf; + const char *lstop = lstart + chunk_size; + enum { + ST_SKIPSPACE, + ST_SKIPSPHEX, + ST_WAITDIGITS, + ST_DIGITS, + ST_HEXDIGIT1, + ST_HEXDIGIT2, + ST_HEXCOLON, + ST_EXTRASTUFF + } state = ST_SKIPSPACE; + + if(chunk_size) + ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", + (long)chunk_size, *lstart, lstop[-1]); + + /* + * We may have received a tag here. It will be processed inline. + * Use strtoul()-like code and serialize the result. + */ + for(value = 0, lp = lstart; lp < lstop; lp++) { + int lv = *lp; + switch(lv) { + case 0x09: case 0x0a: case 0x0d: case 0x20: + switch(state) { + case ST_SKIPSPACE: + case ST_SKIPSPHEX: + continue; + case ST_HEXCOLON: + if(xer_is_whitespace(lp, lstop - lp)) { + lp = lstop - 1; + continue; + } + break; + default: + break; + } + break; + case 0x2d: /* '-' */ + if(state == ST_SKIPSPACE) { + sign = -1; + state = ST_WAITDIGITS; + continue; + } + break; + case 0x2b: /* '+' */ + if(state == ST_SKIPSPACE) { + state = ST_WAITDIGITS; + continue; + } + break; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + switch(state) { + case ST_DIGITS: break; + case ST_SKIPSPHEX: /* Fall through */ + case ST_HEXDIGIT1: + value = (lv - 0x30) << 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += (lv - 0x30); + state = ST_HEXCOLON; + st->buf[st->size++] = (uint8_t)value; + continue; + case ST_HEXCOLON: + return XPBD_BROKEN_ENCODING; + default: + state = ST_DIGITS; + break; + } + + { + long new_value = value * 10; + + if(new_value / 10 != value) + /* Overflow */ + return XPBD_DECODER_LIMIT; + + value = new_value + (lv - 0x30); + /* Check for two's complement overflow */ + if(value < 0) { + /* Check whether it is a LONG_MIN */ + if(sign == -1 + && (unsigned long)value + == ~((unsigned long)-1 >> 1)) { + sign = 1; + } else { + /* Overflow */ + return XPBD_DECODER_LIMIT; + } + } + } + continue; + case 0x3c: /* '<' */ + if(state == ST_SKIPSPACE) { + const asn_INTEGER_enum_map_t *el; + el = INTEGER_map_enum2value( + (asn_INTEGER_specifics_t *) + td->specifics, lstart, lstop); + if(el) { + ASN_DEBUG("Found \"%s\" => %ld", + el->enum_name, el->nat_value); + state = ST_DIGITS; + value = el->nat_value; + lp = lstop - 1; + continue; + } + ASN_DEBUG("Unknown identifier for INTEGER"); + } + return XPBD_BROKEN_ENCODING; + case 0x3a: /* ':' */ + if(state == ST_HEXCOLON) { + /* This colon is expected */ + state = ST_HEXDIGIT1; + continue; + } else if(state == ST_DIGITS) { + /* The colon here means that we have + * decoded the first two hexadecimal + * places as a decimal value. + * Switch decoding mode. */ + ASN_DEBUG("INTEGER re-evaluate as hex form"); + if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + } else { + ASN_DEBUG("state %d at %d", state, lp - lstart); + break; + } + /* [A-Fa-f] */ + case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46: + case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66: + switch(state) { + case ST_SKIPSPHEX: + case ST_SKIPSPACE: /* Fall through */ + case ST_HEXDIGIT1: + value = lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + value <<= 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + st->buf[st->size++] = (uint8_t)value; + state = ST_HEXCOLON; + continue; + case ST_DIGITS: + ASN_DEBUG("INTEGER re-evaluate as hex form"); + if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + default: + break; + } + break; + } + + /* Found extra non-numeric stuff */ + ASN_DEBUG("Found non-numeric 0x%2x at %d", + lv, lp - lstart); + state = ST_EXTRASTUFF; + break; + } + + switch(state) { + case ST_DIGITS: + /* Everything is cool */ + break; + case ST_HEXCOLON: + st->buf[st->size] = 0; /* Just in case termination */ + return XPBD_BODY_CONSUMED; + case ST_HEXDIGIT1: + case ST_HEXDIGIT2: + case ST_SKIPSPHEX: + return XPBD_BROKEN_ENCODING; + default: + if(xer_is_whitespace(lp, lstop - lp)) { + if(state != ST_EXTRASTUFF) + return XPBD_NOT_BODY_IGNORE; + break; + } else { + ASN_DEBUG("INTEGER: No useful digits (state %d)", + state); + return XPBD_BROKEN_ENCODING; /* No digits */ + } + break; + } + + value *= sign; /* Change sign, if needed */ + + if(asn_long2INTEGER(st, value)) + return XPBD_SYSTEM_FAILURE; + + return XPBD_BODY_CONSUMED; +} + +asn_dec_rval_t +INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + 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(INTEGER_t), opt_mname, + buf_ptr, size, INTEGER__xer_body_decode); +} + +asn_enc_rval_t +INTEGER_encode_xer(asn_TYPE_descriptor_t *td, 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; + + (void)ilevel; + (void)flags; + + if(!st || !st->buf) + _ASN_ENCODE_FAILED; + + er.encoded = INTEGER__dump(td, st, cb, app_key, 1); + if(er.encoded < 0) _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + +asn_dec_rval_t +INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + INTEGER_t *st = (INTEGER_t *)*sptr; + asn_per_constraint_t *ct; + int repeat; + + (void)opt_codec_ctx; + + if(!st) { + st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) _ASN_DECODE_FAILED; + } + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) _ASN_DECODE_STARVED; + if(inext) ct = 0; + } + + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + if(ct) { + if(ct->flags & APC_SEMI_CONSTRAINED) { + st->buf = (uint8_t *)CALLOC(1, 2); + if(!st->buf) _ASN_DECODE_FAILED; + st->size = 1; + } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { + size_t size = (ct->range_bits + 7) >> 3; + st->buf = (uint8_t *)MALLOC(1 + size + 1); + if(!st->buf) _ASN_DECODE_FAILED; + st->size = size; + } + } + + /* X.691, #12.2.2 */ + if(ct && ct->flags != APC_UNCONSTRAINED) { + /* #10.5.6 */ + ASN_DEBUG("Integer with range %d bits", ct->range_bits); + if(ct->range_bits >= 0) { + long value; + if(ct->range_bits == 32) { + long lhalf; + value = per_get_few_bits(pd, 16); + if(value < 0) _ASN_DECODE_STARVED; + lhalf = per_get_few_bits(pd, 16); + if(lhalf < 0) _ASN_DECODE_STARVED; + value = (value << 16) | lhalf; + } else { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) _ASN_DECODE_STARVED; + } + ASN_DEBUG("Got value %ld + low %ld", + value, ct->lower_bound); + value += ct->lower_bound; + if((specs && specs->field_unsigned) + ? asn_ulong2INTEGER(st, value) + : asn_long2INTEGER(st, value)) + _ASN_DECODE_FAILED; + return rval; + } + } else { + ASN_DEBUG("Decoding unconstrained integer %s", td->name); + } + + /* X.691, #12.2.3, #12.2.4 */ + do { + ssize_t len; + void *p; + int ret; + + /* Get the PER length */ + len = uper_get_length(pd, -1, &repeat); + if(len < 0) _ASN_DECODE_STARVED; + + p = REALLOC(st->buf, st->size + len + 1); + if(!p) _ASN_DECODE_FAILED; + st->buf = (uint8_t *)p; + + ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); + if(ret < 0) _ASN_DECODE_STARVED; + st->size += len; + } while(repeat); + st->buf[st->size] = 0; /* JIC */ + + /* #12.2.3 */ + if(ct && ct->lower_bound) { + /* + * TODO: replace by in-place arithmetics. + */ + long value; + if(asn_INTEGER2long(st, &value)) + _ASN_DECODE_FAILED; + if(asn_long2INTEGER(st, value + ct->lower_bound)) + _ASN_DECODE_FAILED; + } + + return rval; +} + +asn_enc_rval_t +INTEGER_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + INTEGER_t *st = (INTEGER_t *)sptr; + const uint8_t *buf; + const uint8_t *end; + asn_per_constraint_t *ct; + long value = 0; + + if(!st || st->size == 0) _ASN_ENCODE_FAILED; + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + er.encoded = 0; + + if(ct) { + int inext = 0; + if(specs && specs->field_unsigned) { + unsigned long uval; + if(asn_INTEGER2ulong(st, &uval)) + _ASN_ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(uval < (unsigned long)ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(uval < (unsigned long)ct->lower_bound + || uval > (unsigned long)ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", + uval, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + value = uval; + } else { + if(asn_INTEGER2long(st, &value)) + _ASN_ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(value < ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(value < ct->lower_bound + || value > ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", + value, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + _ASN_ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + _ASN_ENCODE_FAILED; + } + } + + + /* X.691, #12.2.2 */ + if(ct && ct->range_bits >= 0) { + /* #10.5.6 */ + ASN_DEBUG("Encoding integer with range %d bits", + ct->range_bits); + if(ct->range_bits == 32) { + /* TODO: extend to >32 bits */ + long v = value - ct->lower_bound; + if(per_put_few_bits(po, v >> 1, 31) + || per_put_few_bits(po, v, 1)) + _ASN_ENCODE_FAILED; + } else { + if(per_put_few_bits(po, value - ct->lower_bound, + ct->range_bits)) + _ASN_ENCODE_FAILED; + } + _ASN_ENCODED_OK(er); + } + + if(ct && ct->lower_bound) { + ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); + /* TODO: adjust lower bound */ + _ASN_ENCODE_FAILED; + } + + for(buf = st->buf, end = st->buf + st->size; buf < end;) { + ssize_t mayEncode = uper_put_length(po, end - buf); + if(mayEncode < 0) + _ASN_ENCODE_FAILED; + if(per_put_many_bits(po, buf, 8 * mayEncode)) + _ASN_ENCODE_FAILED; + buf += mayEncode; + } + + _ASN_ENCODED_OK(er); +} + +int +asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { + uint8_t *b, *end; + size_t size; + long l; + + /* Sanity checking */ + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + /* Cache the begin/end of the buffer */ + b = iptr->buf; /* Start of the INTEGER buffer */ + size = iptr->size; + end = b + size; /* Where to stop */ + + if(size > sizeof(long)) { + uint8_t *end1 = end - 1; + /* + * Slightly more advanced processing, + * able to >sizeof(long) bytes, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip out the insignificant leading bytes */ + for(; b < end1; b++) { + switch(*b) { + case 0x00: if((b[1] & 0x80) == 0) continue; break; + case 0xff: if((b[1] & 0x80) != 0) continue; break; + } + break; + } + + size = end - b; + if(size > sizeof(long)) { + /* Still cannot fit the long */ + errno = ERANGE; + return -1; + } + } + + /* Shortcut processing of a corner case */ + if(end == b) { + *lptr = 0; + return 0; + } + + /* Perform the sign initialization */ + /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ + if((*b >> 7)) l = -1; else l = 0; + + /* Conversion engine */ + for(; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + +int +asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { + uint8_t *b, *end; + unsigned long l; + size_t size; + + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + b = iptr->buf; + size = iptr->size; + end = b + size; + + /* If all extra leading bytes are zeroes, ignore them */ + for(; size > sizeof(unsigned long); b++, size--) { + if(*b) { + /* Value won't fit unsigned long */ + errno = ERANGE; + return -1; + } + } + + /* Conversion engine */ + for(l = 0; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + +int +asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { + uint8_t *buf; + uint8_t *end; + uint8_t *b; + int shr; + + if(value <= LONG_MAX) + return asn_long2INTEGER(st, value); + + buf = (uint8_t *)MALLOC(1 + sizeof(value)); + if(!buf) return -1; + + end = buf + (sizeof(value) + 1); + buf[0] = 0; + for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++) + *b = (uint8_t)(value >> shr); + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = 1 + sizeof(value); + + return 0; +} + +int +asn_long2INTEGER(INTEGER_t *st, long value) { + uint8_t *buf, *bp; + uint8_t *p; + uint8_t *pstart; + uint8_t *pend1; + int littleEndian = 1; /* Run-time detection */ + int add; + + if(!st) { + errno = EINVAL; + return -1; + } + + buf = (uint8_t *)MALLOC(sizeof(value)); + if(!buf) return -1; + + if(*(char *)&littleEndian) { + pstart = (uint8_t *)&value + sizeof(value) - 1; + pend1 = (uint8_t *)&value; + add = -1; + } else { + pstart = (uint8_t *)&value; + pend1 = pstart + sizeof(value) - 1; + add = 1; + } + + /* + * If the contents octet consists of more than one octet, + * then bits of the first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + for(p = pstart; p != pend1; p += add) { + switch(*p) { + case 0x00: if((*(p+add) & 0x80) == 0) + continue; + break; + case 0xff: if((*(p+add) & 0x80)) + continue; + break; + } + break; + } + /* Copy the integer body */ + for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) + *bp++ = *p; + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = bp - buf; + + return 0; +} diff --git a/src/core/libs/supl/asn-rrlp/INTEGER.h b/src/core/libs/supl/asn-rrlp/INTEGER.h new file mode 100644 index 000000000..8411bfcdd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/INTEGER.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _INTEGER_H_ +#define _INTEGER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; + +extern asn_TYPE_descriptor_t asn_DEF_INTEGER; + +/* Map with to integer value association */ +typedef struct asn_INTEGER_enum_map_s { + long nat_value; /* associated native integer value */ + size_t enum_len; /* strlen("tag") */ + const char *enum_name; /* "tag" */ +} asn_INTEGER_enum_map_t; + +/* This type describes an enumeration for INTEGER and ENUMERATED types */ +typedef struct asn_INTEGER_specifics_s { + asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ + unsigned int *enum2value; /* "tag" => N; sorted by tag */ + int map_count; /* Elements in either map */ + int extension; /* This map is extensible */ + int strict_enumeration; /* Enumeration set is fixed */ + int field_width; /* Size of native integer */ + int field_unsigned; /* Signed=0, unsigned=1 */ +} asn_INTEGER_specifics_t; + +asn_struct_print_f INTEGER_print; +ber_type_decoder_f INTEGER_decode_ber; +der_type_encoder_f INTEGER_encode_der; +xer_type_decoder_f INTEGER_decode_xer; +xer_type_encoder_f INTEGER_encode_xer; +per_type_decoder_f INTEGER_decode_uper; +per_type_encoder_f INTEGER_encode_uper; + +/*********************************** + * Some handy conversion routines. * + ***********************************/ + +/* + * Returns 0 if it was possible to convert, -1 otherwise. + * -1/EINVAL: Mandatory argument missing + * -1/ERANGE: Value encoded is out of range for long representation + * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). + */ +int asn_INTEGER2long(const INTEGER_t *i, long *l); +int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); +int asn_long2INTEGER(INTEGER_t *i, long l); +int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); + +/* + * Convert the integer value into the corresponding enumeration map entry. + */ +const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); + +#ifdef __cplusplus +} +#endif + +#endif /* _INTEGER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/IonosphericModel.c b/src/core/libs/supl/asn-rrlp/IonosphericModel.c new file mode 100644 index 000000000..552004de2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/IonosphericModel.c @@ -0,0 +1,369 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "IonosphericModel.h" + +static int +memb_alfa0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_alfa1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_alfa2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_alfa3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_beta0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_beta1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_beta2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_beta3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_alfa0_constr_2 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_alfa1_constr_3 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_alfa2_constr_4 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_alfa3_constr_5 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_beta0_constr_6 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_beta1_constr_7 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_beta2_constr_8 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_beta3_constr_9 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_IonosphericModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa0), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_alfa0_constraint_1, + &asn_PER_memb_alfa0_constr_2, + 0, + "alfa0" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa1), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_alfa1_constraint_1, + &asn_PER_memb_alfa1_constr_3, + 0, + "alfa1" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa2), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_alfa2_constraint_1, + &asn_PER_memb_alfa2_constr_4, + 0, + "alfa2" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa3), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_alfa3_constraint_1, + &asn_PER_memb_alfa3_constr_5, + 0, + "alfa3" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta0), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_beta0_constraint_1, + &asn_PER_memb_beta0_constr_6, + 0, + "beta0" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta1), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_beta1_constraint_1, + &asn_PER_memb_beta1_constr_7, + 0, + "beta1" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta2), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_beta2_constraint_1, + &asn_PER_memb_beta2_constr_8, + 0, + "beta2" + }, + { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta3), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_beta3_constraint_1, + &asn_PER_memb_beta3_constr_9, + 0, + "beta3" + }, +}; +static ber_tlv_tag_t asn_DEF_IonosphericModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_IonosphericModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* alfa0 at 763 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* alfa1 at 764 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* alfa2 at 765 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* alfa3 at 766 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* beta0 at 767 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* beta1 at 768 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* beta2 at 769 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* beta3 at 770 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_IonosphericModel_specs_1 = { + sizeof(struct IonosphericModel), + offsetof(struct IonosphericModel, _asn_ctx), + asn_MAP_IonosphericModel_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_IonosphericModel = { + "IonosphericModel", + "IonosphericModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_IonosphericModel_tags_1, + sizeof(asn_DEF_IonosphericModel_tags_1) + /sizeof(asn_DEF_IonosphericModel_tags_1[0]), /* 1 */ + asn_DEF_IonosphericModel_tags_1, /* Same as above */ + sizeof(asn_DEF_IonosphericModel_tags_1) + /sizeof(asn_DEF_IonosphericModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_IonosphericModel_1, + 8, /* Elements count */ + &asn_SPC_IonosphericModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/IonosphericModel.h b/src/core/libs/supl/asn-rrlp/IonosphericModel.h new file mode 100644 index 000000000..bb5f38987 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/IonosphericModel.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _IonosphericModel_H_ +#define _IonosphericModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* IonosphericModel */ +typedef struct IonosphericModel { + long alfa0; + long alfa1; + long alfa2; + long alfa3; + long beta0; + long beta1; + long beta2; + long beta3; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} IonosphericModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_IonosphericModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _IonosphericModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/LAC.c b/src/core/libs/supl/asn-rrlp/LAC.c new file mode 100644 index 000000000..e15942e24 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LAC.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "LAC.h" + +int +LAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +LAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +LAC_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + LAC_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +LAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + LAC_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +LAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + LAC_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +LAC_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + LAC_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +LAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + LAC_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +LAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + LAC_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +LAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + LAC_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +LAC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + LAC_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_LAC_constr_1 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_LAC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_LAC = { + "LAC", + "LAC", + LAC_free, + LAC_print, + LAC_constraint, + LAC_decode_ber, + LAC_encode_der, + LAC_decode_xer, + LAC_encode_xer, + LAC_decode_uper, + LAC_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_LAC_tags_1, + sizeof(asn_DEF_LAC_tags_1) + /sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ + asn_DEF_LAC_tags_1, /* Same as above */ + sizeof(asn_DEF_LAC_tags_1) + /sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ + &asn_PER_type_LAC_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/LAC.h b/src/core/libs/supl/asn-rrlp/LAC.h new file mode 100644 index 000000000..b600e36d4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LAC.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _LAC_H_ +#define _LAC_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* LAC */ +typedef long LAC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_LAC; +asn_struct_free_f LAC_free; +asn_struct_print_f LAC_print; +asn_constr_check_f LAC_constraint; +ber_type_decoder_f LAC_decode_ber; +der_type_encoder_f LAC_encode_der; +xer_type_decoder_f LAC_decode_xer; +xer_type_encoder_f LAC_encode_xer; +per_type_decoder_f LAC_decode_uper; +per_type_encoder_f LAC_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _LAC_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/LocErrorReason.c b/src/core/libs/supl/asn-rrlp/LocErrorReason.c new file mode 100644 index 000000000..2d98516db --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LocErrorReason.c @@ -0,0 +1,171 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "LocErrorReason.h" + +int +LocErrorReason_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +LocErrorReason_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +LocErrorReason_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +LocErrorReason_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +LocErrorReason_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +LocErrorReason_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +LocErrorReason_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +LocErrorReason_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +LocErrorReason_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +LocErrorReason_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + LocErrorReason_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_LocErrorReason_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 10 } /* (0..10,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_LocErrorReason_value2enum_1[] = { + { 0, 9, "unDefined" }, + { 1, 13, "notEnoughBTSs" }, + { 2, 13, "notEnoughSats" }, + { 3, 24, "eotdLocCalAssDataMissing" }, + { 4, 18, "eotdAssDataMissing" }, + { 5, 23, "gpsLocCalAssDataMissing" }, + { 6, 17, "gpsAssDataMissing" }, + { 7, 18, "methodNotSupported" }, + { 8, 12, "notProcessed" }, + { 9, 25, "refBTSForGPSNotServingBTS" }, + { 10, 26, "refBTSForEOTDNotServingBTS" }, + { 11, 18, "notEnoughGANSSSats" }, + { 12, 19, "ganssAssDataMissing" }, + { 13, 27, "refBTSForGANSSNotServingBTS" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_LocErrorReason_enum2value_1[] = { + 4, /* eotdAssDataMissing(4) */ + 3, /* eotdLocCalAssDataMissing(3) */ + 12, /* ganssAssDataMissing(12) */ + 6, /* gpsAssDataMissing(6) */ + 5, /* gpsLocCalAssDataMissing(5) */ + 7, /* methodNotSupported(7) */ + 1, /* notEnoughBTSs(1) */ + 11, /* notEnoughGANSSSats(11) */ + 2, /* notEnoughSats(2) */ + 8, /* notProcessed(8) */ + 10, /* refBTSForEOTDNotServingBTS(10) */ + 13, /* refBTSForGANSSNotServingBTS(13) */ + 9, /* refBTSForGPSNotServingBTS(9) */ + 0 /* unDefined(0) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_LocErrorReason_specs_1 = { + asn_MAP_LocErrorReason_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_LocErrorReason_enum2value_1, /* N => "tag"; sorted by N */ + 14, /* Number of elements in the maps */ + 12, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_LocErrorReason_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_LocErrorReason = { + "LocErrorReason", + "LocErrorReason", + LocErrorReason_free, + LocErrorReason_print, + LocErrorReason_constraint, + LocErrorReason_decode_ber, + LocErrorReason_encode_der, + LocErrorReason_decode_xer, + LocErrorReason_encode_xer, + LocErrorReason_decode_uper, + LocErrorReason_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_LocErrorReason_tags_1, + sizeof(asn_DEF_LocErrorReason_tags_1) + /sizeof(asn_DEF_LocErrorReason_tags_1[0]), /* 1 */ + asn_DEF_LocErrorReason_tags_1, /* Same as above */ + sizeof(asn_DEF_LocErrorReason_tags_1) + /sizeof(asn_DEF_LocErrorReason_tags_1[0]), /* 1 */ + &asn_PER_type_LocErrorReason_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_LocErrorReason_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/LocErrorReason.h b/src/core/libs/supl/asn-rrlp/LocErrorReason.h new file mode 100644 index 000000000..0dfcf0b80 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LocErrorReason.h @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _LocErrorReason_H_ +#define _LocErrorReason_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum LocErrorReason { + LocErrorReason_unDefined = 0, + LocErrorReason_notEnoughBTSs = 1, + LocErrorReason_notEnoughSats = 2, + LocErrorReason_eotdLocCalAssDataMissing = 3, + LocErrorReason_eotdAssDataMissing = 4, + LocErrorReason_gpsLocCalAssDataMissing = 5, + LocErrorReason_gpsAssDataMissing = 6, + LocErrorReason_methodNotSupported = 7, + LocErrorReason_notProcessed = 8, + LocErrorReason_refBTSForGPSNotServingBTS = 9, + LocErrorReason_refBTSForEOTDNotServingBTS = 10, + /* + * Enumeration is extensible + */ + LocErrorReason_notEnoughGANSSSats = 11, + LocErrorReason_ganssAssDataMissing = 12, + LocErrorReason_refBTSForGANSSNotServingBTS = 13 +} e_LocErrorReason; + +/* LocErrorReason */ +typedef ENUMERATED_t LocErrorReason_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_LocErrorReason; +asn_struct_free_f LocErrorReason_free; +asn_struct_print_f LocErrorReason_print; +asn_constr_check_f LocErrorReason_constraint; +ber_type_decoder_f LocErrorReason_decode_ber; +der_type_encoder_f LocErrorReason_encode_der; +xer_type_decoder_f LocErrorReason_decode_xer; +xer_type_encoder_f LocErrorReason_encode_xer; +per_type_decoder_f LocErrorReason_decode_uper; +per_type_encoder_f LocErrorReason_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _LocErrorReason_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/LocationError.c b/src/core/libs/supl/asn-rrlp/LocationError.c new file mode 100644 index 000000000..228344253 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LocationError.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "LocationError.h" + +static asn_TYPE_member_t asn_MBR_LocationError_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct LocationError, locErrorReason), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocErrorReason, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "locErrorReason" + }, + { ATF_POINTER, 1, offsetof(struct LocationError, additionalAssistanceData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AdditionalAssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "additionalAssistanceData" + }, +}; +static int asn_MAP_LocationError_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_LocationError_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_LocationError_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* locErrorReason at 488 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* additionalAssistanceData at 489 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_LocationError_specs_1 = { + sizeof(struct LocationError), + offsetof(struct LocationError, _asn_ctx), + asn_MAP_LocationError_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_LocationError_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_LocationError = { + "LocationError", + "LocationError", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_LocationError_tags_1, + sizeof(asn_DEF_LocationError_tags_1) + /sizeof(asn_DEF_LocationError_tags_1[0]), /* 1 */ + asn_DEF_LocationError_tags_1, /* Same as above */ + sizeof(asn_DEF_LocationError_tags_1) + /sizeof(asn_DEF_LocationError_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_LocationError_1, + 2, /* Elements count */ + &asn_SPC_LocationError_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/LocationError.h b/src/core/libs/supl/asn-rrlp/LocationError.h new file mode 100644 index 000000000..2786f4b7a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LocationError.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _LocationError_H_ +#define _LocationError_H_ + + +#include + +/* Including external dependencies */ +#include "LocErrorReason.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct AdditionalAssistanceData; + +/* LocationError */ +typedef struct LocationError { + LocErrorReason_t locErrorReason; + struct AdditionalAssistanceData *additionalAssistanceData /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} LocationError_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_LocationError; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "AdditionalAssistanceData.h" + +#endif /* _LocationError_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/LocationInfo.c b/src/core/libs/supl/asn-rrlp/LocationInfo.c new file mode 100644 index 000000000..92d0990f6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LocationInfo.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "LocationInfo.h" + +static int +memb_refFrame_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_gpsTOW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 14399999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refFrame_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_gpsTOW_constr_3 = { + { APC_CONSTRAINED, 24, -1, 0, 14399999 } /* (0..14399999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_LocationInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct LocationInfo, refFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refFrame_constraint_1, + &asn_PER_memb_refFrame_constr_2, + 0, + "refFrame" + }, + { ATF_POINTER, 1, offsetof(struct LocationInfo, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gpsTOW_constraint_1, + &asn_PER_memb_gpsTOW_constr_3, + 0, + "gpsTOW" + }, + { ATF_NOFLAGS, 0, offsetof(struct LocationInfo, fixType), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FixType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fixType" + }, + { ATF_NOFLAGS, 0, offsetof(struct LocationInfo, posEstimate), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posEstimate" + }, +}; +static int asn_MAP_LocationInfo_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_LocationInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_LocationInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrame at 420 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTOW at 423 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* fixType at 424 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* posEstimate at 432 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_LocationInfo_specs_1 = { + sizeof(struct LocationInfo), + offsetof(struct LocationInfo, _asn_ctx), + asn_MAP_LocationInfo_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_LocationInfo_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_LocationInfo = { + "LocationInfo", + "LocationInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_LocationInfo_tags_1, + sizeof(asn_DEF_LocationInfo_tags_1) + /sizeof(asn_DEF_LocationInfo_tags_1[0]), /* 1 */ + asn_DEF_LocationInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_LocationInfo_tags_1) + /sizeof(asn_DEF_LocationInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_LocationInfo_1, + 4, /* Elements count */ + &asn_SPC_LocationInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/LocationInfo.h b/src/core/libs/supl/asn-rrlp/LocationInfo.h new file mode 100644 index 000000000..4dd96a3fa --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/LocationInfo.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _LocationInfo_H_ +#define _LocationInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include "FixType.h" +#include "Ext-GeographicalInformation.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* LocationInfo */ +typedef struct LocationInfo { + long refFrame; + long *gpsTOW /* OPTIONAL */; + FixType_t fixType; + Ext_GeographicalInformation_t posEstimate; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} LocationInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_LocationInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _LocationInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c new file mode 100644 index 000000000..808aef74c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MeasureResponseTime.h" + +int +MeasureResponseTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +MeasureResponseTime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +MeasureResponseTime_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +MeasureResponseTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +MeasureResponseTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +MeasureResponseTime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +MeasureResponseTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +MeasureResponseTime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +MeasureResponseTime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +MeasureResponseTime_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + MeasureResponseTime_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_MeasureResponseTime_constr_1 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_MeasureResponseTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MeasureResponseTime = { + "MeasureResponseTime", + "MeasureResponseTime", + MeasureResponseTime_free, + MeasureResponseTime_print, + MeasureResponseTime_constraint, + MeasureResponseTime_decode_ber, + MeasureResponseTime_encode_der, + MeasureResponseTime_decode_xer, + MeasureResponseTime_encode_xer, + MeasureResponseTime_decode_uper, + MeasureResponseTime_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MeasureResponseTime_tags_1, + sizeof(asn_DEF_MeasureResponseTime_tags_1) + /sizeof(asn_DEF_MeasureResponseTime_tags_1[0]), /* 1 */ + asn_DEF_MeasureResponseTime_tags_1, /* Same as above */ + sizeof(asn_DEF_MeasureResponseTime_tags_1) + /sizeof(asn_DEF_MeasureResponseTime_tags_1[0]), /* 1 */ + &asn_PER_type_MeasureResponseTime_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h new file mode 100644 index 000000000..4a6fda64b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MeasureResponseTime_H_ +#define _MeasureResponseTime_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MeasureResponseTime */ +typedef long MeasureResponseTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MeasureResponseTime; +asn_struct_free_f MeasureResponseTime_free; +asn_struct_print_f MeasureResponseTime_print; +asn_constr_check_f MeasureResponseTime_constraint; +ber_type_decoder_f MeasureResponseTime_decode_ber; +der_type_encoder_f MeasureResponseTime_encode_der; +xer_type_decoder_f MeasureResponseTime_decode_xer; +xer_type_encoder_f MeasureResponseTime_encode_xer; +per_type_decoder_f MeasureResponseTime_decode_uper; +per_type_encoder_f MeasureResponseTime_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _MeasureResponseTime_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MethodType.c b/src/core/libs/supl/asn-rrlp/MethodType.c new file mode 100644 index 000000000..7a2b9ecfa --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MethodType.c @@ -0,0 +1,90 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MethodType.h" + +static asn_per_constraints_t asn_PER_type_MethodType_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_MethodType_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msAssisted), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AccuracyOpt, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msAssisted" + }, + { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msBased), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msBased" + }, + { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msBasedPref), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msBasedPref" + }, + { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msAssistedPref), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msAssistedPref" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_MethodType_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msAssisted at 117 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msBased at 118 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msBasedPref at 119 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* msAssistedPref at 121 */ +}; +static asn_CHOICE_specifics_t asn_SPC_MethodType_specs_1 = { + sizeof(struct MethodType), + offsetof(struct MethodType, _asn_ctx), + offsetof(struct MethodType, present), + sizeof(((struct MethodType *)0)->present), + asn_MAP_MethodType_tag2el_1, + 4, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_MethodType = { + "MethodType", + "MethodType", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_MethodType_constr_1, + asn_MBR_MethodType_1, + 4, /* Elements count */ + &asn_SPC_MethodType_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MethodType.h b/src/core/libs/supl/asn-rrlp/MethodType.h new file mode 100644 index 000000000..b9c0b4338 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MethodType.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MethodType_H_ +#define _MethodType_H_ + + +#include + +/* Including external dependencies */ +#include "AccuracyOpt.h" +#include "Accuracy.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum MethodType_PR { + MethodType_PR_NOTHING, /* No components present */ + MethodType_PR_msAssisted, + MethodType_PR_msBased, + MethodType_PR_msBasedPref, + MethodType_PR_msAssistedPref +} MethodType_PR; + +/* MethodType */ +typedef struct MethodType { + MethodType_PR present; + union MethodType_u { + AccuracyOpt_t msAssisted; + Accuracy_t msBased; + Accuracy_t msBasedPref; + Accuracy_t msAssistedPref; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MethodType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MethodType; + +#ifdef __cplusplus +} +#endif + +#endif /* _MethodType_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c new file mode 100644 index 000000000..bf42ed64a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ModuloTimeSlot.h" + +int +ModuloTimeSlot_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +ModuloTimeSlot_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +ModuloTimeSlot_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ModuloTimeSlot_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ModuloTimeSlot_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ModuloTimeSlot_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ModuloTimeSlot_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ModuloTimeSlot_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +ModuloTimeSlot_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +ModuloTimeSlot_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ModuloTimeSlot_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_ModuloTimeSlot_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_ModuloTimeSlot_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ModuloTimeSlot = { + "ModuloTimeSlot", + "ModuloTimeSlot", + ModuloTimeSlot_free, + ModuloTimeSlot_print, + ModuloTimeSlot_constraint, + ModuloTimeSlot_decode_ber, + ModuloTimeSlot_encode_der, + ModuloTimeSlot_decode_xer, + ModuloTimeSlot_encode_xer, + ModuloTimeSlot_decode_uper, + ModuloTimeSlot_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ModuloTimeSlot_tags_1, + sizeof(asn_DEF_ModuloTimeSlot_tags_1) + /sizeof(asn_DEF_ModuloTimeSlot_tags_1[0]), /* 1 */ + asn_DEF_ModuloTimeSlot_tags_1, /* Same as above */ + sizeof(asn_DEF_ModuloTimeSlot_tags_1) + /sizeof(asn_DEF_ModuloTimeSlot_tags_1[0]), /* 1 */ + &asn_PER_type_ModuloTimeSlot_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h new file mode 100644 index 000000000..dc6f487aa --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ModuloTimeSlot_H_ +#define _ModuloTimeSlot_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ModuloTimeSlot */ +typedef long ModuloTimeSlot_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ModuloTimeSlot; +asn_struct_free_f ModuloTimeSlot_free; +asn_struct_print_f ModuloTimeSlot_print; +asn_constr_check_f ModuloTimeSlot_constraint; +ber_type_decoder_f ModuloTimeSlot_decode_ber; +der_type_encoder_f ModuloTimeSlot_encode_der; +xer_type_decoder_f ModuloTimeSlot_decode_xer; +xer_type_encoder_f ModuloTimeSlot_encode_xer; +per_type_decoder_f ModuloTimeSlot_decode_uper; +per_type_encoder_f ModuloTimeSlot_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ModuloTimeSlot_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c new file mode 100644 index 000000000..b2a849cb5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MoreAssDataToBeSent.h" + +int +MoreAssDataToBeSent_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +MoreAssDataToBeSent_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +MoreAssDataToBeSent_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +MoreAssDataToBeSent_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +MoreAssDataToBeSent_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +MoreAssDataToBeSent_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +MoreAssDataToBeSent_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +MoreAssDataToBeSent_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +MoreAssDataToBeSent_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +MoreAssDataToBeSent_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_MoreAssDataToBeSent_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_MoreAssDataToBeSent_value2enum_1[] = { + { 0, 14, "noMoreMessages" }, + { 1, 20, "moreMessagesOnTheWay" } +}; +static unsigned int asn_MAP_MoreAssDataToBeSent_enum2value_1[] = { + 1, /* moreMessagesOnTheWay(1) */ + 0 /* noMoreMessages(0) */ +}; +static asn_INTEGER_specifics_t asn_SPC_MoreAssDataToBeSent_specs_1 = { + asn_MAP_MoreAssDataToBeSent_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_MoreAssDataToBeSent_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_MoreAssDataToBeSent_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MoreAssDataToBeSent = { + "MoreAssDataToBeSent", + "MoreAssDataToBeSent", + MoreAssDataToBeSent_free, + MoreAssDataToBeSent_print, + MoreAssDataToBeSent_constraint, + MoreAssDataToBeSent_decode_ber, + MoreAssDataToBeSent_encode_der, + MoreAssDataToBeSent_decode_xer, + MoreAssDataToBeSent_encode_xer, + MoreAssDataToBeSent_decode_uper, + MoreAssDataToBeSent_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MoreAssDataToBeSent_tags_1, + sizeof(asn_DEF_MoreAssDataToBeSent_tags_1) + /sizeof(asn_DEF_MoreAssDataToBeSent_tags_1[0]), /* 1 */ + asn_DEF_MoreAssDataToBeSent_tags_1, /* Same as above */ + sizeof(asn_DEF_MoreAssDataToBeSent_tags_1) + /sizeof(asn_DEF_MoreAssDataToBeSent_tags_1[0]), /* 1 */ + &asn_PER_type_MoreAssDataToBeSent_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_MoreAssDataToBeSent_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h new file mode 100644 index 000000000..3ccac3704 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MoreAssDataToBeSent_H_ +#define _MoreAssDataToBeSent_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum MoreAssDataToBeSent { + MoreAssDataToBeSent_noMoreMessages = 0, + MoreAssDataToBeSent_moreMessagesOnTheWay = 1 +} e_MoreAssDataToBeSent; + +/* MoreAssDataToBeSent */ +typedef ENUMERATED_t MoreAssDataToBeSent_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MoreAssDataToBeSent; +asn_struct_free_f MoreAssDataToBeSent_free; +asn_struct_print_f MoreAssDataToBeSent_print; +asn_constr_check_f MoreAssDataToBeSent_constraint; +ber_type_decoder_f MoreAssDataToBeSent_decode_ber; +der_type_encoder_f MoreAssDataToBeSent_encode_der; +xer_type_decoder_f MoreAssDataToBeSent_decode_xer; +xer_type_encoder_f MoreAssDataToBeSent_encode_xer; +per_type_decoder_f MoreAssDataToBeSent_decode_uper; +per_type_encoder_f MoreAssDataToBeSent_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _MoreAssDataToBeSent_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MpathIndic.c b/src/core/libs/supl/asn-rrlp/MpathIndic.c new file mode 100644 index 000000000..8a1a0a280 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MpathIndic.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MpathIndic.h" + +int +MpathIndic_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +MpathIndic_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +MpathIndic_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + MpathIndic_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +MpathIndic_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +MpathIndic_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +MpathIndic_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +MpathIndic_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +MpathIndic_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +MpathIndic_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +MpathIndic_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + MpathIndic_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_MpathIndic_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_MpathIndic_value2enum_1[] = { + { 0, 11, "notMeasured" }, + { 1, 3, "low" }, + { 2, 6, "medium" }, + { 3, 4, "high" } +}; +static unsigned int asn_MAP_MpathIndic_enum2value_1[] = { + 3, /* high(3) */ + 1, /* low(1) */ + 2, /* medium(2) */ + 0 /* notMeasured(0) */ +}; +static asn_INTEGER_specifics_t asn_SPC_MpathIndic_specs_1 = { + asn_MAP_MpathIndic_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_MpathIndic_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_MpathIndic_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MpathIndic = { + "MpathIndic", + "MpathIndic", + MpathIndic_free, + MpathIndic_print, + MpathIndic_constraint, + MpathIndic_decode_ber, + MpathIndic_encode_der, + MpathIndic_decode_xer, + MpathIndic_encode_xer, + MpathIndic_decode_uper, + MpathIndic_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MpathIndic_tags_1, + sizeof(asn_DEF_MpathIndic_tags_1) + /sizeof(asn_DEF_MpathIndic_tags_1[0]), /* 1 */ + asn_DEF_MpathIndic_tags_1, /* Same as above */ + sizeof(asn_DEF_MpathIndic_tags_1) + /sizeof(asn_DEF_MpathIndic_tags_1[0]), /* 1 */ + &asn_PER_type_MpathIndic_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_MpathIndic_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MpathIndic.h b/src/core/libs/supl/asn-rrlp/MpathIndic.h new file mode 100644 index 000000000..d83f3fb8f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MpathIndic.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MpathIndic_H_ +#define _MpathIndic_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum MpathIndic { + MpathIndic_notMeasured = 0, + MpathIndic_low = 1, + MpathIndic_medium = 2, + MpathIndic_high = 3 +} e_MpathIndic; + +/* MpathIndic */ +typedef ENUMERATED_t MpathIndic_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MpathIndic; +asn_struct_free_f MpathIndic_free; +asn_struct_print_f MpathIndic_print; +asn_constr_check_f MpathIndic_constraint; +ber_type_decoder_f MpathIndic_decode_ber; +der_type_encoder_f MpathIndic_encode_der; +xer_type_decoder_f MpathIndic_decode_xer; +xer_type_encoder_f MpathIndic_encode_xer; +per_type_decoder_f MpathIndic_decode_uper; +per_type_encoder_f MpathIndic_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _MpathIndic_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c new file mode 100644 index 000000000..284872b9d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MsrAssistBTS-R98-ExpOTD.h" + +static asn_TYPE_member_t asn_MBR_MsrAssistBTS_R98_ExpOTD_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS_R98_ExpOTD, expectedOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpectedOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "expectedOTD" + }, + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS_R98_ExpOTD, expOTDUncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpOTDUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "expOTDUncertainty" + }, +}; +static ber_tlv_tag_t asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MsrAssistBTS_R98_ExpOTD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* expectedOTD at 910 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* expOTDUncertainty at 912 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistBTS_R98_ExpOTD_specs_1 = { + sizeof(struct MsrAssistBTS_R98_ExpOTD), + offsetof(struct MsrAssistBTS_R98_ExpOTD, _asn_ctx), + asn_MAP_MsrAssistBTS_R98_ExpOTD_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS_R98_ExpOTD = { + "MsrAssistBTS-R98-ExpOTD", + "MsrAssistBTS-R98-ExpOTD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1, + sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MsrAssistBTS_R98_ExpOTD_1, + 2, /* Elements count */ + &asn_SPC_MsrAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h new file mode 100644 index 000000000..a37ca3146 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MsrAssistBTS_R98_ExpOTD_H_ +#define _MsrAssistBTS_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include "ExpectedOTD.h" +#include "ExpOTDUncertainty.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MsrAssistBTS-R98-ExpOTD */ +typedef struct MsrAssistBTS_R98_ExpOTD { + ExpectedOTD_t expectedOTD; + ExpOTDUncertainty_t expOTDUncertainty; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MsrAssistBTS_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +#endif /* _MsrAssistBTS_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c new file mode 100644 index 000000000..1540767b9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MsrAssistBTS.h" + +static asn_TYPE_member_t asn_MBR_MsrAssistBTS_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bcchCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsic" + }, + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, multiFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "multiFrameOffset" + }, + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, timeSlotScheme), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlotScheme, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeSlotScheme" + }, + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, roughRTD), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RoughRTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "roughRTD" + }, + { ATF_POINTER, 1, offsetof(struct MsrAssistBTS, calcAssistanceBTS), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CalcAssistanceBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "calcAssistanceBTS" + }, +}; +static int asn_MAP_MsrAssistBTS_oms_1[] = { 5 }; +static ber_tlv_tag_t asn_DEF_MsrAssistBTS_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MsrAssistBTS_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 193 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 194 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* multiFrameOffset at 195 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeSlotScheme at 196 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* roughRTD at 197 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* calcAssistanceBTS at 200 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistBTS_specs_1 = { + sizeof(struct MsrAssistBTS), + offsetof(struct MsrAssistBTS, _asn_ctx), + asn_MAP_MsrAssistBTS_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_MsrAssistBTS_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS = { + "MsrAssistBTS", + "MsrAssistBTS", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MsrAssistBTS_tags_1, + sizeof(asn_DEF_MsrAssistBTS_tags_1) + /sizeof(asn_DEF_MsrAssistBTS_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistBTS_tags_1) + /sizeof(asn_DEF_MsrAssistBTS_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MsrAssistBTS_1, + 6, /* Elements count */ + &asn_SPC_MsrAssistBTS_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h new file mode 100644 index 000000000..a5ec44205 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MsrAssistBTS_H_ +#define _MsrAssistBTS_H_ + + +#include + +/* Including external dependencies */ +#include "BCCHCarrier.h" +#include "BSIC.h" +#include "MultiFrameOffset.h" +#include "TimeSlotScheme.h" +#include "RoughRTD.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct CalcAssistanceBTS; + +/* MsrAssistBTS */ +typedef struct MsrAssistBTS { + BCCHCarrier_t bcchCarrier; + BSIC_t bsic; + MultiFrameOffset_t multiFrameOffset; + TimeSlotScheme_t timeSlotScheme; + RoughRTD_t roughRTD; + struct CalcAssistanceBTS *calcAssistanceBTS /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MsrAssistBTS_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "CalcAssistanceBTS.h" + +#endif /* _MsrAssistBTS_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c new file mode 100644 index 000000000..8c9e2df07 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MsrAssistData-R98-ExpOTD.h" + +static asn_TYPE_member_t asn_MBR_MsrAssistData_R98_ExpOTD_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistData_R98_ExpOTD, msrAssistList_R98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrAssistList-R98-ExpOTD" + }, +}; +static ber_tlv_tag_t asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MsrAssistData_R98_ExpOTD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* msrAssistList-R98-ExpOTD at 900 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistData_R98_ExpOTD_specs_1 = { + sizeof(struct MsrAssistData_R98_ExpOTD), + offsetof(struct MsrAssistData_R98_ExpOTD, _asn_ctx), + asn_MAP_MsrAssistData_R98_ExpOTD_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MsrAssistData_R98_ExpOTD = { + "MsrAssistData-R98-ExpOTD", + "MsrAssistData-R98-ExpOTD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MsrAssistData_R98_ExpOTD_tags_1, + sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistData_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MsrAssistData_R98_ExpOTD_1, + 1, /* Elements count */ + &asn_SPC_MsrAssistData_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h new file mode 100644 index 000000000..3fb932d86 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MsrAssistData_R98_ExpOTD_H_ +#define _MsrAssistData_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfMsrAssistBTS-R98-ExpOTD.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MsrAssistData-R98-ExpOTD */ +typedef struct MsrAssistData_R98_ExpOTD { + SeqOfMsrAssistBTS_R98_ExpOTD_t msrAssistList_R98_ExpOTD; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MsrAssistData_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MsrAssistData_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +#endif /* _MsrAssistData_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData.c b/src/core/libs/supl/asn-rrlp/MsrAssistData.c new file mode 100644 index 000000000..cd441bf5f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MsrAssistData.h" + +static asn_TYPE_member_t asn_MBR_MsrAssistData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MsrAssistData, msrAssistList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfMsrAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrAssistList" + }, +}; +static ber_tlv_tag_t asn_DEF_MsrAssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MsrAssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* msrAssistList at 189 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistData_specs_1 = { + sizeof(struct MsrAssistData), + offsetof(struct MsrAssistData, _asn_ctx), + asn_MAP_MsrAssistData_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MsrAssistData = { + "MsrAssistData", + "MsrAssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MsrAssistData_tags_1, + sizeof(asn_DEF_MsrAssistData_tags_1) + /sizeof(asn_DEF_MsrAssistData_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistData_tags_1) + /sizeof(asn_DEF_MsrAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MsrAssistData_1, + 1, /* Elements count */ + &asn_SPC_MsrAssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData.h b/src/core/libs/supl/asn-rrlp/MsrAssistData.h new file mode 100644 index 000000000..0aa260631 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MsrAssistData_H_ +#define _MsrAssistData_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfMsrAssistBTS.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MsrAssistData */ +typedef struct MsrAssistData { + SeqOfMsrAssistBTS_t msrAssistList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MsrAssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MsrAssistData; + +#ifdef __cplusplus +} +#endif + +#endif /* _MsrAssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c new file mode 100644 index 000000000..4603e562c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c @@ -0,0 +1,131 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MsrPosition-Req.h" + +static asn_TYPE_member_t asn_MBR_MsrPosition_Req_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MsrPosition_Req, positionInstruct), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionInstruct, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "positionInstruct" + }, + { ATF_POINTER, 7, offsetof(struct MsrPosition_Req, referenceAssistData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceAssistData" + }, + { ATF_POINTER, 6, offsetof(struct MsrPosition_Req, msrAssistData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrAssistData" + }, + { ATF_POINTER, 5, offsetof(struct MsrPosition_Req, systemInfoAssistData), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoAssistData" + }, + { ATF_POINTER, 4, offsetof(struct MsrPosition_Req, gps_AssistData), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gps-AssistData" + }, + { ATF_POINTER, 3, offsetof(struct MsrPosition_Req, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extensionContainer" + }, + { ATF_POINTER, 2, offsetof(struct MsrPosition_Req, rel98_MsrPosition_Req_extension), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_MsrPosition_Req_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel98-MsrPosition-Req-extension" + }, + { ATF_POINTER, 1, offsetof(struct MsrPosition_Req, rel5_MsrPosition_Req_extension), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel5_MsrPosition_Req_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel5-MsrPosition-Req-extension" + }, +}; +static int asn_MAP_MsrPosition_Req_oms_1[] = { 1, 2, 3, 4, 5, 6, 7 }; +static ber_tlv_tag_t asn_DEF_MsrPosition_Req_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MsrPosition_Req_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* positionInstruct at 31 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceAssistData at 32 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msrAssistData at 33 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* systemInfoAssistData at 34 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* gps-AssistData at 35 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* extensionContainer at 36 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* rel98-MsrPosition-Req-extension at 39 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* rel5-MsrPosition-Req-extension at 41 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MsrPosition_Req_specs_1 = { + sizeof(struct MsrPosition_Req), + offsetof(struct MsrPosition_Req, _asn_ctx), + asn_MAP_MsrPosition_Req_tag2el_1, + 8, /* Count of tags in the map */ + asn_MAP_MsrPosition_Req_oms_1, /* Optional members */ + 5, 2, /* Root/Additions */ + 5, /* Start extensions */ + 9 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MsrPosition_Req = { + "MsrPosition-Req", + "MsrPosition-Req", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MsrPosition_Req_tags_1, + sizeof(asn_DEF_MsrPosition_Req_tags_1) + /sizeof(asn_DEF_MsrPosition_Req_tags_1[0]), /* 1 */ + asn_DEF_MsrPosition_Req_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrPosition_Req_tags_1) + /sizeof(asn_DEF_MsrPosition_Req_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MsrPosition_Req_1, + 8, /* Elements count */ + &asn_SPC_MsrPosition_Req_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h new file mode 100644 index 000000000..011046652 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h @@ -0,0 +1,65 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MsrPosition_Req_H_ +#define _MsrPosition_Req_H_ + + +#include + +/* Including external dependencies */ +#include "PositionInstruct.h" +#include "ExtensionContainer.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ReferenceAssistData; +struct MsrAssistData; +struct SystemInfoAssistData; +struct GPS_AssistData; +struct Rel98_MsrPosition_Req_Extension; +struct Rel5_MsrPosition_Req_Extension; + +/* MsrPosition-Req */ +typedef struct MsrPosition_Req { + PositionInstruct_t positionInstruct; + struct ReferenceAssistData *referenceAssistData /* OPTIONAL */; + struct MsrAssistData *msrAssistData /* OPTIONAL */; + struct SystemInfoAssistData *systemInfoAssistData /* OPTIONAL */; + struct GPS_AssistData *gps_AssistData /* OPTIONAL */; + ExtensionContainer_t *extensionContainer /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + struct Rel98_MsrPosition_Req_Extension *rel98_MsrPosition_Req_extension /* OPTIONAL */; + struct Rel5_MsrPosition_Req_Extension *rel5_MsrPosition_Req_extension /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MsrPosition_Req_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MsrPosition_Req; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "ReferenceAssistData.h" +#include "MsrAssistData.h" +#include "SystemInfoAssistData.h" +#include "GPS-AssistData.h" +#include "Rel98-MsrPosition-Req-Extension.h" +#include "Rel5-MsrPosition-Req-Extension.h" + +#endif /* _MsrPosition_Req_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c new file mode 100644 index 000000000..16ff241a0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c @@ -0,0 +1,141 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MsrPosition-Rsp.h" + +static asn_TYPE_member_t asn_MBR_MsrPosition_Rsp_1[] = { + { ATF_POINTER, 9, offsetof(struct MsrPosition_Rsp, multipleSets), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultipleSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "multipleSets" + }, + { ATF_POINTER, 8, offsetof(struct MsrPosition_Rsp, referenceIdentity), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceIdentity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceIdentity" + }, + { ATF_POINTER, 7, offsetof(struct MsrPosition_Rsp, otd_MeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasureInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otd-MeasureInfo" + }, + { ATF_POINTER, 6, offsetof(struct MsrPosition_Rsp, locationInfo), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "locationInfo" + }, + { ATF_POINTER, 5, offsetof(struct MsrPosition_Rsp, gps_MeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPS_MeasureInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gps-MeasureInfo" + }, + { ATF_POINTER, 4, offsetof(struct MsrPosition_Rsp, locationError), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationError, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "locationError" + }, + { ATF_POINTER, 3, offsetof(struct MsrPosition_Rsp, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extensionContainer" + }, + { ATF_POINTER, 2, offsetof(struct MsrPosition_Rsp, rel_98_MsrPosition_Rsp_Extension), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel_98_MsrPosition_Rsp_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel-98-MsrPosition-Rsp-Extension" + }, + { ATF_POINTER, 1, offsetof(struct MsrPosition_Rsp, rel_5_MsrPosition_Rsp_Extension), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel_5_MsrPosition_Rsp_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel-5-MsrPosition-Rsp-Extension" + }, +}; +static int asn_MAP_MsrPosition_Rsp_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static ber_tlv_tag_t asn_DEF_MsrPosition_Rsp_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MsrPosition_Rsp_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* multipleSets at 51 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceIdentity at 52 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* otd-MeasureInfo at 53 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* locationInfo at 54 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* gps-MeasureInfo at 55 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* locationError at 56 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* extensionContainer at 57 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* rel-98-MsrPosition-Rsp-Extension at 61 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* rel-5-MsrPosition-Rsp-Extension at 63 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MsrPosition_Rsp_specs_1 = { + sizeof(struct MsrPosition_Rsp), + offsetof(struct MsrPosition_Rsp, _asn_ctx), + asn_MAP_MsrPosition_Rsp_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_MsrPosition_Rsp_oms_1, /* Optional members */ + 7, 2, /* Root/Additions */ + 6, /* Start extensions */ + 10 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MsrPosition_Rsp = { + "MsrPosition-Rsp", + "MsrPosition-Rsp", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MsrPosition_Rsp_tags_1, + sizeof(asn_DEF_MsrPosition_Rsp_tags_1) + /sizeof(asn_DEF_MsrPosition_Rsp_tags_1[0]), /* 1 */ + asn_DEF_MsrPosition_Rsp_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrPosition_Rsp_tags_1) + /sizeof(asn_DEF_MsrPosition_Rsp_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MsrPosition_Rsp_1, + 9, /* Elements count */ + &asn_SPC_MsrPosition_Rsp_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h new file mode 100644 index 000000000..ddb735fbd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MsrPosition_Rsp_H_ +#define _MsrPosition_Rsp_H_ + + +#include + +/* Including external dependencies */ +#include "ExtensionContainer.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct MultipleSets; +struct ReferenceIdentity; +struct OTD_MeasureInfo; +struct LocationInfo; +struct GPS_MeasureInfo; +struct LocationError; +struct Rel_98_MsrPosition_Rsp_Extension; +struct Rel_5_MsrPosition_Rsp_Extension; + +/* MsrPosition-Rsp */ +typedef struct MsrPosition_Rsp { + struct MultipleSets *multipleSets /* OPTIONAL */; + struct ReferenceIdentity *referenceIdentity /* OPTIONAL */; + struct OTD_MeasureInfo *otd_MeasureInfo /* OPTIONAL */; + struct LocationInfo *locationInfo /* OPTIONAL */; + struct GPS_MeasureInfo *gps_MeasureInfo /* OPTIONAL */; + struct LocationError *locationError /* OPTIONAL */; + ExtensionContainer_t *extensionContainer /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + struct Rel_98_MsrPosition_Rsp_Extension *rel_98_MsrPosition_Rsp_Extension /* OPTIONAL */; + struct Rel_5_MsrPosition_Rsp_Extension *rel_5_MsrPosition_Rsp_Extension /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MsrPosition_Rsp_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MsrPosition_Rsp; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "MultipleSets.h" +#include "ReferenceIdentity.h" +#include "OTD-MeasureInfo.h" +#include "LocationInfo.h" +#include "GPS-MeasureInfo.h" +#include "LocationError.h" +#include "Rel-98-MsrPosition-Rsp-Extension.h" +#include "Rel-5-MsrPosition-Rsp-Extension.h" + +#endif /* _MsrPosition_Rsp_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c new file mode 100644 index 000000000..de7c825dd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MultiFrameCarrier.h" + +static asn_TYPE_member_t asn_MBR_MultiFrameCarrier_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MultiFrameCarrier, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bcchCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct MultiFrameCarrier, multiFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "multiFrameOffset" + }, +}; +static ber_tlv_tag_t asn_DEF_MultiFrameCarrier_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MultiFrameCarrier_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 411 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* multiFrameOffset at 413 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MultiFrameCarrier_specs_1 = { + sizeof(struct MultiFrameCarrier), + offsetof(struct MultiFrameCarrier, _asn_ctx), + asn_MAP_MultiFrameCarrier_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MultiFrameCarrier = { + "MultiFrameCarrier", + "MultiFrameCarrier", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MultiFrameCarrier_tags_1, + sizeof(asn_DEF_MultiFrameCarrier_tags_1) + /sizeof(asn_DEF_MultiFrameCarrier_tags_1[0]), /* 1 */ + asn_DEF_MultiFrameCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_MultiFrameCarrier_tags_1) + /sizeof(asn_DEF_MultiFrameCarrier_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MultiFrameCarrier_1, + 2, /* Elements count */ + &asn_SPC_MultiFrameCarrier_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h new file mode 100644 index 000000000..974756a36 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MultiFrameCarrier_H_ +#define _MultiFrameCarrier_H_ + + +#include + +/* Including external dependencies */ +#include "BCCHCarrier.h" +#include "MultiFrameOffset.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MultiFrameCarrier */ +typedef struct MultiFrameCarrier { + BCCHCarrier_t bcchCarrier; + MultiFrameOffset_t multiFrameOffset; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MultiFrameCarrier_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MultiFrameCarrier; + +#ifdef __cplusplus +} +#endif + +#endif /* _MultiFrameCarrier_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c new file mode 100644 index 000000000..8d9149817 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MultiFrameOffset.h" + +int +MultiFrameOffset_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 51)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +MultiFrameOffset_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +MultiFrameOffset_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +MultiFrameOffset_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +MultiFrameOffset_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +MultiFrameOffset_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +MultiFrameOffset_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +MultiFrameOffset_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +MultiFrameOffset_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +MultiFrameOffset_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + MultiFrameOffset_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_MultiFrameOffset_constr_1 = { + { APC_CONSTRAINED, 6, 6, 0, 51 } /* (0..51) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_MultiFrameOffset_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MultiFrameOffset = { + "MultiFrameOffset", + "MultiFrameOffset", + MultiFrameOffset_free, + MultiFrameOffset_print, + MultiFrameOffset_constraint, + MultiFrameOffset_decode_ber, + MultiFrameOffset_encode_der, + MultiFrameOffset_decode_xer, + MultiFrameOffset_encode_xer, + MultiFrameOffset_decode_uper, + MultiFrameOffset_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MultiFrameOffset_tags_1, + sizeof(asn_DEF_MultiFrameOffset_tags_1) + /sizeof(asn_DEF_MultiFrameOffset_tags_1[0]), /* 1 */ + asn_DEF_MultiFrameOffset_tags_1, /* Same as above */ + sizeof(asn_DEF_MultiFrameOffset_tags_1) + /sizeof(asn_DEF_MultiFrameOffset_tags_1[0]), /* 1 */ + &asn_PER_type_MultiFrameOffset_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h new file mode 100644 index 000000000..0dca44394 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MultiFrameOffset_H_ +#define _MultiFrameOffset_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MultiFrameOffset */ +typedef long MultiFrameOffset_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MultiFrameOffset; +asn_struct_free_f MultiFrameOffset_free; +asn_struct_print_f MultiFrameOffset_print; +asn_constr_check_f MultiFrameOffset_constraint; +ber_type_decoder_f MultiFrameOffset_decode_ber; +der_type_encoder_f MultiFrameOffset_encode_der; +xer_type_decoder_f MultiFrameOffset_decode_xer; +xer_type_encoder_f MultiFrameOffset_encode_xer; +per_type_decoder_f MultiFrameOffset_decode_uper; +per_type_encoder_f MultiFrameOffset_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _MultiFrameOffset_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/MultipleSets.c b/src/core/libs/supl/asn-rrlp/MultipleSets.c new file mode 100644 index 000000000..cce55bd21 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MultipleSets.c @@ -0,0 +1,141 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "MultipleSets.h" + +static int +memb_nbrOfSets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 2 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_nbrOfReferenceBTSs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_nbrOfSets_constr_2 = { + { APC_CONSTRAINED, 1, 1, 2, 3 } /* (2..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_nbrOfReferenceBTSs_constr_3 = { + { APC_CONSTRAINED, 2, 2, 1, 3 } /* (1..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_MultipleSets_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct MultipleSets, nbrOfSets), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_nbrOfSets_constraint_1, + &asn_PER_memb_nbrOfSets_constr_2, + 0, + "nbrOfSets" + }, + { ATF_NOFLAGS, 0, offsetof(struct MultipleSets, nbrOfReferenceBTSs), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_nbrOfReferenceBTSs_constraint_1, + &asn_PER_memb_nbrOfReferenceBTSs_constr_3, + 0, + "nbrOfReferenceBTSs" + }, + { ATF_POINTER, 1, offsetof(struct MultipleSets, referenceRelation), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceRelation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceRelation" + }, +}; +static int asn_MAP_MultipleSets_oms_1[] = { 2 }; +static ber_tlv_tag_t asn_DEF_MultipleSets_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MultipleSets_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nbrOfSets at 267 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nbrOfReferenceBTSs at 270 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* referenceRelation at 274 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MultipleSets_specs_1 = { + sizeof(struct MultipleSets), + offsetof(struct MultipleSets, _asn_ctx), + asn_MAP_MultipleSets_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_MultipleSets_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MultipleSets = { + "MultipleSets", + "MultipleSets", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MultipleSets_tags_1, + sizeof(asn_DEF_MultipleSets_tags_1) + /sizeof(asn_DEF_MultipleSets_tags_1[0]), /* 1 */ + asn_DEF_MultipleSets_tags_1, /* Same as above */ + sizeof(asn_DEF_MultipleSets_tags_1) + /sizeof(asn_DEF_MultipleSets_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MultipleSets_1, + 3, /* Elements count */ + &asn_SPC_MultipleSets_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/MultipleSets.h b/src/core/libs/supl/asn-rrlp/MultipleSets.h new file mode 100644 index 000000000..032c62542 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/MultipleSets.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _MultipleSets_H_ +#define _MultipleSets_H_ + + +#include + +/* Including external dependencies */ +#include +#include "ReferenceRelation.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MultipleSets */ +typedef struct MultipleSets { + long nbrOfSets; + long nbrOfReferenceBTSs; + ReferenceRelation_t *referenceRelation /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MultipleSets_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MultipleSets; + +#ifdef __cplusplus +} +#endif + +#endif /* _MultipleSets_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/NULL.c b/src/core/libs/supl/asn-rrlp/NULL.c new file mode 100644 index 000000000..6d3316f1c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NULL.c @@ -0,0 +1,147 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include /* Implemented in terms of BOOLEAN type */ + +/* + * NULL basic type description. + */ +static ber_tlv_tag_t asn_DEF_NULL_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NULL = { + "NULL", + "NULL", + BOOLEAN_free, + NULL_print, + asn_generic_no_constraint, + BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ + NULL_encode_der, /* Special handling of DER encoding */ + NULL_decode_xer, + NULL_encode_xer, + NULL_decode_uper, /* Unaligned PER decoder */ + NULL_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NULL_tags, + sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), + asn_DEF_NULL_tags, /* Same as above */ + sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval; + + erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = ptr; + } + + _ASN_ENCODED_OK(erval); +} + +asn_enc_rval_t +NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + + (void)td; + (void)sptr; + (void)ilevel; + (void)flags; + (void)cb; + (void)app_key; + + /* XMLNullValue is empty */ + er.encoded = 0; + _ASN_ENCODED_OK(er); +} + + +static enum xer_pbd_rval +NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { + (void)td; + (void)sptr; + + if(xer_is_whitespace(chunk_buf, chunk_size)) + return XPBD_BODY_CONSUMED; + else + return XPBD_BROKEN_ENCODING; +} + +asn_dec_rval_t +NULL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + 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(NULL_t), opt_mname, buf_ptr, size, + NULL__xer_body_decode); +} + +int +NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(sptr) { + return (cb("", 9, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +asn_dec_rval_t +NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)opt_codec_ctx; + (void)td; + (void)constraints; + (void)pd; + + if(!*sptr) { + *sptr = MALLOC(sizeof(NULL_t)); + if(*sptr) { + *(NULL_t *)*sptr = 0; + } else { + _ASN_DECODE_FAILED; + } + } + + /* + * NULL type does not have content octets. + */ + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + +asn_enc_rval_t +NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) { + asn_enc_rval_t er; + + (void)td; + (void)constraints; + (void)sptr; + (void)po; + + er.encoded = 0; + _ASN_ENCODED_OK(er); +} diff --git a/src/core/libs/supl/asn-rrlp/NULL.h b/src/core/libs/supl/asn-rrlp/NULL.h new file mode 100644 index 000000000..131e77592 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NULL.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_TYPE_NULL_H +#define ASN_TYPE_NULL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The value of the NULL type is meaningless: see BOOLEAN if you want to + * carry true/false semantics. + */ +typedef int NULL_t; + +extern asn_TYPE_descriptor_t asn_DEF_NULL; + +asn_struct_print_f NULL_print; +der_type_encoder_f NULL_encode_der; +xer_type_decoder_f NULL_decode_xer; +xer_type_encoder_f NULL_encode_xer; +per_type_decoder_f NULL_decode_uper; +per_type_encoder_f NULL_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* NULL_H */ diff --git a/src/core/libs/supl/asn-rrlp/NativeEnumerated.c b/src/core/libs/supl/asn-rrlp/NativeEnumerated.c new file mode 100644 index 000000000..1554220f8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NativeEnumerated.c @@ -0,0 +1,207 @@ +/*- + * Copyright (c) 2004, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include +#include + +/* + * NativeEnumerated basic type description. + */ +static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { + "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ + "ENUMERATED", + NativeInteger_free, + NativeInteger_print, + asn_generic_no_constraint, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeEnumerated_encode_xer, + NativeEnumerated_decode_uper, + NativeEnumerated_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NativeEnumerated_tags, + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + asn_DEF_NativeEnumerated_tags, /* Same as above */ + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + const long *native = (const long *)sptr; + const asn_INTEGER_enum_map_t *el; + + (void)ilevel; + (void)flags; + + if(!native) _ASN_ENCODE_FAILED; + + el = INTEGER_map_value2enum(specs, *native); + if(el) { + size_t srcsize = el->enum_len + 5; + char *src = (char *)alloca(srcsize); + + er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); + assert(er.encoded > 0 && (size_t)er.encoded < srcsize); + if(cb(src, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } else { + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + _ASN_ENCODE_FAILED; + } +} + +asn_dec_rval_t +NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + long *native = (long *)*sptr; + asn_per_constraint_t *ct; + long value; + + (void)opt_codec_ctx; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else _ASN_DECODE_FAILED; /* Mandatory! */ + if(!specs) _ASN_DECODE_FAILED; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) _ASN_DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); + + if(ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) _ASN_DECODE_STARVED; + if(inext) ct = 0; + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) _ASN_DECODE_STARVED; + if(value >= (specs->extension + ? specs->extension - 1 : specs->map_count)) + _ASN_DECODE_FAILED; + } else { + if(!specs->extension) + _ASN_DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if(value < 0) _ASN_DECODE_STARVED; + value += specs->extension - 1; + if(value >= specs->map_count) + _ASN_DECODE_FAILED; + } + + *native = specs->value2enum[value].nat_value; + ASN_DEBUG("Decoded %s = %ld", td->name, *native); + + return rval; +} + +static int +NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { + const asn_INTEGER_enum_map_t *a = ap; + const asn_INTEGER_enum_map_t *b = bp; + if(a->nat_value == b->nat_value) + return 0; + if(a->nat_value < b->nat_value) + return -1; + return 1; +} + +asn_enc_rval_t +NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native, value; + asn_per_constraint_t *ct; + int inext = 0; + asn_INTEGER_enum_map_t key; + asn_INTEGER_enum_map_t *kf; + + if(!sptr) _ASN_ENCODE_FAILED; + if(!specs) _ASN_ENCODE_FAILED; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else _ASN_ENCODE_FAILED; /* Mandatory! */ + + ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); + + er.encoded = 0; + + native = *(long *)sptr; + if(native < 0) _ASN_ENCODE_FAILED; + + key.nat_value = native; + kf = bsearch(&key, specs->value2enum, specs->map_count, + sizeof(key), NativeEnumerated__compar_value2enum); + if(!kf) { + ASN_DEBUG("No element corresponds to %ld", native); + _ASN_ENCODE_FAILED; + } + value = kf - specs->value2enum; + + if(ct->range_bits >= 0) { + int cmpWith = specs->extension + ? specs->extension - 1 : specs->map_count; + if(value >= cmpWith) + inext = 1; + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + _ASN_ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + _ASN_ENCODE_FAILED; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, value, ct->range_bits)) + _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + if(!specs->extension) + _ASN_ENCODE_FAILED; + + /* + * X.691, #10.6: normally small non-negative whole number; + */ + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", + value, specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + diff --git a/src/core/libs/supl/asn-rrlp/NativeEnumerated.h b/src/core/libs/supl/asn-rrlp/NativeEnumerated.h new file mode 100644 index 000000000..c59bb1ba9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NativeEnumerated.h @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard ENUMERATED in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeEnumerated_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeEnumerated_H_ +#define _NativeEnumerated_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; + +xer_type_encoder_f NativeEnumerated_encode_xer; +per_type_decoder_f NativeEnumerated_decode_uper; +per_type_encoder_f NativeEnumerated_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeEnumerated_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/NativeInteger.c b/src/core/libs/supl/asn-rrlp/NativeInteger.c new file mode 100644 index 000000000..abdb71a8c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NativeInteger.c @@ -0,0 +1,332 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include +#include + +/* + * NativeInteger basic type description. + */ +static ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NativeInteger = { + "INTEGER", /* The ASN.1 type is still INTEGER */ + "INTEGER", + NativeInteger_free, + NativeInteger_print, + asn_generic_no_constraint, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeInteger_encode_xer, + NativeInteger_decode_uper, /* Unaligned PER decoder */ + NativeInteger_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NativeInteger_tags, + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + asn_DEF_NativeInteger_tags, /* Same as above */ + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode INTEGER type. + */ +asn_dec_rval_t +NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + long *native = (long *)*nint_ptr; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + /* + * If the structure is not there, allocate it. + */ + if(native == NULL) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(native == NULL) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + } + + ASN_DEBUG("Decoding %s as INTEGER (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("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this 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; + } + + /* + * ASN.1 encoded INTEGER: buf_ptr, length + * Fill the native, at the same time checking for overflow. + * If overflow occured, return with RC_FAIL. + */ + { + INTEGER_t tmp; + union { + const void *constbuf; + void *nonconstbuf; + } unconst_buf; + long l; + + unconst_buf.constbuf = buf_ptr; + tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; + tmp.size = length; + + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmp, &l) + : asn_INTEGER2long(&tmp, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + + *native = l; + } + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", + (long)rval.consumed, (long)length, td->name, (long)*native); + + return rval; +} + +/* + * Encode the NativeInteger using the standard INTEGER type DER encoder. + */ +asn_enc_rval_t +NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */ + asn_enc_rval_t erval; + INTEGER_t tmp; + +#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ + + tmp.buf = (uint8_t *)&native; + tmp.size = sizeof(native); + +#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ + uint8_t buf[sizeof(native)]; + uint8_t *p; + + /* Prepare a fake INTEGER */ + for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) + *p = (uint8_t)native; + + tmp.buf = buf; + tmp.size = sizeof(buf); +#endif /* WORDS_BIGENDIAN */ + + /* Encode fake INTEGER */ + erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); + if(erval.encoded == -1) { + assert(erval.structure_ptr == &tmp); + erval.structure_ptr = ptr; + } + return erval; +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +asn_dec_rval_t +NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + INTEGER_t st; + void *st_ptr = (void *)&st; + long *native = (long *)*sptr; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) _ASN_DECODE_FAILED; + } + + memset(&st, 0, sizeof(st)); + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, + opt_mname, buf_ptr, size); + if(rval.code == RC_OK) { + long l; + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&st, &l) + : asn_INTEGER2long(&st, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + } else { + *native = l; + } + } else { + /* + * Cannot restart from the middle; + * there is no place to save state in the native type. + * Request a continuation from the very beginning. + */ + rval.consumed = 0; + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); + return rval; +} + + +asn_enc_rval_t +NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit int */ + asn_enc_rval_t er; + const long *native = (const long *)sptr; + + (void)ilevel; + (void)flags; + + if(!native) _ASN_ENCODE_FAILED; + + er.encoded = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) + || cb(scratch, er.encoded, app_key) < 0) + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + +asn_dec_rval_t +NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + long *native = (long *)*sptr; + INTEGER_t tmpint; + void *tmpintptr = &tmpint; + + (void)opt_codec_ctx; + ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) _ASN_DECODE_FAILED; + } + + memset(&tmpint, 0, sizeof tmpint); + rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, + &tmpintptr, pd); + if(rval.code == RC_OK) { + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", + td->name, *native); + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + + return rval; +} + +asn_enc_rval_t +NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native; + INTEGER_t tmpint; + + if(!sptr) _ASN_ENCODE_FAILED; + + native = *(long *)sptr; + + ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); + + memset(&tmpint, 0, sizeof(tmpint)); + if((specs&&specs->field_unsigned) + ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) + _ASN_ENCODE_FAILED; + er = INTEGER_encode_uper(td, constraints, &tmpint, po); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; +} + +/* + * INTEGER specific human-readable output. + */ +int +NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + const long *native = (const long *)sptr; + char scratch[32]; /* Enough for 64-bit int */ + int ret; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(native) { + ret = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + assert(ret > 0 && (size_t)ret < sizeof(scratch)); + return (cb(scratch, ret, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", + td->name, contents_only, ptr); + + if(!contents_only) { + FREEMEM(ptr); + } +} + diff --git a/src/core/libs/supl/asn-rrlp/NativeInteger.h b/src/core/libs/supl/asn-rrlp/NativeInteger.h new file mode 100644 index 000000000..4e63a8355 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NativeInteger.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard INTEGER in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeInteger_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeInteger_H_ +#define _NativeInteger_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeInteger; + +asn_struct_free_f NativeInteger_free; +asn_struct_print_f NativeInteger_print; +ber_type_decoder_f NativeInteger_decode_ber; +der_type_encoder_f NativeInteger_encode_der; +xer_type_decoder_f NativeInteger_decode_xer; +xer_type_encoder_f NativeInteger_encode_xer; +per_type_decoder_f NativeInteger_decode_uper; +per_type_encoder_f NativeInteger_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeInteger_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c new file mode 100644 index 000000000..1b2ae3a79 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c @@ -0,0 +1,689 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "NavModel-KeplerianSet.h" + +static int +memb_keplerToeLSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerDeltaN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerOmegaDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerELSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 33554431)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerIDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8192 && value <= 8191)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerAPowerHalfLSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 67108863)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerI0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerOmega0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerCrs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerCis_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerCus_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerCrc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerCic_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_keplerCuc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_keplerToeLSB_constr_2 = { + { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerW_constr_3 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerDeltaN_constr_4 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerM0_constr_5 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerOmegaDot_constr_6 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerELSB_constr_7 = { + { APC_CONSTRAINED, 25, -1, 0, 33554431 } /* (0..33554431) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerIDot_constr_8 = { + { APC_CONSTRAINED, 14, 14, -8192, 8191 } /* (-8192..8191) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerAPowerHalfLSB_constr_9 = { + { APC_CONSTRAINED, 26, -1, 0, 67108863 } /* (0..67108863) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerI0_constr_10 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerOmega0_constr_11 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerCrs_constr_12 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerCis_constr_13 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerCus_constr_14 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerCrc_constr_15 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerCic_constr_16 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_keplerCuc_constr_17 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_NavModel_KeplerianSet_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerToeLSB), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerToeLSB_constraint_1, + &asn_PER_memb_keplerToeLSB_constr_2, + 0, + "keplerToeLSB" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerW), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerW_constraint_1, + &asn_PER_memb_keplerW_constr_3, + 0, + "keplerW" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerDeltaN), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerDeltaN_constraint_1, + &asn_PER_memb_keplerDeltaN_constr_4, + 0, + "keplerDeltaN" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerM0), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerM0_constraint_1, + &asn_PER_memb_keplerM0_constr_5, + 0, + "keplerM0" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerOmegaDot), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerOmegaDot_constraint_1, + &asn_PER_memb_keplerOmegaDot_constr_6, + 0, + "keplerOmegaDot" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerELSB), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerELSB_constraint_1, + &asn_PER_memb_keplerELSB_constr_7, + 0, + "keplerELSB" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerIDot), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerIDot_constraint_1, + &asn_PER_memb_keplerIDot_constr_8, + 0, + "keplerIDot" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerAPowerHalfLSB), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerAPowerHalfLSB_constraint_1, + &asn_PER_memb_keplerAPowerHalfLSB_constr_9, + 0, + "keplerAPowerHalfLSB" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerI0), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerI0_constraint_1, + &asn_PER_memb_keplerI0_constr_10, + 0, + "keplerI0" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerOmega0), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerOmega0_constraint_1, + &asn_PER_memb_keplerOmega0_constr_11, + 0, + "keplerOmega0" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCrs), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerCrs_constraint_1, + &asn_PER_memb_keplerCrs_constr_12, + 0, + "keplerCrs" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCis), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerCis_constraint_1, + &asn_PER_memb_keplerCis_constr_13, + 0, + "keplerCis" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCus), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerCus_constraint_1, + &asn_PER_memb_keplerCus_constr_14, + 0, + "keplerCus" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCrc), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerCrc_constraint_1, + &asn_PER_memb_keplerCrc_constr_15, + 0, + "keplerCrc" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCic), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerCic_constraint_1, + &asn_PER_memb_keplerCic_constr_16, + 0, + "keplerCic" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCuc), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_keplerCuc_constraint_1, + &asn_PER_memb_keplerCuc_constr_17, + 0, + "keplerCuc" + }, +}; +static ber_tlv_tag_t asn_DEF_NavModel_KeplerianSet_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_NavModel_KeplerianSet_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* keplerToeLSB at 1254 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* keplerW at 1255 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* keplerDeltaN at 1256 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* keplerM0 at 1257 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* keplerOmegaDot at 1258 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* keplerELSB at 1259 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* keplerIDot at 1260 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* keplerAPowerHalfLSB at 1261 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* keplerI0 at 1262 */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* keplerOmega0 at 1263 */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* keplerCrs at 1264 */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* keplerCis at 1265 */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* keplerCus at 1266 */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* keplerCrc at 1267 */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* keplerCic at 1268 */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 } /* keplerCuc at 1269 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_NavModel_KeplerianSet_specs_1 = { + sizeof(struct NavModel_KeplerianSet), + offsetof(struct NavModel_KeplerianSet, _asn_ctx), + asn_MAP_NavModel_KeplerianSet_tag2el_1, + 16, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_NavModel_KeplerianSet = { + "NavModel-KeplerianSet", + "NavModel-KeplerianSet", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NavModel_KeplerianSet_tags_1, + sizeof(asn_DEF_NavModel_KeplerianSet_tags_1) + /sizeof(asn_DEF_NavModel_KeplerianSet_tags_1[0]), /* 1 */ + asn_DEF_NavModel_KeplerianSet_tags_1, /* Same as above */ + sizeof(asn_DEF_NavModel_KeplerianSet_tags_1) + /sizeof(asn_DEF_NavModel_KeplerianSet_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_NavModel_KeplerianSet_1, + 16, /* Elements count */ + &asn_SPC_NavModel_KeplerianSet_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h new file mode 100644 index 000000000..f295c623b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _NavModel_KeplerianSet_H_ +#define _NavModel_KeplerianSet_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* NavModel-KeplerianSet */ +typedef struct NavModel_KeplerianSet { + long keplerToeLSB; + long keplerW; + long keplerDeltaN; + long keplerM0; + long keplerOmegaDot; + long keplerELSB; + long keplerIDot; + long keplerAPowerHalfLSB; + long keplerI0; + long keplerOmega0; + long keplerCrs; + long keplerCis; + long keplerCus; + long keplerCrc; + long keplerCic; + long keplerCuc; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NavModel_KeplerianSet_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NavModel_KeplerianSet; + +#ifdef __cplusplus +} +#endif + +#endif /* _NavModel_KeplerianSet_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/NavModelElement.c b/src/core/libs/supl/asn-rrlp/NavModelElement.c new file mode 100644 index 000000000..9ee6486e8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NavModelElement.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "NavModelElement.h" + +static asn_TYPE_member_t asn_MBR_NavModelElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct NavModelElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satelliteID" + }, + { ATF_NOFLAGS, 0, offsetof(struct NavModelElement, satStatus), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_SatStatus, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satStatus" + }, +}; +static ber_tlv_tag_t asn_DEF_NavModelElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_NavModelElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 703 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* satStatus at 705 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_NavModelElement_specs_1 = { + sizeof(struct NavModelElement), + offsetof(struct NavModelElement, _asn_ctx), + asn_MAP_NavModelElement_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_NavModelElement = { + "NavModelElement", + "NavModelElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NavModelElement_tags_1, + sizeof(asn_DEF_NavModelElement_tags_1) + /sizeof(asn_DEF_NavModelElement_tags_1[0]), /* 1 */ + asn_DEF_NavModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_NavModelElement_tags_1) + /sizeof(asn_DEF_NavModelElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_NavModelElement_1, + 2, /* Elements count */ + &asn_SPC_NavModelElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/NavModelElement.h b/src/core/libs/supl/asn-rrlp/NavModelElement.h new file mode 100644 index 000000000..f4504afe2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NavModelElement.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _NavModelElement_H_ +#define _NavModelElement_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include "SatStatus.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* NavModelElement */ +typedef struct NavModelElement { + SatelliteID_t satelliteID; + SatStatus_t satStatus; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NavModelElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NavModelElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _NavModelElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/NavigationModel.c b/src/core/libs/supl/asn-rrlp/NavigationModel.c new file mode 100644 index 000000000..874918e2c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NavigationModel.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "NavigationModel.h" + +static asn_TYPE_member_t asn_MBR_NavigationModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct NavigationModel, navModelList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfNavModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "navModelList" + }, +}; +static ber_tlv_tag_t asn_DEF_NavigationModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_NavigationModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* navModelList at 697 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_NavigationModel_specs_1 = { + sizeof(struct NavigationModel), + offsetof(struct NavigationModel, _asn_ctx), + asn_MAP_NavigationModel_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_NavigationModel = { + "NavigationModel", + "NavigationModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NavigationModel_tags_1, + sizeof(asn_DEF_NavigationModel_tags_1) + /sizeof(asn_DEF_NavigationModel_tags_1[0]), /* 1 */ + asn_DEF_NavigationModel_tags_1, /* Same as above */ + sizeof(asn_DEF_NavigationModel_tags_1) + /sizeof(asn_DEF_NavigationModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_NavigationModel_1, + 1, /* Elements count */ + &asn_SPC_NavigationModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/NavigationModel.h b/src/core/libs/supl/asn-rrlp/NavigationModel.h new file mode 100644 index 000000000..cb37e54de --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NavigationModel.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _NavigationModel_H_ +#define _NavigationModel_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfNavModelElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* NavigationModel */ +typedef struct NavigationModel { + SeqOfNavModelElement_t navModelList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NavigationModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NavigationModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _NavigationModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/NeighborIdentity.c b/src/core/libs/supl/asn-rrlp/NeighborIdentity.c new file mode 100644 index 000000000..624b5cec2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NeighborIdentity.c @@ -0,0 +1,110 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "NeighborIdentity.h" + +static asn_per_constraints_t asn_PER_type_NeighborIdentity_constr_1 = { + { APC_CONSTRAINED, 3, 3, 0, 5 } /* (0..5) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_NeighborIdentity_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.bsicAndCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSICAndCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsicAndCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.ci), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ci" + }, + { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.multiFrameCarrier), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "multiFrameCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.requestIndex), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequestIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "requestIndex" + }, + { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.systemInfoIndex), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoIndex" + }, + { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.ciAndLAC), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellIDAndLAC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ciAndLAC" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_NeighborIdentity_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bsicAndCarrier at 398 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ci at 399 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* multiFrameCarrier at 400 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* requestIndex at 401 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* systemInfoIndex at 402 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* ciAndLAC at 407 */ +}; +static asn_CHOICE_specifics_t asn_SPC_NeighborIdentity_specs_1 = { + sizeof(struct NeighborIdentity), + offsetof(struct NeighborIdentity, _asn_ctx), + offsetof(struct NeighborIdentity, present), + sizeof(((struct NeighborIdentity *)0)->present), + asn_MAP_NeighborIdentity_tag2el_1, + 6, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_NeighborIdentity = { + "NeighborIdentity", + "NeighborIdentity", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_NeighborIdentity_constr_1, + asn_MBR_NeighborIdentity_1, + 6, /* Elements count */ + &asn_SPC_NeighborIdentity_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/NeighborIdentity.h b/src/core/libs/supl/asn-rrlp/NeighborIdentity.h new file mode 100644 index 000000000..b12b599e7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NeighborIdentity.h @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _NeighborIdentity_H_ +#define _NeighborIdentity_H_ + + +#include + +/* Including external dependencies */ +#include "BSICAndCarrier.h" +#include "CellID.h" +#include "MultiFrameCarrier.h" +#include "RequestIndex.h" +#include "SystemInfoIndex.h" +#include "CellIDAndLAC.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum NeighborIdentity_PR { + NeighborIdentity_PR_NOTHING, /* No components present */ + NeighborIdentity_PR_bsicAndCarrier, + NeighborIdentity_PR_ci, + NeighborIdentity_PR_multiFrameCarrier, + NeighborIdentity_PR_requestIndex, + NeighborIdentity_PR_systemInfoIndex, + NeighborIdentity_PR_ciAndLAC +} NeighborIdentity_PR; + +/* NeighborIdentity */ +typedef struct NeighborIdentity { + NeighborIdentity_PR present; + union NeighborIdentity_u { + BSICAndCarrier_t bsicAndCarrier; + CellID_t ci; + MultiFrameCarrier_t multiFrameCarrier; + RequestIndex_t requestIndex; + SystemInfoIndex_t systemInfoIndex; + CellIDAndLAC_t ciAndLAC; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NeighborIdentity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NeighborIdentity; + +#ifdef __cplusplus +} +#endif + +#endif /* _NeighborIdentity_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c new file mode 100644 index 000000000..1f748f2cc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "NumOfMeasurements.h" + +int +NumOfMeasurements_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +NumOfMeasurements_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +NumOfMeasurements_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +NumOfMeasurements_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +NumOfMeasurements_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +NumOfMeasurements_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +NumOfMeasurements_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +NumOfMeasurements_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +NumOfMeasurements_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +NumOfMeasurements_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NumOfMeasurements_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_NumOfMeasurements_constr_1 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_NumOfMeasurements_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NumOfMeasurements = { + "NumOfMeasurements", + "NumOfMeasurements", + NumOfMeasurements_free, + NumOfMeasurements_print, + NumOfMeasurements_constraint, + NumOfMeasurements_decode_ber, + NumOfMeasurements_encode_der, + NumOfMeasurements_decode_xer, + NumOfMeasurements_encode_xer, + NumOfMeasurements_decode_uper, + NumOfMeasurements_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NumOfMeasurements_tags_1, + sizeof(asn_DEF_NumOfMeasurements_tags_1) + /sizeof(asn_DEF_NumOfMeasurements_tags_1[0]), /* 1 */ + asn_DEF_NumOfMeasurements_tags_1, /* Same as above */ + sizeof(asn_DEF_NumOfMeasurements_tags_1) + /sizeof(asn_DEF_NumOfMeasurements_tags_1[0]), /* 1 */ + &asn_PER_type_NumOfMeasurements_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h new file mode 100644 index 000000000..82524d0ed --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _NumOfMeasurements_H_ +#define _NumOfMeasurements_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* NumOfMeasurements */ +typedef long NumOfMeasurements_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NumOfMeasurements; +asn_struct_free_f NumOfMeasurements_free; +asn_struct_print_f NumOfMeasurements_print; +asn_constr_check_f NumOfMeasurements_constraint; +ber_type_decoder_f NumOfMeasurements_decode_ber; +der_type_encoder_f NumOfMeasurements_encode_der; +xer_type_decoder_f NumOfMeasurements_decode_xer; +xer_type_encoder_f NumOfMeasurements_encode_xer; +per_type_decoder_f NumOfMeasurements_decode_uper; +per_type_encoder_f NumOfMeasurements_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NumOfMeasurements_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c new file mode 100644 index 000000000..584def8b4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c @@ -0,0 +1,1805 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include /* for .bits_unused member */ +#include + +/* + * OCTET STRING basic type description. + */ +static ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +static asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = { + sizeof(OCTET_STRING_t), + offsetof(OCTET_STRING_t, _asn_ctx), + ASN_OSUBV_STR +}; +static asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = { + { APC_CONSTRAINED, 8, 8, 0, 255 }, + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { + "OCTET STRING", /* Canonical name */ + "OCTET_STRING", /* XML tag name */ + OCTET_STRING_free, + OCTET_STRING_print, /* non-ascii stuff, generally */ + asn_generic_no_constraint, + OCTET_STRING_decode_ber, + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_hex, + OCTET_STRING_encode_xer, + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OCTET_STRING_tags, + sizeof(asn_DEF_OCTET_STRING_tags) + / sizeof(asn_DEF_OCTET_STRING_tags[0]), + asn_DEF_OCTET_STRING_tags, /* Same as above */ + sizeof(asn_DEF_OCTET_STRING_tags) + / sizeof(asn_DEF_OCTET_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_DEF_OCTET_STRING_specs +}; + +#undef _CH_PHASE +#undef NEXT_PHASE +#undef PREV_PHASE +#define _CH_PHASE(ctx, inc) do { \ + if(ctx->phase == 0) \ + ctx->context = 0; \ + ctx->phase += inc; \ + } while(0) +#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) +#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +#undef RETURN +#define RETURN(_code) do { \ + asn_dec_rval_t tmprval; \ + tmprval.code = _code; \ + tmprval.consumed = consumed_myself; \ + return tmprval; \ + } while(0) + +#undef APPEND +#define APPEND(bufptr, bufsize) do { \ + size_t _bs = (bufsize); /* Append size */ \ + size_t _ns = ctx->context; /* Allocated now */ \ + size_t _es = st->size + _bs; /* Expected size */ \ + /* int is really a typeof(st->size): */ \ + if((int)_es < 0) RETURN(RC_FAIL); \ + if(_ns <= _es) { \ + void *ptr; \ + /* Be nice and round to the memory allocator */ \ + do { _ns = _ns ? _ns << 1 : 16; } \ + while(_ns <= _es); \ + /* int is really a typeof(st->size): */ \ + if((int)_ns < 0) RETURN(RC_FAIL); \ + ptr = REALLOC(st->buf, _ns); \ + if(ptr) { \ + st->buf = (uint8_t *)ptr; \ + ctx->context = _ns; \ + } else { \ + RETURN(RC_FAIL); \ + } \ + ASN_DEBUG("Reallocating into %ld", (long)_ns); \ + } \ + memcpy(st->buf + st->size, bufptr, _bs); \ + /* Convenient nul-termination */ \ + st->buf[_es] = '\0'; \ + st->size = _es; \ + } while(0) + +/* + * 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. + * No, I am not going to explain what the following stuff is. + */ +struct _stack_el { + ber_tlv_len_t left; /* What's left to read (or -1) */ + ber_tlv_len_t got; /* What was actually processed */ + int cont_level; /* Depth of subcontainment */ + int want_nulls; /* Want null "end of content" octets? */ + int bits_chopped; /* Flag in BIT STRING mode */ + ber_tlv_tag_t tag; /* For debugging purposes */ + struct _stack_el *prev; + struct _stack_el *next; +}; +struct _stack { + struct _stack_el *tail; + struct _stack_el *cur_ptr; +}; + +static struct _stack_el * +OS__add_stack_el(struct _stack *st) { + struct _stack_el *nel; + + /* + * Reuse the old stack frame or allocate a new one. + */ + if(st->cur_ptr && st->cur_ptr->next) { + nel = st->cur_ptr->next; + nel->bits_chopped = 0; + nel->got = 0; + /* Retain the nel->cont_level, it's correct. */ + } else { + nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); + if(nel == NULL) + return NULL; + + if(st->tail) { + /* Increase a subcontainment depth */ + nel->cont_level = st->tail->cont_level + 1; + st->tail->next = nel; + } + nel->prev = st->tail; + st->tail = nel; + } + + st->cur_ptr = nel; + + return nel; +} + +static struct _stack * +_new_stack() { + return (struct _stack *)CALLOC(1, sizeof(struct _stack)); +} + +/* + * Decode OCTET STRING type. + */ +asn_dec_rval_t +OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const void *buf_ptr, size_t size, int tag_mode) { + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + asn_dec_rval_t rval; + asn_struct_ctx_t *ctx; + ssize_t consumed_myself = 0; + struct _stack *stck; /* Expectations stack structure */ + struct _stack_el *sel = 0; /* Stack element */ + int tlv_constr; + enum asn_OS_Subvariant type_variant = specs->subvariant; + + ASN_DEBUG("Decoding %s as %s (frame %ld)", + td->name, + (type_variant == ASN_OSUBV_STR) ? + "OCTET STRING" : "OS-SpecialCase", + (long)size); + + /* + * Create the string if does not exist. + */ + if(st == NULL) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(st == NULL) RETURN(RC_FAIL); + } + + /* Restore parsing context */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + switch(ctx->phase) { + case 0: + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, ctx, + buf_ptr, size, tag_mode, -1, + &ctx->left, &tlv_constr); + if(rval.code != RC_OK) + return rval; + + if(tlv_constr) { + /* + * Complex operation, requires stack of expectations. + */ + ctx->ptr = _new_stack(); + if(ctx->ptr) { + stck = (struct _stack *)ctx->ptr; + } else { + RETURN(RC_FAIL); + } + } else { + /* + * Jump into stackless primitive decoding. + */ + _CH_PHASE(ctx, 3); + if(type_variant == ASN_OSUBV_ANY && tag_mode != 1) + APPEND(buf_ptr, rval.consumed); + ADVANCE(rval.consumed); + goto phase3; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + phase1: + /* + * Fill the stack with expectations. + */ + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + do { + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_tag_t expected_tag; + ssize_t tl, ll, tlvl; + /* This one works even if (sel->left == -1) */ + ssize_t Left = ((!sel||(size_t)sel->left >= size) + ?(ssize_t)size:sel->left); + + + ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, + (long)(sel?sel->left:0), + (long)(sel?sel->want_nulls:0), + (long)(sel?sel->got:0) + ); + if(sel && sel->left <= 0 && sel->want_nulls == 0) { + if(sel->prev) { + struct _stack_el *prev = sel->prev; + if(prev->left != -1) { + if(prev->left < sel->got) + RETURN(RC_FAIL); + prev->left -= sel->got; + } + prev->got += sel->got; + sel = stck->cur_ptr = prev; + if(!sel) break; + tlv_constr = 1; + continue; + } else { + sel = stck->cur_ptr = 0; + break; /* Nothing to wait */ + } + } + + tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); + ASN_DEBUG("fetch tag(size=%ld,L=%ld), %sstack, left=%ld, wn=%ld, tl=%ld", + (long)size, (long)Left, sel?"":"!", + (long)(sel?sel->left:0), + (long)(sel?sel->want_nulls:0), + (long)tl); + switch(tl) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); + + ll = ber_fetch_length(tlv_constr, + (const char *)buf_ptr + tl,Left - tl,&tlv_len); + ASN_DEBUG("Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld", + ber_tlv_tag_string(tlv_tag), tlv_constr, + (long)Left, (long)tl, (long)tlv_len, (long)ll); + switch(ll) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + if(sel && sel->want_nulls + && ((const uint8_t *)buf_ptr)[0] == 0 + && ((const uint8_t *)buf_ptr)[1] == 0) + { + + ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); + + if(type_variant == ASN_OSUBV_ANY + && (tag_mode != 1 || sel->cont_level)) + APPEND("\0\0", 2); + + ADVANCE(2); + sel->got += 2; + if(sel->left != -1) { + sel->left -= 2; /* assert(sel->left >= 2) */ + } + + sel->want_nulls--; + if(sel->want_nulls == 0) { + /* Move to the next expectation */ + sel->left = 0; + tlv_constr = 1; + } + + continue; + } + + /* + * Set up expected tags, + * depending on ASN.1 type being decoded. + */ + switch(type_variant) { + case ASN_OSUBV_BIT: + /* X.690: 8.6.4.1, NOTE 2 */ + /* Fall through */ + case ASN_OSUBV_STR: + default: + if(sel) { + int level = sel->cont_level; + if(level < td->all_tags_count) { + expected_tag = td->all_tags[level]; + break; + } else if(td->all_tags_count) { + expected_tag = td->all_tags + [td->all_tags_count - 1]; + break; + } + /* else, Fall through */ + } + /* Fall through */ + case ASN_OSUBV_ANY: + expected_tag = tlv_tag; + break; + } + + + if(tlv_tag != expected_tag) { + char buf[2][32]; + ber_tlv_tag_snprint(tlv_tag, + buf[0], sizeof(buf[0])); + ber_tlv_tag_snprint(td->tags[td->tags_count-1], + buf[1], sizeof(buf[1])); + ASN_DEBUG("Tag does not match expectation: %s != %s", + buf[0], buf[1]); + RETURN(RC_FAIL); + } + + tlvl = tl + ll; /* Combined length of T and L encoding */ + if((tlv_len + tlvl) < 0) { + /* tlv_len value is too big */ + ASN_DEBUG("TLV encoding + length (%ld) is too big", + (long)tlv_len); + RETURN(RC_FAIL); + } + + /* + * Append a new expectation. + */ + sel = OS__add_stack_el(stck); + if(!sel) RETURN(RC_FAIL); + + sel->tag = tlv_tag; + + sel->want_nulls = (tlv_len==-1); + if(sel->prev && sel->prev->left != -1) { + /* Check that the parent frame is big enough */ + if(sel->prev->left < tlvl + (tlv_len==-1?0:tlv_len)) + RETURN(RC_FAIL); + if(tlv_len == -1) + sel->left = sel->prev->left - tlvl; + else + sel->left = tlv_len; + } else { + sel->left = tlv_len; + } + if(type_variant == ASN_OSUBV_ANY + && (tag_mode != 1 || sel->cont_level)) + APPEND(buf_ptr, tlvl); + sel->got += tlvl; + ADVANCE(tlvl); + + ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", + (long)sel->got, (long)sel->left, + sel->want_nulls, sel->cont_level); + + } while(tlv_constr); + if(sel == NULL) { + /* Finished operation, "phase out" */ + ASN_DEBUG("Phase out"); + _CH_PHASE(ctx, +3); + break; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 2: + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", + (long)sel->left, (long)size, (long)sel->got, + sel->want_nulls); + { + ber_tlv_len_t len; + + assert(sel->left >= 0); + + len = ((ber_tlv_len_t)size < sel->left) + ? (ber_tlv_len_t)size : sel->left; + if(len > 0) { + if(type_variant == ASN_OSUBV_BIT + && sel->bits_chopped == 0) { + /* Put the unused-bits-octet away */ + st->bits_unused = *(const uint8_t *)buf_ptr; + APPEND(((const char *)buf_ptr+1), (len - 1)); + sel->bits_chopped = 1; + } else { + APPEND(buf_ptr, len); + } + ADVANCE(len); + sel->left -= len; + sel->got += len; + } + + if(sel->left) { + ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", + (long)sel->left, (long)size, sel->want_nulls); + RETURN(RC_WMORE); + } + + PREV_PHASE(ctx); + goto phase1; + } + break; + case 3: + phase3: + /* + * Primitive form, no stack required. + */ + assert(ctx->left >= 0); + + if(size < (size_t)ctx->left) { + if(!size) RETURN(RC_WMORE); + if(type_variant == ASN_OSUBV_BIT && !ctx->context) { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, size); + assert(ctx->context > 0); + ctx->left -= size; + ADVANCE(size); + RETURN(RC_WMORE); + } else { + if(type_variant == ASN_OSUBV_BIT + && !ctx->context && ctx->left) { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, ctx->left); + ADVANCE(ctx->left); + ctx->left = 0; + + NEXT_PHASE(ctx); + } + break; + } + + if(sel) { + ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", + sel->prev, sel->want_nulls, + (long)sel->left, (long)sel->got, (long)size); + if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { + RETURN(RC_WMORE); + } + } + + /* + * BIT STRING-specific processing. + */ + if(type_variant == ASN_OSUBV_BIT && st->size) { + /* Finalize BIT STRING: zero out unused bits. */ + st->buf[st->size-1] &= 0xff << st->bits_unused; + } + + ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", + (long)consumed_myself, td->name, + (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", + (long)st->size); + + + RETURN(RC_OK); +} + +/* + * Encode OCTET STRING type using DER. + */ +asn_enc_rval_t +OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, 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_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + BIT_STRING_t *st = (BIT_STRING_t *)sptr; + enum asn_OS_Subvariant type_variant = specs->subvariant; + int fix_last_byte = 0; + + ASN_DEBUG("%s %s as OCTET STRING", + cb?"Estimating":"Encoding", td->name); + + /* + * Write tags. + */ + if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) { + er.encoded = der_write_tags(td, + (type_variant == ASN_OSUBV_BIT) + st->size, + tag_mode, type_variant == ASN_OSUBV_ANY, tag, + cb, app_key); + if(er.encoded == -1) { + er.failed_type = td; + er.structure_ptr = sptr; + return er; + } + } else { + /* Disallow: [] IMPLICIT ANY */ + assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); + er.encoded = 0; + } + + if(!cb) { + er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; + _ASN_ENCODED_OK(er); + } + + /* + * Prepare to deal with the last octet of BIT STRING. + */ + if(type_variant == ASN_OSUBV_BIT) { + uint8_t b = st->bits_unused & 0x07; + if(b && st->size) fix_last_byte = 1; + _ASN_CALLBACK(&b, 1); + er.encoded++; + } + + /* Invoke callback for the main part of the buffer */ + _ASN_CALLBACK(st->buf, st->size - fix_last_byte); + + /* The last octet should be stripped off the unused bits */ + if(fix_last_byte) { + uint8_t b = st->buf[st->size-1] & (0xff << st->bits_unused); + _ASN_CALLBACK(&b, 1); + } + + er.encoded += st->size; + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +asn_enc_rval_t +OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + static const char *h2c = "0123456789ABCDEF"; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + asn_enc_rval_t er; + char scratch[16 * 3 + 4]; + char *p = scratch; + uint8_t *buf; + uint8_t *end; + size_t i; + + if(!st || (!st->buf && st->size)) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + /* + * Dump the contents of the buffer in hexadecimal. + */ + buf = st->buf; + end = buf + st->size; + if(flags & XER_F_CANONICAL) { + char *scend = scratch + (sizeof(scratch) - 2); + for(; buf < end; buf++) { + if(p >= scend) { + _ASN_CALLBACK(scratch, p - scratch); + er.encoded += p - scratch; + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + } + + _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ + er.encoded += p - scratch; + } else { + for(i = 0; buf < end; buf++, i++) { + if(!(i % 16) && (i || st->size > 16)) { + _ASN_CALLBACK(scratch, p-scratch); + er.encoded += (p-scratch); + p = scratch; + _i_ASN_TEXT_INDENT(1, ilevel); + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + if(p - scratch) { + p--; /* Remove the tail space */ + _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ + er.encoded += p - scratch; + if(st->size > 16) + _i_ASN_TEXT_INDENT(1, ilevel-1); + } + } + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +static struct OCTET_STRING__xer_escape_table_s { + char *string; + int size; +} OCTET_STRING__xer_escape_table[] = { +#define OSXET(s) { s, sizeof(s) - 1 } + OSXET("\074\156\165\154\057\076"), /* */ + OSXET("\074\163\157\150\057\076"), /* */ + OSXET("\074\163\164\170\057\076"), /* */ + OSXET("\074\145\164\170\057\076"), /* */ + OSXET("\074\145\157\164\057\076"), /* */ + OSXET("\074\145\156\161\057\076"), /* */ + OSXET("\074\141\143\153\057\076"), /* */ + OSXET("\074\142\145\154\057\076"), /* */ + OSXET("\074\142\163\057\076"), /* */ + OSXET("\011"), /* \t */ + OSXET("\012"), /* \n */ + OSXET("\074\166\164\057\076"), /* */ + OSXET("\074\146\146\057\076"), /* */ + OSXET("\015"), /* \r */ + OSXET("\074\163\157\057\076"), /* */ + OSXET("\074\163\151\057\076"), /* */ + OSXET("\074\144\154\145\057\076"), /* */ + OSXET("\074\144\143\061\057\076"), /* */ + OSXET("\074\144\143\062\057\076"), /* */ + OSXET("\074\144\143\063\057\076"), /* */ + OSXET("\074\144\143\064\057\076"), /* */ + OSXET("\074\156\141\153\057\076"), /* */ + OSXET("\074\163\171\156\057\076"), /* */ + OSXET("\074\145\164\142\057\076"), /* */ + OSXET("\074\143\141\156\057\076"), /* */ + OSXET("\074\145\155\057\076"), /* */ + OSXET("\074\163\165\142\057\076"), /* */ + OSXET("\074\145\163\143\057\076"), /* */ + OSXET("\074\151\163\064\057\076"), /* */ + OSXET("\074\151\163\063\057\076"), /* */ + OSXET("\074\151\163\062\057\076"), /* */ + OSXET("\074\151\163\061\057\076"), /* */ + { 0, 0 }, /* " " */ + { 0, 0 }, /* ! */ + { 0, 0 }, /* \" */ + { 0, 0 }, /* # */ + { 0, 0 }, /* $ */ + { 0, 0 }, /* % */ + OSXET("\046\141\155\160\073"), /* & */ + { 0, 0 }, /* ' */ + {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */ + {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */ + {0,0},{0,0},{0,0},{0,0}, /* 89:; */ + OSXET("\046\154\164\073"), /* < */ + { 0, 0 }, /* = */ + OSXET("\046\147\164\073"), /* > */ +}; + +static int +OS__check_escaped_control_char(const void *buf, int size) { + size_t i; + /* + * Inefficient algorithm which translates the escape sequences + * defined above into characters. Returns -1 if not found. + * TODO: replace by a faster algorithm (bsearch(), hash or + * nested table lookups). + */ + for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) { + struct OCTET_STRING__xer_escape_table_s *el; + el = &OCTET_STRING__xer_escape_table[i]; + if(el->size == size && memcmp(buf, el->string, size) == 0) + return i; + } + return -1; +} + +static int +OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) { + /* + * This might be one of the escape sequences + * for control characters. Check it out. + * #11.15.5 + */ + int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size); + if(control_char >= 0) { + OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; + void *p = REALLOC(st->buf, st->size + 2); + if(p) { + st->buf = (uint8_t *)p; + st->buf[st->size++] = control_char; + st->buf[st->size] = '\0'; /* nul-termination */ + return 0; + } + } + + return -1; /* No, it's not */ +} + +asn_enc_rval_t +OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, 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; + uint8_t *buf, *end; + uint8_t *ss; /* Sequence start */ + ssize_t encoded_len = 0; + + (void)ilevel; /* Unused argument */ + (void)flags; /* Unused argument */ + + if(!st || (!st->buf && st->size)) + _ASN_ENCODE_FAILED; + + buf = st->buf; + end = buf + st->size; + for(ss = buf; buf < end; buf++) { + unsigned int ch = *buf; + int s_len; /* Special encoding sequence length */ + + /* + * Escape certain characters: X.680/11.15 + */ + if(ch < sizeof(OCTET_STRING__xer_escape_table) + /sizeof(OCTET_STRING__xer_escape_table[0]) + && (s_len = OCTET_STRING__xer_escape_table[ch].size)) { + if(((buf - ss) && cb(ss, buf - ss, app_key) < 0) + || cb(OCTET_STRING__xer_escape_table[ch].string, s_len, + app_key) < 0) + _ASN_ENCODE_FAILED; + encoded_len += (buf - ss) + s_len; + ss = buf + 1; + } + } + + encoded_len += (buf - ss); + if((buf - ss) && cb(ss, buf - ss, app_key) < 0) + _ASN_ENCODE_FAILED; + + er.encoded = encoded_len; + _ASN_ENCODED_OK(er); +} + +/* + * Convert from hexadecimal format (cstring): "AB CD EF" + */ +static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + const char *chunk_stop = (const char *)chunk_buf; + const char *p = chunk_stop; + const char *pend = p + chunk_size; + unsigned int clv = 0; + int half = 0; /* Half bit */ + uint8_t *buf; + + /* Reallocate buffer according to high cap estimation */ + ssize_t _ns = st->size + (chunk_size + 1) / 2; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + /* + * If something like " a b c " appears here, the " a b":3 will be + * converted, and the rest skipped. That is, unless buf_size is greater + * than chunk_size, then it'll be equivalent to "ABC0". + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + switch(ch) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* Ignore whitespace */ + continue; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ + clv = (clv << 4) + (ch - 0x30); + break; + case 0x41: case 0x42: case 0x43: /* ABC */ + case 0x44: case 0x45: case 0x46: /* DEF */ + clv = (clv << 4) + (ch - 0x41 + 10); + break; + case 0x61: case 0x62: case 0x63: /* abc */ + case 0x64: case 0x65: case 0x66: /* def */ + clv = (clv << 4) + (ch - 0x61 + 10); + break; + default: + *buf = 0; /* JIC */ + return -1; + } + if(half++) { + half = 0; + *buf++ = clv; + chunk_stop = p + 1; + } + } + + /* + * Check partial decoding. + */ + if(half) { + if(have_more) { + /* + * Partial specification is fine, + * because no more more PXER_TEXT data is available. + */ + *buf++ = clv << 4; + chunk_stop = p; + } + } else { + chunk_stop = p; + } + + st->size = buf - st->buf; /* Adjust the buffer size */ + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return (chunk_stop - (const char *)chunk_buf); /* Converted size */ +} + +/* + * Convert from binary format: "00101011101" + */ +static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + BIT_STRING_t *st = (BIT_STRING_t *)sptr; + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + int bits_unused = st->bits_unused & 0x7; + uint8_t *buf; + + /* Reallocate buffer according to high cap estimation */ + ssize_t _ns = st->size + (chunk_size + 7) / 8; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + (void)have_more; + + if(bits_unused == 0) + bits_unused = 8; + else if(st->size) + buf--; + + /* + * Convert series of 0 and 1 into the octet string. + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + switch(ch) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* Ignore whitespace */ + break; + case 0x30: + case 0x31: + if(bits_unused-- <= 0) { + *++buf = 0; /* Clean the cell */ + bits_unused = 7; + } + *buf |= (ch&1) << bits_unused; + break; + default: + st->bits_unused = bits_unused; + return -1; + } + } + + if(bits_unused == 8) { + st->size = buf - st->buf; + st->bits_unused = 0; + } else { + st->size = buf - st->buf + 1; + st->bits_unused = bits_unused; + } + + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return chunk_size; /* Converted in full */ +} + +/* + * Something like strtod(), but with stricter rules. + */ +static int +OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { + int32_t val = 0; + const char *p; + + for(p = buf; p < end; p++) { + int ch = *p; + + /* Strange huge value */ + if((val * base + base) < 0) + return -1; + + switch(ch) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ + val = val * base + (ch - 0x30); + break; + case 0x41: case 0x42: case 0x43: /* ABC */ + case 0x44: case 0x45: case 0x46: /* DEF */ + val = val * base + (ch - 0x41 + 10); + break; + case 0x61: case 0x62: case 0x63: /* abc */ + case 0x64: case 0x65: case 0x66: /* def */ + val = val * base + (ch - 0x61 + 10); + break; + case 0x3b: /* ';' */ + *ret_value = val; + return (p - buf) + 1; + default: + return -1; /* Character set error */ + } + } + + *ret_value = -1; + return (p - buf); +} + +/* + * Convert from the plain UTF-8 format, expanding entity references: "2 < 3" + */ +static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + uint8_t *buf; + + /* Reallocate buffer */ + ssize_t _ns = st->size + chunk_size; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + /* + * Convert series of 0 and 1 into the octet string. + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + int len; /* Length of the rest of the chunk */ + + if(ch != 0x26 /* '&' */) { + *buf++ = ch; + continue; /* That was easy... */ + } + + /* + * Process entity reference. + */ + len = chunk_size - (p - (const char *)chunk_buf); + if(len == 1 /* "&" */) goto want_more; + if(p[1] == 0x23 /* '#' */) { + const char *pval; /* Pointer to start of digits */ + int32_t val = 0; /* Entity reference value */ + int base; + + if(len == 2 /* "&#" */) goto want_more; + if(p[2] == 0x78 /* 'x' */) + pval = p + 3, base = 16; + else + pval = p + 2, base = 10; + len = OS__strtoent(base, pval, p + len, &val); + if(len == -1) { + /* Invalid charset. Just copy verbatim. */ + *buf++ = ch; + continue; + } + if(!len || pval[len-1] != 0x3b) goto want_more; + assert(val > 0); + p += (pval - p) + len - 1; /* Advance past entref */ + + if(val < 0x80) { + *buf++ = (char)val; + } else if(val < 0x800) { + *buf++ = 0xc0 | ((val >> 6)); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x10000) { + *buf++ = 0xe0 | ((val >> 12)); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x200000) { + *buf++ = 0xf0 | ((val >> 18)); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x4000000) { + *buf++ = 0xf8 | ((val >> 24)); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else { + *buf++ = 0xfc | ((val >> 30) & 0x1); + *buf++ = 0x80 | ((val >> 24) & 0x3f); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + } else { + /* + * Ugly, limited parsing of & > < + */ + char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); + if(!sc) goto want_more; + if((sc - p) == 4 + && p[1] == 0x61 /* 'a' */ + && p[2] == 0x6d /* 'm' */ + && p[3] == 0x70 /* 'p' */) { + *buf++ = 0x26; + p = sc; + continue; + } + if((sc - p) == 3) { + if(p[1] == 0x6c) { + *buf = 0x3c; /* '<' */ + } else if(p[1] == 0x67) { + *buf = 0x3e; /* '>' */ + } else { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + if(p[2] != 0x74) { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + buf++; + p = sc; + continue; + } + /* Unsupported entity reference */ + *buf++ = ch; + } + + continue; + want_more: + if(have_more) { + /* + * We know that no more data (of the same type) + * is coming. Copy the rest verbatim. + */ + *buf++ = ch; + continue; + } + chunk_size = (p - (const char *)chunk_buf); + /* Processing stalled: need more data */ + break; + } + + st->size = buf - st->buf; + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return chunk_size; /* Converted in full */ +} + +/* + * Decode OCTET STRING from the XML element's body. + */ +static asn_dec_rval_t +OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_ptr, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_ptr, const void *chunk_buf, size_t chunk_size, + int have_more) +) { + OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr; + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + asn_struct_ctx_t *ctx; /* Per-structure parser context */ + asn_dec_rval_t rval; /* Return value from the decoder */ + int st_allocated; + + /* + * Create the string if does not exist. + */ + if(!st) { + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + *sptr = (void *)st; + if(!st) goto sta_failed; + st_allocated = 1; + } else { + st_allocated = 0; + } + if(!st->buf) { + /* This is separate from above section */ + st->buf = (uint8_t *)CALLOC(1, 1); + if(!st->buf) { + if(st_allocated) { + *sptr = 0; + goto stb_failed; + } else { + goto sta_failed; + } + } + } + + /* Restore parsing context */ + ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset); + + return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, + buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); + +stb_failed: + FREEMEM(st); +sta_failed: + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; +} + +/* + * Decode OCTET STRING from the hexadecimal data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal); +} + +/* + * Decode OCTET STRING from the binary (0/1) data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, 0, OCTET_STRING__convert_binary); +} + +/* + * Decode OCTET STRING from the string (ASCII/UTF-8) data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, + OCTET_STRING__handle_control_chars, + OCTET_STRING__convert_entrefs); +} + +static int +OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, + size_t units, unsigned int bpc, unsigned int unit_bits, + long lb, long ub, asn_per_constraints_t *pc) { + uint8_t *end = buf + units * bpc; + + ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", + (int)units, lb, ub, unit_bits); + + /* X.691: 27.5.4 */ + if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + /* Decode without translation */ + lb = 0; + } else if(pc && pc->code2value) { + if(unit_bits > 16) + return 1; /* FATAL: can't have constrained + * UniversalString with more than + * 16 million code points */ + for(; buf < end; buf += bpc) { + int value; + int code = per_get_few_bits(po, unit_bits); + if(code < 0) return -1; /* WMORE */ + value = pc->code2value(code); + if(value < 0) { + ASN_DEBUG("Code %d (0x%02x) is" + " not in map (%ld..%ld)", + code, code, lb, ub); + return 1; /* FATAL */ + } + switch(bpc) { + case 1: *buf = value; break; + case 2: buf[0] = value >> 8; buf[1] = value; break; + case 4: buf[0] = value >> 24; buf[1] = value >> 16; + buf[2] = value >> 8; buf[3] = value; break; + } + } + return 0; + } + + /* Shortcut the no-op copying to the aligned structure */ + if(lb == 0 && (unit_bits == 8 * bpc)) { + return per_get_many_bits(po, buf, 0, unit_bits * units); + } + + for(; buf < end; buf += bpc) { + int code = per_get_few_bits(po, unit_bits); + int ch = code + lb; + if(code < 0) return -1; /* WMORE */ + if(ch > ub) { + ASN_DEBUG("Code %d is out of range (%ld..%ld)", + ch, lb, ub); + return 1; /* FATAL */ + } + switch(bpc) { + case 1: *buf = ch; break; + case 2: buf[0] = ch >> 8; buf[1] = ch; break; + case 4: buf[0] = ch >> 24; buf[1] = ch >> 16; + buf[2] = ch >> 8; buf[3] = ch; break; + } + } + + return 0; +} + +static int +OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, + size_t units, unsigned int bpc, unsigned int unit_bits, + long lb, long ub, asn_per_constraints_t *pc) { + const uint8_t *end = buf + units * bpc; + + ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", + (int)units, lb, ub, unit_bits, bpc); + + /* X.691: 27.5.4 */ + if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + /* Encode as is */ + lb = 0; + } else if(pc && pc->value2code) { + for(; buf < end; buf += bpc) { + int code; + uint32_t value; + switch(bpc) { + case 1: value = *(const uint8_t *)buf; break; + case 2: value = (buf[0] << 8) | buf[1]; break; + case 4: value = (buf[0] << 24) | (buf[1] << 16) + | (buf[2] << 8) | buf[3]; break; + default: return -1; + } + code = pc->value2code(value); + if(code < 0) { + ASN_DEBUG("Character %d (0x%02x) is" + " not in map (%ld..%ld)", + *buf, *buf, lb, ub); + return -1; + } + if(per_put_few_bits(po, code, unit_bits)) + return -1; + } + } + + /* Shortcut the no-op copying to the aligned structure */ + if(lb == 0 && (unit_bits == 8 * bpc)) { + return per_put_many_bits(po, buf, unit_bits * units); + } + + for(ub -= lb; buf < end; buf += bpc) { + int ch; + uint32_t value; + switch(bpc) { + case 1: value = *(const uint8_t *)buf; break; + case 2: value = (buf[0] << 8) | buf[1]; break; + case 4: value = (buf[0] << 24) | (buf[1] << 16) + | (buf[2] << 8) | buf[3]; break; + default: return -1; + } + ch = value - lb; + if(ch < 0 || ch > ub) { + ASN_DEBUG("Character %d (0x%02x)" + " is out of range (%ld..%ld)", + *buf, *buf, lb, ub + lb); + return -1; + } + if(per_put_few_bits(po, ch, unit_bits)) + return -1; + } + + return 0; +} + +asn_dec_rval_t +OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + asn_dec_rval_t rval = { RC_OK, 0 }; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + ssize_t consumed_myself = 0; + int repeat; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + + (void)opt_codec_ctx; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + + switch(specs->subvariant) { + default: + case ASN_OSUBV_ANY: + ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); + RETURN(RC_FAIL); + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + break; + } + + /* + * Allocate the string. + */ + if(!st) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(!st) RETURN(RC_FAIL); + } + + ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + + if(csiz->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) RETURN(RC_WMORE); + if(inext) { + csiz = &asn_DEF_OCTET_STRING_constraints.size; + cval = &asn_DEF_OCTET_STRING_constraints.value; + unit_bits = canonical_unit_bits; + } + } + + if(csiz->effective_bits >= 0) { + FREEMEM(st->buf); + if(bpc) { + st->size = csiz->upper_bound * bpc; + } else { + st->size = (csiz->upper_bound + 7) >> 3; + } + st->buf = (uint8_t *)MALLOC(st->size + 1); + if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits == 0) { + int ret; + if(bpc) { + ASN_DEBUG("Encoding OCTET STRING size %ld", + csiz->upper_bound); + ret = OCTET_STRING_per_get_characters(pd, st->buf, + csiz->upper_bound, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ASN_DEBUG("Encoding BIT STRING size %ld", + csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, + unit_bits * csiz->upper_bound); + } + if(ret < 0) RETURN(RC_WMORE); + consumed_myself += unit_bits * csiz->upper_bound; + st->buf[st->size] = 0; + if(bpc == 0) { + int ubs = (csiz->upper_bound & 0x7); + st->bits_unused = ubs ? 8 - ubs : 0; + } + RETURN(RC_OK); + } + + st->size = 0; + do { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; + + /* Get the PER length */ + raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); + if(raw_len < 0) RETURN(RC_WMORE); + raw_len += csiz->lower_bound; + + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + if(bpc) { + len_bytes = raw_len * bpc; + len_bits = len_bytes * unit_bits; + } else { + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if(len_bits & 0x7) + st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + } + p = REALLOC(st->buf, st->size + len_bytes + 1); + if(!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + if(bpc) { + ret = OCTET_STRING_per_get_characters(pd, + &st->buf[st->size], raw_len, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ret = per_get_many_bits(pd, &st->buf[st->size], + 0, len_bits); + } + if(ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; + } while(repeat); + st->buf[st->size] = 0; /* nul-terminate */ + + return rval; +} + +asn_enc_rval_t +OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; + int inext = 0; /* Lies not within extension root */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + unsigned int sizeinunits; + const uint8_t *buf; + int ret; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + int ct_extensible; + + if(!st || (!st->buf && st->size)) + _ASN_ENCODE_FAILED; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + ct_extensible = csiz->flags & APC_EXTENSIBLE; + + switch(specs->subvariant) { + default: + case ASN_OSUBV_ANY: + _ASN_ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", + sizeinunits, st->bits_unused); + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + sizeinunits = st->size; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + sizeinunits = st->size / 2; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + sizeinunits = st->size / 4; + break; + } + + ASN_DEBUG("Encoding %s into %d units of %d bits" + " (%ld..%ld, effective %d)%s", + td->name, sizeinunits, unit_bits, + csiz->lower_bound, csiz->upper_bound, + csiz->effective_bits, ct_extensible ? " EXT" : ""); + + /* Figure out wheter size lies within PER visible constraint */ + + if(csiz->effective_bits >= 0) { + if((int)sizeinunits < csiz->lower_bound + || (int)sizeinunits > csiz->upper_bound) { + if(ct_extensible) { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + unit_bits = canonical_unit_bits; + inext = 1; + } else + _ASN_ENCODE_FAILED; + } + } else { + inext = 0; + } + + if(ct_extensible) { + /* Declare whether length is [not] within extension root */ + if(per_put_few_bits(po, inext, 1)) + _ASN_ENCODE_FAILED; + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits >= 0) { + ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", + st->size, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + if(ret) _ASN_ENCODE_FAILED; + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, st->buf, + sizeinunits, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, st->buf, + sizeinunits * unit_bits); + } + if(ret) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + ASN_DEBUG("Encoding %d bytes", st->size); + + if(sizeinunits == 0) { + if(uper_put_length(po, 0)) + _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + buf = st->buf; + while(sizeinunits) { + ssize_t maySave = uper_put_length(po, sizeinunits); + if(maySave < 0) _ASN_ENCODE_FAILED; + + ASN_DEBUG("Encoding %ld of %ld", + (long)maySave, (long)sizeinunits); + + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, buf, + maySave, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, buf, maySave * unit_bits); + } + if(ret) _ASN_ENCODE_FAILED; + + if(bpc) + buf += maySave * bpc; + else + buf += maySave >> 3; + sizeinunits -= maySave; + assert(!(maySave & 0x07) || !sizeinunits); + } + + _ASN_ENCODED_OK(er); +} + +int +OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + static const char *h2c = "0123456789ABCDEF"; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + char scratch[16 * 3 + 4]; + char *p = scratch; + uint8_t *buf; + uint8_t *end; + size_t i; + + (void)td; /* Unused argument */ + + if(!st || (!st->buf && st->size)) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* + * Dump the contents of the buffer in hexadecimal. + */ + buf = st->buf; + end = buf + st->size; + for(i = 0; buf < end; buf++, i++) { + if(!(i % 16) && (i || st->size > 16)) { + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + _i_INDENT(1); + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Remove the tail space */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + return 0; +} + +int +OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(st && (st->buf || !st->size)) { + return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_struct_ctx_t *ctx = (asn_struct_ctx_t *) + ((char *)st + specs->ctx_offset); + struct _stack *stck; + + if(!td || !st) + return; + + ASN_DEBUG("Freeing %s as OCTET STRING", td->name); + + if(st->buf) { + FREEMEM(st->buf); + st->buf = 0; + } + + /* + * Remove decode-time stack. + */ + stck = (struct _stack *)ctx->ptr; + if(stck) { + while(stck->tail) { + struct _stack_el *sel = stck->tail; + stck->tail = sel->prev; + FREEMEM(sel); + } + FREEMEM(stck); + } + + if(!contents_only) { + FREEMEM(st); + } +} + +/* + * Conversion routines. + */ +int +OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { + void *buf; + + if(st == 0 || (str == 0 && len)) { + errno = EINVAL; + return -1; + } + + /* + * Clear the OCTET STRING. + */ + if(str == NULL) { + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + return 0; + } + + /* Determine the original string size, if not explicitly given */ + if(len < 0) + len = strlen(str); + + /* Allocate and fill the memory */ + buf = MALLOC(len + 1); + if(buf == NULL) + return -1; + + memcpy(buf, str, len); + ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ + FREEMEM(st->buf); + st->buf = (uint8_t *)buf; + st->size = len; + + return 0; +} + +OCTET_STRING_t * +OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + OCTET_STRING_t *st; + + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + if(st && str && OCTET_STRING_fromBuf(st, str, len)) { + FREEMEM(st); + st = NULL; + } + + return st; +} + diff --git a/src/core/libs/supl/asn-rrlp/OCTET_STRING.h b/src/core/libs/supl/asn-rrlp/OCTET_STRING.h new file mode 100644 index 000000000..8df9a182d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OCTET_STRING.h @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _OCTET_STRING_H_ +#define _OCTET_STRING_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OCTET_STRING { + uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */ + int size; /* Size of the buffer */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} OCTET_STRING_t; + +extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING; + +asn_struct_free_f OCTET_STRING_free; +asn_struct_print_f OCTET_STRING_print; +asn_struct_print_f OCTET_STRING_print_utf8; +ber_type_decoder_f OCTET_STRING_decode_ber; +der_type_encoder_f OCTET_STRING_encode_der; +xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */ +xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */ +xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */ +xer_type_encoder_f OCTET_STRING_encode_xer; +xer_type_encoder_f OCTET_STRING_encode_xer_utf8; +per_type_decoder_f OCTET_STRING_decode_uper; +per_type_encoder_f OCTET_STRING_encode_uper; + +/****************************** + * Handy conversion routines. * + ******************************/ + +/* + * This function clears the previous value of the OCTET STRING (if any) + * and then allocates a new memory with the specified content (str/size). + * If size = -1, the size of the original string will be determined + * using strlen(str). + * If str equals to NULL, the function will silently clear the + * current contents of the OCTET STRING. + * Returns 0 if it was possible to perform operation, -1 otherwise. + */ +int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size); + +/* Handy conversion from the C string into the OCTET STRING. */ +#define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1) + +/* + * Allocate and fill the new OCTET STRING and return a pointer to the newly + * allocated object. NULL is permitted in str: the function will just allocate + * empty OCTET STRING. + */ +OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, + const char *str, int size); + +/**************************** + * Internally useful stuff. * + ****************************/ + +typedef struct asn_OCTET_STRING_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the structure */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + enum asn_OS_Subvariant { + ASN_OSUBV_ANY, /* The open type (ANY) */ + ASN_OSUBV_BIT, /* BIT STRING */ + ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */ + ASN_OSUBV_U16, /* 16-bit character (BMPString) */ + ASN_OSUBV_U32 /* 32-bit character (UniversalString) */ + } subvariant; +} asn_OCTET_STRING_specifics_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _OCTET_STRING_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c new file mode 100644 index 000000000..5b2b79eda --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c @@ -0,0 +1,123 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-FirstSetMsrs.h" + +int +OTD_FirstSetMsrs_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_OTD_MeasurementWithID.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using OTD_MeasurementWithID, + * so here we adjust the DEF accordingly. + */ +static void +OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_OTD_MeasurementWithID.free_struct; + td->print_struct = asn_DEF_OTD_MeasurementWithID.print_struct; + td->ber_decoder = asn_DEF_OTD_MeasurementWithID.ber_decoder; + td->der_encoder = asn_DEF_OTD_MeasurementWithID.der_encoder; + td->xer_decoder = asn_DEF_OTD_MeasurementWithID.xer_decoder; + td->xer_encoder = asn_DEF_OTD_MeasurementWithID.xer_encoder; + td->uper_decoder = asn_DEF_OTD_MeasurementWithID.uper_decoder; + td->uper_encoder = asn_DEF_OTD_MeasurementWithID.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_OTD_MeasurementWithID.per_constraints; + td->elements = asn_DEF_OTD_MeasurementWithID.elements; + td->elements_count = asn_DEF_OTD_MeasurementWithID.elements_count; + td->specifics = asn_DEF_OTD_MeasurementWithID.specifics; +} + +void +OTD_FirstSetMsrs_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OTD_FirstSetMsrs_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OTD_FirstSetMsrs_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OTD_FirstSetMsrs_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OTD_FirstSetMsrs_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OTD_FirstSetMsrs_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +OTD_FirstSetMsrs_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +OTD_FirstSetMsrs_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static ber_tlv_tag_t asn_DEF_OTD_FirstSetMsrs_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OTD_FirstSetMsrs = { + "OTD-FirstSetMsrs", + "OTD-FirstSetMsrs", + OTD_FirstSetMsrs_free, + OTD_FirstSetMsrs_print, + OTD_FirstSetMsrs_constraint, + OTD_FirstSetMsrs_decode_ber, + OTD_FirstSetMsrs_encode_der, + OTD_FirstSetMsrs_decode_xer, + OTD_FirstSetMsrs_encode_xer, + OTD_FirstSetMsrs_decode_uper, + OTD_FirstSetMsrs_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_FirstSetMsrs_tags_1, + sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1) + /sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1[0]), /* 1 */ + asn_DEF_OTD_FirstSetMsrs_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1) + /sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h new file mode 100644 index 000000000..b5979dc51 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_FirstSetMsrs_H_ +#define _OTD_FirstSetMsrs_H_ + + +#include + +/* Including external dependencies */ +#include "OTD-MeasurementWithID.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTD-FirstSetMsrs */ +typedef OTD_MeasurementWithID_t OTD_FirstSetMsrs_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_FirstSetMsrs; +asn_struct_free_f OTD_FirstSetMsrs_free; +asn_struct_print_f OTD_FirstSetMsrs_print; +asn_constr_check_f OTD_FirstSetMsrs_constraint; +ber_type_decoder_f OTD_FirstSetMsrs_decode_ber; +der_type_encoder_f OTD_FirstSetMsrs_encode_der; +xer_type_decoder_f OTD_FirstSetMsrs_decode_xer; +xer_type_encoder_f OTD_FirstSetMsrs_encode_xer; +per_type_decoder_f OTD_FirstSetMsrs_decode_uper; +per_type_encoder_f OTD_FirstSetMsrs_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTD_FirstSetMsrs_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c new file mode 100644 index 000000000..52a6c7323 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c @@ -0,0 +1,141 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MeasureInfo-5-Ext.h" + +int +OTD_MeasureInfo_5_Ext_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* Determine the number of elements */ + size = _A_CSEQUENCE_FROM_VOID(sptr)->count; + + if((size >= 1 && size <= 2)) { + /* Perform validation of the inner elements */ + return td->check_constraints(td, sptr, ctfailcb, app_key); + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using SeqOfOTD_MsrElementRest, + * so here we adjust the DEF accordingly. + */ +static void +OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_SeqOfOTD_MsrElementRest.free_struct; + td->print_struct = asn_DEF_SeqOfOTD_MsrElementRest.print_struct; + td->ber_decoder = asn_DEF_SeqOfOTD_MsrElementRest.ber_decoder; + td->der_encoder = asn_DEF_SeqOfOTD_MsrElementRest.der_encoder; + td->xer_decoder = asn_DEF_SeqOfOTD_MsrElementRest.xer_decoder; + td->xer_encoder = asn_DEF_SeqOfOTD_MsrElementRest.xer_encoder; + td->uper_decoder = asn_DEF_SeqOfOTD_MsrElementRest.uper_decoder; + td->uper_encoder = asn_DEF_SeqOfOTD_MsrElementRest.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_SeqOfOTD_MsrElementRest.per_constraints; + td->elements = asn_DEF_SeqOfOTD_MsrElementRest.elements; + td->elements_count = asn_DEF_SeqOfOTD_MsrElementRest.elements_count; + td->specifics = asn_DEF_SeqOfOTD_MsrElementRest.specifics; +} + +void +OTD_MeasureInfo_5_Ext_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OTD_MeasureInfo_5_Ext_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OTD_MeasureInfo_5_Ext_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OTD_MeasureInfo_5_Ext_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OTD_MeasureInfo_5_Ext_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OTD_MeasureInfo_5_Ext_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +OTD_MeasureInfo_5_Ext_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +OTD_MeasureInfo_5_Ext_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static ber_tlv_tag_t asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_5_Ext = { + "OTD-MeasureInfo-5-Ext", + "OTD-MeasureInfo-5-Ext", + OTD_MeasureInfo_5_Ext_free, + OTD_MeasureInfo_5_Ext_print, + OTD_MeasureInfo_5_Ext_constraint, + OTD_MeasureInfo_5_Ext_decode_ber, + OTD_MeasureInfo_5_Ext_encode_der, + OTD_MeasureInfo_5_Ext_decode_xer, + OTD_MeasureInfo_5_Ext_encode_xer, + OTD_MeasureInfo_5_Ext_decode_uper, + OTD_MeasureInfo_5_Ext_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MeasureInfo_5_Ext_tags_1, + sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1) + /sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasureInfo_5_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1) + /sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h new file mode 100644 index 000000000..d75bc01a4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MeasureInfo_5_Ext_H_ +#define _OTD_MeasureInfo_5_Ext_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfOTD-MsrElementRest.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTD-MeasureInfo-5-Ext */ +typedef SeqOfOTD_MsrElementRest_t OTD_MeasureInfo_5_Ext_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_5_Ext; +asn_struct_free_f OTD_MeasureInfo_5_Ext_free; +asn_struct_print_f OTD_MeasureInfo_5_Ext_print; +asn_constr_check_f OTD_MeasureInfo_5_Ext_constraint; +ber_type_decoder_f OTD_MeasureInfo_5_Ext_decode_ber; +der_type_encoder_f OTD_MeasureInfo_5_Ext_encode_der; +xer_type_decoder_f OTD_MeasureInfo_5_Ext_decode_xer; +xer_type_encoder_f OTD_MeasureInfo_5_Ext_encode_xer; +per_type_decoder_f OTD_MeasureInfo_5_Ext_decode_uper; +per_type_encoder_f OTD_MeasureInfo_5_Ext_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTD_MeasureInfo_5_Ext_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c new file mode 100644 index 000000000..6b6b6c73f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MeasureInfo-R98-Ext.h" + +static asn_TYPE_member_t asn_MBR_OTD_MeasureInfo_R98_Ext_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasureInfo_R98_Ext, otdMsrFirstSets_R98_Ext), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MsrElementFirst_R98_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otdMsrFirstSets-R98-Ext" + }, +}; +static ber_tlv_tag_t asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MeasureInfo_R98_Ext_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* otdMsrFirstSets-R98-Ext at 974 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_MeasureInfo_R98_Ext_specs_1 = { + sizeof(struct OTD_MeasureInfo_R98_Ext), + offsetof(struct OTD_MeasureInfo_R98_Ext, _asn_ctx), + asn_MAP_OTD_MeasureInfo_R98_Ext_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_R98_Ext = { + "OTD-MeasureInfo-R98-Ext", + "OTD-MeasureInfo-R98-Ext", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1, + sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1) + /sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1) + /sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_MeasureInfo_R98_Ext_1, + 1, /* Elements count */ + &asn_SPC_OTD_MeasureInfo_R98_Ext_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h new file mode 100644 index 000000000..40f15a992 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MeasureInfo_R98_Ext_H_ +#define _OTD_MeasureInfo_R98_Ext_H_ + + +#include + +/* Including external dependencies */ +#include "OTD-MsrElementFirst-R98-Ext.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTD-MeasureInfo-R98-Ext */ +typedef struct OTD_MeasureInfo_R98_Ext { + OTD_MsrElementFirst_R98_Ext_t otdMsrFirstSets_R98_Ext; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MeasureInfo_R98_Ext_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_R98_Ext; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTD_MeasureInfo_R98_Ext_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c new file mode 100644 index 000000000..09f8cc1fd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MeasureInfo.h" + +static asn_TYPE_member_t asn_MBR_OTD_MeasureInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasureInfo, otdMsrFirstSets), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MsrElementFirst, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otdMsrFirstSets" + }, + { ATF_POINTER, 1, offsetof(struct OTD_MeasureInfo, otdMsrRestSets), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_MsrElementRest, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otdMsrRestSets" + }, +}; +static int asn_MAP_OTD_MeasureInfo_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_OTD_MeasureInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MeasureInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* otdMsrFirstSets at 323 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* otdMsrRestSets at 327 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_MeasureInfo_specs_1 = { + sizeof(struct OTD_MeasureInfo), + offsetof(struct OTD_MeasureInfo, _asn_ctx), + asn_MAP_OTD_MeasureInfo_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_OTD_MeasureInfo_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo = { + "OTD-MeasureInfo", + "OTD-MeasureInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MeasureInfo_tags_1, + sizeof(asn_DEF_OTD_MeasureInfo_tags_1) + /sizeof(asn_DEF_OTD_MeasureInfo_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasureInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasureInfo_tags_1) + /sizeof(asn_DEF_OTD_MeasureInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_MeasureInfo_1, + 2, /* Elements count */ + &asn_SPC_OTD_MeasureInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h new file mode 100644 index 000000000..8ee559573 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MeasureInfo_H_ +#define _OTD_MeasureInfo_H_ + + +#include + +/* Including external dependencies */ +#include "OTD-MsrElementFirst.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SeqOfOTD_MsrElementRest; + +/* OTD-MeasureInfo */ +typedef struct OTD_MeasureInfo { + OTD_MsrElementFirst_t otdMsrFirstSets; + struct SeqOfOTD_MsrElementRest *otdMsrRestSets /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MeasureInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SeqOfOTD-MsrElementRest.h" + +#endif /* _OTD_MeasureInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-Measurement.c b/src/core/libs/supl/asn-rrlp/OTD-Measurement.c new file mode 100644 index 000000000..eb3dfcd3c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-Measurement.c @@ -0,0 +1,79 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-Measurement.h" + +static asn_TYPE_member_t asn_MBR_OTD_Measurement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, nborTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "nborTimeSlot" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, eotdQuality), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_EOTDQuality, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "eotdQuality" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, otdValue), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTDValue, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otdValue" + }, +}; +static ber_tlv_tag_t asn_DEF_OTD_Measurement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_Measurement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nborTimeSlot at 379 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* eotdQuality at 380 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* otdValue at 382 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_Measurement_specs_1 = { + sizeof(struct OTD_Measurement), + offsetof(struct OTD_Measurement, _asn_ctx), + asn_MAP_OTD_Measurement_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_Measurement = { + "OTD-Measurement", + "OTD-Measurement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_Measurement_tags_1, + sizeof(asn_DEF_OTD_Measurement_tags_1) + /sizeof(asn_DEF_OTD_Measurement_tags_1[0]), /* 1 */ + asn_DEF_OTD_Measurement_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_Measurement_tags_1) + /sizeof(asn_DEF_OTD_Measurement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_Measurement_1, + 3, /* Elements count */ + &asn_SPC_OTD_Measurement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-Measurement.h b/src/core/libs/supl/asn-rrlp/OTD-Measurement.h new file mode 100644 index 000000000..78c8b4a5b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-Measurement.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_Measurement_H_ +#define _OTD_Measurement_H_ + + +#include + +/* Including external dependencies */ +#include "ModuloTimeSlot.h" +#include "EOTDQuality.h" +#include "OTDValue.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTD-Measurement */ +typedef struct OTD_Measurement { + ModuloTimeSlot_t nborTimeSlot; + EOTDQuality_t eotdQuality; + OTDValue_t otdValue; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_Measurement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_Measurement; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTD_Measurement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c new file mode 100644 index 000000000..2d23dae79 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c @@ -0,0 +1,89 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MeasurementWithID.h" + +static asn_TYPE_member_t asn_MBR_OTD_MeasurementWithID_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, neighborIdentity), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_NeighborIdentity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "neighborIdentity" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, nborTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "nborTimeSlot" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, eotdQuality), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_EOTDQuality, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "eotdQuality" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, otdValue), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTDValue, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otdValue" + }, +}; +static ber_tlv_tag_t asn_DEF_OTD_MeasurementWithID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MeasurementWithID_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* neighborIdentity at 386 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nborTimeSlot at 387 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* eotdQuality at 388 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* otdValue at 390 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_MeasurementWithID_specs_1 = { + sizeof(struct OTD_MeasurementWithID), + offsetof(struct OTD_MeasurementWithID, _asn_ctx), + asn_MAP_OTD_MeasurementWithID_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MeasurementWithID = { + "OTD-MeasurementWithID", + "OTD-MeasurementWithID", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MeasurementWithID_tags_1, + sizeof(asn_DEF_OTD_MeasurementWithID_tags_1) + /sizeof(asn_DEF_OTD_MeasurementWithID_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasurementWithID_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasurementWithID_tags_1) + /sizeof(asn_DEF_OTD_MeasurementWithID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_MeasurementWithID_1, + 4, /* Elements count */ + &asn_SPC_OTD_MeasurementWithID_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h new file mode 100644 index 000000000..03944b046 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MeasurementWithID_H_ +#define _OTD_MeasurementWithID_H_ + + +#include + +/* Including external dependencies */ +#include "NeighborIdentity.h" +#include "ModuloTimeSlot.h" +#include "EOTDQuality.h" +#include "OTDValue.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTD-MeasurementWithID */ +typedef struct OTD_MeasurementWithID { + NeighborIdentity_t neighborIdentity; + ModuloTimeSlot_t nborTimeSlot; + EOTDQuality_t eotdQuality; + OTDValue_t otdValue; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MeasurementWithID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MeasurementWithID; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTD_MeasurementWithID_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c new file mode 100644 index 000000000..1acef169f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MsrElementFirst-R98-Ext.h" + +static asn_TYPE_member_t asn_MBR_OTD_MsrElementFirst_R98_Ext_1[] = { + { ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst_R98_Ext, otd_FirstSetMsrs_R98_Ext), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otd-FirstSetMsrs-R98-Ext" + }, +}; +static int asn_MAP_OTD_MsrElementFirst_R98_Ext_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MsrElementFirst_R98_Ext_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* otd-FirstSetMsrs-R98-Ext at 979 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_MsrElementFirst_R98_Ext_specs_1 = { + sizeof(struct OTD_MsrElementFirst_R98_Ext), + offsetof(struct OTD_MsrElementFirst_R98_Ext, _asn_ctx), + asn_MAP_OTD_MsrElementFirst_R98_Ext_tag2el_1, + 1, /* Count of tags in the map */ + asn_MAP_OTD_MsrElementFirst_R98_Ext_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst_R98_Ext = { + "OTD-MsrElementFirst-R98-Ext", + "OTD-MsrElementFirst-R98-Ext", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1, + sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1) + /sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[0]), /* 1 */ + asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1) + /sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_MsrElementFirst_R98_Ext_1, + 1, /* Elements count */ + &asn_SPC_OTD_MsrElementFirst_R98_Ext_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h new file mode 100644 index 000000000..6c372026d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MsrElementFirst_R98_Ext_H_ +#define _OTD_MsrElementFirst_R98_Ext_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SeqOfOTD_FirstSetMsrs_R98_Ext; + +/* OTD-MsrElementFirst-R98-Ext */ +typedef struct OTD_MsrElementFirst_R98_Ext { + struct SeqOfOTD_FirstSetMsrs_R98_Ext *otd_FirstSetMsrs_R98_Ext /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MsrElementFirst_R98_Ext_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst_R98_Ext; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SeqOfOTD-FirstSetMsrs-R98-Ext.h" + +#endif /* _OTD_MsrElementFirst_R98_Ext_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c new file mode 100644 index 000000000..5a55a2d96 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c @@ -0,0 +1,171 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MsrElementFirst.h" + +static int +memb_refFrameNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 42431)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_taCorrection_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 960)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refFrameNumber_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 42431 } /* (0..42431) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_taCorrection_constr_6 = { + { APC_CONSTRAINED, 10, 10, 0, 960 } /* (0..960) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_OTD_MsrElementFirst_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, refFrameNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refFrameNumber_constraint_1, + &asn_PER_memb_refFrameNumber_constr_2, + 0, + "refFrameNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, referenceTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceTimeSlot" + }, + { ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst, toaMeasurementsOfRef), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TOA_MeasurementsOfRef, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "toaMeasurementsOfRef" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, stdResolution), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_StdResolution, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "stdResolution" + }, + { ATF_POINTER, 2, offsetof(struct OTD_MsrElementFirst, taCorrection), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_taCorrection_constraint_1, + &asn_PER_memb_taCorrection_constr_6, + 0, + "taCorrection" + }, + { ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst, otd_FirstSetMsrs), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_FirstSetMsrs, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otd-FirstSetMsrs" + }, +}; +static int asn_MAP_OTD_MsrElementFirst_oms_1[] = { 2, 4, 5 }; +static ber_tlv_tag_t asn_DEF_OTD_MsrElementFirst_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MsrElementFirst_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrameNumber at 334 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceTimeSlot at 335 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toaMeasurementsOfRef at 336 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* stdResolution at 337 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* taCorrection at 338 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* otd-FirstSetMsrs at 341 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_MsrElementFirst_specs_1 = { + sizeof(struct OTD_MsrElementFirst), + offsetof(struct OTD_MsrElementFirst, _asn_ctx), + asn_MAP_OTD_MsrElementFirst_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_OTD_MsrElementFirst_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst = { + "OTD-MsrElementFirst", + "OTD-MsrElementFirst", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MsrElementFirst_tags_1, + sizeof(asn_DEF_OTD_MsrElementFirst_tags_1) + /sizeof(asn_DEF_OTD_MsrElementFirst_tags_1[0]), /* 1 */ + asn_DEF_OTD_MsrElementFirst_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MsrElementFirst_tags_1) + /sizeof(asn_DEF_OTD_MsrElementFirst_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_MsrElementFirst_1, + 6, /* Elements count */ + &asn_SPC_OTD_MsrElementFirst_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h new file mode 100644 index 000000000..b08cce911 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MsrElementFirst_H_ +#define _OTD_MsrElementFirst_H_ + + +#include + +/* Including external dependencies */ +#include +#include "ModuloTimeSlot.h" +#include "StdResolution.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct TOA_MeasurementsOfRef; +struct SeqOfOTD_FirstSetMsrs; + +/* OTD-MsrElementFirst */ +typedef struct OTD_MsrElementFirst { + long refFrameNumber; + ModuloTimeSlot_t referenceTimeSlot; + struct TOA_MeasurementsOfRef *toaMeasurementsOfRef /* OPTIONAL */; + StdResolution_t stdResolution; + long *taCorrection /* OPTIONAL */; + struct SeqOfOTD_FirstSetMsrs *otd_FirstSetMsrs /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MsrElementFirst_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "TOA-MeasurementsOfRef.h" +#include "SeqOfOTD-FirstSetMsrs.h" + +#endif /* _OTD_MsrElementFirst_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c new file mode 100644 index 000000000..d779dab1d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c @@ -0,0 +1,171 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MsrElementRest.h" + +static int +memb_refFrameNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 42431)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_taCorrection_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 960)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refFrameNumber_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 42431 } /* (0..42431) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_taCorrection_constr_6 = { + { APC_CONSTRAINED, 10, 10, 0, 960 } /* (0..960) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_OTD_MsrElementRest_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, refFrameNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refFrameNumber_constraint_1, + &asn_PER_memb_refFrameNumber_constr_2, + 0, + "refFrameNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, referenceTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceTimeSlot" + }, + { ATF_POINTER, 1, offsetof(struct OTD_MsrElementRest, toaMeasurementsOfRef), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TOA_MeasurementsOfRef, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "toaMeasurementsOfRef" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, stdResolution), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_StdResolution, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "stdResolution" + }, + { ATF_POINTER, 2, offsetof(struct OTD_MsrElementRest, taCorrection), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_taCorrection_constraint_1, + &asn_PER_memb_taCorrection_constr_6, + 0, + "taCorrection" + }, + { ATF_POINTER, 1, offsetof(struct OTD_MsrElementRest, otd_MsrsOfOtherSets), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_MsrsOfOtherSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otd-MsrsOfOtherSets" + }, +}; +static int asn_MAP_OTD_MsrElementRest_oms_1[] = { 2, 4, 5 }; +static ber_tlv_tag_t asn_DEF_OTD_MsrElementRest_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MsrElementRest_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrameNumber at 347 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceTimeSlot at 348 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toaMeasurementsOfRef at 349 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* stdResolution at 350 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* taCorrection at 351 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* otd-MsrsOfOtherSets at 354 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_OTD_MsrElementRest_specs_1 = { + sizeof(struct OTD_MsrElementRest), + offsetof(struct OTD_MsrElementRest, _asn_ctx), + asn_MAP_OTD_MsrElementRest_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_OTD_MsrElementRest_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementRest = { + "OTD-MsrElementRest", + "OTD-MsrElementRest", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTD_MsrElementRest_tags_1, + sizeof(asn_DEF_OTD_MsrElementRest_tags_1) + /sizeof(asn_DEF_OTD_MsrElementRest_tags_1[0]), /* 1 */ + asn_DEF_OTD_MsrElementRest_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MsrElementRest_tags_1) + /sizeof(asn_DEF_OTD_MsrElementRest_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_OTD_MsrElementRest_1, + 6, /* Elements count */ + &asn_SPC_OTD_MsrElementRest_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h new file mode 100644 index 000000000..a87a3c7fb --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MsrElementRest_H_ +#define _OTD_MsrElementRest_H_ + + +#include + +/* Including external dependencies */ +#include +#include "ModuloTimeSlot.h" +#include "StdResolution.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct TOA_MeasurementsOfRef; +struct SeqOfOTD_MsrsOfOtherSets; + +/* OTD-MsrElementRest */ +typedef struct OTD_MsrElementRest { + long refFrameNumber; + ModuloTimeSlot_t referenceTimeSlot; + struct TOA_MeasurementsOfRef *toaMeasurementsOfRef /* OPTIONAL */; + StdResolution_t stdResolution; + long *taCorrection /* OPTIONAL */; + struct SeqOfOTD_MsrsOfOtherSets *otd_MsrsOfOtherSets /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MsrElementRest_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementRest; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "TOA-MeasurementsOfRef.h" +#include "SeqOfOTD-MsrsOfOtherSets.h" + +#endif /* _OTD_MsrElementRest_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c new file mode 100644 index 000000000..a331cc268 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTD-MsrsOfOtherSets.h" + +static asn_per_constraints_t asn_PER_type_OTD_MsrsOfOtherSets_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_OTD_MsrsOfOtherSets_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrsOfOtherSets, choice.identityNotPresent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_Measurement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "identityNotPresent" + }, + { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrsOfOtherSets, choice.identityPresent), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasurementWithID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "identityPresent" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_OTD_MsrsOfOtherSets_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* identityNotPresent at 372 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* identityPresent at 374 */ +}; +static asn_CHOICE_specifics_t asn_SPC_OTD_MsrsOfOtherSets_specs_1 = { + sizeof(struct OTD_MsrsOfOtherSets), + offsetof(struct OTD_MsrsOfOtherSets, _asn_ctx), + offsetof(struct OTD_MsrsOfOtherSets, present), + sizeof(((struct OTD_MsrsOfOtherSets *)0)->present), + asn_MAP_OTD_MsrsOfOtherSets_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_OTD_MsrsOfOtherSets = { + "OTD-MsrsOfOtherSets", + "OTD-MsrsOfOtherSets", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_OTD_MsrsOfOtherSets_constr_1, + asn_MBR_OTD_MsrsOfOtherSets_1, + 2, /* Elements count */ + &asn_SPC_OTD_MsrsOfOtherSets_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h new file mode 100644 index 000000000..ec2efd3a2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTD_MsrsOfOtherSets_H_ +#define _OTD_MsrsOfOtherSets_H_ + + +#include + +/* Including external dependencies */ +#include "OTD-Measurement.h" +#include "OTD-MeasurementWithID.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum OTD_MsrsOfOtherSets_PR { + OTD_MsrsOfOtherSets_PR_NOTHING, /* No components present */ + OTD_MsrsOfOtherSets_PR_identityNotPresent, + OTD_MsrsOfOtherSets_PR_identityPresent +} OTD_MsrsOfOtherSets_PR; + +/* OTD-MsrsOfOtherSets */ +typedef struct OTD_MsrsOfOtherSets { + OTD_MsrsOfOtherSets_PR present; + union OTD_MsrsOfOtherSets_u { + OTD_Measurement_t identityNotPresent; + OTD_MeasurementWithID_t identityPresent; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} OTD_MsrsOfOtherSets_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTD_MsrsOfOtherSets; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTD_MsrsOfOtherSets_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/OTDValue.c b/src/core/libs/supl/asn-rrlp/OTDValue.c new file mode 100644 index 000000000..28ae50d85 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTDValue.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "OTDValue.h" + +int +OTDValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 39999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +OTDValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +OTDValue_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + OTDValue_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +OTDValue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +OTDValue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +OTDValue_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +OTDValue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +OTDValue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +OTDValue_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +OTDValue_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OTDValue_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_OTDValue_constr_1 = { + { APC_CONSTRAINED, 16, 16, 0, 39999 } /* (0..39999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_OTDValue_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_OTDValue = { + "OTDValue", + "OTDValue", + OTDValue_free, + OTDValue_print, + OTDValue_constraint, + OTDValue_decode_ber, + OTDValue_encode_der, + OTDValue_decode_xer, + OTDValue_encode_xer, + OTDValue_decode_uper, + OTDValue_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OTDValue_tags_1, + sizeof(asn_DEF_OTDValue_tags_1) + /sizeof(asn_DEF_OTDValue_tags_1[0]), /* 1 */ + asn_DEF_OTDValue_tags_1, /* Same as above */ + sizeof(asn_DEF_OTDValue_tags_1) + /sizeof(asn_DEF_OTDValue_tags_1[0]), /* 1 */ + &asn_PER_type_OTDValue_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/OTDValue.h b/src/core/libs/supl/asn-rrlp/OTDValue.h new file mode 100644 index 000000000..39fc8a9d3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/OTDValue.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _OTDValue_H_ +#define _OTDValue_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTDValue */ +typedef long OTDValue_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_OTDValue; +asn_struct_free_f OTDValue_free; +asn_struct_print_f OTDValue_print; +asn_constr_check_f OTDValue_constraint; +ber_type_decoder_f OTDValue_decode_ber; +der_type_encoder_f OTDValue_encode_der; +xer_type_decoder_f OTDValue_decode_xer; +xer_type_encoder_f OTDValue_encode_xer; +per_type_decoder_f OTDValue_decode_uper; +per_type_encoder_f OTDValue_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _OTDValue_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/PDU.c b/src/core/libs/supl/asn-rrlp/PDU.c new file mode 100644 index 000000000..ae0cceeed --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PDU.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Messages" + * found in "../rrlp-messages.asn" + */ + +#include "PDU.h" + +static int +memb_referenceNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_referenceNumber_constr_2 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_PDU_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PDU, referenceNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_referenceNumber_constraint_1, + &asn_PER_memb_referenceNumber_constr_2, + 0, + "referenceNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct PDU, component), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_RRLP_Component, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "component" + }, +}; +static ber_tlv_tag_t asn_DEF_PDU_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceNumber at 16 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* component at 18 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = { + sizeof(struct PDU), + offsetof(struct PDU, _asn_ctx), + asn_MAP_PDU_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PDU = { + "PDU", + "PDU", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PDU_tags_1, + sizeof(asn_DEF_PDU_tags_1) + /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ + asn_DEF_PDU_tags_1, /* Same as above */ + sizeof(asn_DEF_PDU_tags_1) + /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PDU_1, + 2, /* Elements count */ + &asn_SPC_PDU_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/PDU.h b/src/core/libs/supl/asn-rrlp/PDU.h new file mode 100644 index 000000000..e73e9958a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PDU.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Messages" + * found in "../rrlp-messages.asn" + */ + +#ifndef _PDU_H_ +#define _PDU_H_ + + +#include + +/* Including external dependencies */ +#include +#include "RRLP-Component.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PDU */ +typedef struct PDU { + long referenceNumber; + RRLP_Component_t component; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PDU_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* _PDU_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/PositionData.c b/src/core/libs/supl/asn-rrlp/PositionData.c new file mode 100644 index 000000000..7f53011b8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PositionData.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "PositionData.h" + +int +PositionData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size >= 3 && size <= 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +PositionData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +PositionData_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + PositionData_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +PositionData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +PositionData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +PositionData_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +PositionData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +PositionData_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +PositionData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +PositionData_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PositionData_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_PositionData_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 3, 16 } /* (SIZE(3..16)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_PositionData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_PositionData = { + "PositionData", + "PositionData", + PositionData_free, + PositionData_print, + PositionData_constraint, + PositionData_decode_ber, + PositionData_encode_der, + PositionData_decode_xer, + PositionData_encode_xer, + PositionData_decode_uper, + PositionData_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PositionData_tags_1, + sizeof(asn_DEF_PositionData_tags_1) + /sizeof(asn_DEF_PositionData_tags_1[0]), /* 1 */ + asn_DEF_PositionData_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionData_tags_1) + /sizeof(asn_DEF_PositionData_tags_1[0]), /* 1 */ + &asn_PER_type_PositionData_constr_1, + 0, 0, /* Defined elsewhere */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/PositionData.h b/src/core/libs/supl/asn-rrlp/PositionData.h new file mode 100644 index 000000000..fddb87bcd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PositionData.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _PositionData_H_ +#define _PositionData_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PositionData { + PositionData_e_otd = 0, + PositionData_gps = 1, + PositionData_galileo = 2 +} e_PositionData; + +/* PositionData */ +typedef BIT_STRING_t PositionData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PositionData; +asn_struct_free_f PositionData_free; +asn_struct_print_f PositionData_print; +asn_constr_check_f PositionData_constraint; +ber_type_decoder_f PositionData_decode_ber; +der_type_encoder_f PositionData_encode_der; +xer_type_decoder_f PositionData_decode_xer; +xer_type_encoder_f PositionData_encode_xer; +per_type_decoder_f PositionData_decode_uper; +per_type_encoder_f PositionData_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _PositionData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/PositionInstruct.c b/src/core/libs/supl/asn-rrlp/PositionInstruct.c new file mode 100644 index 000000000..473b09612 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PositionInstruct.c @@ -0,0 +1,101 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "PositionInstruct.h" + +static asn_TYPE_member_t asn_MBR_PositionInstruct_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, methodType), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_MethodType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "methodType" + }, + { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, positionMethod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "positionMethod" + }, + { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, measureResponseTime), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MeasureResponseTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "measureResponseTime" + }, + { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, useMultipleSets), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UseMultipleSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "useMultipleSets" + }, + { ATF_POINTER, 1, offsetof(struct PositionInstruct, environmentCharacter), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_EnvironmentCharacter, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "environmentCharacter" + }, +}; +static int asn_MAP_PositionInstruct_oms_1[] = { 4 }; +static ber_tlv_tag_t asn_DEF_PositionInstruct_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PositionInstruct_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* methodType at 108 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* positionMethod at 109 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* measureResponseTime at 110 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* useMultipleSets at 111 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* environmentCharacter at 112 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PositionInstruct_specs_1 = { + sizeof(struct PositionInstruct), + offsetof(struct PositionInstruct, _asn_ctx), + asn_MAP_PositionInstruct_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_PositionInstruct_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PositionInstruct = { + "PositionInstruct", + "PositionInstruct", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PositionInstruct_tags_1, + sizeof(asn_DEF_PositionInstruct_tags_1) + /sizeof(asn_DEF_PositionInstruct_tags_1[0]), /* 1 */ + asn_DEF_PositionInstruct_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionInstruct_tags_1) + /sizeof(asn_DEF_PositionInstruct_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PositionInstruct_1, + 5, /* Elements count */ + &asn_SPC_PositionInstruct_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/PositionInstruct.h b/src/core/libs/supl/asn-rrlp/PositionInstruct.h new file mode 100644 index 000000000..43119ef57 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PositionInstruct.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _PositionInstruct_H_ +#define _PositionInstruct_H_ + + +#include + +/* Including external dependencies */ +#include "MethodType.h" +#include "PositionMethod.h" +#include "MeasureResponseTime.h" +#include "UseMultipleSets.h" +#include "EnvironmentCharacter.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PositionInstruct */ +typedef struct PositionInstruct { + MethodType_t methodType; + PositionMethod_t positionMethod; + MeasureResponseTime_t measureResponseTime; + UseMultipleSets_t useMultipleSets; + EnvironmentCharacter_t *environmentCharacter /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PositionInstruct_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PositionInstruct; + +#ifdef __cplusplus +} +#endif + +#endif /* _PositionInstruct_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/PositionMethod.c b/src/core/libs/supl/asn-rrlp/PositionMethod.c new file mode 100644 index 000000000..07e07f2a3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PositionMethod.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "PositionMethod.h" + +int +PositionMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +PositionMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +PositionMethod_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + PositionMethod_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +PositionMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +PositionMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +PositionMethod_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +PositionMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +PositionMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +PositionMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +PositionMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PositionMethod_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_PositionMethod_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_PositionMethod_value2enum_1[] = { + { 0, 4, "eotd" }, + { 1, 3, "gps" }, + { 2, 9, "gpsOrEOTD" } +}; +static unsigned int asn_MAP_PositionMethod_enum2value_1[] = { + 0, /* eotd(0) */ + 1, /* gps(1) */ + 2 /* gpsOrEOTD(2) */ +}; +static asn_INTEGER_specifics_t asn_SPC_PositionMethod_specs_1 = { + asn_MAP_PositionMethod_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PositionMethod_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_PositionMethod_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_PositionMethod = { + "PositionMethod", + "PositionMethod", + PositionMethod_free, + PositionMethod_print, + PositionMethod_constraint, + PositionMethod_decode_ber, + PositionMethod_encode_der, + PositionMethod_decode_xer, + PositionMethod_encode_xer, + PositionMethod_decode_uper, + PositionMethod_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PositionMethod_tags_1, + sizeof(asn_DEF_PositionMethod_tags_1) + /sizeof(asn_DEF_PositionMethod_tags_1[0]), /* 1 */ + asn_DEF_PositionMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionMethod_tags_1) + /sizeof(asn_DEF_PositionMethod_tags_1[0]), /* 1 */ + &asn_PER_type_PositionMethod_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_PositionMethod_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/PositionMethod.h b/src/core/libs/supl/asn-rrlp/PositionMethod.h new file mode 100644 index 000000000..82e88091d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/PositionMethod.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _PositionMethod_H_ +#define _PositionMethod_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PositionMethod { + PositionMethod_eotd = 0, + PositionMethod_gps = 1, + PositionMethod_gpsOrEOTD = 2 +} e_PositionMethod; + +/* PositionMethod */ +typedef ENUMERATED_t PositionMethod_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PositionMethod; +asn_struct_free_f PositionMethod_free; +asn_struct_print_f PositionMethod_print; +asn_constr_check_f PositionMethod_constraint; +ber_type_decoder_f PositionMethod_decode_ber; +der_type_encoder_f PositionMethod_encode_der; +xer_type_decoder_f PositionMethod_decode_xer; +xer_type_encoder_f PositionMethod_encode_xer; +per_type_decoder_f PositionMethod_decode_uper; +per_type_encoder_f PositionMethod_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _PositionMethod_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ProtocolError.c b/src/core/libs/supl/asn-rrlp/ProtocolError.c new file mode 100644 index 000000000..dce79738d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ProtocolError.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ProtocolError.h" + +static asn_TYPE_member_t asn_MBR_ProtocolError_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ProtocolError, errorCause), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ErrorCodes, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "errorCause" + }, + { ATF_POINTER, 2, offsetof(struct ProtocolError, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extensionContainer" + }, + { ATF_POINTER, 1, offsetof(struct ProtocolError, rel_5_ProtocolError_Extension), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel_5_ProtocolError_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel-5-ProtocolError-Extension" + }, +}; +static int asn_MAP_ProtocolError_oms_1[] = { 1, 2 }; +static ber_tlv_tag_t asn_DEF_ProtocolError_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ProtocolError_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* errorCause at 96 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* extensionContainer at 97 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rel-5-ProtocolError-Extension at 100 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ProtocolError_specs_1 = { + sizeof(struct ProtocolError), + offsetof(struct ProtocolError, _asn_ctx), + asn_MAP_ProtocolError_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_ProtocolError_oms_1, /* Optional members */ + 1, 1, /* Root/Additions */ + 1, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ProtocolError = { + "ProtocolError", + "ProtocolError", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ProtocolError_tags_1, + sizeof(asn_DEF_ProtocolError_tags_1) + /sizeof(asn_DEF_ProtocolError_tags_1[0]), /* 1 */ + asn_DEF_ProtocolError_tags_1, /* Same as above */ + sizeof(asn_DEF_ProtocolError_tags_1) + /sizeof(asn_DEF_ProtocolError_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ProtocolError_1, + 3, /* Elements count */ + &asn_SPC_ProtocolError_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ProtocolError.h b/src/core/libs/supl/asn-rrlp/ProtocolError.h new file mode 100644 index 000000000..00a94c40f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ProtocolError.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ProtocolError_H_ +#define _ProtocolError_H_ + + +#include + +/* Including external dependencies */ +#include "ErrorCodes.h" +#include "ExtensionContainer.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Rel_5_ProtocolError_Extension; + +/* ProtocolError */ +typedef struct ProtocolError { + ErrorCodes_t errorCause; + ExtensionContainer_t *extensionContainer /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + struct Rel_5_ProtocolError_Extension *rel_5_ProtocolError_Extension /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ProtocolError_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ProtocolError; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Rel-5-ProtocolError-Extension.h" + +#endif /* _ProtocolError_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RRLP-Component.c b/src/core/libs/supl/asn-rrlp/RRLP-Component.c new file mode 100644 index 000000000..e587f7de4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RRLP-Component.c @@ -0,0 +1,100 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Messages" + * found in "../rrlp-messages.asn" + */ + +#include "RRLP-Component.h" + +static asn_per_constraints_t asn_PER_type_RRLP_Component_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4 } /* (0..4,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_RRLP_Component_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.msrPositionReq), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrPosition_Req, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrPositionReq" + }, + { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.msrPositionRsp), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrPosition_Rsp, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrPositionRsp" + }, + { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.assistanceData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "assistanceData" + }, + { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.assistanceDataAck), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "assistanceDataAck" + }, + { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.protocolError), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ProtocolError, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "protocolError" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_RRLP_Component_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msrPositionReq at 21 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msrPositionRsp at 22 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* assistanceData at 23 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* assistanceDataAck at 24 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* protocolError at 25 */ +}; +static asn_CHOICE_specifics_t asn_SPC_RRLP_Component_specs_1 = { + sizeof(struct RRLP_Component), + offsetof(struct RRLP_Component, _asn_ctx), + offsetof(struct RRLP_Component, present), + sizeof(((struct RRLP_Component *)0)->present), + asn_MAP_RRLP_Component_tag2el_1, + 5, /* Count of tags in the map */ + 0, + 5 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_RRLP_Component = { + "RRLP-Component", + "RRLP-Component", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_RRLP_Component_constr_1, + asn_MBR_RRLP_Component_1, + 5, /* Elements count */ + &asn_SPC_RRLP_Component_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RRLP-Component.h b/src/core/libs/supl/asn-rrlp/RRLP-Component.h new file mode 100644 index 000000000..021f54a4f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RRLP-Component.h @@ -0,0 +1,64 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Messages" + * found in "../rrlp-messages.asn" + */ + +#ifndef _RRLP_Component_H_ +#define _RRLP_Component_H_ + + +#include + +/* Including external dependencies */ +#include "MsrPosition-Req.h" +#include "MsrPosition-Rsp.h" +#include "AssistanceData.h" +#include +#include "ProtocolError.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum RRLP_Component_PR { + RRLP_Component_PR_NOTHING, /* No components present */ + RRLP_Component_PR_msrPositionReq, + RRLP_Component_PR_msrPositionRsp, + RRLP_Component_PR_assistanceData, + RRLP_Component_PR_assistanceDataAck, + RRLP_Component_PR_protocolError, + /* Extensions may appear below */ + +} RRLP_Component_PR; + +/* RRLP-Component */ +typedef struct RRLP_Component { + RRLP_Component_PR present; + union RRLP_Component_u { + MsrPosition_Req_t msrPositionReq; + MsrPosition_Rsp_t msrPositionRsp; + AssistanceData_t assistanceData; + NULL_t assistanceDataAck; + ProtocolError_t protocolError; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} RRLP_Component_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RRLP_Component; + +#ifdef __cplusplus +} +#endif + +#endif /* _RRLP_Component_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RefLocation.c b/src/core/libs/supl/asn-rrlp/RefLocation.c new file mode 100644 index 000000000..c08ab64fd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RefLocation.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RefLocation.h" + +static asn_TYPE_member_t asn_MBR_RefLocation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RefLocation, threeDLocation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "threeDLocation" + }, +}; +static ber_tlv_tag_t asn_DEF_RefLocation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_RefLocation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* threeDLocation at 650 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_RefLocation_specs_1 = { + sizeof(struct RefLocation), + offsetof(struct RefLocation, _asn_ctx), + asn_MAP_RefLocation_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_RefLocation = { + "RefLocation", + "RefLocation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RefLocation_tags_1, + sizeof(asn_DEF_RefLocation_tags_1) + /sizeof(asn_DEF_RefLocation_tags_1[0]), /* 1 */ + asn_DEF_RefLocation_tags_1, /* Same as above */ + sizeof(asn_DEF_RefLocation_tags_1) + /sizeof(asn_DEF_RefLocation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_RefLocation_1, + 1, /* Elements count */ + &asn_SPC_RefLocation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RefLocation.h b/src/core/libs/supl/asn-rrlp/RefLocation.h new file mode 100644 index 000000000..0a0849c58 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RefLocation.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RefLocation_H_ +#define _RefLocation_H_ + + +#include + +/* Including external dependencies */ +#include "Ext-GeographicalInformation.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RefLocation */ +typedef struct RefLocation { + Ext_GeographicalInformation_t threeDLocation; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} RefLocation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RefLocation; + +#ifdef __cplusplus +} +#endif + +#endif /* _RefLocation_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RefQuality.c b/src/core/libs/supl/asn-rrlp/RefQuality.c new file mode 100644 index 000000000..f64877ef4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RefQuality.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RefQuality.h" + +int +RefQuality_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +RefQuality_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +RefQuality_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + RefQuality_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +RefQuality_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +RefQuality_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +RefQuality_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +RefQuality_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +RefQuality_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +RefQuality_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +RefQuality_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + RefQuality_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_RefQuality_constr_1 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_RefQuality_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RefQuality = { + "RefQuality", + "RefQuality", + RefQuality_free, + RefQuality_print, + RefQuality_constraint, + RefQuality_decode_ber, + RefQuality_encode_der, + RefQuality_decode_xer, + RefQuality_encode_xer, + RefQuality_decode_uper, + RefQuality_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RefQuality_tags_1, + sizeof(asn_DEF_RefQuality_tags_1) + /sizeof(asn_DEF_RefQuality_tags_1[0]), /* 1 */ + asn_DEF_RefQuality_tags_1, /* Same as above */ + sizeof(asn_DEF_RefQuality_tags_1) + /sizeof(asn_DEF_RefQuality_tags_1[0]), /* 1 */ + &asn_PER_type_RefQuality_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RefQuality.h b/src/core/libs/supl/asn-rrlp/RefQuality.h new file mode 100644 index 000000000..1fe321512 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RefQuality.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RefQuality_H_ +#define _RefQuality_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RefQuality */ +typedef long RefQuality_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RefQuality; +asn_struct_free_f RefQuality_free; +asn_struct_print_f RefQuality_print; +asn_constr_check_f RefQuality_constraint; +ber_type_decoder_f RefQuality_decode_ber; +der_type_encoder_f RefQuality_encode_der; +xer_type_decoder_f RefQuality_decode_xer; +xer_type_encoder_f RefQuality_encode_xer; +per_type_decoder_f RefQuality_decode_uper; +per_type_encoder_f RefQuality_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RefQuality_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c new file mode 100644 index 000000000..8f2ad8ff1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c @@ -0,0 +1,91 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceAssistData.h" + +static asn_TYPE_member_t asn_MBR_ReferenceAssistData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bcchCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsic" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, timeSlotScheme), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlotScheme, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeSlotScheme" + }, + { ATF_POINTER, 1, offsetof(struct ReferenceAssistData, btsPosition), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BTSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "btsPosition" + }, +}; +static int asn_MAP_ReferenceAssistData_oms_1[] = { 3 }; +static ber_tlv_tag_t asn_DEF_ReferenceAssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ReferenceAssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 157 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 158 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* timeSlotScheme at 159 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* btsPosition at 160 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ReferenceAssistData_specs_1 = { + sizeof(struct ReferenceAssistData), + offsetof(struct ReferenceAssistData, _asn_ctx), + asn_MAP_ReferenceAssistData_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_ReferenceAssistData_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceAssistData = { + "ReferenceAssistData", + "ReferenceAssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ReferenceAssistData_tags_1, + sizeof(asn_DEF_ReferenceAssistData_tags_1) + /sizeof(asn_DEF_ReferenceAssistData_tags_1[0]), /* 1 */ + asn_DEF_ReferenceAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceAssistData_tags_1) + /sizeof(asn_DEF_ReferenceAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ReferenceAssistData_1, + 4, /* Elements count */ + &asn_SPC_ReferenceAssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h new file mode 100644 index 000000000..74659c650 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceAssistData_H_ +#define _ReferenceAssistData_H_ + + +#include + +/* Including external dependencies */ +#include "BCCHCarrier.h" +#include "BSIC.h" +#include "TimeSlotScheme.h" +#include "BTSPosition.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ReferenceAssistData */ +typedef struct ReferenceAssistData { + BCCHCarrier_t bcchCarrier; + BSIC_t bsic; + TimeSlotScheme_t timeSlotScheme; + BTSPosition_t *btsPosition /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ReferenceAssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceAssistData; + +#ifdef __cplusplus +} +#endif + +#endif /* _ReferenceAssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceFrame.c b/src/core/libs/supl/asn-rrlp/ReferenceFrame.c new file mode 100644 index 000000000..56c1bbc50 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceFrame.c @@ -0,0 +1,131 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceFrame.h" + +static int +memb_referenceFN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_referenceFNMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_referenceFN_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_referenceFNMSB_constr_3 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_ReferenceFrame_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ReferenceFrame, referenceFN), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_referenceFN_constraint_1, + &asn_PER_memb_referenceFN_constr_2, + 0, + "referenceFN" + }, + { ATF_POINTER, 1, offsetof(struct ReferenceFrame, referenceFNMSB), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_referenceFNMSB_constraint_1, + &asn_PER_memb_referenceFNMSB_constr_3, + 0, + "referenceFNMSB" + }, +}; +static int asn_MAP_ReferenceFrame_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_ReferenceFrame_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ReferenceFrame_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFN at 1438 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* referenceFNMSB at 1440 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ReferenceFrame_specs_1 = { + sizeof(struct ReferenceFrame), + offsetof(struct ReferenceFrame, _asn_ctx), + asn_MAP_ReferenceFrame_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_ReferenceFrame_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceFrame = { + "ReferenceFrame", + "ReferenceFrame", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ReferenceFrame_tags_1, + sizeof(asn_DEF_ReferenceFrame_tags_1) + /sizeof(asn_DEF_ReferenceFrame_tags_1[0]), /* 1 */ + asn_DEF_ReferenceFrame_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceFrame_tags_1) + /sizeof(asn_DEF_ReferenceFrame_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ReferenceFrame_1, + 2, /* Elements count */ + &asn_SPC_ReferenceFrame_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceFrame.h b/src/core/libs/supl/asn-rrlp/ReferenceFrame.h new file mode 100644 index 000000000..52bb0d24b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceFrame.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceFrame_H_ +#define _ReferenceFrame_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ReferenceFrame */ +typedef struct ReferenceFrame { + long referenceFN; + long *referenceFNMSB /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ReferenceFrame_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceFrame; + +#ifdef __cplusplus +} +#endif + +#endif /* _ReferenceFrame_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c new file mode 100644 index 000000000..06ca2f3ea --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceIdentity.h" + +static asn_TYPE_member_t asn_MBR_ReferenceIdentity_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentity, refBTSList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfReferenceIdentityType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "refBTSList" + }, +}; +static ber_tlv_tag_t asn_DEF_ReferenceIdentity_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ReferenceIdentity_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* refBTSList at 289 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ReferenceIdentity_specs_1 = { + sizeof(struct ReferenceIdentity), + offsetof(struct ReferenceIdentity, _asn_ctx), + asn_MAP_ReferenceIdentity_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceIdentity = { + "ReferenceIdentity", + "ReferenceIdentity", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ReferenceIdentity_tags_1, + sizeof(asn_DEF_ReferenceIdentity_tags_1) + /sizeof(asn_DEF_ReferenceIdentity_tags_1[0]), /* 1 */ + asn_DEF_ReferenceIdentity_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceIdentity_tags_1) + /sizeof(asn_DEF_ReferenceIdentity_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ReferenceIdentity_1, + 1, /* Elements count */ + &asn_SPC_ReferenceIdentity_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h new file mode 100644 index 000000000..16088ffc6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceIdentity_H_ +#define _ReferenceIdentity_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfReferenceIdentityType.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ReferenceIdentity */ +typedef struct ReferenceIdentity { + SeqOfReferenceIdentityType_t refBTSList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ReferenceIdentity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceIdentity; + +#ifdef __cplusplus +} +#endif + +#endif /* _ReferenceIdentity_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c new file mode 100644 index 000000000..d36515591 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c @@ -0,0 +1,100 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceIdentityType.h" + +static asn_per_constraints_t asn_PER_type_ReferenceIdentityType_constr_1 = { + { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_ReferenceIdentityType_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.bsicAndCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSICAndCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "bsicAndCarrier" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.ci), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ci" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.requestIndex), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequestIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "requestIndex" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.systemInfoIndex), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoIndex" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.ciAndLAC), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellIDAndLAC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ciAndLAC" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_ReferenceIdentityType_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bsicAndCarrier at 294 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ci at 295 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* requestIndex at 296 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* systemInfoIndex at 297 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ciAndLAC at 301 */ +}; +static asn_CHOICE_specifics_t asn_SPC_ReferenceIdentityType_specs_1 = { + sizeof(struct ReferenceIdentityType), + offsetof(struct ReferenceIdentityType, _asn_ctx), + offsetof(struct ReferenceIdentityType, present), + sizeof(((struct ReferenceIdentityType *)0)->present), + asn_MAP_ReferenceIdentityType_tag2el_1, + 5, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceIdentityType = { + "ReferenceIdentityType", + "ReferenceIdentityType", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_ReferenceIdentityType_constr_1, + asn_MBR_ReferenceIdentityType_1, + 5, /* Elements count */ + &asn_SPC_ReferenceIdentityType_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h new file mode 100644 index 000000000..356f03135 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceIdentityType_H_ +#define _ReferenceIdentityType_H_ + + +#include + +/* Including external dependencies */ +#include "BSICAndCarrier.h" +#include "CellID.h" +#include "RequestIndex.h" +#include "SystemInfoIndex.h" +#include "CellIDAndLAC.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ReferenceIdentityType_PR { + ReferenceIdentityType_PR_NOTHING, /* No components present */ + ReferenceIdentityType_PR_bsicAndCarrier, + ReferenceIdentityType_PR_ci, + ReferenceIdentityType_PR_requestIndex, + ReferenceIdentityType_PR_systemInfoIndex, + ReferenceIdentityType_PR_ciAndLAC +} ReferenceIdentityType_PR; + +/* ReferenceIdentityType */ +typedef struct ReferenceIdentityType { + ReferenceIdentityType_PR present; + union ReferenceIdentityType_u { + BSICAndCarrier_t bsicAndCarrier; + CellID_t ci; + RequestIndex_t requestIndex; + SystemInfoIndex_t systemInfoIndex; + CellIDAndLAC_t ciAndLAC; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ReferenceIdentityType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceIdentityType; + +#ifdef __cplusplus +} +#endif + +#endif /* _ReferenceIdentityType_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceRelation.c b/src/core/libs/supl/asn-rrlp/ReferenceRelation.c new file mode 100644 index 000000000..931e2c477 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceRelation.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceRelation.h" + +int +ReferenceRelation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +ReferenceRelation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +ReferenceRelation_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ReferenceRelation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ReferenceRelation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ReferenceRelation_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ReferenceRelation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ReferenceRelation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +ReferenceRelation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +ReferenceRelation_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ReferenceRelation_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_ReferenceRelation_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_ReferenceRelation_value2enum_1[] = { + { 0, 17, "secondBTSThirdSet" }, + { 1, 18, "secondBTSSecondSet" }, + { 2, 16, "firstBTSFirstSet" } +}; +static unsigned int asn_MAP_ReferenceRelation_enum2value_1[] = { + 2, /* firstBTSFirstSet(2) */ + 1, /* secondBTSSecondSet(1) */ + 0 /* secondBTSThirdSet(0) */ +}; +static asn_INTEGER_specifics_t asn_SPC_ReferenceRelation_specs_1 = { + asn_MAP_ReferenceRelation_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_ReferenceRelation_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_ReferenceRelation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceRelation = { + "ReferenceRelation", + "ReferenceRelation", + ReferenceRelation_free, + ReferenceRelation_print, + ReferenceRelation_constraint, + ReferenceRelation_decode_ber, + ReferenceRelation_encode_der, + ReferenceRelation_decode_xer, + ReferenceRelation_encode_xer, + ReferenceRelation_decode_uper, + ReferenceRelation_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ReferenceRelation_tags_1, + sizeof(asn_DEF_ReferenceRelation_tags_1) + /sizeof(asn_DEF_ReferenceRelation_tags_1[0]), /* 1 */ + asn_DEF_ReferenceRelation_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceRelation_tags_1) + /sizeof(asn_DEF_ReferenceRelation_tags_1[0]), /* 1 */ + &asn_PER_type_ReferenceRelation_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_ReferenceRelation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceRelation.h b/src/core/libs/supl/asn-rrlp/ReferenceRelation.h new file mode 100644 index 000000000..c89d6dfd1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceRelation.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceRelation_H_ +#define _ReferenceRelation_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ReferenceRelation { + ReferenceRelation_secondBTSThirdSet = 0, + ReferenceRelation_secondBTSSecondSet = 1, + ReferenceRelation_firstBTSFirstSet = 2 +} e_ReferenceRelation; + +/* ReferenceRelation */ +typedef ENUMERATED_t ReferenceRelation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceRelation; +asn_struct_free_f ReferenceRelation_free; +asn_struct_print_f ReferenceRelation_print; +asn_constr_check_f ReferenceRelation_constraint; +ber_type_decoder_f ReferenceRelation_decode_ber; +der_type_encoder_f ReferenceRelation_encode_der; +xer_type_decoder_f ReferenceRelation_decode_xer; +xer_type_encoder_f ReferenceRelation_encode_xer; +per_type_decoder_f ReferenceRelation_decode_uper; +per_type_encoder_f ReferenceRelation_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ReferenceRelation_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceTime.c b/src/core/libs/supl/asn-rrlp/ReferenceTime.c new file mode 100644 index 000000000..6e96a8119 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceTime.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceTime.h" + +static asn_TYPE_member_t asn_MBR_ReferenceTime_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ReferenceTime, gpsTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTime" + }, + { ATF_POINTER, 2, offsetof(struct ReferenceTime, gsmTime), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GSMTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gsmTime" + }, + { ATF_POINTER, 1, offsetof(struct ReferenceTime, gpsTowAssist), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOWAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTowAssist" + }, +}; +static int asn_MAP_ReferenceTime_oms_1[] = { 1, 2 }; +static ber_tlv_tag_t asn_DEF_ReferenceTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ReferenceTime_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTime at 586 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gsmTime at 587 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gpsTowAssist at 588 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ReferenceTime_specs_1 = { + sizeof(struct ReferenceTime), + offsetof(struct ReferenceTime, _asn_ctx), + asn_MAP_ReferenceTime_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_ReferenceTime_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceTime = { + "ReferenceTime", + "ReferenceTime", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ReferenceTime_tags_1, + sizeof(asn_DEF_ReferenceTime_tags_1) + /sizeof(asn_DEF_ReferenceTime_tags_1[0]), /* 1 */ + asn_DEF_ReferenceTime_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceTime_tags_1) + /sizeof(asn_DEF_ReferenceTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ReferenceTime_1, + 3, /* Elements count */ + &asn_SPC_ReferenceTime_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceTime.h b/src/core/libs/supl/asn-rrlp/ReferenceTime.h new file mode 100644 index 000000000..101df484a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceTime.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceTime_H_ +#define _ReferenceTime_H_ + + +#include + +/* Including external dependencies */ +#include "GPSTime.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GSMTime; +struct GPSTOWAssist; + +/* ReferenceTime */ +typedef struct ReferenceTime { + GPSTime_t gpsTime; + struct GSMTime *gsmTime /* OPTIONAL */; + struct GPSTOWAssist *gpsTowAssist /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ReferenceTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceTime; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GSMTime.h" +#include "GPSTOWAssist.h" + +#endif /* _ReferenceTime_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c new file mode 100644 index 000000000..c50931e21 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "ReferenceWGS84.h" + +static asn_TYPE_member_t asn_MBR_ReferenceWGS84_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ReferenceWGS84, relativeNorth), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RelDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "relativeNorth" + }, + { ATF_NOFLAGS, 0, offsetof(struct ReferenceWGS84, relativeEast), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RelDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "relativeEast" + }, + { ATF_POINTER, 1, offsetof(struct ReferenceWGS84, relativeAlt), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RelativeAlt, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "relativeAlt" + }, +}; +static int asn_MAP_ReferenceWGS84_oms_1[] = { 2 }; +static ber_tlv_tag_t asn_DEF_ReferenceWGS84_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ReferenceWGS84_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* relativeNorth at 247 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* relativeEast at 248 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* relativeAlt at 250 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ReferenceWGS84_specs_1 = { + sizeof(struct ReferenceWGS84), + offsetof(struct ReferenceWGS84, _asn_ctx), + asn_MAP_ReferenceWGS84_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_ReferenceWGS84_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ReferenceWGS84 = { + "ReferenceWGS84", + "ReferenceWGS84", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ReferenceWGS84_tags_1, + sizeof(asn_DEF_ReferenceWGS84_tags_1) + /sizeof(asn_DEF_ReferenceWGS84_tags_1[0]), /* 1 */ + asn_DEF_ReferenceWGS84_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceWGS84_tags_1) + /sizeof(asn_DEF_ReferenceWGS84_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ReferenceWGS84_1, + 3, /* Elements count */ + &asn_SPC_ReferenceWGS84_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h new file mode 100644 index 000000000..d90698cdf --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _ReferenceWGS84_H_ +#define _ReferenceWGS84_H_ + + +#include + +/* Including external dependencies */ +#include "RelDistance.h" +#include "RelativeAlt.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ReferenceWGS84 */ +typedef struct ReferenceWGS84 { + RelDistance_t relativeNorth; + RelDistance_t relativeEast; + RelativeAlt_t *relativeAlt /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ReferenceWGS84_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ReferenceWGS84; + +#ifdef __cplusplus +} +#endif + +#endif /* _ReferenceWGS84_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c new file mode 100644 index 000000000..539a2b5de --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel-5-MsrPosition-Rsp-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel_5_MsrPosition_Rsp_Extension_1[] = { + { ATF_POINTER, 3, offsetof(struct Rel_5_MsrPosition_Rsp_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extended-reference" + }, + { ATF_POINTER, 2, offsetof(struct Rel_5_MsrPosition_Rsp_Extension, otd_MeasureInfo_5_Ext), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasureInfo_5_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otd-MeasureInfo-5-Ext" + }, + { ATF_POINTER, 1, offsetof(struct Rel_5_MsrPosition_Rsp_Extension, ulPseudoSegInd), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UlPseudoSegInd, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ulPseudoSegInd" + }, +}; +static int asn_MAP_Rel_5_MsrPosition_Rsp_Extension_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel_5_MsrPosition_Rsp_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* extended-reference at 985 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* otd-MeasureInfo-5-Ext at 991 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ulPseudoSegInd at 992 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel_5_MsrPosition_Rsp_Extension_specs_1 = { + sizeof(struct Rel_5_MsrPosition_Rsp_Extension), + offsetof(struct Rel_5_MsrPosition_Rsp_Extension, _asn_ctx), + asn_MAP_Rel_5_MsrPosition_Rsp_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel_5_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel_5_MsrPosition_Rsp_Extension = { + "Rel-5-MsrPosition-Rsp-Extension", + "Rel-5-MsrPosition-Rsp-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1, + sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1) + /sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1) + /sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel_5_MsrPosition_Rsp_Extension_1, + 3, /* Elements count */ + &asn_SPC_Rel_5_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h new file mode 100644 index 000000000..5f3e42073 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h @@ -0,0 +1,51 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel_5_MsrPosition_Rsp_Extension_H_ +#define _Rel_5_MsrPosition_Rsp_Extension_H_ + + +#include + +/* Including external dependencies */ +#include "UlPseudoSegInd.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Extended_reference; +struct SeqOfOTD_MsrElementRest; + +/* Rel-5-MsrPosition-Rsp-Extension */ +typedef struct Rel_5_MsrPosition_Rsp_Extension { + struct Extended_reference *extended_reference /* OPTIONAL */; + struct SeqOfOTD_MsrElementRest *otd_MeasureInfo_5_Ext /* OPTIONAL */; + UlPseudoSegInd_t *ulPseudoSegInd /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel_5_MsrPosition_Rsp_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel_5_MsrPosition_Rsp_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Extended-reference.h" +#include "OTD-MeasureInfo-5-Ext.h" + +#endif /* _Rel_5_MsrPosition_Rsp_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c new file mode 100644 index 000000000..9c492e83f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel-5-ProtocolError-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel_5_ProtocolError_Extension_1[] = { + { ATF_POINTER, 1, offsetof(struct Rel_5_ProtocolError_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extended-reference" + }, +}; +static int asn_MAP_Rel_5_ProtocolError_Extension_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_Rel_5_ProtocolError_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel_5_ProtocolError_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* extended-reference at 1030 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel_5_ProtocolError_Extension_specs_1 = { + sizeof(struct Rel_5_ProtocolError_Extension), + offsetof(struct Rel_5_ProtocolError_Extension, _asn_ctx), + asn_MAP_Rel_5_ProtocolError_Extension_tag2el_1, + 1, /* Count of tags in the map */ + asn_MAP_Rel_5_ProtocolError_Extension_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 0, /* Start extensions */ + 2 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel_5_ProtocolError_Extension = { + "Rel-5-ProtocolError-Extension", + "Rel-5-ProtocolError-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel_5_ProtocolError_Extension_tags_1, + sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1) + /sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_5_ProtocolError_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1) + /sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel_5_ProtocolError_Extension_1, + 1, /* Elements count */ + &asn_SPC_Rel_5_ProtocolError_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h new file mode 100644 index 000000000..e73e5a0b7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel_5_ProtocolError_Extension_H_ +#define _Rel_5_ProtocolError_Extension_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Extended_reference; + +/* Rel-5-ProtocolError-Extension */ +typedef struct Rel_5_ProtocolError_Extension { + struct Extended_reference *extended_reference /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel_5_ProtocolError_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel_5_ProtocolError_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Extended-reference.h" + +#endif /* _Rel_5_ProtocolError_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c new file mode 100644 index 000000000..65917fd31 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel-7-MsrPosition-Rsp-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel_7_MsrPosition_Rsp_Extension_1[] = { + { ATF_POINTER, 3, offsetof(struct Rel_7_MsrPosition_Rsp_Extension, velEstimate), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_VelocityEstimate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "velEstimate" + }, + { ATF_POINTER, 2, offsetof(struct Rel_7_MsrPosition_Rsp_Extension, ganssLocationInfo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSLocationInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssLocationInfo" + }, + { ATF_POINTER, 1, offsetof(struct Rel_7_MsrPosition_Rsp_Extension, ganssMeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSMeasureInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssMeasureInfo" + }, +}; +static int asn_MAP_Rel_7_MsrPosition_Rsp_Extension_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel_7_MsrPosition_Rsp_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* velEstimate at 1397 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssLocationInfo at 1402 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssMeasureInfo at 1403 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel_7_MsrPosition_Rsp_Extension_specs_1 = { + sizeof(struct Rel_7_MsrPosition_Rsp_Extension), + offsetof(struct Rel_7_MsrPosition_Rsp_Extension, _asn_ctx), + asn_MAP_Rel_7_MsrPosition_Rsp_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel_7_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel_7_MsrPosition_Rsp_Extension = { + "Rel-7-MsrPosition-Rsp-Extension", + "Rel-7-MsrPosition-Rsp-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1, + sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1) + /sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1) + /sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel_7_MsrPosition_Rsp_Extension_1, + 3, /* Elements count */ + &asn_SPC_Rel_7_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h new file mode 100644 index 000000000..771706639 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h @@ -0,0 +1,51 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel_7_MsrPosition_Rsp_Extension_H_ +#define _Rel_7_MsrPosition_Rsp_Extension_H_ + + +#include + +/* Including external dependencies */ +#include "VelocityEstimate.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSLocationInfo; +struct GANSSMeasureInfo; + +/* Rel-7-MsrPosition-Rsp-Extension */ +typedef struct Rel_7_MsrPosition_Rsp_Extension { + VelocityEstimate_t *velEstimate /* OPTIONAL */; + struct GANSSLocationInfo *ganssLocationInfo /* OPTIONAL */; + struct GANSSMeasureInfo *ganssMeasureInfo /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel_7_MsrPosition_Rsp_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel_7_MsrPosition_Rsp_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSLocationInfo.h" +#include "GANSSMeasureInfo.h" + +#endif /* _Rel_7_MsrPosition_Rsp_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c new file mode 100644 index 000000000..e0b00f49d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c @@ -0,0 +1,126 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel-98-MsrPosition-Rsp-Extension.h" + +static asn_TYPE_member_t asn_MBR_rel_98_Ext_MeasureInfo_2[] = { + { ATF_POINTER, 1, offsetof(struct rel_98_Ext_MeasureInfo, otd_MeasureInfo_R98_Ext), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasureInfo_R98_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "otd-MeasureInfo-R98-Ext" + }, +}; +static int asn_MAP_rel_98_Ext_MeasureInfo_oms_2[] = { 0 }; +static ber_tlv_tag_t asn_DEF_rel_98_Ext_MeasureInfo_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_rel_98_Ext_MeasureInfo_tag2el_2[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* otd-MeasureInfo-R98-Ext at 960 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_rel_98_Ext_MeasureInfo_specs_2 = { + sizeof(struct rel_98_Ext_MeasureInfo), + offsetof(struct rel_98_Ext_MeasureInfo, _asn_ctx), + asn_MAP_rel_98_Ext_MeasureInfo_tag2el_2, + 1, /* Count of tags in the map */ + asn_MAP_rel_98_Ext_MeasureInfo_oms_2, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_rel_98_Ext_MeasureInfo_2 = { + "rel-98-Ext-MeasureInfo", + "rel-98-Ext-MeasureInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_rel_98_Ext_MeasureInfo_tags_2, + sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2) + /sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2[0]) - 1, /* 1 */ + asn_DEF_rel_98_Ext_MeasureInfo_tags_2, /* Same as above */ + sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2) + /sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_rel_98_Ext_MeasureInfo_2, + 1, /* Elements count */ + &asn_SPC_rel_98_Ext_MeasureInfo_specs_2 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_Rel_98_MsrPosition_Rsp_Extension_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Rel_98_MsrPosition_Rsp_Extension, rel_98_Ext_MeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_rel_98_Ext_MeasureInfo_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel-98-Ext-MeasureInfo" + }, + { ATF_POINTER, 1, offsetof(struct Rel_98_MsrPosition_Rsp_Extension, timeAssistanceMeasurements), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTimeAssistanceMeasurements, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeAssistanceMeasurements" + }, +}; +static int asn_MAP_Rel_98_MsrPosition_Rsp_Extension_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel_98_MsrPosition_Rsp_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rel-98-Ext-MeasureInfo at 960 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* timeAssistanceMeasurements at 963 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel_98_MsrPosition_Rsp_Extension_specs_1 = { + sizeof(struct Rel_98_MsrPosition_Rsp_Extension), + offsetof(struct Rel_98_MsrPosition_Rsp_Extension, _asn_ctx), + asn_MAP_Rel_98_MsrPosition_Rsp_Extension_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_Rel_98_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ + 0, 1, /* Root/Additions */ + 0, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel_98_MsrPosition_Rsp_Extension = { + "Rel-98-MsrPosition-Rsp-Extension", + "Rel-98-MsrPosition-Rsp-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1, + sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1) + /sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1) + /sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel_98_MsrPosition_Rsp_Extension_1, + 2, /* Elements count */ + &asn_SPC_Rel_98_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h new file mode 100644 index 000000000..a54e43bf1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h @@ -0,0 +1,54 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel_98_MsrPosition_Rsp_Extension_H_ +#define _Rel_98_MsrPosition_Rsp_Extension_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GPSTimeAssistanceMeasurements; +struct OTD_MeasureInfo_R98_Ext; + +/* Rel-98-MsrPosition-Rsp-Extension */ +typedef struct Rel_98_MsrPosition_Rsp_Extension { + struct rel_98_Ext_MeasureInfo { + struct OTD_MeasureInfo_R98_Ext *otd_MeasureInfo_R98_Ext /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } rel_98_Ext_MeasureInfo; + /* + * This type is extensible, + * possible extensions are below. + */ + struct GPSTimeAssistanceMeasurements *timeAssistanceMeasurements /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel_98_MsrPosition_Rsp_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel_98_MsrPosition_Rsp_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GPSTimeAssistanceMeasurements.h" +#include "OTD-MeasureInfo-R98-Ext.h" + +#endif /* _Rel_98_MsrPosition_Rsp_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c new file mode 100644 index 000000000..d41d4045d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel5-AssistanceData-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel5_AssistanceData_Extension_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Rel5_AssistanceData_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extended-reference" + }, +}; +static ber_tlv_tag_t asn_DEF_Rel5_AssistanceData_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel5_AssistanceData_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* extended-reference at 1023 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel5_AssistanceData_Extension_specs_1 = { + sizeof(struct Rel5_AssistanceData_Extension), + offsetof(struct Rel5_AssistanceData_Extension, _asn_ctx), + asn_MAP_Rel5_AssistanceData_Extension_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel5_AssistanceData_Extension = { + "Rel5-AssistanceData-Extension", + "Rel5-AssistanceData-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel5_AssistanceData_Extension_tags_1, + sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1) + /sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel5_AssistanceData_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1) + /sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel5_AssistanceData_Extension_1, + 1, /* Elements count */ + &asn_SPC_Rel5_AssistanceData_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h new file mode 100644 index 000000000..5f38409b5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel5_AssistanceData_Extension_H_ +#define _Rel5_AssistanceData_Extension_H_ + + +#include + +/* Including external dependencies */ +#include "Extended-reference.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Rel5-AssistanceData-Extension */ +typedef struct Rel5_AssistanceData_Extension { + Extended_reference_t extended_reference; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel5_AssistanceData_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel5_AssistanceData_Extension; + +#ifdef __cplusplus +} +#endif + +#endif /* _Rel5_AssistanceData_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c new file mode 100644 index 000000000..33d6d3868 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel5-MsrPosition-Req-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel5_MsrPosition_Req_Extension_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Rel5_MsrPosition_Req_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "extended-reference" + }, +}; +static ber_tlv_tag_t asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel5_MsrPosition_Req_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* extended-reference at 1017 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel5_MsrPosition_Req_Extension_specs_1 = { + sizeof(struct Rel5_MsrPosition_Req_Extension), + offsetof(struct Rel5_MsrPosition_Req_Extension, _asn_ctx), + asn_MAP_Rel5_MsrPosition_Req_Extension_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel5_MsrPosition_Req_Extension = { + "Rel5-MsrPosition-Req-Extension", + "Rel5-MsrPosition-Req-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1, + sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1) + /sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1) + /sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel5_MsrPosition_Req_Extension_1, + 1, /* Elements count */ + &asn_SPC_Rel5_MsrPosition_Req_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h new file mode 100644 index 000000000..498073afb --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel5_MsrPosition_Req_Extension_H_ +#define _Rel5_MsrPosition_Req_Extension_H_ + + +#include + +/* Including external dependencies */ +#include "Extended-reference.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Rel5-MsrPosition-Req-Extension */ +typedef struct Rel5_MsrPosition_Req_Extension { + Extended_reference_t extended_reference; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel5_MsrPosition_Req_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel5_MsrPosition_Req_Extension; + +#ifdef __cplusplus +} +#endif + +#endif /* _Rel5_MsrPosition_Req_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c new file mode 100644 index 000000000..54a513ebc --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel7-AssistanceData-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel7_AssistanceData_Extension_1[] = { + { ATF_POINTER, 3, offsetof(struct Rel7_AssistanceData_Extension, ganss_AssistData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganss-AssistData" + }, + { ATF_POINTER, 2, offsetof(struct Rel7_AssistanceData_Extension, ganssCarrierPhaseMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssCarrierPhaseMeasurementRequest" + }, + { ATF_POINTER, 1, offsetof(struct Rel7_AssistanceData_Extension, ganssTODGSMTimeAssociationMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODGSMTimeAssociationMeasurementRequest" + }, +}; +static int asn_MAP_Rel7_AssistanceData_Extension_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_Rel7_AssistanceData_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel7_AssistanceData_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganss-AssistData at 1491 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssCarrierPhaseMeasurementRequest at 1492 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssTODGSMTimeAssociationMeasurementRequest at 1493 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel7_AssistanceData_Extension_specs_1 = { + sizeof(struct Rel7_AssistanceData_Extension), + offsetof(struct Rel7_AssistanceData_Extension, _asn_ctx), + asn_MAP_Rel7_AssistanceData_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel7_AssistanceData_Extension_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel7_AssistanceData_Extension = { + "Rel7-AssistanceData-Extension", + "Rel7-AssistanceData-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel7_AssistanceData_Extension_tags_1, + sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1) + /sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel7_AssistanceData_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1) + /sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel7_AssistanceData_Extension_1, + 3, /* Elements count */ + &asn_SPC_Rel7_AssistanceData_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h new file mode 100644 index 000000000..34778f32e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel7_AssistanceData_Extension_H_ +#define _Rel7_AssistanceData_Extension_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSS_AssistData; + +/* Rel7-AssistanceData-Extension */ +typedef struct Rel7_AssistanceData_Extension { + struct GANSS_AssistData *ganss_AssistData /* OPTIONAL */; + NULL_t *ganssCarrierPhaseMeasurementRequest /* OPTIONAL */; + NULL_t *ganssTODGSMTimeAssociationMeasurementRequest /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel7_AssistanceData_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel7_AssistanceData_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSS-AssistData.h" + +#endif /* _Rel7_AssistanceData_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c new file mode 100644 index 000000000..994b800f4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel7-MsrPosition-Req-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel7_MsrPosition_Req_Extension_1[] = { + { ATF_POINTER, 6, offsetof(struct Rel7_MsrPosition_Req_Extension, velocityRequested), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "velocityRequested" + }, + { ATF_POINTER, 5, offsetof(struct Rel7_MsrPosition_Req_Extension, ganssPositionMethod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSPositioningMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssPositionMethod" + }, + { ATF_POINTER, 4, offsetof(struct Rel7_MsrPosition_Req_Extension, ganss_AssistData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganss-AssistData" + }, + { ATF_POINTER, 3, offsetof(struct Rel7_MsrPosition_Req_Extension, ganssCarrierPhaseMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssCarrierPhaseMeasurementRequest" + }, + { ATF_POINTER, 2, offsetof(struct Rel7_MsrPosition_Req_Extension, ganssTODGSMTimeAssociationMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssTODGSMTimeAssociationMeasurementRequest" + }, + { ATF_POINTER, 1, offsetof(struct Rel7_MsrPosition_Req_Extension, requiredResponseTime), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequiredResponseTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "requiredResponseTime" + }, +}; +static int asn_MAP_Rel7_MsrPosition_Req_Extension_oms_1[] = { 0, 1, 2, 3, 4, 5 }; +static ber_tlv_tag_t asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel7_MsrPosition_Req_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* velocityRequested at 1045 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssPositionMethod at 1046 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganss-AssistData at 1047 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssCarrierPhaseMeasurementRequest at 1048 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssTODGSMTimeAssociationMeasurementRequest at 1049 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* requiredResponseTime at 1050 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel7_MsrPosition_Req_Extension_specs_1 = { + sizeof(struct Rel7_MsrPosition_Req_Extension), + offsetof(struct Rel7_MsrPosition_Req_Extension, _asn_ctx), + asn_MAP_Rel7_MsrPosition_Req_Extension_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_Rel7_MsrPosition_Req_Extension_oms_1, /* Optional members */ + 6, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel7_MsrPosition_Req_Extension = { + "Rel7-MsrPosition-Req-Extension", + "Rel7-MsrPosition-Req-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1, + sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1) + /sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1) + /sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel7_MsrPosition_Req_Extension_1, + 6, /* Elements count */ + &asn_SPC_Rel7_MsrPosition_Req_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h new file mode 100644 index 000000000..d44d16028 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h @@ -0,0 +1,54 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel7_MsrPosition_Req_Extension_H_ +#define _Rel7_MsrPosition_Req_Extension_H_ + + +#include + +/* Including external dependencies */ +#include +#include "GANSSPositioningMethod.h" +#include "RequiredResponseTime.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSS_AssistData; + +/* Rel7-MsrPosition-Req-Extension */ +typedef struct Rel7_MsrPosition_Req_Extension { + NULL_t *velocityRequested /* OPTIONAL */; + GANSSPositioningMethod_t *ganssPositionMethod /* OPTIONAL */; + struct GANSS_AssistData *ganss_AssistData /* OPTIONAL */; + NULL_t *ganssCarrierPhaseMeasurementRequest /* OPTIONAL */; + NULL_t *ganssTODGSMTimeAssociationMeasurementRequest /* OPTIONAL */; + RequiredResponseTime_t *requiredResponseTime /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel7_MsrPosition_Req_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel7_MsrPosition_Req_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSS-AssistData.h" + +#endif /* _Rel7_MsrPosition_Req_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c new file mode 100644 index 000000000..b94825baf --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel98-AssistanceData-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel98_AssistanceData_Extension_1[] = { + { ATF_POINTER, 3, offsetof(struct Rel98_AssistanceData_Extension, rel98_Ext_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_Ext_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel98-Ext-ExpOTD" + }, + { ATF_POINTER, 2, offsetof(struct Rel98_AssistanceData_Extension, gpsTimeAssistanceMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTimeAssistanceMeasurementRequest" + }, + { ATF_POINTER, 1, offsetof(struct Rel98_AssistanceData_Extension, gpsReferenceTimeUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSReferenceTimeUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsReferenceTimeUncertainty" + }, +}; +static int asn_MAP_Rel98_AssistanceData_Extension_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_Rel98_AssistanceData_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel98_AssistanceData_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rel98-Ext-ExpOTD at 879 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTimeAssistanceMeasurementRequest at 881 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gpsReferenceTimeUncertainty at 882 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel98_AssistanceData_Extension_specs_1 = { + sizeof(struct Rel98_AssistanceData_Extension), + offsetof(struct Rel98_AssistanceData_Extension, _asn_ctx), + asn_MAP_Rel98_AssistanceData_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel98_AssistanceData_Extension_oms_1, /* Optional members */ + 1, 2, /* Root/Additions */ + 0, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel98_AssistanceData_Extension = { + "Rel98-AssistanceData-Extension", + "Rel98-AssistanceData-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel98_AssistanceData_Extension_tags_1, + sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1) + /sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel98_AssistanceData_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1) + /sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel98_AssistanceData_Extension_1, + 3, /* Elements count */ + &asn_SPC_Rel98_AssistanceData_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h new file mode 100644 index 000000000..87c6177f6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel98_AssistanceData_Extension_H_ +#define _Rel98_AssistanceData_Extension_H_ + + +#include + +/* Including external dependencies */ +#include +#include "GPSReferenceTimeUncertainty.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Rel98_Ext_ExpOTD; + +/* Rel98-AssistanceData-Extension */ +typedef struct Rel98_AssistanceData_Extension { + struct Rel98_Ext_ExpOTD *rel98_Ext_ExpOTD /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + NULL_t *gpsTimeAssistanceMeasurementRequest /* OPTIONAL */; + GPSReferenceTimeUncertainty_t *gpsReferenceTimeUncertainty /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel98_AssistanceData_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel98_AssistanceData_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Rel98-Ext-ExpOTD.h" + +#endif /* _Rel98_AssistanceData_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c new file mode 100644 index 000000000..943579089 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel98-Ext-ExpOTD.h" + +static asn_TYPE_member_t asn_MBR_Rel98_Ext_ExpOTD_1[] = { + { ATF_POINTER, 2, offsetof(struct Rel98_Ext_ExpOTD, msrAssistData_R98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrAssistData_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msrAssistData-R98-ExpOTD" + }, + { ATF_POINTER, 1, offsetof(struct Rel98_Ext_ExpOTD, systemInfoAssistData_R98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoAssistData_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoAssistData-R98-ExpOTD" + }, +}; +static int asn_MAP_Rel98_Ext_ExpOTD_oms_1[] = { 0, 1 }; +static ber_tlv_tag_t asn_DEF_Rel98_Ext_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel98_Ext_ExpOTD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msrAssistData-R98-ExpOTD at 890 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* systemInfoAssistData-R98-ExpOTD at 894 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel98_Ext_ExpOTD_specs_1 = { + sizeof(struct Rel98_Ext_ExpOTD), + offsetof(struct Rel98_Ext_ExpOTD, _asn_ctx), + asn_MAP_Rel98_Ext_ExpOTD_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_Rel98_Ext_ExpOTD_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel98_Ext_ExpOTD = { + "Rel98-Ext-ExpOTD", + "Rel98-Ext-ExpOTD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel98_Ext_ExpOTD_tags_1, + sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1) + /sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_Rel98_Ext_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1) + /sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel98_Ext_ExpOTD_1, + 2, /* Elements count */ + &asn_SPC_Rel98_Ext_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h new file mode 100644 index 000000000..48169dd3f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel98_Ext_ExpOTD_H_ +#define _Rel98_Ext_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct MsrAssistData_R98_ExpOTD; +struct SystemInfoAssistData_R98_ExpOTD; + +/* Rel98-Ext-ExpOTD */ +typedef struct Rel98_Ext_ExpOTD { + struct MsrAssistData_R98_ExpOTD *msrAssistData_R98_ExpOTD /* OPTIONAL */; + struct SystemInfoAssistData_R98_ExpOTD *systemInfoAssistData_R98_ExpOTD /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel98_Ext_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel98_Ext_ExpOTD; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "MsrAssistData-R98-ExpOTD.h" +#include "SystemInfoAssistData-R98-ExpOTD.h" + +#endif /* _Rel98_Ext_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c new file mode 100644 index 000000000..1ad5bc639 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "Rel98-MsrPosition-Req-Extension.h" + +static asn_TYPE_member_t asn_MBR_Rel98_MsrPosition_Req_Extension_1[] = { + { ATF_POINTER, 3, offsetof(struct Rel98_MsrPosition_Req_Extension, rel98_Ext_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_Ext_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rel98-Ext-ExpOTD" + }, + { ATF_POINTER, 2, offsetof(struct Rel98_MsrPosition_Req_Extension, gpsTimeAssistanceMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTimeAssistanceMeasurementRequest" + }, + { ATF_POINTER, 1, offsetof(struct Rel98_MsrPosition_Req_Extension, gpsReferenceTimeUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSReferenceTimeUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsReferenceTimeUncertainty" + }, +}; +static int asn_MAP_Rel98_MsrPosition_Req_Extension_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Rel98_MsrPosition_Req_Extension_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rel98-Ext-ExpOTD at 871 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTimeAssistanceMeasurementRequest at 873 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gpsReferenceTimeUncertainty at 874 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Rel98_MsrPosition_Req_Extension_specs_1 = { + sizeof(struct Rel98_MsrPosition_Req_Extension), + offsetof(struct Rel98_MsrPosition_Req_Extension, _asn_ctx), + asn_MAP_Rel98_MsrPosition_Req_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel98_MsrPosition_Req_Extension_oms_1, /* Optional members */ + 1, 2, /* Root/Additions */ + 0, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Rel98_MsrPosition_Req_Extension = { + "Rel98-MsrPosition-Req-Extension", + "Rel98-MsrPosition-Req-Extension", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1, + sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1) + /sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1) + /sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Rel98_MsrPosition_Req_Extension_1, + 3, /* Elements count */ + &asn_SPC_Rel98_MsrPosition_Req_Extension_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h new file mode 100644 index 000000000..39913e245 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _Rel98_MsrPosition_Req_Extension_H_ +#define _Rel98_MsrPosition_Req_Extension_H_ + + +#include + +/* Including external dependencies */ +#include +#include "GPSReferenceTimeUncertainty.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Rel98_Ext_ExpOTD; + +/* Rel98-MsrPosition-Req-Extension */ +typedef struct Rel98_MsrPosition_Req_Extension { + struct Rel98_Ext_ExpOTD *rel98_Ext_ExpOTD /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + NULL_t *gpsTimeAssistanceMeasurementRequest /* OPTIONAL */; + GPSReferenceTimeUncertainty_t *gpsReferenceTimeUncertainty /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Rel98_MsrPosition_Req_Extension_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Rel98_MsrPosition_Req_Extension; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Rel98-Ext-ExpOTD.h" + +#endif /* _Rel98_MsrPosition_Req_Extension_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RelDistance.c b/src/core/libs/supl/asn-rrlp/RelDistance.c new file mode 100644 index 000000000..a444e3f70 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RelDistance.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RelDistance.h" + +int +RelDistance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -200000 && value <= 200000)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +RelDistance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +RelDistance_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + RelDistance_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +RelDistance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +RelDistance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +RelDistance_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +RelDistance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +RelDistance_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +RelDistance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +RelDistance_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + RelDistance_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_RelDistance_constr_1 = { + { APC_CONSTRAINED, 19, -1, -200000, 200000 } /* (-200000..200000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_RelDistance_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RelDistance = { + "RelDistance", + "RelDistance", + RelDistance_free, + RelDistance_print, + RelDistance_constraint, + RelDistance_decode_ber, + RelDistance_encode_der, + RelDistance_decode_xer, + RelDistance_encode_xer, + RelDistance_decode_uper, + RelDistance_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RelDistance_tags_1, + sizeof(asn_DEF_RelDistance_tags_1) + /sizeof(asn_DEF_RelDistance_tags_1[0]), /* 1 */ + asn_DEF_RelDistance_tags_1, /* Same as above */ + sizeof(asn_DEF_RelDistance_tags_1) + /sizeof(asn_DEF_RelDistance_tags_1[0]), /* 1 */ + &asn_PER_type_RelDistance_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RelDistance.h b/src/core/libs/supl/asn-rrlp/RelDistance.h new file mode 100644 index 000000000..290bfa795 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RelDistance.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RelDistance_H_ +#define _RelDistance_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RelDistance */ +typedef long RelDistance_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RelDistance; +asn_struct_free_f RelDistance_free; +asn_struct_print_f RelDistance_print; +asn_constr_check_f RelDistance_constraint; +ber_type_decoder_f RelDistance_decode_ber; +der_type_encoder_f RelDistance_encode_der; +xer_type_decoder_f RelDistance_decode_xer; +xer_type_encoder_f RelDistance_encode_xer; +per_type_decoder_f RelDistance_decode_uper; +per_type_encoder_f RelDistance_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RelDistance_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RelativeAlt.c b/src/core/libs/supl/asn-rrlp/RelativeAlt.c new file mode 100644 index 000000000..c65d44aa1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RelativeAlt.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RelativeAlt.h" + +int +RelativeAlt_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -4000 && value <= 4000)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +RelativeAlt_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +RelativeAlt_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +RelativeAlt_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +RelativeAlt_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +RelativeAlt_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +RelativeAlt_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +RelativeAlt_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +RelativeAlt_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +RelativeAlt_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + RelativeAlt_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_RelativeAlt_constr_1 = { + { APC_CONSTRAINED, 13, 13, -4000, 4000 } /* (-4000..4000) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_RelativeAlt_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RelativeAlt = { + "RelativeAlt", + "RelativeAlt", + RelativeAlt_free, + RelativeAlt_print, + RelativeAlt_constraint, + RelativeAlt_decode_ber, + RelativeAlt_encode_der, + RelativeAlt_decode_xer, + RelativeAlt_encode_xer, + RelativeAlt_decode_uper, + RelativeAlt_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RelativeAlt_tags_1, + sizeof(asn_DEF_RelativeAlt_tags_1) + /sizeof(asn_DEF_RelativeAlt_tags_1[0]), /* 1 */ + asn_DEF_RelativeAlt_tags_1, /* Same as above */ + sizeof(asn_DEF_RelativeAlt_tags_1) + /sizeof(asn_DEF_RelativeAlt_tags_1[0]), /* 1 */ + &asn_PER_type_RelativeAlt_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RelativeAlt.h b/src/core/libs/supl/asn-rrlp/RelativeAlt.h new file mode 100644 index 000000000..f773482d4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RelativeAlt.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RelativeAlt_H_ +#define _RelativeAlt_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RelativeAlt */ +typedef long RelativeAlt_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RelativeAlt; +asn_struct_free_f RelativeAlt_free; +asn_struct_print_f RelativeAlt_print; +asn_constr_check_f RelativeAlt_constraint; +ber_type_decoder_f RelativeAlt_decode_ber; +der_type_encoder_f RelativeAlt_encode_der; +xer_type_decoder_f RelativeAlt_decode_xer; +xer_type_encoder_f RelativeAlt_encode_xer; +per_type_decoder_f RelativeAlt_decode_uper; +per_type_encoder_f RelativeAlt_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RelativeAlt_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RequestIndex.c b/src/core/libs/supl/asn-rrlp/RequestIndex.c new file mode 100644 index 000000000..6d481f20f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RequestIndex.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RequestIndex.h" + +int +RequestIndex_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +RequestIndex_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +RequestIndex_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + RequestIndex_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +RequestIndex_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +RequestIndex_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +RequestIndex_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +RequestIndex_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +RequestIndex_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +RequestIndex_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +RequestIndex_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + RequestIndex_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_RequestIndex_constr_1 = { + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (1..16) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_RequestIndex_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RequestIndex = { + "RequestIndex", + "RequestIndex", + RequestIndex_free, + RequestIndex_print, + RequestIndex_constraint, + RequestIndex_decode_ber, + RequestIndex_encode_der, + RequestIndex_decode_xer, + RequestIndex_encode_xer, + RequestIndex_decode_uper, + RequestIndex_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RequestIndex_tags_1, + sizeof(asn_DEF_RequestIndex_tags_1) + /sizeof(asn_DEF_RequestIndex_tags_1[0]), /* 1 */ + asn_DEF_RequestIndex_tags_1, /* Same as above */ + sizeof(asn_DEF_RequestIndex_tags_1) + /sizeof(asn_DEF_RequestIndex_tags_1[0]), /* 1 */ + &asn_PER_type_RequestIndex_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RequestIndex.h b/src/core/libs/supl/asn-rrlp/RequestIndex.h new file mode 100644 index 000000000..033a25329 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RequestIndex.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RequestIndex_H_ +#define _RequestIndex_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RequestIndex */ +typedef long RequestIndex_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RequestIndex; +asn_struct_free_f RequestIndex_free; +asn_struct_print_f RequestIndex_print; +asn_constr_check_f RequestIndex_constraint; +ber_type_decoder_f RequestIndex_decode_ber; +der_type_encoder_f RequestIndex_encode_der; +xer_type_decoder_f RequestIndex_decode_xer; +xer_type_encoder_f RequestIndex_encode_xer; +per_type_decoder_f RequestIndex_decode_uper; +per_type_encoder_f RequestIndex_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RequestIndex_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c new file mode 100644 index 000000000..52aff059d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RequiredResponseTime.h" + +int +RequiredResponseTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 128)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +RequiredResponseTime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +RequiredResponseTime_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +RequiredResponseTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +RequiredResponseTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +RequiredResponseTime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +RequiredResponseTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +RequiredResponseTime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +RequiredResponseTime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +RequiredResponseTime_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + RequiredResponseTime_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_RequiredResponseTime_constr_1 = { + { APC_CONSTRAINED, 7, 7, 1, 128 } /* (1..128) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_RequiredResponseTime_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RequiredResponseTime = { + "RequiredResponseTime", + "RequiredResponseTime", + RequiredResponseTime_free, + RequiredResponseTime_print, + RequiredResponseTime_constraint, + RequiredResponseTime_decode_ber, + RequiredResponseTime_encode_der, + RequiredResponseTime_decode_xer, + RequiredResponseTime_encode_xer, + RequiredResponseTime_decode_uper, + RequiredResponseTime_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RequiredResponseTime_tags_1, + sizeof(asn_DEF_RequiredResponseTime_tags_1) + /sizeof(asn_DEF_RequiredResponseTime_tags_1[0]), /* 1 */ + asn_DEF_RequiredResponseTime_tags_1, /* Same as above */ + sizeof(asn_DEF_RequiredResponseTime_tags_1) + /sizeof(asn_DEF_RequiredResponseTime_tags_1[0]), /* 1 */ + &asn_PER_type_RequiredResponseTime_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h new file mode 100644 index 000000000..0a609686b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RequiredResponseTime_H_ +#define _RequiredResponseTime_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RequiredResponseTime */ +typedef long RequiredResponseTime_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RequiredResponseTime; +asn_struct_free_f RequiredResponseTime_free; +asn_struct_print_f RequiredResponseTime_print; +asn_constr_check_f RequiredResponseTime_constraint; +ber_type_decoder_f RequiredResponseTime_decode_ber; +der_type_encoder_f RequiredResponseTime_encode_der; +xer_type_decoder_f RequiredResponseTime_decode_xer; +xer_type_encoder_f RequiredResponseTime_encode_xer; +per_type_decoder_f RequiredResponseTime_decode_uper; +per_type_encoder_f RequiredResponseTime_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RequiredResponseTime_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/RoughRTD.c b/src/core/libs/supl/asn-rrlp/RoughRTD.c new file mode 100644 index 000000000..db420b619 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RoughRTD.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "RoughRTD.h" + +int +RoughRTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1250)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +RoughRTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +RoughRTD_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + RoughRTD_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +RoughRTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +RoughRTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +RoughRTD_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +RoughRTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +RoughRTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +RoughRTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +RoughRTD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + RoughRTD_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_RoughRTD_constr_1 = { + { APC_CONSTRAINED, 11, 11, 0, 1250 } /* (0..1250) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_RoughRTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_RoughRTD = { + "RoughRTD", + "RoughRTD", + RoughRTD_free, + RoughRTD_print, + RoughRTD_constraint, + RoughRTD_decode_ber, + RoughRTD_encode_der, + RoughRTD_decode_xer, + RoughRTD_encode_xer, + RoughRTD_decode_uper, + RoughRTD_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RoughRTD_tags_1, + sizeof(asn_DEF_RoughRTD_tags_1) + /sizeof(asn_DEF_RoughRTD_tags_1[0]), /* 1 */ + asn_DEF_RoughRTD_tags_1, /* Same as above */ + sizeof(asn_DEF_RoughRTD_tags_1) + /sizeof(asn_DEF_RoughRTD_tags_1[0]), /* 1 */ + &asn_PER_type_RoughRTD_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/RoughRTD.h b/src/core/libs/supl/asn-rrlp/RoughRTD.h new file mode 100644 index 000000000..0cbd20bf7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/RoughRTD.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _RoughRTD_H_ +#define _RoughRTD_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* RoughRTD */ +typedef long RoughRTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RoughRTD; +asn_struct_free_f RoughRTD_free; +asn_struct_print_f RoughRTD_print; +asn_constr_check_f RoughRTD_constraint; +ber_type_decoder_f RoughRTD_decode_ber; +der_type_encoder_f RoughRTD_encode_der; +xer_type_decoder_f RoughRTD_decode_xer; +xer_type_encoder_f RoughRTD_encode_xer; +per_type_decoder_f RoughRTD_decode_uper; +per_type_encoder_f RoughRTD_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _RoughRTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SVID.c b/src/core/libs/supl/asn-rrlp/SVID.c new file mode 100644 index 000000000..5a9adbd3a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SVID.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SVID.h" + +int +SVID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +SVID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +SVID_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SVID_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SVID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SVID_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SVID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SVID_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SVID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SVID_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SVID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SVID_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SVID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SVID_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +SVID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SVID_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +SVID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SVID_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_SVID_constr_1 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_SVID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SVID = { + "SVID", + "SVID", + SVID_free, + SVID_print, + SVID_constraint, + SVID_decode_ber, + SVID_encode_der, + SVID_decode_xer, + SVID_encode_xer, + SVID_decode_uper, + SVID_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SVID_tags_1, + sizeof(asn_DEF_SVID_tags_1) + /sizeof(asn_DEF_SVID_tags_1[0]), /* 1 */ + asn_DEF_SVID_tags_1, /* Same as above */ + sizeof(asn_DEF_SVID_tags_1) + /sizeof(asn_DEF_SVID_tags_1[0]), /* 1 */ + &asn_PER_type_SVID_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SVID.h b/src/core/libs/supl/asn-rrlp/SVID.h new file mode 100644 index 000000000..7cb51b7b3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SVID.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SVID_H_ +#define _SVID_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SVID */ +typedef long SVID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SVID; +asn_struct_free_f SVID_free; +asn_struct_print_f SVID_print; +asn_constr_check_f SVID_constraint; +ber_type_decoder_f SVID_decode_ber; +der_type_encoder_f SVID_encode_der; +xer_type_decoder_f SVID_decode_xer; +xer_type_encoder_f SVID_encode_xer; +per_type_decoder_f SVID_decode_uper; +per_type_encoder_f SVID_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SVID_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SVIDMASK.c b/src/core/libs/supl/asn-rrlp/SVIDMASK.c new file mode 100644 index 000000000..7c2c1a590 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SVIDMASK.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SVIDMASK.h" + +int +SVIDMASK_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size >= 1 && size <= 36)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +SVIDMASK_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +SVIDMASK_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SVIDMASK_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SVIDMASK_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SVIDMASK_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SVIDMASK_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SVIDMASK_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +SVIDMASK_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +SVIDMASK_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SVIDMASK_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_SVIDMASK_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 36 } /* (SIZE(1..36)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_SVIDMASK_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SVIDMASK = { + "SVIDMASK", + "SVIDMASK", + SVIDMASK_free, + SVIDMASK_print, + SVIDMASK_constraint, + SVIDMASK_decode_ber, + SVIDMASK_encode_der, + SVIDMASK_decode_xer, + SVIDMASK_encode_xer, + SVIDMASK_decode_uper, + SVIDMASK_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SVIDMASK_tags_1, + sizeof(asn_DEF_SVIDMASK_tags_1) + /sizeof(asn_DEF_SVIDMASK_tags_1[0]), /* 1 */ + asn_DEF_SVIDMASK_tags_1, /* Same as above */ + sizeof(asn_DEF_SVIDMASK_tags_1) + /sizeof(asn_DEF_SVIDMASK_tags_1[0]), /* 1 */ + &asn_PER_type_SVIDMASK_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SVIDMASK.h b/src/core/libs/supl/asn-rrlp/SVIDMASK.h new file mode 100644 index 000000000..75c15933b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SVIDMASK.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SVIDMASK_H_ +#define _SVIDMASK_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SVIDMASK */ +typedef BIT_STRING_t SVIDMASK_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SVIDMASK; +asn_struct_free_f SVIDMASK_free; +asn_struct_print_f SVIDMASK_print; +asn_constr_check_f SVIDMASK_constraint; +ber_type_decoder_f SVIDMASK_decode_ber; +der_type_encoder_f SVIDMASK_encode_der; +xer_type_decoder_f SVIDMASK_decode_xer; +xer_type_encoder_f SVIDMASK_encode_xer; +per_type_decoder_f SVIDMASK_decode_uper; +per_type_encoder_f SVIDMASK_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SVIDMASK_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SatElement.c b/src/core/libs/supl/asn-rrlp/SatElement.c new file mode 100644 index 000000000..5a3eaf8e1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SatElement.c @@ -0,0 +1,379 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SatElement.h" + +static int +memb_iode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 239)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_udre_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_pseudoRangeCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -2047 && value <= 2047)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_rangeRateCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -127 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_deltaPseudoRangeCor2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -127 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_deltaRangeRateCor2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -7 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_deltaPseudoRangeCor3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -127 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_deltaRangeRateCor3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -7 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_iode_constr_3 = { + { APC_CONSTRAINED, 8, 8, 0, 239 } /* (0..239) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_udre_constr_4 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_pseudoRangeCor_constr_5 = { + { APC_CONSTRAINED, 12, 12, -2047, 2047 } /* (-2047..2047) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_rangeRateCor_constr_6 = { + { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_deltaPseudoRangeCor2_constr_7 = { + { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_deltaRangeRateCor2_constr_8 = { + { APC_CONSTRAINED, 4, 4, -7, 7 } /* (-7..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_deltaPseudoRangeCor3_constr_9 = { + { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_deltaRangeRateCor3_constr_10 = { + { APC_CONSTRAINED, 4, 4, -7, 7 } /* (-7..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SatElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SatElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satelliteID" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, iode), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_iode_constraint_1, + &asn_PER_memb_iode_constr_3, + 0, + "iode" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, udre), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_udre_constraint_1, + &asn_PER_memb_udre_constr_4, + 0, + "udre" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, pseudoRangeCor), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_pseudoRangeCor_constraint_1, + &asn_PER_memb_pseudoRangeCor_constr_5, + 0, + "pseudoRangeCor" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, rangeRateCor), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_rangeRateCor_constraint_1, + &asn_PER_memb_rangeRateCor_constr_6, + 0, + "rangeRateCor" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaPseudoRangeCor2), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_deltaPseudoRangeCor2_constraint_1, + &asn_PER_memb_deltaPseudoRangeCor2_constr_7, + 0, + "deltaPseudoRangeCor2" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaRangeRateCor2), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_deltaRangeRateCor2_constraint_1, + &asn_PER_memb_deltaRangeRateCor2_constr_8, + 0, + "deltaRangeRateCor2" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaPseudoRangeCor3), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_deltaPseudoRangeCor3_constraint_1, + &asn_PER_memb_deltaPseudoRangeCor3_constr_9, + 0, + "deltaPseudoRangeCor3" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaRangeRateCor3), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_deltaRangeRateCor3_constraint_1, + &asn_PER_memb_deltaRangeRateCor3_constr_10, + 0, + "deltaRangeRateCor3" + }, +}; +static ber_tlv_tag_t asn_DEF_SatElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SatElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 664 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* iode at 667 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* udre at 669 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pseudoRangeCor at 673 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* rangeRateCor at 677 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* deltaPseudoRangeCor2 at 680 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* deltaRangeRateCor2 at 683 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* deltaPseudoRangeCor3 at 686 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* deltaRangeRateCor3 at 689 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SatElement_specs_1 = { + sizeof(struct SatElement), + offsetof(struct SatElement, _asn_ctx), + asn_MAP_SatElement_tag2el_1, + 9, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SatElement = { + "SatElement", + "SatElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SatElement_tags_1, + sizeof(asn_DEF_SatElement_tags_1) + /sizeof(asn_DEF_SatElement_tags_1[0]), /* 1 */ + asn_DEF_SatElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SatElement_tags_1) + /sizeof(asn_DEF_SatElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SatElement_1, + 9, /* Elements count */ + &asn_SPC_SatElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SatElement.h b/src/core/libs/supl/asn-rrlp/SatElement.h new file mode 100644 index 000000000..a312d6f4c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SatElement.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SatElement_H_ +#define _SatElement_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SatElement */ +typedef struct SatElement { + SatelliteID_t satelliteID; + long iode; + long udre; + long pseudoRangeCor; + long rangeRateCor; + long deltaPseudoRangeCor2; + long deltaRangeRateCor2; + long deltaPseudoRangeCor3; + long deltaRangeRateCor3; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SatElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SatElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _SatElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SatStatus.c b/src/core/libs/supl/asn-rrlp/SatStatus.c new file mode 100644 index 000000000..b92afe853 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SatStatus.c @@ -0,0 +1,80 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SatStatus.h" + +static asn_per_constraints_t asn_PER_type_SatStatus_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 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_SatStatus_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.newSatelliteAndModelUC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UncompressedEphemeris, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "newSatelliteAndModelUC" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.oldSatelliteAndModel), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "oldSatelliteAndModel" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.newNaviModelUC), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UncompressedEphemeris, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "newNaviModelUC" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_SatStatus_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* newSatelliteAndModelUC at 710 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* oldSatelliteAndModel at 713 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* newNaviModelUC at 716 */ +}; +static asn_CHOICE_specifics_t asn_SPC_SatStatus_specs_1 = { + sizeof(struct SatStatus), + offsetof(struct SatStatus, _asn_ctx), + offsetof(struct SatStatus, present), + sizeof(((struct SatStatus *)0)->present), + asn_MAP_SatStatus_tag2el_1, + 3, /* Count of tags in the map */ + 0, + 3 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_SatStatus = { + "SatStatus", + "SatStatus", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_SatStatus_constr_1, + asn_MBR_SatStatus_1, + 3, /* Elements count */ + &asn_SPC_SatStatus_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SatStatus.h b/src/core/libs/supl/asn-rrlp/SatStatus.h new file mode 100644 index 000000000..889424d29 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SatStatus.h @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SatStatus_H_ +#define _SatStatus_H_ + + +#include + +/* Including external dependencies */ +#include "UncompressedEphemeris.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SatStatus_PR { + SatStatus_PR_NOTHING, /* No components present */ + SatStatus_PR_newSatelliteAndModelUC, + SatStatus_PR_oldSatelliteAndModel, + SatStatus_PR_newNaviModelUC, + /* Extensions may appear below */ + +} SatStatus_PR; + +/* SatStatus */ +typedef struct SatStatus { + SatStatus_PR present; + union SatStatus_u { + UncompressedEphemeris_t newSatelliteAndModelUC; + NULL_t oldSatelliteAndModel; + UncompressedEphemeris_t newNaviModelUC; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SatStatus_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SatStatus; + +#ifdef __cplusplus +} +#endif + +#endif /* _SatStatus_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SatelliteID.c b/src/core/libs/supl/asn-rrlp/SatelliteID.c new file mode 100644 index 000000000..84951ec1a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SatelliteID.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SatelliteID.h" + +int +SatelliteID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +SatelliteID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +SatelliteID_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SatelliteID_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SatelliteID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SatelliteID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SatelliteID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SatelliteID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SatelliteID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +SatelliteID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +SatelliteID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SatelliteID_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_SatelliteID_constr_1 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_SatelliteID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SatelliteID = { + "SatelliteID", + "SatelliteID", + SatelliteID_free, + SatelliteID_print, + SatelliteID_constraint, + SatelliteID_decode_ber, + SatelliteID_encode_der, + SatelliteID_decode_xer, + SatelliteID_encode_xer, + SatelliteID_decode_uper, + SatelliteID_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SatelliteID_tags_1, + sizeof(asn_DEF_SatelliteID_tags_1) + /sizeof(asn_DEF_SatelliteID_tags_1[0]), /* 1 */ + asn_DEF_SatelliteID_tags_1, /* Same as above */ + sizeof(asn_DEF_SatelliteID_tags_1) + /sizeof(asn_DEF_SatelliteID_tags_1[0]), /* 1 */ + &asn_PER_type_SatelliteID_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SatelliteID.h b/src/core/libs/supl/asn-rrlp/SatelliteID.h new file mode 100644 index 000000000..834eb70ad --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SatelliteID.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SatelliteID_H_ +#define _SatelliteID_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SatelliteID */ +typedef long SatelliteID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SatelliteID; +asn_struct_free_f SatelliteID_free; +asn_struct_print_f SatelliteID_print; +asn_constr_check_f SatelliteID_constraint; +ber_type_decoder_f SatelliteID_decode_ber; +der_type_encoder_f SatelliteID_encode_der; +xer_type_decoder_f SatelliteID_decode_xer; +xer_type_encoder_f SatelliteID_encode_xer; +per_type_decoder_f SatelliteID_decode_uper; +per_type_encoder_f SatelliteID_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SatelliteID_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c new file mode 100644 index 000000000..7425bba8d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOf-BadSatelliteSet.h" + +static asn_per_constraints_t asn_PER_type_SeqOf_BadSatelliteSet_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOf_BadSatelliteSet_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOf_BadSatelliteSet_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOf_BadSatelliteSet_specs_1 = { + sizeof(struct SeqOf_BadSatelliteSet), + offsetof(struct SeqOf_BadSatelliteSet, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOf_BadSatelliteSet = { + "SeqOf-BadSatelliteSet", + "SeqOf-BadSatelliteSet", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOf_BadSatelliteSet_tags_1, + sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1) + /sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1[0]), /* 1 */ + asn_DEF_SeqOf_BadSatelliteSet_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1) + /sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOf_BadSatelliteSet_constr_1, + asn_MBR_SeqOf_BadSatelliteSet_1, + 1, /* Single element */ + &asn_SPC_SeqOf_BadSatelliteSet_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h new file mode 100644 index 000000000..a258a3214 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOf_BadSatelliteSet_H_ +#define _SeqOf_BadSatelliteSet_H_ + + +#include + +/* Including external dependencies */ +#include "SatelliteID.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SeqOf-BadSatelliteSet */ +typedef struct SeqOf_BadSatelliteSet { + A_SEQUENCE_OF(SatelliteID_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOf_BadSatelliteSet_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOf_BadSatelliteSet; + +#ifdef __cplusplus +} +#endif + +#endif /* _SeqOf_BadSatelliteSet_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c new file mode 100644 index 000000000..2347dbef1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOf-GANSSDataBits.h" + +static asn_per_constraints_t asn_PER_type_SeqOf_GANSSDataBits_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 10, 10, 1, 1024 } /* (SIZE(1..1024)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOf_GANSSDataBits_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_GANSSDataBit, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOf_GANSSDataBits_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOf_GANSSDataBits_specs_1 = { + sizeof(struct SeqOf_GANSSDataBits), + offsetof(struct SeqOf_GANSSDataBits, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOf_GANSSDataBits = { + "SeqOf-GANSSDataBits", + "SeqOf-GANSSDataBits", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOf_GANSSDataBits_tags_1, + sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1) + /sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1[0]), /* 1 */ + asn_DEF_SeqOf_GANSSDataBits_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1) + /sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOf_GANSSDataBits_constr_1, + asn_MBR_SeqOf_GANSSDataBits_1, + 1, /* Single element */ + &asn_SPC_SeqOf_GANSSDataBits_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h new file mode 100644 index 000000000..a55a8e2de --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOf_GANSSDataBits_H_ +#define _SeqOf_GANSSDataBits_H_ + + +#include + +/* Including external dependencies */ +#include "GANSSDataBit.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SeqOf-GANSSDataBits */ +typedef struct SeqOf_GANSSDataBits { + A_SEQUENCE_OF(GANSSDataBit_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOf_GANSSDataBits_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOf_GANSSDataBits; + +#ifdef __cplusplus +} +#endif + +#endif /* _SeqOf_GANSSDataBits_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c new file mode 100644 index 000000000..4084ecaf0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfAcquisElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfAcquisElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfAcquisElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_AcquisElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfAcquisElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfAcquisElement_specs_1 = { + sizeof(struct SeqOfAcquisElement), + offsetof(struct SeqOfAcquisElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfAcquisElement = { + "SeqOfAcquisElement", + "SeqOfAcquisElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfAcquisElement_tags_1, + sizeof(asn_DEF_SeqOfAcquisElement_tags_1) + /sizeof(asn_DEF_SeqOfAcquisElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfAcquisElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfAcquisElement_tags_1) + /sizeof(asn_DEF_SeqOfAcquisElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfAcquisElement_constr_1, + asn_MBR_SeqOfAcquisElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfAcquisElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h new file mode 100644 index 000000000..ed7212889 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfAcquisElement_H_ +#define _SeqOfAcquisElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct AcquisElement; + +/* SeqOfAcquisElement */ +typedef struct SeqOfAcquisElement { + A_SEQUENCE_OF(struct AcquisElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfAcquisElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfAcquisElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "AcquisElement.h" + +#endif /* _SeqOfAcquisElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c new file mode 100644 index 000000000..33843ff27 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfAlmanacElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfAlmanacElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfAlmanacElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_AlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfAlmanacElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfAlmanacElement_specs_1 = { + sizeof(struct SeqOfAlmanacElement), + offsetof(struct SeqOfAlmanacElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfAlmanacElement = { + "SeqOfAlmanacElement", + "SeqOfAlmanacElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfAlmanacElement_tags_1, + sizeof(asn_DEF_SeqOfAlmanacElement_tags_1) + /sizeof(asn_DEF_SeqOfAlmanacElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfAlmanacElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfAlmanacElement_tags_1) + /sizeof(asn_DEF_SeqOfAlmanacElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfAlmanacElement_constr_1, + asn_MBR_SeqOfAlmanacElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfAlmanacElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h new file mode 100644 index 000000000..1050eae30 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfAlmanacElement_H_ +#define _SeqOfAlmanacElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct AlmanacElement; + +/* SeqOfAlmanacElement */ +typedef struct SeqOfAlmanacElement { + A_SEQUENCE_OF(struct AlmanacElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfAlmanacElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfAlmanacElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "AlmanacElement.h" + +#endif /* _SeqOfAlmanacElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c new file mode 100644 index 000000000..1e77ca7ff --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfBadSignalElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfBadSignalElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfBadSignalElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_BadSignalElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfBadSignalElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfBadSignalElement_specs_1 = { + sizeof(struct SeqOfBadSignalElement), + offsetof(struct SeqOfBadSignalElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfBadSignalElement = { + "SeqOfBadSignalElement", + "SeqOfBadSignalElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfBadSignalElement_tags_1, + sizeof(asn_DEF_SeqOfBadSignalElement_tags_1) + /sizeof(asn_DEF_SeqOfBadSignalElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfBadSignalElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfBadSignalElement_tags_1) + /sizeof(asn_DEF_SeqOfBadSignalElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfBadSignalElement_constr_1, + asn_MBR_SeqOfBadSignalElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfBadSignalElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h new file mode 100644 index 000000000..8de761fd2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfBadSignalElement_H_ +#define _SeqOfBadSignalElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct BadSignalElement; + +/* SeqOfBadSignalElement */ +typedef struct SeqOfBadSignalElement { + A_SEQUENCE_OF(struct BadSignalElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfBadSignalElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfBadSignalElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "BadSignalElement.h" + +#endif /* _SeqOfBadSignalElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c new file mode 100644 index 000000000..e65dcad05 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfDGANSSSgnElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfDGANSSSgnElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfDGANSSSgnElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_DGANSSSgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfDGANSSSgnElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfDGANSSSgnElement_specs_1 = { + sizeof(struct SeqOfDGANSSSgnElement), + offsetof(struct SeqOfDGANSSSgnElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfDGANSSSgnElement = { + "SeqOfDGANSSSgnElement", + "SeqOfDGANSSSgnElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfDGANSSSgnElement_tags_1, + sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1) + /sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfDGANSSSgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1) + /sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfDGANSSSgnElement_constr_1, + asn_MBR_SeqOfDGANSSSgnElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfDGANSSSgnElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h new file mode 100644 index 000000000..560c771d7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfDGANSSSgnElement_H_ +#define _SeqOfDGANSSSgnElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct DGANSSSgnElement; + +/* SeqOfDGANSSSgnElement */ +typedef struct SeqOfDGANSSSgnElement { + A_SEQUENCE_OF(struct DGANSSSgnElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfDGANSSSgnElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfDGANSSSgnElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "DGANSSSgnElement.h" + +#endif /* _SeqOfDGANSSSgnElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c new file mode 100644 index 000000000..689475fdd --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSS-MsrSetElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSS_MsrSetElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSS_MsrSetElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSS_MsrSetElement_specs_1 = { + sizeof(struct SeqOfGANSS_MsrSetElement), + offsetof(struct SeqOfGANSS_MsrSetElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_MsrSetElement = { + "SeqOfGANSS-MsrSetElement", + "SeqOfGANSS-MsrSetElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSS_MsrSetElement_tags_1, + sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSS_MsrSetElement_constr_1, + asn_MBR_SeqOfGANSS_MsrSetElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSS_MsrSetElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h new file mode 100644 index 000000000..2686188e9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSS_MsrSetElement_H_ +#define _SeqOfGANSS_MsrSetElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSS_MsrSetElement; + +/* SeqOfGANSS-MsrSetElement */ +typedef struct SeqOfGANSS_MsrSetElement { + A_SEQUENCE_OF(struct GANSS_MsrSetElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSS_MsrSetElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_MsrSetElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSS-MsrSetElement.h" + +#endif /* _SeqOfGANSS_MsrSetElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c new file mode 100644 index 000000000..8543904c5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSS-SgnElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSS_SgnElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSS_SgnElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSS_SgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSS_SgnElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSS_SgnElement_specs_1 = { + sizeof(struct SeqOfGANSS_SgnElement), + offsetof(struct SeqOfGANSS_SgnElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnElement = { + "SeqOfGANSS-SgnElement", + "SeqOfGANSS-SgnElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSS_SgnElement_tags_1, + sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSS_SgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSS_SgnElement_constr_1, + asn_MBR_SeqOfGANSS_SgnElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSS_SgnElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h new file mode 100644 index 000000000..0ba0c8388 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSS_SgnElement_H_ +#define _SeqOfGANSS_SgnElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSS_SgnElement; + +/* SeqOfGANSS-SgnElement */ +typedef struct SeqOfGANSS_SgnElement { + A_SEQUENCE_OF(struct GANSS_SgnElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSS_SgnElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSS-SgnElement.h" + +#endif /* _SeqOfGANSS_SgnElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c new file mode 100644 index 000000000..706d36493 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSS-SgnTypeElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSS_SgnTypeElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 6 } /* (SIZE(1..6)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSS_SgnTypeElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSS_SgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSS_SgnTypeElement_specs_1 = { + sizeof(struct SeqOfGANSS_SgnTypeElement), + offsetof(struct SeqOfGANSS_SgnTypeElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnTypeElement = { + "SeqOfGANSS-SgnTypeElement", + "SeqOfGANSS-SgnTypeElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1, + sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSS_SgnTypeElement_constr_1, + asn_MBR_SeqOfGANSS_SgnTypeElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSS_SgnTypeElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h new file mode 100644 index 000000000..15c0a2516 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSS_SgnTypeElement_H_ +#define _SeqOfGANSS_SgnTypeElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSS_SgnTypeElement; + +/* SeqOfGANSS-SgnTypeElement */ +typedef struct SeqOfGANSS_SgnTypeElement { + A_SEQUENCE_OF(struct GANSS_SgnTypeElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSS_SgnTypeElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnTypeElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSS-SgnTypeElement.h" + +#endif /* _SeqOfGANSS_SgnTypeElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c new file mode 100644 index 000000000..1b6a339f8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSSAlmanacElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSSAlmanacElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 36 } /* (SIZE(1..36)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSSAlmanacElement_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_GANSSAlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSSAlmanacElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSAlmanacElement_specs_1 = { + sizeof(struct SeqOfGANSSAlmanacElement), + offsetof(struct SeqOfGANSSAlmanacElement, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSAlmanacElement = { + "SeqOfGANSSAlmanacElement", + "SeqOfGANSSAlmanacElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSSAlmanacElement_tags_1, + sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSAlmanacElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSSAlmanacElement_constr_1, + asn_MBR_SeqOfGANSSAlmanacElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSSAlmanacElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h new file mode 100644 index 000000000..a8e655568 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSSAlmanacElement_H_ +#define _SeqOfGANSSAlmanacElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSAlmanacElement; + +/* SeqOfGANSSAlmanacElement */ +typedef struct SeqOfGANSSAlmanacElement { + A_SEQUENCE_OF(struct GANSSAlmanacElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSSAlmanacElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSAlmanacElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSAlmanacElement.h" + +#endif /* _SeqOfGANSSAlmanacElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c new file mode 100644 index 000000000..737ab2623 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSSGenericAssistDataElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSSGenericAssistDataElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSSGenericAssistDataElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSSGenericAssistDataElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSGenericAssistDataElement_specs_1 = { + sizeof(struct SeqOfGANSSGenericAssistDataElement), + offsetof(struct SeqOfGANSSGenericAssistDataElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSGenericAssistDataElement = { + "SeqOfGANSSGenericAssistDataElement", + "SeqOfGANSSGenericAssistDataElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1, + sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSSGenericAssistDataElement_constr_1, + asn_MBR_SeqOfGANSSGenericAssistDataElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSSGenericAssistDataElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h new file mode 100644 index 000000000..62441ea78 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSSGenericAssistDataElement_H_ +#define _SeqOfGANSSGenericAssistDataElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSGenericAssistDataElement; + +/* SeqOfGANSSGenericAssistDataElement */ +typedef struct SeqOfGANSSGenericAssistDataElement { + A_SEQUENCE_OF(struct GANSSGenericAssistDataElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSSGenericAssistDataElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSGenericAssistDataElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSGenericAssistDataElement.h" + +#endif /* _SeqOfGANSSGenericAssistDataElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c new file mode 100644 index 000000000..8e9a1bf16 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSSRefMeasurementElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSSRefMeasurementElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSSRefMeasurementElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSSRefMeasurementElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSRefMeasurementElement_specs_1 = { + sizeof(struct SeqOfGANSSRefMeasurementElement), + offsetof(struct SeqOfGANSSRefMeasurementElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSRefMeasurementElement = { + "SeqOfGANSSRefMeasurementElement", + "SeqOfGANSSRefMeasurementElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1, + sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSSRefMeasurementElement_constr_1, + asn_MBR_SeqOfGANSSRefMeasurementElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSSRefMeasurementElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h new file mode 100644 index 000000000..615f304ad --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSSRefMeasurementElement_H_ +#define _SeqOfGANSSRefMeasurementElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSRefMeasurementElement; + +/* SeqOfGANSSRefMeasurementElement */ +typedef struct SeqOfGANSSRefMeasurementElement { + A_SEQUENCE_OF(struct GANSSRefMeasurementElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSSRefMeasurementElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSRefMeasurementElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSRefMeasurementElement.h" + +#endif /* _SeqOfGANSSRefMeasurementElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c new file mode 100644 index 000000000..5c9c95fa5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSSSatelliteElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSSSatelliteElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSSSatelliteElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSSSatelliteElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSSSatelliteElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSSatelliteElement_specs_1 = { + sizeof(struct SeqOfGANSSSatelliteElement), + offsetof(struct SeqOfGANSSSatelliteElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSSatelliteElement = { + "SeqOfGANSSSatelliteElement", + "SeqOfGANSSSatelliteElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSSSatelliteElement_tags_1, + sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSSatelliteElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1) + /sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSSSatelliteElement_constr_1, + asn_MBR_SeqOfGANSSSatelliteElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSSSatelliteElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h new file mode 100644 index 000000000..adb5f6cf7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSSSatelliteElement_H_ +#define _SeqOfGANSSSatelliteElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSSatelliteElement; + +/* SeqOfGANSSSatelliteElement */ +typedef struct SeqOfGANSSSatelliteElement { + A_SEQUENCE_OF(struct GANSSSatelliteElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSSSatelliteElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSSatelliteElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSSatelliteElement.h" + +#endif /* _SeqOfGANSSSatelliteElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c new file mode 100644 index 000000000..d3a923f23 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGANSSTimeModel.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGANSSTimeModel_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 7 } /* (SIZE(1..7)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGANSSTimeModel_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GANSSTimeModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGANSSTimeModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSTimeModel_specs_1 = { + sizeof(struct SeqOfGANSSTimeModel), + offsetof(struct SeqOfGANSSTimeModel, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSTimeModel = { + "SeqOfGANSSTimeModel", + "SeqOfGANSSTimeModel", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGANSSTimeModel_tags_1, + sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1) + /sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSTimeModel_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1) + /sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGANSSTimeModel_constr_1, + asn_MBR_SeqOfGANSSTimeModel_1, + 1, /* Single element */ + &asn_SPC_SeqOfGANSSTimeModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h new file mode 100644 index 000000000..715157be2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGANSSTimeModel_H_ +#define _SeqOfGANSSTimeModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GANSSTimeModelElement; + +/* SeqOfGANSSTimeModel */ +typedef struct SeqOfGANSSTimeModel { + A_SEQUENCE_OF(struct GANSSTimeModelElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGANSSTimeModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSTimeModel; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GANSSTimeModelElement.h" + +#endif /* _SeqOfGANSSTimeModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c new file mode 100644 index 000000000..c66328606 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGPS-MsrElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGPS_MsrElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGPS_MsrElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GPS_MsrElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGPS_MsrElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGPS_MsrElement_specs_1 = { + sizeof(struct SeqOfGPS_MsrElement), + offsetof(struct SeqOfGPS_MsrElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrElement = { + "SeqOfGPS-MsrElement", + "SeqOfGPS-MsrElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGPS_MsrElement_tags_1, + sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1) + /sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGPS_MsrElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1) + /sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGPS_MsrElement_constr_1, + asn_MBR_SeqOfGPS_MsrElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGPS_MsrElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h new file mode 100644 index 000000000..626ad95ae --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGPS_MsrElement_H_ +#define _SeqOfGPS_MsrElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GPS_MsrElement; + +/* SeqOfGPS-MsrElement */ +typedef struct SeqOfGPS_MsrElement { + A_SEQUENCE_OF(struct GPS_MsrElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGPS_MsrElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GPS-MsrElement.h" + +#endif /* _SeqOfGPS_MsrElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c new file mode 100644 index 000000000..b9f6297a5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfGPS-MsrSetElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfGPS_MsrSetElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfGPS_MsrSetElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_GPS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfGPS_MsrSetElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGPS_MsrSetElement_specs_1 = { + sizeof(struct SeqOfGPS_MsrSetElement), + offsetof(struct SeqOfGPS_MsrSetElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrSetElement = { + "SeqOfGPS-MsrSetElement", + "SeqOfGPS-MsrSetElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfGPS_MsrSetElement_tags_1, + sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1) + /sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGPS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1) + /sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfGPS_MsrSetElement_constr_1, + asn_MBR_SeqOfGPS_MsrSetElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfGPS_MsrSetElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h new file mode 100644 index 000000000..c8ae1a982 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfGPS_MsrSetElement_H_ +#define _SeqOfGPS_MsrSetElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GPS_MsrSetElement; + +/* SeqOfGPS-MsrSetElement */ +typedef struct SeqOfGPS_MsrSetElement { + A_SEQUENCE_OF(struct GPS_MsrSetElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfGPS_MsrSetElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrSetElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GPS-MsrSetElement.h" + +#endif /* _SeqOfGPS_MsrSetElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c new file mode 100644 index 000000000..15f1cefff --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfMsrAssistBTS-R98-ExpOTD.h" + +static asn_per_constraints_t asn_PER_type_SeqOfMsrAssistBTS_R98_ExpOTD_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfMsrAssistBTS_R98_ExpOTD_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_MsrAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfMsrAssistBTS_R98_ExpOTD_specs_1 = { + sizeof(struct SeqOfMsrAssistBTS_R98_ExpOTD), + offsetof(struct SeqOfMsrAssistBTS_R98_ExpOTD, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD = { + "SeqOfMsrAssistBTS-R98-ExpOTD", + "SeqOfMsrAssistBTS-R98-ExpOTD", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1, + sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfMsrAssistBTS_R98_ExpOTD_constr_1, + asn_MBR_SeqOfMsrAssistBTS_R98_ExpOTD_1, + 1, /* Single element */ + &asn_SPC_SeqOfMsrAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h new file mode 100644 index 000000000..752ce2934 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfMsrAssistBTS_R98_ExpOTD_H_ +#define _SeqOfMsrAssistBTS_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct MsrAssistBTS_R98_ExpOTD; + +/* SeqOfMsrAssistBTS-R98-ExpOTD */ +typedef struct SeqOfMsrAssistBTS_R98_ExpOTD { + A_SEQUENCE_OF(struct MsrAssistBTS_R98_ExpOTD) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfMsrAssistBTS_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "MsrAssistBTS-R98-ExpOTD.h" + +#endif /* _SeqOfMsrAssistBTS_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c new file mode 100644 index 000000000..fb1b5638e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfMsrAssistBTS.h" + +static asn_per_constraints_t asn_PER_type_SeqOfMsrAssistBTS_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfMsrAssistBTS_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_MsrAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfMsrAssistBTS_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfMsrAssistBTS_specs_1 = { + sizeof(struct SeqOfMsrAssistBTS), + offsetof(struct SeqOfMsrAssistBTS, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS = { + "SeqOfMsrAssistBTS", + "SeqOfMsrAssistBTS", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfMsrAssistBTS_tags_1, + sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1) + /sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1[0]), /* 1 */ + asn_DEF_SeqOfMsrAssistBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1) + /sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfMsrAssistBTS_constr_1, + asn_MBR_SeqOfMsrAssistBTS_1, + 1, /* Single element */ + &asn_SPC_SeqOfMsrAssistBTS_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h new file mode 100644 index 000000000..03c0af381 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfMsrAssistBTS_H_ +#define _SeqOfMsrAssistBTS_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct MsrAssistBTS; + +/* SeqOfMsrAssistBTS */ +typedef struct SeqOfMsrAssistBTS { + A_SEQUENCE_OF(struct MsrAssistBTS) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfMsrAssistBTS_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "MsrAssistBTS.h" + +#endif /* _SeqOfMsrAssistBTS_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c new file mode 100644 index 000000000..d28ec04a2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfNavModelElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfNavModelElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfNavModelElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_NavModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfNavModelElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfNavModelElement_specs_1 = { + sizeof(struct SeqOfNavModelElement), + offsetof(struct SeqOfNavModelElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfNavModelElement = { + "SeqOfNavModelElement", + "SeqOfNavModelElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfNavModelElement_tags_1, + sizeof(asn_DEF_SeqOfNavModelElement_tags_1) + /sizeof(asn_DEF_SeqOfNavModelElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfNavModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfNavModelElement_tags_1) + /sizeof(asn_DEF_SeqOfNavModelElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfNavModelElement_constr_1, + asn_MBR_SeqOfNavModelElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfNavModelElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h new file mode 100644 index 000000000..aa49a6357 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfNavModelElement_H_ +#define _SeqOfNavModelElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct NavModelElement; + +/* SeqOfNavModelElement */ +typedef struct SeqOfNavModelElement { + A_SEQUENCE_OF(struct NavModelElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfNavModelElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfNavModelElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "NavModelElement.h" + +#endif /* _SeqOfNavModelElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c new file mode 100644 index 000000000..ace76ee1a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfOTD-FirstSetMsrs-R98-Ext.h" + +static asn_per_constraints_t asn_PER_type_SeqOfOTD_FirstSetMsrs_R98_Ext_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfOTD_FirstSetMsrs_R98_Ext_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_OTD_FirstSetMsrs, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_FirstSetMsrs_R98_Ext_specs_1 = { + sizeof(struct SeqOfOTD_FirstSetMsrs_R98_Ext), + offsetof(struct SeqOfOTD_FirstSetMsrs_R98_Ext, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext = { + "SeqOfOTD-FirstSetMsrs-R98-Ext", + "SeqOfOTD-FirstSetMsrs-R98-Ext", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1, + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1) + /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1) + /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfOTD_FirstSetMsrs_R98_Ext_constr_1, + asn_MBR_SeqOfOTD_FirstSetMsrs_R98_Ext_1, + 1, /* Single element */ + &asn_SPC_SeqOfOTD_FirstSetMsrs_R98_Ext_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h new file mode 100644 index 000000000..e193afc3c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfOTD_FirstSetMsrs_R98_Ext_H_ +#define _SeqOfOTD_FirstSetMsrs_R98_Ext_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct OTD_MeasurementWithID; + +/* SeqOfOTD-FirstSetMsrs-R98-Ext */ +typedef struct SeqOfOTD_FirstSetMsrs_R98_Ext { + A_SEQUENCE_OF(struct OTD_MeasurementWithID) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfOTD_FirstSetMsrs_R98_Ext_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "OTD-FirstSetMsrs.h" + +#endif /* _SeqOfOTD_FirstSetMsrs_R98_Ext_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c new file mode 100644 index 000000000..d3f9263f8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfOTD-FirstSetMsrs.h" + +static asn_per_constraints_t asn_PER_type_SeqOfOTD_FirstSetMsrs_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 10 } /* (SIZE(1..10)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfOTD_FirstSetMsrs_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_OTD_FirstSetMsrs, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_FirstSetMsrs_specs_1 = { + sizeof(struct SeqOfOTD_FirstSetMsrs), + offsetof(struct SeqOfOTD_FirstSetMsrs, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs = { + "SeqOfOTD-FirstSetMsrs", + "SeqOfOTD-FirstSetMsrs", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1, + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1) + /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1) + /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfOTD_FirstSetMsrs_constr_1, + asn_MBR_SeqOfOTD_FirstSetMsrs_1, + 1, /* Single element */ + &asn_SPC_SeqOfOTD_FirstSetMsrs_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h new file mode 100644 index 000000000..9d3390037 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfOTD_FirstSetMsrs_H_ +#define _SeqOfOTD_FirstSetMsrs_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct OTD_MeasurementWithID; + +/* SeqOfOTD-FirstSetMsrs */ +typedef struct SeqOfOTD_FirstSetMsrs { + A_SEQUENCE_OF(struct OTD_MeasurementWithID) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfOTD_FirstSetMsrs_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "OTD-FirstSetMsrs.h" + +#endif /* _SeqOfOTD_FirstSetMsrs_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c new file mode 100644 index 000000000..27c86b0a5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfOTD-MsrElementRest.h" + +static asn_per_constraints_t asn_PER_type_SeqOfOTD_MsrElementRest_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfOTD_MsrElementRest_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_OTD_MsrElementRest, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfOTD_MsrElementRest_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_MsrElementRest_specs_1 = { + sizeof(struct SeqOfOTD_MsrElementRest), + offsetof(struct SeqOfOTD_MsrElementRest, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrElementRest = { + "SeqOfOTD-MsrElementRest", + "SeqOfOTD-MsrElementRest", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfOTD_MsrElementRest_tags_1, + sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1) + /sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_MsrElementRest_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1) + /sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfOTD_MsrElementRest_constr_1, + asn_MBR_SeqOfOTD_MsrElementRest_1, + 1, /* Single element */ + &asn_SPC_SeqOfOTD_MsrElementRest_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h new file mode 100644 index 000000000..d92408eb8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfOTD_MsrElementRest_H_ +#define _SeqOfOTD_MsrElementRest_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct OTD_MsrElementRest; + +/* SeqOfOTD-MsrElementRest */ +typedef struct SeqOfOTD_MsrElementRest { + A_SEQUENCE_OF(struct OTD_MsrElementRest) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfOTD_MsrElementRest_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrElementRest; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "OTD-MsrElementRest.h" + +#endif /* _SeqOfOTD_MsrElementRest_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c new file mode 100644 index 000000000..51b804707 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfOTD-MsrsOfOtherSets.h" + +static asn_per_constraints_t asn_PER_type_SeqOfOTD_MsrsOfOtherSets_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 10 } /* (SIZE(1..10)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfOTD_MsrsOfOtherSets_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_OTD_MsrsOfOtherSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_MsrsOfOtherSets_specs_1 = { + sizeof(struct SeqOfOTD_MsrsOfOtherSets), + offsetof(struct SeqOfOTD_MsrsOfOtherSets, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrsOfOtherSets = { + "SeqOfOTD-MsrsOfOtherSets", + "SeqOfOTD-MsrsOfOtherSets", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1, + sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1) + /sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1) + /sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfOTD_MsrsOfOtherSets_constr_1, + asn_MBR_SeqOfOTD_MsrsOfOtherSets_1, + 1, /* Single element */ + &asn_SPC_SeqOfOTD_MsrsOfOtherSets_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h new file mode 100644 index 000000000..21324431d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfOTD_MsrsOfOtherSets_H_ +#define _SeqOfOTD_MsrsOfOtherSets_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct OTD_MsrsOfOtherSets; + +/* SeqOfOTD-MsrsOfOtherSets */ +typedef struct SeqOfOTD_MsrsOfOtherSets { + A_SEQUENCE_OF(struct OTD_MsrsOfOtherSets) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfOTD_MsrsOfOtherSets_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrsOfOtherSets; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "OTD-MsrsOfOtherSets.h" + +#endif /* _SeqOfOTD_MsrsOfOtherSets_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c new file mode 100644 index 000000000..e02edb83c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfReferenceIdentityType.h" + +static asn_per_constraints_t asn_PER_type_SeqOfReferenceIdentityType_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfReferenceIdentityType_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_ReferenceIdentityType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfReferenceIdentityType_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfReferenceIdentityType_specs_1 = { + sizeof(struct SeqOfReferenceIdentityType), + offsetof(struct SeqOfReferenceIdentityType, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfReferenceIdentityType = { + "SeqOfReferenceIdentityType", + "SeqOfReferenceIdentityType", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfReferenceIdentityType_tags_1, + sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1) + /sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1[0]), /* 1 */ + asn_DEF_SeqOfReferenceIdentityType_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1) + /sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfReferenceIdentityType_constr_1, + asn_MBR_SeqOfReferenceIdentityType_1, + 1, /* Single element */ + &asn_SPC_SeqOfReferenceIdentityType_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h new file mode 100644 index 000000000..f7b890090 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfReferenceIdentityType_H_ +#define _SeqOfReferenceIdentityType_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct ReferenceIdentityType; + +/* SeqOfReferenceIdentityType */ +typedef struct SeqOfReferenceIdentityType { + A_SEQUENCE_OF(struct ReferenceIdentityType) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfReferenceIdentityType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfReferenceIdentityType; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "ReferenceIdentityType.h" + +#endif /* _SeqOfReferenceIdentityType_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c new file mode 100644 index 000000000..c70089990 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfSatElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfSatElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfSatElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SatElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfSatElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfSatElement_specs_1 = { + sizeof(struct SeqOfSatElement), + offsetof(struct SeqOfSatElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfSatElement = { + "SeqOfSatElement", + "SeqOfSatElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfSatElement_tags_1, + sizeof(asn_DEF_SeqOfSatElement_tags_1) + /sizeof(asn_DEF_SeqOfSatElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSatElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSatElement_tags_1) + /sizeof(asn_DEF_SeqOfSatElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfSatElement_constr_1, + asn_MBR_SeqOfSatElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfSatElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h new file mode 100644 index 000000000..16b8282f9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfSatElement_H_ +#define _SeqOfSatElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SatElement; + +/* SeqOfSatElement */ +typedef struct SeqOfSatElement { + A_SEQUENCE_OF(struct SatElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfSatElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfSatElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SatElement.h" + +#endif /* _SeqOfSatElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c new file mode 100644 index 000000000..36a8f243a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfSgnTypeElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfSgnTypeElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfSgnTypeElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfSgnTypeElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfSgnTypeElement_specs_1 = { + sizeof(struct SeqOfSgnTypeElement), + offsetof(struct SeqOfSgnTypeElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfSgnTypeElement = { + "SeqOfSgnTypeElement", + "SeqOfSgnTypeElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfSgnTypeElement_tags_1, + sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1) + /sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1) + /sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfSgnTypeElement_constr_1, + asn_MBR_SeqOfSgnTypeElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfSgnTypeElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h new file mode 100644 index 000000000..2af754902 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfSgnTypeElement_H_ +#define _SeqOfSgnTypeElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SgnTypeElement; + +/* SeqOfSgnTypeElement */ +typedef struct SeqOfSgnTypeElement { + A_SEQUENCE_OF(struct SgnTypeElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfSgnTypeElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfSgnTypeElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SgnTypeElement.h" + +#endif /* _SeqOfSgnTypeElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c new file mode 100644 index 000000000..4ecbbcbb7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfStandardClockModelElement.h" + +static asn_per_constraints_t asn_PER_type_SeqOfStandardClockModelElement_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfStandardClockModelElement_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_StandardClockModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfStandardClockModelElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfStandardClockModelElement_specs_1 = { + sizeof(struct SeqOfStandardClockModelElement), + offsetof(struct SeqOfStandardClockModelElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfStandardClockModelElement = { + "SeqOfStandardClockModelElement", + "SeqOfStandardClockModelElement", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfStandardClockModelElement_tags_1, + sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1) + /sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfStandardClockModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1) + /sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfStandardClockModelElement_constr_1, + asn_MBR_SeqOfStandardClockModelElement_1, + 1, /* Single element */ + &asn_SPC_SeqOfStandardClockModelElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h new file mode 100644 index 000000000..9f5c0d239 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfStandardClockModelElement_H_ +#define _SeqOfStandardClockModelElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct StandardClockModelElement; + +/* SeqOfStandardClockModelElement */ +typedef struct SeqOfStandardClockModelElement { + A_SEQUENCE_OF(struct StandardClockModelElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfStandardClockModelElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfStandardClockModelElement; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "StandardClockModelElement.h" + +#endif /* _SeqOfStandardClockModelElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c new file mode 100644 index 000000000..ae77b5fee --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfSystemInfoAssistBTS-R98-ExpOTD.h" + +static asn_per_constraints_t asn_PER_type_SeqOfSystemInfoAssistBTS_R98_ExpOTD_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfSystemInfoAssistBTS_R98_ExpOTD_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_SystemInfoAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfSystemInfoAssistBTS_R98_ExpOTD_specs_1 = { + sizeof(struct SeqOfSystemInfoAssistBTS_R98_ExpOTD), + offsetof(struct SeqOfSystemInfoAssistBTS_R98_ExpOTD, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD = { + "SeqOfSystemInfoAssistBTS-R98-ExpOTD", + "SeqOfSystemInfoAssistBTS-R98-ExpOTD", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1, + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfSystemInfoAssistBTS_R98_ExpOTD_constr_1, + asn_MBR_SeqOfSystemInfoAssistBTS_R98_ExpOTD_1, + 1, /* Single element */ + &asn_SPC_SeqOfSystemInfoAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h new file mode 100644 index 000000000..8dffd5e0f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfSystemInfoAssistBTS_R98_ExpOTD_H_ +#define _SeqOfSystemInfoAssistBTS_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SystemInfoAssistBTS_R98_ExpOTD; + +/* SeqOfSystemInfoAssistBTS-R98-ExpOTD */ +typedef struct SeqOfSystemInfoAssistBTS_R98_ExpOTD { + A_SEQUENCE_OF(struct SystemInfoAssistBTS_R98_ExpOTD) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfSystemInfoAssistBTS_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SystemInfoAssistBTS-R98-ExpOTD.h" + +#endif /* _SeqOfSystemInfoAssistBTS_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c new file mode 100644 index 000000000..a728a3bde --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SeqOfSystemInfoAssistBTS.h" + +static asn_per_constraints_t asn_PER_type_SeqOfSystemInfoAssistBTS_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SeqOfSystemInfoAssistBTS_1[] = { + { ATF_POINTER, 0, 0, + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_SystemInfoAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfSystemInfoAssistBTS_specs_1 = { + sizeof(struct SeqOfSystemInfoAssistBTS), + offsetof(struct SeqOfSystemInfoAssistBTS, _asn_ctx), + 2, /* XER encoding is XMLValueList */ +}; +asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS = { + "SeqOfSystemInfoAssistBTS", + "SeqOfSystemInfoAssistBTS", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SeqOfSystemInfoAssistBTS_tags_1, + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1) + /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSystemInfoAssistBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1) + /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[0]), /* 1 */ + &asn_PER_type_SeqOfSystemInfoAssistBTS_constr_1, + asn_MBR_SeqOfSystemInfoAssistBTS_1, + 1, /* Single element */ + &asn_SPC_SeqOfSystemInfoAssistBTS_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h new file mode 100644 index 000000000..faebb465f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SeqOfSystemInfoAssistBTS_H_ +#define _SeqOfSystemInfoAssistBTS_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SystemInfoAssistBTS; + +/* SeqOfSystemInfoAssistBTS */ +typedef struct SeqOfSystemInfoAssistBTS { + A_SEQUENCE_OF(struct SystemInfoAssistBTS) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SeqOfSystemInfoAssistBTS_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SystemInfoAssistBTS.h" + +#endif /* _SeqOfSystemInfoAssistBTS_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SgnTypeElement.c b/src/core/libs/supl/asn-rrlp/SgnTypeElement.c new file mode 100644 index 000000000..fa49b6689 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SgnTypeElement.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SgnTypeElement.h" + +static int +memb_ganssStatusHealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ganssStatusHealth_constr_3 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SgnTypeElement_1[] = { + { ATF_POINTER, 1, offsetof(struct SgnTypeElement, ganssSignalID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSSignalID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ganssSignalID" + }, + { ATF_NOFLAGS, 0, offsetof(struct SgnTypeElement, ganssStatusHealth), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ganssStatusHealth_constraint_1, + &asn_PER_memb_ganssStatusHealth_constr_3, + 0, + "ganssStatusHealth" + }, + { ATF_NOFLAGS, 0, offsetof(struct SgnTypeElement, dganssSgnList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfDGANSSSgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dganssSgnList" + }, +}; +static int asn_MAP_SgnTypeElement_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_SgnTypeElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SgnTypeElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssSignalID at 1196 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssStatusHealth at 1197 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* dganssSgnList at 1200 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SgnTypeElement_specs_1 = { + sizeof(struct SgnTypeElement), + offsetof(struct SgnTypeElement, _asn_ctx), + asn_MAP_SgnTypeElement_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_SgnTypeElement_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SgnTypeElement = { + "SgnTypeElement", + "SgnTypeElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SgnTypeElement_tags_1, + sizeof(asn_DEF_SgnTypeElement_tags_1) + /sizeof(asn_DEF_SgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_SgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SgnTypeElement_tags_1) + /sizeof(asn_DEF_SgnTypeElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SgnTypeElement_1, + 3, /* Elements count */ + &asn_SPC_SgnTypeElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SgnTypeElement.h b/src/core/libs/supl/asn-rrlp/SgnTypeElement.h new file mode 100644 index 000000000..35ebe62ca --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SgnTypeElement.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SgnTypeElement_H_ +#define _SgnTypeElement_H_ + + +#include + +/* Including external dependencies */ +#include "GANSSSignalID.h" +#include +#include "SeqOfDGANSSSgnElement.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SgnTypeElement */ +typedef struct SgnTypeElement { + GANSSSignalID_t *ganssSignalID /* OPTIONAL */; + long ganssStatusHealth; + SeqOfDGANSSSgnElement_t dganssSgnList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SgnTypeElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SgnTypeElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _SgnTypeElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c new file mode 100644 index 000000000..e04f2b6c0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c @@ -0,0 +1,291 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "StandardClockModelElement.h" + +static int +memb_stanClockTocLSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stanClockAF2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -2048 && value <= 2047)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stanClockAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -131072 && value <= 131071)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stanClockAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -134217728 && value <= 134217727)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stanClockTgd_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -512 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_stanModelID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_stanClockTocLSB_constr_2 = { + { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stanClockAF2_constr_3 = { + { APC_CONSTRAINED, 12, 12, -2048, 2047 } /* (-2048..2047) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stanClockAF1_constr_4 = { + { APC_CONSTRAINED, 18, -1, -131072, 131071 } /* (-131072..131071) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stanClockAF0_constr_5 = { + { APC_CONSTRAINED, 28, -1, -134217728, 134217727 } /* (-134217728..134217727) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stanClockTgd_constr_6 = { + { APC_CONSTRAINED, 10, 10, -512, 511 } /* (-512..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_stanModelID_constr_7 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_StandardClockModelElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockTocLSB), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stanClockTocLSB_constraint_1, + &asn_PER_memb_stanClockTocLSB_constr_2, + 0, + "stanClockTocLSB" + }, + { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stanClockAF2_constraint_1, + &asn_PER_memb_stanClockAF2_constr_3, + 0, + "stanClockAF2" + }, + { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF1), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stanClockAF1_constraint_1, + &asn_PER_memb_stanClockAF1_constr_4, + 0, + "stanClockAF1" + }, + { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF0), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stanClockAF0_constraint_1, + &asn_PER_memb_stanClockAF0_constr_5, + 0, + "stanClockAF0" + }, + { ATF_POINTER, 2, offsetof(struct StandardClockModelElement, stanClockTgd), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stanClockTgd_constraint_1, + &asn_PER_memb_stanClockTgd_constr_6, + 0, + "stanClockTgd" + }, + { ATF_POINTER, 1, offsetof(struct StandardClockModelElement, stanModelID), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_stanModelID_constraint_1, + &asn_PER_memb_stanModelID_constr_7, + 0, + "stanModelID" + }, +}; +static int asn_MAP_StandardClockModelElement_oms_1[] = { 4, 5 }; +static ber_tlv_tag_t asn_DEF_StandardClockModelElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_StandardClockModelElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* stanClockTocLSB at 1281 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* stanClockAF2 at 1282 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* stanClockAF1 at 1283 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* stanClockAF0 at 1284 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* stanClockTgd at 1285 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* stanModelID at 1286 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_StandardClockModelElement_specs_1 = { + sizeof(struct StandardClockModelElement), + offsetof(struct StandardClockModelElement, _asn_ctx), + asn_MAP_StandardClockModelElement_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_StandardClockModelElement_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_StandardClockModelElement = { + "StandardClockModelElement", + "StandardClockModelElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_StandardClockModelElement_tags_1, + sizeof(asn_DEF_StandardClockModelElement_tags_1) + /sizeof(asn_DEF_StandardClockModelElement_tags_1[0]), /* 1 */ + asn_DEF_StandardClockModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_StandardClockModelElement_tags_1) + /sizeof(asn_DEF_StandardClockModelElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_StandardClockModelElement_1, + 6, /* Elements count */ + &asn_SPC_StandardClockModelElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h new file mode 100644 index 000000000..7fe79afb8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _StandardClockModelElement_H_ +#define _StandardClockModelElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* StandardClockModelElement */ +typedef struct StandardClockModelElement { + long stanClockTocLSB; + long stanClockAF2; + long stanClockAF1; + long stanClockAF0; + long *stanClockTgd /* OPTIONAL */; + long *stanModelID /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} StandardClockModelElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_StandardClockModelElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _StandardClockModelElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/StdResolution.c b/src/core/libs/supl/asn-rrlp/StdResolution.c new file mode 100644 index 000000000..b5dd33517 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/StdResolution.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "StdResolution.h" + +int +StdResolution_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +StdResolution_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +StdResolution_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + StdResolution_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +StdResolution_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +StdResolution_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +StdResolution_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +StdResolution_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +StdResolution_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +StdResolution_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +StdResolution_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + StdResolution_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_StdResolution_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_StdResolution_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_StdResolution = { + "StdResolution", + "StdResolution", + StdResolution_free, + StdResolution_print, + StdResolution_constraint, + StdResolution_decode_ber, + StdResolution_encode_der, + StdResolution_decode_xer, + StdResolution_encode_xer, + StdResolution_decode_uper, + StdResolution_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_StdResolution_tags_1, + sizeof(asn_DEF_StdResolution_tags_1) + /sizeof(asn_DEF_StdResolution_tags_1[0]), /* 1 */ + asn_DEF_StdResolution_tags_1, /* Same as above */ + sizeof(asn_DEF_StdResolution_tags_1) + /sizeof(asn_DEF_StdResolution_tags_1[0]), /* 1 */ + &asn_PER_type_StdResolution_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/StdResolution.h b/src/core/libs/supl/asn-rrlp/StdResolution.h new file mode 100644 index 000000000..289d227b8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/StdResolution.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _StdResolution_H_ +#define _StdResolution_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* StdResolution */ +typedef long StdResolution_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_StdResolution; +asn_struct_free_f StdResolution_free; +asn_struct_print_f StdResolution_print; +asn_constr_check_f StdResolution_constraint; +ber_type_decoder_f StdResolution_decode_ber; +der_type_encoder_f StdResolution_encode_der; +xer_type_decoder_f StdResolution_decode_xer; +xer_type_encoder_f StdResolution_encode_xer; +per_type_decoder_f StdResolution_decode_uper; +per_type_encoder_f StdResolution_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _StdResolution_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c new file mode 100644 index 000000000..a7e14dce0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SystemInfoAssistBTS-R98-ExpOTD.h" + +static asn_per_constraints_t asn_PER_type_SystemInfoAssistBTS_R98_ExpOTD_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SystemInfoAssistBTS_R98_ExpOTD_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, choice.notPresent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "notPresent" + }, + { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, choice.present), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AssistBTSData_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "present" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistBTS_R98_ExpOTD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* notPresent at 927 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* present at 929 */ +}; +static asn_CHOICE_specifics_t asn_SPC_SystemInfoAssistBTS_R98_ExpOTD_specs_1 = { + sizeof(struct SystemInfoAssistBTS_R98_ExpOTD), + offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, _asn_ctx), + offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, present), + sizeof(((struct SystemInfoAssistBTS_R98_ExpOTD *)0)->present), + asn_MAP_SystemInfoAssistBTS_R98_ExpOTD_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS_R98_ExpOTD = { + "SystemInfoAssistBTS-R98-ExpOTD", + "SystemInfoAssistBTS-R98-ExpOTD", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_SystemInfoAssistBTS_R98_ExpOTD_constr_1, + asn_MBR_SystemInfoAssistBTS_R98_ExpOTD_1, + 2, /* Elements count */ + &asn_SPC_SystemInfoAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h new file mode 100644 index 000000000..78c025886 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SystemInfoAssistBTS_R98_ExpOTD_H_ +#define _SystemInfoAssistBTS_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include +#include "AssistBTSData-R98-ExpOTD.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SystemInfoAssistBTS_R98_ExpOTD_PR { + SystemInfoAssistBTS_R98_ExpOTD_PR_NOTHING, /* No components present */ + SystemInfoAssistBTS_R98_ExpOTD_PR_notPresent, + SystemInfoAssistBTS_R98_ExpOTD_PR_present +} SystemInfoAssistBTS_R98_ExpOTD_PR; + +/* SystemInfoAssistBTS-R98-ExpOTD */ +typedef struct SystemInfoAssistBTS_R98_ExpOTD { + SystemInfoAssistBTS_R98_ExpOTD_PR present; + union SystemInfoAssistBTS_R98_ExpOTD_u { + NULL_t notPresent; + AssistBTSData_R98_ExpOTD_t present; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SystemInfoAssistBTS_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +#endif /* _SystemInfoAssistBTS_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c new file mode 100644 index 000000000..30a007816 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SystemInfoAssistBTS.h" + +static asn_per_constraints_t asn_PER_type_SystemInfoAssistBTS_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SystemInfoAssistBTS_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS, choice.notPresent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "notPresent" + }, + { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS, choice.present), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AssistBTSData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "present" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistBTS_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* notPresent at 223 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* present at 225 */ +}; +static asn_CHOICE_specifics_t asn_SPC_SystemInfoAssistBTS_specs_1 = { + sizeof(struct SystemInfoAssistBTS), + offsetof(struct SystemInfoAssistBTS, _asn_ctx), + offsetof(struct SystemInfoAssistBTS, present), + sizeof(((struct SystemInfoAssistBTS *)0)->present), + asn_MAP_SystemInfoAssistBTS_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS = { + "SystemInfoAssistBTS", + "SystemInfoAssistBTS", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_SystemInfoAssistBTS_constr_1, + asn_MBR_SystemInfoAssistBTS_1, + 2, /* Elements count */ + &asn_SPC_SystemInfoAssistBTS_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h new file mode 100644 index 000000000..daa8c9997 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SystemInfoAssistBTS_H_ +#define _SystemInfoAssistBTS_H_ + + +#include + +/* Including external dependencies */ +#include +#include "AssistBTSData.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SystemInfoAssistBTS_PR { + SystemInfoAssistBTS_PR_NOTHING, /* No components present */ + SystemInfoAssistBTS_PR_notPresent, + SystemInfoAssistBTS_PR_present +} SystemInfoAssistBTS_PR; + +/* SystemInfoAssistBTS */ +typedef struct SystemInfoAssistBTS { + SystemInfoAssistBTS_PR present; + union SystemInfoAssistBTS_u { + NULL_t notPresent; + AssistBTSData_t present; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SystemInfoAssistBTS_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS; + +#ifdef __cplusplus +} +#endif + +#endif /* _SystemInfoAssistBTS_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c new file mode 100644 index 000000000..2b7bcde9a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SystemInfoAssistData-R98-ExpOTD.h" + +static asn_TYPE_member_t asn_MBR_SystemInfoAssistData_R98_ExpOTD_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistData_R98_ExpOTD, systemInfoAssistListR98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoAssistListR98-ExpOTD" + }, +}; +static ber_tlv_tag_t asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistData_R98_ExpOTD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* systemInfoAssistListR98-ExpOTD at 917 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SystemInfoAssistData_R98_ExpOTD_specs_1 = { + sizeof(struct SystemInfoAssistData_R98_ExpOTD), + offsetof(struct SystemInfoAssistData_R98_ExpOTD, _asn_ctx), + asn_MAP_SystemInfoAssistData_R98_ExpOTD_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData_R98_ExpOTD = { + "SystemInfoAssistData-R98-ExpOTD", + "SystemInfoAssistData-R98-ExpOTD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1, + sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1) + /sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SystemInfoAssistData_R98_ExpOTD_1, + 1, /* Elements count */ + &asn_SPC_SystemInfoAssistData_R98_ExpOTD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h new file mode 100644 index 000000000..a5961648f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SystemInfoAssistData_R98_ExpOTD_H_ +#define _SystemInfoAssistData_R98_ExpOTD_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfSystemInfoAssistBTS-R98-ExpOTD.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SystemInfoAssistData-R98-ExpOTD */ +typedef struct SystemInfoAssistData_R98_ExpOTD { + SeqOfSystemInfoAssistBTS_R98_ExpOTD_t systemInfoAssistListR98_ExpOTD; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SystemInfoAssistData_R98_ExpOTD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData_R98_ExpOTD; + +#ifdef __cplusplus +} +#endif + +#endif /* _SystemInfoAssistData_R98_ExpOTD_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c new file mode 100644 index 000000000..92c50d615 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SystemInfoAssistData.h" + +static asn_TYPE_member_t asn_MBR_SystemInfoAssistData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistData, systemInfoAssistList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSystemInfoAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "systemInfoAssistList" + }, +}; +static ber_tlv_tag_t asn_DEF_SystemInfoAssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* systemInfoAssistList at 218 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SystemInfoAssistData_specs_1 = { + sizeof(struct SystemInfoAssistData), + offsetof(struct SystemInfoAssistData, _asn_ctx), + asn_MAP_SystemInfoAssistData_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData = { + "SystemInfoAssistData", + "SystemInfoAssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SystemInfoAssistData_tags_1, + sizeof(asn_DEF_SystemInfoAssistData_tags_1) + /sizeof(asn_DEF_SystemInfoAssistData_tags_1[0]), /* 1 */ + asn_DEF_SystemInfoAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_SystemInfoAssistData_tags_1) + /sizeof(asn_DEF_SystemInfoAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SystemInfoAssistData_1, + 1, /* Elements count */ + &asn_SPC_SystemInfoAssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h new file mode 100644 index 000000000..ddc134341 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SystemInfoAssistData_H_ +#define _SystemInfoAssistData_H_ + + +#include + +/* Including external dependencies */ +#include "SeqOfSystemInfoAssistBTS.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SystemInfoAssistData */ +typedef struct SystemInfoAssistData { + SeqOfSystemInfoAssistBTS_t systemInfoAssistList; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SystemInfoAssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData; + +#ifdef __cplusplus +} +#endif + +#endif /* _SystemInfoAssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c new file mode 100644 index 000000000..713303193 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "SystemInfoIndex.h" + +int +SystemInfoIndex_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 1 && value <= 32)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +SystemInfoIndex_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +SystemInfoIndex_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SystemInfoIndex_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SystemInfoIndex_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SystemInfoIndex_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SystemInfoIndex_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SystemInfoIndex_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +SystemInfoIndex_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +SystemInfoIndex_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SystemInfoIndex_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_SystemInfoIndex_constr_1 = { + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (1..32) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_SystemInfoIndex_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SystemInfoIndex = { + "SystemInfoIndex", + "SystemInfoIndex", + SystemInfoIndex_free, + SystemInfoIndex_print, + SystemInfoIndex_constraint, + SystemInfoIndex_decode_ber, + SystemInfoIndex_encode_der, + SystemInfoIndex_decode_xer, + SystemInfoIndex_encode_xer, + SystemInfoIndex_decode_uper, + SystemInfoIndex_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SystemInfoIndex_tags_1, + sizeof(asn_DEF_SystemInfoIndex_tags_1) + /sizeof(asn_DEF_SystemInfoIndex_tags_1[0]), /* 1 */ + asn_DEF_SystemInfoIndex_tags_1, /* Same as above */ + sizeof(asn_DEF_SystemInfoIndex_tags_1) + /sizeof(asn_DEF_SystemInfoIndex_tags_1[0]), /* 1 */ + &asn_PER_type_SystemInfoIndex_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h new file mode 100644 index 000000000..3e5c4a217 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _SystemInfoIndex_H_ +#define _SystemInfoIndex_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SystemInfoIndex */ +typedef long SystemInfoIndex_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SystemInfoIndex; +asn_struct_free_f SystemInfoIndex_free; +asn_struct_print_f SystemInfoIndex_print; +asn_constr_check_f SystemInfoIndex_constraint; +ber_type_decoder_f SystemInfoIndex_decode_ber; +der_type_encoder_f SystemInfoIndex_encode_der; +xer_type_decoder_f SystemInfoIndex_decode_xer; +xer_type_encoder_f SystemInfoIndex_encode_xer; +per_type_decoder_f SystemInfoIndex_decode_uper; +per_type_encoder_f SystemInfoIndex_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SystemInfoIndex_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TA0.c b/src/core/libs/supl/asn-rrlp/TA0.c new file mode 100644 index 000000000..c6e6e0a14 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TA0.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TA0.h" + +int +TA0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TA0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TA0_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TA0_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TA0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TA0_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TA0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TA0_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TA0_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TA0_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TA0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TA0_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TA0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TA0_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TA0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TA0_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TA0_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TA0_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TA0_constr_1 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TA0_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TA0 = { + "TA0", + "TA0", + TA0_free, + TA0_print, + TA0_constraint, + TA0_decode_ber, + TA0_encode_der, + TA0_decode_xer, + TA0_encode_xer, + TA0_decode_uper, + TA0_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TA0_tags_1, + sizeof(asn_DEF_TA0_tags_1) + /sizeof(asn_DEF_TA0_tags_1[0]), /* 1 */ + asn_DEF_TA0_tags_1, /* Same as above */ + sizeof(asn_DEF_TA0_tags_1) + /sizeof(asn_DEF_TA0_tags_1[0]), /* 1 */ + &asn_PER_type_TA0_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TA0.h b/src/core/libs/supl/asn-rrlp/TA0.h new file mode 100644 index 000000000..a046041a9 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TA0.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TA0_H_ +#define _TA0_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TA0 */ +typedef long TA0_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TA0; +asn_struct_free_f TA0_free; +asn_struct_print_f TA0_print; +asn_constr_check_f TA0_constraint; +ber_type_decoder_f TA0_decode_ber; +der_type_encoder_f TA0_encode_der; +xer_type_decoder_f TA0_decode_xer; +xer_type_encoder_f TA0_encode_xer; +per_type_decoder_f TA0_decode_uper; +per_type_encoder_f TA0_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TA0_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TA1.c b/src/core/libs/supl/asn-rrlp/TA1.c new file mode 100644 index 000000000..d118cab48 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TA1.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TA1.h" + +int +TA1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TA1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TA1_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TA1_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TA1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TA1_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TA1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TA1_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TA1_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TA1_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TA1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TA1_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TA1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TA1_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TA1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TA1_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TA1_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TA1_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TA1_constr_1 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TA1_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TA1 = { + "TA1", + "TA1", + TA1_free, + TA1_print, + TA1_constraint, + TA1_decode_ber, + TA1_encode_der, + TA1_decode_xer, + TA1_encode_xer, + TA1_decode_uper, + TA1_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TA1_tags_1, + sizeof(asn_DEF_TA1_tags_1) + /sizeof(asn_DEF_TA1_tags_1[0]), /* 1 */ + asn_DEF_TA1_tags_1, /* Same as above */ + sizeof(asn_DEF_TA1_tags_1) + /sizeof(asn_DEF_TA1_tags_1[0]), /* 1 */ + &asn_PER_type_TA1_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TA1.h b/src/core/libs/supl/asn-rrlp/TA1.h new file mode 100644 index 000000000..e5b12b196 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TA1.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TA1_H_ +#define _TA1_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TA1 */ +typedef long TA1_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TA1; +asn_struct_free_f TA1_free; +asn_struct_print_f TA1_print; +asn_constr_check_f TA1_constraint; +ber_type_decoder_f TA1_decode_ber; +der_type_encoder_f TA1_encode_der; +xer_type_decoder_f TA1_decode_xer; +xer_type_encoder_f TA1_encode_xer; +per_type_decoder_f TA1_decode_uper; +per_type_encoder_f TA1_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TA1_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TA2.c b/src/core/libs/supl/asn-rrlp/TA2.c new file mode 100644 index 000000000..9d4ba1f9d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TA2.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TA2.h" + +int +TA2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -64 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TA2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TA2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TA2_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TA2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TA2_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TA2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TA2_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TA2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TA2_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TA2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TA2_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TA2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TA2_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TA2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TA2_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TA2_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TA2_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TA2_constr_1 = { + { APC_CONSTRAINED, 7, 7, -64, 63 } /* (-64..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TA2_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TA2 = { + "TA2", + "TA2", + TA2_free, + TA2_print, + TA2_constraint, + TA2_decode_ber, + TA2_encode_der, + TA2_decode_xer, + TA2_encode_xer, + TA2_decode_uper, + TA2_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TA2_tags_1, + sizeof(asn_DEF_TA2_tags_1) + /sizeof(asn_DEF_TA2_tags_1[0]), /* 1 */ + asn_DEF_TA2_tags_1, /* Same as above */ + sizeof(asn_DEF_TA2_tags_1) + /sizeof(asn_DEF_TA2_tags_1[0]), /* 1 */ + &asn_PER_type_TA2_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TA2.h b/src/core/libs/supl/asn-rrlp/TA2.h new file mode 100644 index 000000000..b13073c8c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TA2.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TA2_H_ +#define _TA2_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TA2 */ +typedef long TA2_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TA2; +asn_struct_free_f TA2_free; +asn_struct_print_f TA2_print; +asn_constr_check_f TA2_constraint; +ber_type_decoder_f TA2_decode_ber; +der_type_encoder_f TA2_encode_der; +xer_type_decoder_f TA2_decode_xer; +xer_type_encoder_f TA2_encode_xer; +per_type_decoder_f TA2_decode_uper; +per_type_encoder_f TA2_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TA2_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TLMReservedBits.c b/src/core/libs/supl/asn-rrlp/TLMReservedBits.c new file mode 100644 index 000000000..5493ac422 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TLMReservedBits.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TLMReservedBits.h" + +int +TLMReservedBits_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TLMReservedBits_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TLMReservedBits_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TLMReservedBits_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TLMReservedBits_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TLMReservedBits_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TLMReservedBits_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TLMReservedBits_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TLMReservedBits_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TLMReservedBits_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TLMReservedBits_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TLMReservedBits_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TLMReservedBits_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TLMReservedBits = { + "TLMReservedBits", + "TLMReservedBits", + TLMReservedBits_free, + TLMReservedBits_print, + TLMReservedBits_constraint, + TLMReservedBits_decode_ber, + TLMReservedBits_encode_der, + TLMReservedBits_decode_xer, + TLMReservedBits_encode_xer, + TLMReservedBits_decode_uper, + TLMReservedBits_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TLMReservedBits_tags_1, + sizeof(asn_DEF_TLMReservedBits_tags_1) + /sizeof(asn_DEF_TLMReservedBits_tags_1[0]), /* 1 */ + asn_DEF_TLMReservedBits_tags_1, /* Same as above */ + sizeof(asn_DEF_TLMReservedBits_tags_1) + /sizeof(asn_DEF_TLMReservedBits_tags_1[0]), /* 1 */ + &asn_PER_type_TLMReservedBits_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TLMReservedBits.h b/src/core/libs/supl/asn-rrlp/TLMReservedBits.h new file mode 100644 index 000000000..2e64f6af0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TLMReservedBits.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TLMReservedBits_H_ +#define _TLMReservedBits_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TLMReservedBits */ +typedef long TLMReservedBits_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TLMReservedBits; +asn_struct_free_f TLMReservedBits_free; +asn_struct_print_f TLMReservedBits_print; +asn_constr_check_f TLMReservedBits_constraint; +ber_type_decoder_f TLMReservedBits_decode_ber; +der_type_encoder_f TLMReservedBits_encode_der; +xer_type_decoder_f TLMReservedBits_decode_xer; +xer_type_encoder_f TLMReservedBits_encode_xer; +per_type_decoder_f TLMReservedBits_decode_uper; +per_type_encoder_f TLMReservedBits_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TLMReservedBits_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TLMWord.c b/src/core/libs/supl/asn-rrlp/TLMWord.c new file mode 100644 index 000000000..08495fde8 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TLMWord.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TLMWord.h" + +int +TLMWord_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16383)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TLMWord_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TLMWord_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TLMWord_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TLMWord_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TLMWord_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TLMWord_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TLMWord_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TLMWord_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TLMWord_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TLMWord_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TLMWord_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TLMWord_constr_1 = { + { APC_CONSTRAINED, 14, 14, 0, 16383 } /* (0..16383) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TLMWord_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TLMWord = { + "TLMWord", + "TLMWord", + TLMWord_free, + TLMWord_print, + TLMWord_constraint, + TLMWord_decode_ber, + TLMWord_encode_der, + TLMWord_decode_xer, + TLMWord_encode_xer, + TLMWord_decode_uper, + TLMWord_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TLMWord_tags_1, + sizeof(asn_DEF_TLMWord_tags_1) + /sizeof(asn_DEF_TLMWord_tags_1[0]), /* 1 */ + asn_DEF_TLMWord_tags_1, /* Same as above */ + sizeof(asn_DEF_TLMWord_tags_1) + /sizeof(asn_DEF_TLMWord_tags_1[0]), /* 1 */ + &asn_PER_type_TLMWord_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TLMWord.h b/src/core/libs/supl/asn-rrlp/TLMWord.h new file mode 100644 index 000000000..2be30c082 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TLMWord.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TLMWord_H_ +#define _TLMWord_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TLMWord */ +typedef long TLMWord_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TLMWord; +asn_struct_free_f TLMWord_free; +asn_struct_print_f TLMWord_print; +asn_constr_check_f TLMWord_constraint; +ber_type_decoder_f TLMWord_decode_ber; +der_type_encoder_f TLMWord_encode_der; +xer_type_decoder_f TLMWord_decode_xer; +xer_type_encoder_f TLMWord_encode_xer; +per_type_decoder_f TLMWord_decode_uper; +per_type_encoder_f TLMWord_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TLMWord_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c new file mode 100644 index 000000000..a4acf4e11 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TOA-MeasurementsOfRef.h" + +static asn_TYPE_member_t asn_MBR_TOA_MeasurementsOfRef_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct TOA_MeasurementsOfRef, refQuality), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RefQuality, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "refQuality" + }, + { ATF_NOFLAGS, 0, offsetof(struct TOA_MeasurementsOfRef, numOfMeasurements), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NumOfMeasurements, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "numOfMeasurements" + }, +}; +static ber_tlv_tag_t asn_DEF_TOA_MeasurementsOfRef_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_TOA_MeasurementsOfRef_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refQuality at 360 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* numOfMeasurements at 362 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_TOA_MeasurementsOfRef_specs_1 = { + sizeof(struct TOA_MeasurementsOfRef), + offsetof(struct TOA_MeasurementsOfRef, _asn_ctx), + asn_MAP_TOA_MeasurementsOfRef_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_TOA_MeasurementsOfRef = { + "TOA-MeasurementsOfRef", + "TOA-MeasurementsOfRef", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TOA_MeasurementsOfRef_tags_1, + sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1) + /sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1[0]), /* 1 */ + asn_DEF_TOA_MeasurementsOfRef_tags_1, /* Same as above */ + sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1) + /sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_TOA_MeasurementsOfRef_1, + 2, /* Elements count */ + &asn_SPC_TOA_MeasurementsOfRef_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h new file mode 100644 index 000000000..a6e14e330 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TOA_MeasurementsOfRef_H_ +#define _TOA_MeasurementsOfRef_H_ + + +#include + +/* Including external dependencies */ +#include "RefQuality.h" +#include "NumOfMeasurements.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TOA-MeasurementsOfRef */ +typedef struct TOA_MeasurementsOfRef { + RefQuality_t refQuality; + NumOfMeasurements_t numOfMeasurements; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} TOA_MeasurementsOfRef_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TOA_MeasurementsOfRef; + +#ifdef __cplusplus +} +#endif + +#endif /* _TOA_MeasurementsOfRef_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TimeRelation.c b/src/core/libs/supl/asn-rrlp/TimeRelation.c new file mode 100644 index 000000000..8ce850cc2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TimeRelation.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TimeRelation.h" + +static asn_TYPE_member_t asn_MBR_TimeRelation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct TimeRelation, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOW23b, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gpsTOW" + }, + { ATF_POINTER, 1, offsetof(struct TimeRelation, gsmTime), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GSMTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gsmTime" + }, +}; +static int asn_MAP_TimeRelation_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_TimeRelation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_TimeRelation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTOW at 828 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* gsmTime at 829 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_TimeRelation_specs_1 = { + sizeof(struct TimeRelation), + offsetof(struct TimeRelation, _asn_ctx), + asn_MAP_TimeRelation_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_TimeRelation_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_TimeRelation = { + "TimeRelation", + "TimeRelation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TimeRelation_tags_1, + sizeof(asn_DEF_TimeRelation_tags_1) + /sizeof(asn_DEF_TimeRelation_tags_1[0]), /* 1 */ + asn_DEF_TimeRelation_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeRelation_tags_1) + /sizeof(asn_DEF_TimeRelation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_TimeRelation_1, + 2, /* Elements count */ + &asn_SPC_TimeRelation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TimeRelation.h b/src/core/libs/supl/asn-rrlp/TimeRelation.h new file mode 100644 index 000000000..10fdacf09 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TimeRelation.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TimeRelation_H_ +#define _TimeRelation_H_ + + +#include + +/* Including external dependencies */ +#include "GPSTOW23b.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct GSMTime; + +/* TimeRelation */ +typedef struct TimeRelation { + GPSTOW23b_t gpsTOW; + struct GSMTime *gsmTime /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} TimeRelation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TimeRelation; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "GSMTime.h" + +#endif /* _TimeRelation_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TimeSlot.c b/src/core/libs/supl/asn-rrlp/TimeSlot.c new file mode 100644 index 000000000..f879e587c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TimeSlot.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TimeSlot.h" + +int +TimeSlot_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TimeSlot_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TimeSlot_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TimeSlot_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TimeSlot_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TimeSlot_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TimeSlot_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TimeSlot_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TimeSlot_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TimeSlot_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TimeSlot_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TimeSlot_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TimeSlot_constr_1 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TimeSlot_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TimeSlot = { + "TimeSlot", + "TimeSlot", + TimeSlot_free, + TimeSlot_print, + TimeSlot_constraint, + TimeSlot_decode_ber, + TimeSlot_encode_der, + TimeSlot_decode_xer, + TimeSlot_encode_xer, + TimeSlot_decode_uper, + TimeSlot_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TimeSlot_tags_1, + sizeof(asn_DEF_TimeSlot_tags_1) + /sizeof(asn_DEF_TimeSlot_tags_1[0]), /* 1 */ + asn_DEF_TimeSlot_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeSlot_tags_1) + /sizeof(asn_DEF_TimeSlot_tags_1[0]), /* 1 */ + &asn_PER_type_TimeSlot_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TimeSlot.h b/src/core/libs/supl/asn-rrlp/TimeSlot.h new file mode 100644 index 000000000..9f0b125de --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TimeSlot.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TimeSlot_H_ +#define _TimeSlot_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TimeSlot */ +typedef long TimeSlot_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TimeSlot; +asn_struct_free_f TimeSlot_free; +asn_struct_print_f TimeSlot_print; +asn_constr_check_f TimeSlot_constraint; +ber_type_decoder_f TimeSlot_decode_ber; +der_type_encoder_f TimeSlot_encode_der; +xer_type_decoder_f TimeSlot_decode_xer; +xer_type_encoder_f TimeSlot_encode_xer; +per_type_decoder_f TimeSlot_decode_uper; +per_type_encoder_f TimeSlot_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TimeSlot_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c new file mode 100644 index 000000000..dc0d3ca0f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "TimeSlotScheme.h" + +int +TimeSlotScheme_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +TimeSlotScheme_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +TimeSlotScheme_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TimeSlotScheme_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TimeSlotScheme_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TimeSlotScheme_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TimeSlotScheme_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TimeSlotScheme_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TimeSlotScheme_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TimeSlotScheme_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TimeSlotScheme_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TimeSlotScheme_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_TimeSlotScheme_value2enum_1[] = { + { 0, 11, "equalLength" }, + { 1, 13, "variousLength" } +}; +static unsigned int asn_MAP_TimeSlotScheme_enum2value_1[] = { + 0, /* equalLength(0) */ + 1 /* variousLength(1) */ +}; +static asn_INTEGER_specifics_t asn_SPC_TimeSlotScheme_specs_1 = { + asn_MAP_TimeSlotScheme_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_TimeSlotScheme_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_TimeSlotScheme_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TimeSlotScheme = { + "TimeSlotScheme", + "TimeSlotScheme", + TimeSlotScheme_free, + TimeSlotScheme_print, + TimeSlotScheme_constraint, + TimeSlotScheme_decode_ber, + TimeSlotScheme_encode_der, + TimeSlotScheme_decode_xer, + TimeSlotScheme_encode_xer, + TimeSlotScheme_decode_uper, + TimeSlotScheme_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TimeSlotScheme_tags_1, + sizeof(asn_DEF_TimeSlotScheme_tags_1) + /sizeof(asn_DEF_TimeSlotScheme_tags_1[0]), /* 1 */ + asn_DEF_TimeSlotScheme_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeSlotScheme_tags_1) + /sizeof(asn_DEF_TimeSlotScheme_tags_1[0]), /* 1 */ + &asn_PER_type_TimeSlotScheme_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_TimeSlotScheme_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h new file mode 100644 index 000000000..1857d1540 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _TimeSlotScheme_H_ +#define _TimeSlotScheme_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum TimeSlotScheme { + TimeSlotScheme_equalLength = 0, + TimeSlotScheme_variousLength = 1 +} e_TimeSlotScheme; + +/* TimeSlotScheme */ +typedef ENUMERATED_t TimeSlotScheme_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TimeSlotScheme; +asn_struct_free_f TimeSlotScheme_free; +asn_struct_print_f TimeSlotScheme_print; +asn_constr_check_f TimeSlotScheme_constraint; +ber_type_decoder_f TimeSlotScheme_decode_ber; +der_type_encoder_f TimeSlotScheme_encode_der; +xer_type_decoder_f TimeSlotScheme_decode_xer; +xer_type_encoder_f TimeSlotScheme_encode_xer; +per_type_decoder_f TimeSlotScheme_decode_uper; +per_type_encoder_f TimeSlotScheme_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TimeSlotScheme_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/UTCModel.c b/src/core/libs/supl/asn-rrlp/UTCModel.c new file mode 100644 index 000000000..73a0520d6 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UTCModel.c @@ -0,0 +1,369 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "UTCModel.h" + +static int +memb_utcA1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcTot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcWNt_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcDeltaTls_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcWNlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcDN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_utcDeltaTlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_utcA1_constr_2 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcA0_constr_3 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcTot_constr_4 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcWNt_constr_5 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcDeltaTls_constr_6 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcWNlsf_constr_7 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcDN_constr_8 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_utcDeltaTlsf_constr_9 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_UTCModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcA1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcA1_constraint_1, + &asn_PER_memb_utcA1_constr_2, + 0, + "utcA1" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcA0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcA0_constraint_1, + &asn_PER_memb_utcA0_constr_3, + 0, + "utcA0" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcTot), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcTot_constraint_1, + &asn_PER_memb_utcTot_constr_4, + 0, + "utcTot" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcWNt), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcWNt_constraint_1, + &asn_PER_memb_utcWNt_constr_5, + 0, + "utcWNt" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDeltaTls), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcDeltaTls_constraint_1, + &asn_PER_memb_utcDeltaTls_constr_6, + 0, + "utcDeltaTls" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcWNlsf), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcWNlsf_constraint_1, + &asn_PER_memb_utcWNlsf_constr_7, + 0, + "utcWNlsf" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDN), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcDN_constraint_1, + &asn_PER_memb_utcDN_constr_8, + 0, + "utcDN" + }, + { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDeltaTlsf), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_utcDeltaTlsf_constraint_1, + &asn_PER_memb_utcDeltaTlsf_constr_9, + 0, + "utcDeltaTlsf" + }, +}; +static ber_tlv_tag_t asn_DEF_UTCModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_UTCModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* utcA1 at 775 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* utcA0 at 776 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* utcTot at 777 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* utcWNt at 778 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* utcDeltaTls at 779 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* utcWNlsf at 780 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* utcDN at 781 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* utcDeltaTlsf at 782 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_UTCModel_specs_1 = { + sizeof(struct UTCModel), + offsetof(struct UTCModel, _asn_ctx), + asn_MAP_UTCModel_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_UTCModel = { + "UTCModel", + "UTCModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UTCModel_tags_1, + sizeof(asn_DEF_UTCModel_tags_1) + /sizeof(asn_DEF_UTCModel_tags_1[0]), /* 1 */ + asn_DEF_UTCModel_tags_1, /* Same as above */ + sizeof(asn_DEF_UTCModel_tags_1) + /sizeof(asn_DEF_UTCModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_UTCModel_1, + 8, /* Elements count */ + &asn_SPC_UTCModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/UTCModel.h b/src/core/libs/supl/asn-rrlp/UTCModel.h new file mode 100644 index 000000000..1974bea08 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UTCModel.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _UTCModel_H_ +#define _UTCModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UTCModel */ +typedef struct UTCModel { + long utcA1; + long utcA0; + long utcTot; + long utcWNt; + long utcDeltaTls; + long utcWNlsf; + long utcDN; + long utcDeltaTlsf; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UTCModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UTCModel; + +#ifdef __cplusplus +} +#endif + +#endif /* _UTCModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c new file mode 100644 index 000000000..9b2c5278c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "UlPseudoSegInd.h" + +int +UlPseudoSegInd_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +UlPseudoSegInd_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +UlPseudoSegInd_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +UlPseudoSegInd_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +UlPseudoSegInd_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +UlPseudoSegInd_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +UlPseudoSegInd_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +UlPseudoSegInd_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +UlPseudoSegInd_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +UlPseudoSegInd_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + UlPseudoSegInd_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_UlPseudoSegInd_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_UlPseudoSegInd_value2enum_1[] = { + { 0, 11, "firstOfMany" }, + { 1, 12, "secondOfMany" } +}; +static unsigned int asn_MAP_UlPseudoSegInd_enum2value_1[] = { + 0, /* firstOfMany(0) */ + 1 /* secondOfMany(1) */ +}; +static asn_INTEGER_specifics_t asn_SPC_UlPseudoSegInd_specs_1 = { + asn_MAP_UlPseudoSegInd_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_UlPseudoSegInd_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_UlPseudoSegInd_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_UlPseudoSegInd = { + "UlPseudoSegInd", + "UlPseudoSegInd", + UlPseudoSegInd_free, + UlPseudoSegInd_print, + UlPseudoSegInd_constraint, + UlPseudoSegInd_decode_ber, + UlPseudoSegInd_encode_der, + UlPseudoSegInd_decode_xer, + UlPseudoSegInd_encode_xer, + UlPseudoSegInd_decode_uper, + UlPseudoSegInd_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UlPseudoSegInd_tags_1, + sizeof(asn_DEF_UlPseudoSegInd_tags_1) + /sizeof(asn_DEF_UlPseudoSegInd_tags_1[0]), /* 1 */ + asn_DEF_UlPseudoSegInd_tags_1, /* Same as above */ + sizeof(asn_DEF_UlPseudoSegInd_tags_1) + /sizeof(asn_DEF_UlPseudoSegInd_tags_1[0]), /* 1 */ + &asn_PER_type_UlPseudoSegInd_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_UlPseudoSegInd_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h new file mode 100644 index 000000000..cd4b52dae --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _UlPseudoSegInd_H_ +#define _UlPseudoSegInd_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UlPseudoSegInd { + UlPseudoSegInd_firstOfMany = 0, + UlPseudoSegInd_secondOfMany = 1 +} e_UlPseudoSegInd; + +/* UlPseudoSegInd */ +typedef ENUMERATED_t UlPseudoSegInd_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UlPseudoSegInd; +asn_struct_free_f UlPseudoSegInd_free; +asn_struct_print_f UlPseudoSegInd_print; +asn_constr_check_f UlPseudoSegInd_constraint; +ber_type_decoder_f UlPseudoSegInd_decode_ber; +der_type_encoder_f UlPseudoSegInd_encode_der; +xer_type_decoder_f UlPseudoSegInd_decode_xer; +xer_type_encoder_f UlPseudoSegInd_encode_xer; +per_type_decoder_f UlPseudoSegInd_decode_uper; +per_type_encoder_f UlPseudoSegInd_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _UlPseudoSegInd_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c new file mode 100644 index 000000000..07896a408 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c @@ -0,0 +1,1439 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "UncompressedEphemeris.h" + +static int +ephemE_17_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +ephemE_17_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ +} + +static void +ephemE_17_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ephemE_17_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +ephemE_17_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +ephemE_17_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +ephemE_17_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +ephemE_17_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +ephemE_17_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static asn_dec_rval_t +ephemE_17_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +static asn_enc_rval_t +ephemE_17_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ephemE_17_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static int +ephemAPowerHalf_19_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +ephemAPowerHalf_19_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ +} + +static void +ephemAPowerHalf_19_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +ephemAPowerHalf_19_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +ephemAPowerHalf_19_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +ephemAPowerHalf_19_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +ephemAPowerHalf_19_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +ephemAPowerHalf_19_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static asn_dec_rval_t +ephemAPowerHalf_19_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +static asn_enc_rval_t +ephemAPowerHalf_19_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ephemAPowerHalf_19_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static int +memb_ephemCodeOnL2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 3)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemURA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 15)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemSVhealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemIODC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemL2Pflag_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemTgd_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemToc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 37799)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemAF2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -128 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -2097152 && value <= 2097151)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemCrs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemDeltaN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemCuc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +static int +memb_ephemCus_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemAPowerHalf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +static int +memb_ephemToe_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 37799)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemFitFlag_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemAODA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemCic_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemOmegaA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemCis_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemI0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemCrc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -32768 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= (-2147483647L - 1) && value <= 2147483647)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemOmegaADot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ephemIDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8192 && value <= 8191)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_type_ephemE_constr_17 = { + { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_type_ephemAPowerHalf_constr_19 = { + { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCodeOnL2_constr_2 = { + { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemURA_constr_3 = { + { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemSVhealth_constr_4 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemIODC_constr_5 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemL2Pflag_constr_6 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemTgd_constr_8 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemToc_constr_9 = { + { APC_CONSTRAINED, 16, 16, 0, 37799 } /* (0..37799) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemAF2_constr_10 = { + { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemAF1_constr_11 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemAF0_constr_12 = { + { APC_CONSTRAINED, 22, -1, -2097152, 2097151 } /* (-2097152..2097151) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCrs_constr_13 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemDeltaN_constr_14 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemM0_constr_15 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCuc_constr_16 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemE_constr_17 = { + { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCus_constr_18 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemAPowerHalf_constr_19 = { + { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemToe_constr_20 = { + { APC_CONSTRAINED, 16, 16, 0, 37799 } /* (0..37799) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemFitFlag_constr_21 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemAODA_constr_22 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCic_constr_23 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemOmegaA0_constr_24 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCis_constr_25 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemI0_constr_26 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemCrc_constr_27 = { + { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemW_constr_28 = { + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemOmegaADot_constr_29 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ephemIDot_constr_30 = { + { APC_CONSTRAINED, 14, 14, -8192, 8191 } /* (-8192..8191) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_specifics_t asn_SPC_ephemE_specs_17 = { + 0, 0, 0, 0, 0, + 0, /* Native long size */ + 1 /* Unsigned representation */ +}; +static ber_tlv_tag_t asn_DEF_ephemE_tags_17[] = { + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ephemE_17 = { + "ephemE", + "ephemE", + ephemE_17_free, + ephemE_17_print, + ephemE_17_constraint, + ephemE_17_decode_ber, + ephemE_17_encode_der, + ephemE_17_decode_xer, + ephemE_17_encode_xer, + ephemE_17_decode_uper, + ephemE_17_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ephemE_tags_17, + sizeof(asn_DEF_ephemE_tags_17) + /sizeof(asn_DEF_ephemE_tags_17[0]) - 1, /* 1 */ + asn_DEF_ephemE_tags_17, /* Same as above */ + sizeof(asn_DEF_ephemE_tags_17) + /sizeof(asn_DEF_ephemE_tags_17[0]), /* 2 */ + &asn_PER_type_ephemE_constr_17, + 0, 0, /* No members */ + &asn_SPC_ephemE_specs_17 /* Additional specs */ +}; + +static asn_INTEGER_specifics_t asn_SPC_ephemAPowerHalf_specs_19 = { + 0, 0, 0, 0, 0, + 0, /* Native long size */ + 1 /* Unsigned representation */ +}; +static ber_tlv_tag_t asn_DEF_ephemAPowerHalf_tags_19[] = { + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_ephemAPowerHalf_19 = { + "ephemAPowerHalf", + "ephemAPowerHalf", + ephemAPowerHalf_19_free, + ephemAPowerHalf_19_print, + ephemAPowerHalf_19_constraint, + ephemAPowerHalf_19_decode_ber, + ephemAPowerHalf_19_encode_der, + ephemAPowerHalf_19_decode_xer, + ephemAPowerHalf_19_encode_xer, + ephemAPowerHalf_19_decode_uper, + ephemAPowerHalf_19_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ephemAPowerHalf_tags_19, + sizeof(asn_DEF_ephemAPowerHalf_tags_19) + /sizeof(asn_DEF_ephemAPowerHalf_tags_19[0]) - 1, /* 1 */ + asn_DEF_ephemAPowerHalf_tags_19, /* Same as above */ + sizeof(asn_DEF_ephemAPowerHalf_tags_19) + /sizeof(asn_DEF_ephemAPowerHalf_tags_19[0]), /* 2 */ + &asn_PER_type_ephemAPowerHalf_constr_19, + 0, 0, /* No members */ + &asn_SPC_ephemAPowerHalf_specs_19 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_UncompressedEphemeris_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCodeOnL2), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCodeOnL2_constraint_1, + &asn_PER_memb_ephemCodeOnL2_constr_2, + 0, + "ephemCodeOnL2" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemURA), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemURA_constraint_1, + &asn_PER_memb_ephemURA_constr_3, + 0, + "ephemURA" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemSVhealth), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemSVhealth_constraint_1, + &asn_PER_memb_ephemSVhealth_constr_4, + 0, + "ephemSVhealth" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemIODC), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemIODC_constraint_1, + &asn_PER_memb_ephemIODC_constr_5, + 0, + "ephemIODC" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemL2Pflag), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemL2Pflag_constraint_1, + &asn_PER_memb_ephemL2Pflag_constr_6, + 0, + "ephemL2Pflag" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemSF1Rsvd), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_EphemerisSubframe1Reserved, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ephemSF1Rsvd" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemTgd), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemTgd_constraint_1, + &asn_PER_memb_ephemTgd_constr_8, + 0, + "ephemTgd" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemToc), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemToc_constraint_1, + &asn_PER_memb_ephemToc_constr_9, + 0, + "ephemToc" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF2), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemAF2_constraint_1, + &asn_PER_memb_ephemAF2_constr_10, + 0, + "ephemAF2" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF1), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemAF1_constraint_1, + &asn_PER_memb_ephemAF1_constr_11, + 0, + "ephemAF1" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF0), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemAF0_constraint_1, + &asn_PER_memb_ephemAF0_constr_12, + 0, + "ephemAF0" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCrs), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCrs_constraint_1, + &asn_PER_memb_ephemCrs_constr_13, + 0, + "ephemCrs" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemDeltaN), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemDeltaN_constraint_1, + &asn_PER_memb_ephemDeltaN_constr_14, + 0, + "ephemDeltaN" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemM0), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemM0_constraint_1, + &asn_PER_memb_ephemM0_constr_15, + 0, + "ephemM0" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCuc), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCuc_constraint_1, + &asn_PER_memb_ephemCuc_constr_16, + 0, + "ephemCuc" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemE), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ephemE_17, + memb_ephemE_constraint_1, + &asn_PER_memb_ephemE_constr_17, + 0, + "ephemE" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCus), + (ASN_TAG_CLASS_CONTEXT | (16 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCus_constraint_1, + &asn_PER_memb_ephemCus_constr_18, + 0, + "ephemCus" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAPowerHalf), + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ephemAPowerHalf_19, + memb_ephemAPowerHalf_constraint_1, + &asn_PER_memb_ephemAPowerHalf_constr_19, + 0, + "ephemAPowerHalf" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemToe), + (ASN_TAG_CLASS_CONTEXT | (18 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemToe_constraint_1, + &asn_PER_memb_ephemToe_constr_20, + 0, + "ephemToe" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemFitFlag), + (ASN_TAG_CLASS_CONTEXT | (19 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemFitFlag_constraint_1, + &asn_PER_memb_ephemFitFlag_constr_21, + 0, + "ephemFitFlag" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAODA), + (ASN_TAG_CLASS_CONTEXT | (20 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemAODA_constraint_1, + &asn_PER_memb_ephemAODA_constr_22, + 0, + "ephemAODA" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCic), + (ASN_TAG_CLASS_CONTEXT | (21 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCic_constraint_1, + &asn_PER_memb_ephemCic_constr_23, + 0, + "ephemCic" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemOmegaA0), + (ASN_TAG_CLASS_CONTEXT | (22 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemOmegaA0_constraint_1, + &asn_PER_memb_ephemOmegaA0_constr_24, + 0, + "ephemOmegaA0" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCis), + (ASN_TAG_CLASS_CONTEXT | (23 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCis_constraint_1, + &asn_PER_memb_ephemCis_constr_25, + 0, + "ephemCis" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemI0), + (ASN_TAG_CLASS_CONTEXT | (24 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemI0_constraint_1, + &asn_PER_memb_ephemI0_constr_26, + 0, + "ephemI0" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCrc), + (ASN_TAG_CLASS_CONTEXT | (25 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemCrc_constraint_1, + &asn_PER_memb_ephemCrc_constr_27, + 0, + "ephemCrc" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemW), + (ASN_TAG_CLASS_CONTEXT | (26 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemW_constraint_1, + &asn_PER_memb_ephemW_constr_28, + 0, + "ephemW" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemOmegaADot), + (ASN_TAG_CLASS_CONTEXT | (27 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemOmegaADot_constraint_1, + &asn_PER_memb_ephemOmegaADot_constr_29, + 0, + "ephemOmegaADot" + }, + { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemIDot), + (ASN_TAG_CLASS_CONTEXT | (28 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_ephemIDot_constraint_1, + &asn_PER_memb_ephemIDot_constr_30, + 0, + "ephemIDot" + }, +}; +static ber_tlv_tag_t asn_DEF_UncompressedEphemeris_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_UncompressedEphemeris_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ephemCodeOnL2 at 722 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ephemURA at 723 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ephemSVhealth at 724 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ephemIODC at 725 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ephemL2Pflag at 726 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ephemSF1Rsvd at 727 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* ephemTgd at 728 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ephemToc at 729 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* ephemAF2 at 730 */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* ephemAF1 at 731 */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* ephemAF0 at 732 */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* ephemCrs at 733 */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* ephemDeltaN at 734 */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* ephemM0 at 735 */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* ephemCuc at 736 */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 }, /* ephemE at 737 */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* ephemCus at 738 */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* ephemAPowerHalf at 739 */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* ephemToe at 740 */ + { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* ephemFitFlag at 741 */ + { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* ephemAODA at 742 */ + { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 }, /* ephemCic at 743 */ + { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0 }, /* ephemOmegaA0 at 744 */ + { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0 }, /* ephemCis at 745 */ + { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0 }, /* ephemI0 at 746 */ + { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0 }, /* ephemCrc at 747 */ + { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0 }, /* ephemW at 748 */ + { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0 }, /* ephemOmegaADot at 749 */ + { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0 } /* ephemIDot at 750 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_UncompressedEphemeris_specs_1 = { + sizeof(struct UncompressedEphemeris), + offsetof(struct UncompressedEphemeris, _asn_ctx), + asn_MAP_UncompressedEphemeris_tag2el_1, + 29, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_UncompressedEphemeris = { + "UncompressedEphemeris", + "UncompressedEphemeris", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UncompressedEphemeris_tags_1, + sizeof(asn_DEF_UncompressedEphemeris_tags_1) + /sizeof(asn_DEF_UncompressedEphemeris_tags_1[0]), /* 1 */ + asn_DEF_UncompressedEphemeris_tags_1, /* Same as above */ + sizeof(asn_DEF_UncompressedEphemeris_tags_1) + /sizeof(asn_DEF_UncompressedEphemeris_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_UncompressedEphemeris_1, + 29, /* Elements count */ + &asn_SPC_UncompressedEphemeris_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h new file mode 100644 index 000000000..2cecd614f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h @@ -0,0 +1,68 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _UncompressedEphemeris_H_ +#define _UncompressedEphemeris_H_ + + +#include + +/* Including external dependencies */ +#include +#include "EphemerisSubframe1Reserved.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UncompressedEphemeris */ +typedef struct UncompressedEphemeris { + long ephemCodeOnL2; + long ephemURA; + long ephemSVhealth; + long ephemIODC; + long ephemL2Pflag; + EphemerisSubframe1Reserved_t ephemSF1Rsvd; + long ephemTgd; + long ephemToc; + long ephemAF2; + long ephemAF1; + long ephemAF0; + long ephemCrs; + long ephemDeltaN; + long ephemM0; + long ephemCuc; + unsigned long ephemE; + long ephemCus; + unsigned long ephemAPowerHalf; + long ephemToe; + long ephemFitFlag; + long ephemAODA; + long ephemCic; + long ephemOmegaA0; + long ephemCis; + long ephemI0; + long ephemCrc; + long ephemW; + long ephemOmegaADot; + long ephemIDot; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UncompressedEphemeris_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_ephemE_17; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_ephemAPowerHalf_19; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_UncompressedEphemeris; + +#ifdef __cplusplus +} +#endif + +#endif /* _UncompressedEphemeris_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/UseMultipleSets.c b/src/core/libs/supl/asn-rrlp/UseMultipleSets.c new file mode 100644 index 000000000..59c95ffc7 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UseMultipleSets.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "UseMultipleSets.h" + +int +UseMultipleSets_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +UseMultipleSets_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +UseMultipleSets_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +UseMultipleSets_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +UseMultipleSets_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +UseMultipleSets_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +UseMultipleSets_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +UseMultipleSets_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +UseMultipleSets_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +UseMultipleSets_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + UseMultipleSets_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_UseMultipleSets_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_UseMultipleSets_value2enum_1[] = { + { 0, 12, "multipleSets" }, + { 1, 6, "oneSet" } +}; +static unsigned int asn_MAP_UseMultipleSets_enum2value_1[] = { + 0, /* multipleSets(0) */ + 1 /* oneSet(1) */ +}; +static asn_INTEGER_specifics_t asn_SPC_UseMultipleSets_specs_1 = { + asn_MAP_UseMultipleSets_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_UseMultipleSets_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_UseMultipleSets_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_UseMultipleSets = { + "UseMultipleSets", + "UseMultipleSets", + UseMultipleSets_free, + UseMultipleSets_print, + UseMultipleSets_constraint, + UseMultipleSets_decode_ber, + UseMultipleSets_encode_der, + UseMultipleSets_decode_xer, + UseMultipleSets_encode_xer, + UseMultipleSets_decode_uper, + UseMultipleSets_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UseMultipleSets_tags_1, + sizeof(asn_DEF_UseMultipleSets_tags_1) + /sizeof(asn_DEF_UseMultipleSets_tags_1[0]), /* 1 */ + asn_DEF_UseMultipleSets_tags_1, /* Same as above */ + sizeof(asn_DEF_UseMultipleSets_tags_1) + /sizeof(asn_DEF_UseMultipleSets_tags_1[0]), /* 1 */ + &asn_PER_type_UseMultipleSets_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_UseMultipleSets_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/UseMultipleSets.h b/src/core/libs/supl/asn-rrlp/UseMultipleSets.h new file mode 100644 index 000000000..b156fc467 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/UseMultipleSets.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _UseMultipleSets_H_ +#define _UseMultipleSets_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UseMultipleSets { + UseMultipleSets_multipleSets = 0, + UseMultipleSets_oneSet = 1 +} e_UseMultipleSets; + +/* UseMultipleSets */ +typedef ENUMERATED_t UseMultipleSets_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UseMultipleSets; +asn_struct_free_f UseMultipleSets_free; +asn_struct_print_f UseMultipleSets_print; +asn_constr_check_f UseMultipleSets_constraint; +ber_type_decoder_f UseMultipleSets_decode_ber; +der_type_encoder_f UseMultipleSets_encode_der; +xer_type_decoder_f UseMultipleSets_decode_xer; +xer_type_encoder_f UseMultipleSets_encode_xer; +per_type_decoder_f UseMultipleSets_decode_uper; +per_type_encoder_f UseMultipleSets_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _UseMultipleSets_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/VelocityEstimate.c b/src/core/libs/supl/asn-rrlp/VelocityEstimate.c new file mode 100644 index 000000000..0df021549 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/VelocityEstimate.c @@ -0,0 +1,123 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#include "VelocityEstimate.h" + +int +VelocityEstimate_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +VelocityEstimate_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_INTEGER.per_constraints; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +VelocityEstimate_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +VelocityEstimate_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +VelocityEstimate_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +VelocityEstimate_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +VelocityEstimate_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +VelocityEstimate_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +VelocityEstimate_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +VelocityEstimate_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + VelocityEstimate_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static ber_tlv_tag_t asn_DEF_VelocityEstimate_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_VelocityEstimate = { + "VelocityEstimate", + "VelocityEstimate", + VelocityEstimate_free, + VelocityEstimate_print, + VelocityEstimate_constraint, + VelocityEstimate_decode_ber, + VelocityEstimate_encode_der, + VelocityEstimate_decode_xer, + VelocityEstimate_encode_xer, + VelocityEstimate_decode_uper, + VelocityEstimate_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_VelocityEstimate_tags_1, + sizeof(asn_DEF_VelocityEstimate_tags_1) + /sizeof(asn_DEF_VelocityEstimate_tags_1[0]), /* 1 */ + asn_DEF_VelocityEstimate_tags_1, /* Same as above */ + sizeof(asn_DEF_VelocityEstimate_tags_1) + /sizeof(asn_DEF_VelocityEstimate_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-rrlp/VelocityEstimate.h b/src/core/libs/supl/asn-rrlp/VelocityEstimate.h new file mode 100644 index 000000000..45dbb1669 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/VelocityEstimate.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "RRLP-Components" + * found in "../rrlp-components.asn" + */ + +#ifndef _VelocityEstimate_H_ +#define _VelocityEstimate_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* VelocityEstimate */ +typedef INTEGER_t VelocityEstimate_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_VelocityEstimate; +asn_struct_free_f VelocityEstimate_free; +asn_struct_print_f VelocityEstimate_print; +asn_constr_check_f VelocityEstimate_constraint; +ber_type_decoder_f VelocityEstimate_decode_ber; +der_type_encoder_f VelocityEstimate_encode_der; +xer_type_decoder_f VelocityEstimate_decode_xer; +xer_type_encoder_f VelocityEstimate_encode_xer; +per_type_decoder_f VelocityEstimate_decode_uper; +per_type_encoder_f VelocityEstimate_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _VelocityEstimate_H_ */ +#include diff --git a/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c new file mode 100644 index 000000000..ec952fc99 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +typedef A_SEQUENCE_OF(void) asn_sequence; + +void +asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) { + asn_sequence *as = (asn_sequence *)asn_sequence_of_x; + + if(as) { + void *ptr; + int n; + + if(number < 0 || number >= as->count) + return; /* Nothing to delete */ + + if(_do_free && as->free) { + ptr = as->array[number]; + } else { + ptr = 0; + } + + /* + * Shift all elements to the left to hide the gap. + */ + --as->count; + for(n = number; n < as->count; n++) + as->array[n] = as->array[n+1]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if(ptr) as->free(ptr); + } +} + diff --git a/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h new file mode 100644 index 000000000..e678f0347 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_SEQUENCE_OF_H +#define ASN_SEQUENCE_OF_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SEQUENCE OF is the same as SET OF with a tiny difference: + * the delete operation preserves the initial order of elements + * and thus MAY operate in non-constant time. + */ +#define A_SEQUENCE_OF(type) A_SET_OF(type) + +#define ASN_SEQUENCE_ADD(headptr, ptr) \ + asn_sequence_add((headptr), (ptr)) + +/*********************************************** + * Implementation of the SEQUENCE OF structure. + */ + +#define asn_sequence_add asn_set_add +#define asn_sequence_empty asn_set_empty + +/* + * Delete the element from the set by its number (base 0). + * This is NOT a constant-time operation. + * The order of elements is preserved. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ +void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); + +/* + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ +typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; +#define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) +#define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_SEQUENCE_OF_H */ diff --git a/src/core/libs/supl/asn-rrlp/asn_SET_OF.c b/src/core/libs/supl/asn-rrlp/asn_SET_OF.c new file mode 100644 index 000000000..944f2cb8a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_SET_OF.c @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Add another element into the set. + */ +int +asn_set_add(void *asn_set_of_x, void *ptr) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as == 0 || ptr == 0) { + errno = EINVAL; /* Invalid arguments */ + return -1; + } + + /* + * Make sure there's enough space to insert an element. + */ + if(as->count == as->size) { + int _newsize = as->size ? (as->size << 1) : 4; + void *_new_arr; + _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); + if(_new_arr) { + as->array = (void **)_new_arr; + as->size = _newsize; + } else { + /* ENOMEM */ + return -1; + } + } + + as->array[as->count++] = ptr; + + return 0; +} + +void +asn_set_del(void *asn_set_of_x, int number, int _do_free) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as) { + void *ptr; + if(number < 0 || number >= as->count) + return; + + if(_do_free && as->free) { + ptr = as->array[number]; + } else { + ptr = 0; + } + + as->array[number] = as->array[--as->count]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if(ptr) as->free(ptr); + } +} + +/* + * Free the contents of the set, do not free the set itself. + */ +void +asn_set_empty(void *asn_set_of_x) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as) { + if(as->array) { + if(as->free) { + while(as->count--) + as->free(as->array[as->count]); + } + FREEMEM(as->array); + as->array = 0; + } + as->count = 0; + as->size = 0; + } + +} + diff --git a/src/core/libs/supl/asn-rrlp/asn_SET_OF.h b/src/core/libs/supl/asn-rrlp/asn_SET_OF.h new file mode 100644 index 000000000..7edf14b51 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_SET_OF.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_SET_OF_H +#define ASN_SET_OF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define A_SET_OF(type) \ + struct { \ + type **array; \ + int count; /* Meaningful size */ \ + int size; /* Allocated size */ \ + void (*free)(type *); \ + } + +#define ASN_SET_ADD(headptr, ptr) \ + asn_set_add((headptr), (ptr)) + +/******************************************* + * Implementation of the SET OF structure. + */ + +/* + * Add another structure into the set by its pointer. + * RETURN VALUES: + * 0 for success and -1/errno for failure. + */ +int asn_set_add(void *asn_set_of_x, void *ptr); + +/* + * Delete the element from the set by its number (base 0). + * This is a constant-time operation. The order of elements before the + * deleted ones is guaranteed, the order of elements after the deleted + * one is NOT guaranteed. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ +void asn_set_del(void *asn_set_of_x, int number, int _do_free); + +/* + * Empty the contents of the set. Will free the elements, if (*free) is given. + * Will NOT free the set itself. + */ +void asn_set_empty(void *asn_set_of_x); + +/* + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ +typedef A_SET_OF(void) asn_anonymous_set_; +#define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) +#define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_SET_OF_H */ diff --git a/src/core/libs/supl/asn-rrlp/asn_application.h b/src/core/libs/supl/asn-rrlp/asn_application.h new file mode 100644 index 000000000..f40cd86ad --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_application.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Application-level ASN.1 callbacks. + */ +#ifndef _ASN_APPLICATION_H_ +#define _ASN_APPLICATION_H_ + +#include "asn_system.h" /* for platform-dependent types */ +#include "asn_codecs.h" /* for ASN.1 codecs specifics */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Generic type of an application-defined callback to return various + * types of data to the application. + * EXPECTED RETURN VALUES: + * -1: Failed to consume bytes. Abort the mission. + * Non-negative return values indicate success, and ignored. + */ +typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, + void *application_specific_key); + +/* + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ +typedef void (asn_app_constraint_failed_f)(void *application_specific_key, + struct asn_TYPE_descriptor_s *type_descriptor_which_failed, + const void *structure_which_failed_ptr, + const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); + +#ifdef __cplusplus +} +#endif + +#include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ + +#endif /* _ASN_APPLICATION_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/asn_codecs.h b/src/core/libs/supl/asn-rrlp/asn_codecs.h new file mode 100644 index 000000000..4a251d940 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_codecs.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ASN_CODECS_H_ +#define _ASN_CODECS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * This structure defines a set of parameters that may be passed + * to every ASN.1 encoder or decoder function. + * WARNING: if max_stack_size member is set, and you are calling the + * function pointers of the asn_TYPE_descriptor_t directly, + * this structure must be ALLOCATED ON THE STACK! + * If you can't always satisfy this requirement, use ber_decode(), + * xer_decode() and uper_decode() functions instead. + */ +typedef struct asn_codec_ctx_s { + /* + * Limit the decoder routines to use no (much) more stack than a given + * number of bytes. Most of decoders are stack-based, and this + * would protect against stack overflows if the number of nested + * encodings is high. + * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, + * and are safe from this kind of overflow. + * A value from getrlimit(RLIMIT_STACK) may be used to initialize + * this variable. Be careful in multithreaded environments, as the + * stack size is rather limited. + */ + size_t max_stack_size; /* 0 disables stack bounds checking */ +} asn_codec_ctx_t; + +/* + * Type of the return value of the encoding functions (der_encode, xer_encode). + */ +typedef struct asn_enc_rval_s { + /* + * Number of bytes encoded. + * -1 indicates failure to encode the structure. + * In this case, the members below this one are meaningful. + */ + ssize_t encoded; + + /* + * Members meaningful when (encoded == -1), for post mortem analysis. + */ + + /* Type which cannot be encoded */ + struct asn_TYPE_descriptor_s *failed_type; + + /* Pointer to the structure of that type */ + void *structure_ptr; +} asn_enc_rval_t; +#define _ASN_ENCODE_FAILED do { \ + asn_enc_rval_t tmp_error; \ + tmp_error.encoded = -1; \ + tmp_error.failed_type = td; \ + tmp_error.structure_ptr = sptr; \ + ASN_DEBUG("Failed to encode element %s", td->name); \ + return tmp_error; \ +} while(0) +#define _ASN_ENCODED_OK(rval) do { \ + rval.structure_ptr = 0; \ + rval.failed_type = 0; \ + return rval; \ +} while(0) + +/* + * Type of the return value of the decoding functions (ber_decode, xer_decode) + * + * Please note that the number of consumed bytes is ALWAYS meaningful, + * even if code==RC_FAIL. This is to indicate the number of successfully + * decoded bytes, hence providing a possibility to fail with more diagnostics + * (i.e., print the offending remainder of the buffer). + */ +enum asn_dec_rval_code_e { + RC_OK, /* Decoded successfully */ + RC_WMORE, /* More data expected, call again */ + RC_FAIL /* Failure to decode data */ +}; +typedef struct asn_dec_rval_s { + enum asn_dec_rval_code_e code; /* Result code */ + size_t consumed; /* Number of bytes consumed */ +} asn_dec_rval_t; +#define _ASN_DECODE_FAILED do { \ + asn_dec_rval_t tmp_error; \ + tmp_error.code = RC_FAIL; \ + tmp_error.consumed = 0; \ + ASN_DEBUG("Failed to decode element %s", td->name); \ + return tmp_error; \ +} while(0) +#define _ASN_DECODE_STARVED do { \ + asn_dec_rval_t tmp_error; \ + tmp_error.code = RC_WMORE; \ + tmp_error.consumed = 0; \ + return tmp_error; \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN_CODECS_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c new file mode 100644 index 000000000..4e5c63937 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c @@ -0,0 +1,295 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Decode an always-primitive type. + */ +asn_dec_rval_t +ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const void *buf_ptr, size_t size, int tag_mode) { + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + /* + * If the structure is not there, allocate it. + */ + if(st == NULL) { + st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); + if(st == NULL) _ASN_DECODE_FAILED; + *sptr = (void *)st; + } + + ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", + td->name, tag_mode); + + /* + * Check tags and extract value length. + */ + 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("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this 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; + } + + st->size = (int)length; + /* The following better be optimized away. */ + if(sizeof(st->size) != sizeof(length) + && (ber_tlv_len_t)st->size != length) { + st->size = 0; + _ASN_DECODE_FAILED; + } + + st->buf = (uint8_t *)MALLOC(length + 1); + if(!st->buf) { + st->size = 0; + _ASN_DECODE_FAILED; + } + + memcpy(st->buf, buf_ptr, length); + st->buf[length] = '\0'; /* Just in case */ + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s", + (long)rval.consumed, + (long)length, td->name); + + return rval; +} + +/* + * Encode an always-primitive type using DER. + */ +asn_enc_rval_t +der_encode_primitive(asn_TYPE_descriptor_t *td, 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__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; + + ASN_DEBUG("%s %s as a primitive type (tm=%d)", + cb?"Encoding":"Estimating", td->name, tag_mode); + + erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, + cb, app_key); + ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + + if(cb && st->buf) { + if(cb(st->buf, st->size, app_key) < 0) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } else { + assert(st->buf || st->size == 0); + } + + erval.encoded += st->size; + _ASN_ENCODED_OK(erval); +} + +void +ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, + int contents_only) { + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; + + if(!td || !sptr) + return; + + ASN_DEBUG("Freeing %s as a primitive type", td->name); + + if(st->buf) + FREEMEM(st->buf); + + if(!contents_only) + FREEMEM(st); +} + + +/* + * Local internal type passed around as an argument. + */ +struct xdp_arg_s { + asn_TYPE_descriptor_t *type_descriptor; + void *struct_key; + xer_primitive_body_decoder_f *prim_body_decoder; + int decoded_something; + int want_more; +}; + + +static int +xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) { + struct xdp_arg_s *arg = (struct xdp_arg_s *)key; + enum xer_pbd_rval bret; + + if(arg->decoded_something) { + if(xer_is_whitespace(chunk_buf, chunk_size)) + return 0; /* Skip it. */ + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } + + bret = arg->prim_body_decoder(arg->type_descriptor, + arg->struct_key, chunk_buf, chunk_size); + switch(bret) { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return 0; + } + + return -1; +} + +static ssize_t +xer_decode__body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) { + struct xdp_arg_s *arg = (struct xdp_arg_s *)key; + enum xer_pbd_rval bret; + + if(arg->decoded_something) { + if(xer_is_whitespace(chunk_buf, chunk_size)) + return chunk_size; + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } + + if(!have_more) { + /* + * If we've received something like "1", we can't really + * tell whether it is really `1` or `123`, until we know + * that there is no more data coming. + * The have_more argument will be set to 1 once something + * like this is available to the caller of this callback: + * "1want_more = 1; + return -1; + } + + bret = arg->prim_body_decoder(arg->type_descriptor, + arg->struct_key, chunk_buf, chunk_size); + switch(bret) { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return chunk_size; + } + + return -1; +} + + +asn_dec_rval_t +xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, + size_t struct_size, + const char *opt_mname, + const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder +) { + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + asn_struct_ctx_t s_ctx; + struct xdp_arg_s s_arg; + asn_dec_rval_t rc; + + /* + * Create the structure if does not exist. + */ + if(!*sptr) { + *sptr = CALLOC(1, struct_size); + if(!*sptr) _ASN_DECODE_FAILED; + } + + memset(&s_ctx, 0, sizeof(s_ctx)); + s_arg.type_descriptor = td; + s_arg.struct_key = *sptr; + s_arg.prim_body_decoder = prim_body_decoder; + s_arg.decoded_something = 0; + s_arg.want_more = 0; + + rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, + xml_tag, buf_ptr, size, + xer_decode__unexpected_tag, xer_decode__body); + switch(rc.code) { + case RC_OK: + if(!s_arg.decoded_something) { + char ch; + ASN_DEBUG("Primitive body is not recognized, " + "supplying empty one"); + /* + * Decoding opportunity has come and gone. + * Where's the result? + * Try to feed with empty body, see if it eats it. + */ + if(prim_body_decoder(s_arg.type_descriptor, + s_arg.struct_key, &ch, 0) + != XPBD_BODY_CONSUMED) { + /* + * This decoder does not like empty stuff. + */ + _ASN_DECODE_FAILED; + } + } + break; + case RC_WMORE: + /* + * Redo the whole thing later. + * We don't have a context to save intermediate parsing state. + */ + rc.consumed = 0; + break; + case RC_FAIL: + rc.consumed = 0; + if(s_arg.want_more) + rc.code = RC_WMORE; + else + _ASN_DECODE_FAILED; + break; + } + return rc; +} + diff --git a/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h new file mode 100644 index 000000000..0f683fdd0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_CODECS_PRIM_H +#define ASN_CODECS_PRIM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ASN__PRIMITIVE_TYPE_s { + uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ + int size; /* Size of the buffer */ +} ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ + +asn_struct_free_f ASN__PRIMITIVE_TYPE_free; +ber_type_decoder_f ber_decode_primitive; +der_type_encoder_f der_encode_primitive; + +/* + * A callback specification for the xer_decode_primitive() function below. + */ +enum xer_pbd_rval { + XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ + XPBD_DECODER_LIMIT, /* Hit some decoder limitation or deficiency */ + XPBD_BROKEN_ENCODING, /* Encoding of a primitive body is broken */ + XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ + XPBD_BODY_CONSUMED /* Body is recognized and consumed */ +}; +typedef enum xer_pbd_rval (xer_primitive_body_decoder_f) + (asn_TYPE_descriptor_t *td, void *struct_ptr, + const void *chunk_buf, size_t chunk_size); + +/* + * Specific function to decode simple primitive types. + * Also see xer_decode_general() in xer_decoder.h + */ +asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, size_t struct_size, + const char *opt_mname, + const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder +); + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_CODECS_PRIM_H */ diff --git a/src/core/libs/supl/asn-rrlp/asn_internal.h b/src/core/libs/supl/asn-rrlp/asn_internal.h new file mode 100644 index 000000000..249d7ef64 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_internal.h @@ -0,0 +1,119 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Declarations internally useful for the ASN.1 support code. + */ +#ifndef _ASN_INTERNAL_H_ +#define _ASN_INTERNAL_H_ + +#include "asn_application.h" /* Application-visible API */ + +#ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */ +#include /* for assert() macro */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Environment version might be used to avoid running with the old library */ +#define ASN1C_ENVIRONMENT_VERSION 922 /* Compile-time version */ +int get_asn1c_environment_version(void); /* Run-time version */ + +#define CALLOC(nmemb, size) calloc(nmemb, size) +#define MALLOC(size) malloc(size) +#define REALLOC(oldptr, size) realloc(oldptr, size) +#define FREEMEM(ptr) free(ptr) + +/* + * A macro for debugging the ASN.1 internals. + * You may enable or override it. + */ +#ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */ +#if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */ +#ifdef __GNUC__ +#ifdef ASN_THREAD_SAFE +#define asn_debug_indent 0 +#else /* !ASN_THREAD_SAFE */ +int asn_debug_indent; +#endif /* ASN_THREAD_SAFE */ +#define ASN_DEBUG(fmt, args...) do { \ + int adi = asn_debug_indent; \ + while(adi--) fprintf(stderr, " "); \ + fprintf(stderr, fmt, ##args); \ + fprintf(stderr, " (%s:%d)\n", \ + __FILE__, __LINE__); \ + } while(0) +#else /* !__GNUC__ */ +void ASN_DEBUG_f(const char *fmt, ...); +#define ASN_DEBUG ASN_DEBUG_f +#endif /* __GNUC__ */ +#else /* EMIT_ASN_DEBUG != 1 */ +static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } +#endif /* EMIT_ASN_DEBUG */ +#endif /* ASN_DEBUG */ + +/* + * Invoke the application-supplied callback and fail, if something is wrong. + */ +#define __ASN_E_cbc(buf, size) (cb((buf), (size), app_key) < 0) +#define _ASN_E_CALLBACK(foo) do { \ + if(foo) goto cb_failed; \ + } while(0) +#define _ASN_CALLBACK(buf, size) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) +#define _ASN_CALLBACK2(buf1, size1, buf2, size2) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2)) +#define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) \ + || __ASN_E_cbc(buf2, size2) \ + || __ASN_E_cbc(buf3, size3)) + +#define _i_ASN_TEXT_INDENT(nl, level) do { \ + int __level = (level); \ + int __nl = ((nl) != 0); \ + int __i; \ + if(__nl) _ASN_CALLBACK("\n", 1); \ + if(__level < 0) __level = 0; \ + for(__i = 0; __i < __level; __i++) \ + _ASN_CALLBACK(" ", 4); \ + er.encoded += __nl + 4 * __level; \ +} while(0) + +#define _i_INDENT(nl) do { \ + int __i; \ + if((nl) && cb("\n", 1, app_key) < 0) return -1; \ + for(__i = 0; __i < ilevel; __i++) \ + if(cb(" ", 4, app_key) < 0) return -1; \ +} while(0) + +/* + * Check stack against overflow, if limit is set. + */ +#define _ASN_DEFAULT_STACK_MAX (30000) +static inline int +_ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) { + if(ctx && ctx->max_stack_size) { + + /* ctx MUST be allocated on the stack */ + ptrdiff_t usedstack = ((char *)ctx - (char *)&ctx); + if(usedstack > 0) usedstack = -usedstack; /* grows up! */ + + /* double negative required to avoid int wrap-around */ + if(usedstack < -(ptrdiff_t)ctx->max_stack_size) { + ASN_DEBUG("Stack limit %ld reached", + (long)ctx->max_stack_size); + return -1; + } + } + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN_INTERNAL_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/asn_system.h b/src/core/libs/supl/asn-rrlp/asn_system.h new file mode 100644 index 000000000..0a9b092c3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/asn_system.h @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2003, 2004, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Miscellaneous system-dependent types. + */ +#ifndef _ASN_SYSTEM_H_ +#define _ASN_SYSTEM_H_ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include /* For snprintf(3) */ +#include /* For *alloc(3) */ +#include /* For memcpy(3) */ +#include /* For size_t */ +#include /* For LONG_MAX */ +#include /* For va_start */ +#include /* for offsetof and ptrdiff_t */ + +#ifdef WIN32 + +#include +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ +#define sys_ntohl(l) ((((l) << 24) & 0xff000000) \ + | (((l) << 16) & 0xff0000) \ + | (((l) << 8) & 0xff00) \ + | ((l) & 0xff)) + +#ifdef _MSC_VER /* MSVS.Net */ +#ifndef __cplusplus +#define inline __inline +#endif +#ifndef ASSUMESTDTYPES /* Standard types have been defined elsewhere */ +#define ssize_t SSIZE_T +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif /* ASSUMESTDTYPES */ +#define WIN32_LEAN_AND_MEAN +#include +#include +#define isnan _isnan +#define finite _finite +#define copysign _copysign +#define ilogb _logb +#else /* !_MSC_VER */ +#include +#endif /* _MSC_VER */ + +#else /* !WIN32 */ + +#if defined(__vxworks) +#include +#else /* !defined(__vxworks) */ + +#include /* C99 specifies this file */ +/* + * 1. Earlier FreeBSD version didn't have , + * but was present. + * 2. Sun Solaris requires for alloca(3), + * but does not have . + */ +#if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_)) +#if defined(sun) +#include /* For alloca(3) */ +#include /* for finite(3) */ +#elif defined(__hpux) +#ifdef __GNUC__ +#include /* For alloca(3) */ +#else /* !__GNUC__ */ +#define inline +#endif /* __GNUC__ */ +#else +#include /* SUSv2+ and C99 specify this file, for uintXX_t */ +#endif /* defined(sun) */ +#endif + +#include /* for ntohl() */ +#define sys_ntohl(foo) ntohl(foo) + +#endif /* defined(__vxworks) */ + +#endif /* WIN32 */ + +#if __GNUC__ >= 3 +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#endif +#ifndef GCC_NOTUSED +#define GCC_NOTUSED __attribute__((unused)) +#endif +#else +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) /* nothing */ +#endif +#ifndef GCC_NOTUSED +#define GCC_NOTUSED +#endif +#endif + +/* Figure out if thread safety is requested */ +#if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT)) +#define ASN_THREAD_SAFE +#endif /* Thread safety */ + +#ifndef offsetof /* If not defined by */ +#define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0)) +#endif /* offsetof */ + +#ifndef MIN /* Suitable for comparing primitive types (integers) */ +#if defined(__GNUC__) +#define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \ + ((_a)<(_b)?(_a):(_b)); }) +#else /* !__GNUC__ */ +#define MIN(a,b) ((a)<(b)?(a):(b)) /* Unsafe variant */ +#endif /* __GNUC__ */ +#endif /* MIN */ + +#endif /* _ASN_SYSTEM_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/ber_decoder.c b/src/core/libs/supl/asn-rrlp/ber_decoder.c new file mode 100644 index 000000000..601f66c0b --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ber_decoder.c @@ -0,0 +1,283 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) +#undef RETURN +#define RETURN(_code) do { \ + asn_dec_rval_t rval; \ + rval.code = _code; \ + if(opt_ctx) opt_ctx->step = step; /* Save context */ \ + if(_code == RC_OK || opt_ctx) \ + rval.consumed = consumed_myself; \ + else \ + rval.consumed = 0; /* Context-free */ \ + return rval; \ + } while(0) + +/* + * The BER decoder of any type. + */ +asn_dec_rval_t +ber_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, const void *ptr, size_t size) { + asn_codec_ctx_t s_codec_ctx; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* + * Invoke type-specific decoder. + */ + return type_descriptor->ber_decoder(opt_codec_ctx, type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + ptr, size, /* Buffer and its size */ + 0 /* Default tag mode is 0 */ + ); +} + +/* + * Check the set of >> tags matches the definition. + */ +asn_dec_rval_t +ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, + const void *ptr, size_t size, int tag_mode, int last_tag_form, + ber_tlv_len_t *last_length, int *opt_tlv_form) { + ssize_t consumed_myself = 0; + ssize_t tag_len; + ssize_t len_len; + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_len_t limit_len = -1; + int expect_00_terminators = 0; + int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ + int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ + int tagno; + + /* + * Make sure we didn't exceed the maximum stack size. + */ + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + RETURN(RC_FAIL); + + /* + * So what does all this implicit skip stuff mean? + * Imagine two types, + * A ::= [5] IMPLICIT T + * B ::= [2] EXPLICIT T + * Where T is defined as + * T ::= [4] IMPLICIT SEQUENCE { ... } + * + * Let's say, we are starting to decode type A, given the + * following TLV stream: <5> <0>. What does this mean? + * It means that the type A contains type T which is, + * in turn, empty. + * Remember though, that we are still in A. We cannot + * just pass control to the type T decoder. Why? Because + * the type T decoder expects <4> <0>, not <5> <0>. + * So, we must make sure we are going to receive <5> while + * still in A, then pass control to the T decoder, indicating + * that the tag <4> was implicitly skipped. The decoder of T + * hence will be prepared to treat <4> as valid tag, and decode + * it appropriately. + */ + + tagno = step /* Continuing where left previously */ + + (tag_mode==1?-1:0) + ; + ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)", + td->name, (long)size, tag_mode, step, tagno); + /* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */ + + if(tag_mode == 0 && tagno == td->tags_count) { + /* + * This must be the _untagged_ ANY type, + * which outermost tag isn't known in advance. + * Fetch the tag and length separately. + */ + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + switch(tag_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + len_len = ber_fetch_length(tlv_constr, + (const char *)ptr + tag_len, size - tag_len, &tlv_len); + switch(len_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + ASN_DEBUG("Advancing %ld in ANY case", + (long)(tag_len + len_len)); + ADVANCE(tag_len + len_len); + } else { + assert(tagno < td->tags_count); /* At least one loop */ + } + for((void)tagno; tagno < td->tags_count; tagno++, step++) { + + /* + * Fetch and process T from TLV. + */ + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + ASN_DEBUG("Fetching tag from {%p,%ld}: " + "len %ld, step %d, tagno %d got %s", + ptr, (long)size, + (long)tag_len, step, tagno, + ber_tlv_tag_string(tlv_tag)); + switch(tag_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + + /* + * If {I}, don't check anything. + * If {I,B,C}, check B and C unless we're at I. + */ + if(tag_mode != 0 && step == 0) { + /* + * We don't expect tag to match here. + * It's just because we don't know how the tag + * is supposed to look like. + */ + } else { + assert(tagno >= 0); /* Guaranteed by the code above */ + if(tlv_tag != td->tags[tagno]) { + /* + * Unexpected tag. Too bad. + */ + ASN_DEBUG("Expected: %s, " + "expectation failed (tn=%d, tm=%d)", + ber_tlv_tag_string(td->tags[tagno]), + tagno, tag_mode + ); + RETURN(RC_FAIL); + } + } + + /* + * Attention: if there are more tags expected, + * ensure that the current tag is presented + * in constructed form (it contains other tags!). + * If this one is the last one, check that the tag form + * matches the one given in descriptor. + */ + if(tagno < (td->tags_count - 1)) { + if(tlv_constr == 0) { + ASN_DEBUG("tlv_constr = %d, expfail", + tlv_constr); + RETURN(RC_FAIL); + } + } else { + if(last_tag_form != tlv_constr + && last_tag_form != -1) { + ASN_DEBUG("last_tag_form %d != %d", + last_tag_form, tlv_constr); + RETURN(RC_FAIL); + } + } + + /* + * Fetch and process L from TLV. + */ + len_len = ber_fetch_length(tlv_constr, + (const char *)ptr + tag_len, size - tag_len, &tlv_len); + ASN_DEBUG("Fetchinig len = %ld", (long)len_len); + switch(len_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + /* + * FIXME + * As of today, the chain of tags + * must either contain several indefinite length TLVs, + * or several definite length ones. + * No mixing is allowed. + */ + if(tlv_len == -1) { + /* + * Indefinite length. + */ + if(limit_len == -1) { + expect_00_terminators++; + } else { + ASN_DEBUG("Unexpected indefinite length " + "in a chain of definite lengths"); + RETURN(RC_FAIL); + } + ADVANCE(tag_len + len_len); + continue; + } else { + if(expect_00_terminators) { + ASN_DEBUG("Unexpected definite length " + "in a chain of indefinite lengths"); + RETURN(RC_FAIL); + } + } + + /* + * Check that multiple TLVs specify ever decreasing length, + * which is consistent. + */ + if(limit_len == -1) { + limit_len = tlv_len + tag_len + len_len; + if(limit_len < 0) { + /* Too great tlv_len value? */ + RETURN(RC_FAIL); + } + } else if(limit_len != tlv_len + tag_len + len_len) { + /* + * Inner TLV specifies length which is inconsistent + * with the outer TLV's length value. + */ + ASN_DEBUG("Outer TLV is %ld and inner is %ld", + (long)limit_len, (long)tlv_len); + RETURN(RC_FAIL); + } + + ADVANCE(tag_len + len_len); + + limit_len -= (tag_len + len_len); + if((ssize_t)size > limit_len) { + /* + * Make sure that we won't consume more bytes + * from the parent frame than the inferred limit. + */ + size = limit_len; + } + } + + if(opt_tlv_form) + *opt_tlv_form = tlv_constr; + if(expect_00_terminators) + *last_length = -expect_00_terminators; + else + *last_length = tlv_len; + + RETURN(RC_OK); +} diff --git a/src/core/libs/supl/asn-rrlp/ber_decoder.h b/src/core/libs/supl/asn-rrlp/ber_decoder.h new file mode 100644 index 000000000..9fe2e895d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ber_decoder.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_DECODER_H_ +#define _BER_DECODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ +struct asn_codec_ctx_s; /* Forward declaration */ + +/* + * The BER decoder of any type. + * This function may be invoked directly from the application. + * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). + */ +asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of that buffer */ + ); + +/* + * Type of generic function which decodes the byte stream into the structure. + */ +typedef asn_dec_rval_t (ber_type_decoder_f)( + struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, const void *buf_ptr, size_t size, + int tag_mode); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Check that all tags correspond to the type definition (as given in head). + * On return, last_length would contain either a non-negative length of the + * value part of the last TLV, or the negative number of expected + * "end of content" sequences. The number may only be negative if the + * head->last_tag_form is non-zero. + */ +asn_dec_rval_t ber_check_tags( + struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ + struct asn_TYPE_descriptor_s *type_descriptor, + asn_struct_ctx_t *opt_ctx, /* saved decoding context */ + const void *ptr, size_t size, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {-1,0:1}: any, primitive, constr */ + ber_tlv_len_t *last_length, + int *opt_tlv_form /* optional tag form */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_DECODER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_length.c b/src/core/libs/supl/asn-rrlp/ber_tlv_length.c new file mode 100644 index 000000000..b87e75e04 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_length.c @@ -0,0 +1,178 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +ssize_t +ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r) { + const uint8_t *buf = (const uint8_t *)bufptr; + unsigned oct; + + if(size == 0) + return 0; /* Want more */ + + oct = *(const uint8_t *)buf; + if((oct & 0x80) == 0) { + /* + * Short definite length. + */ + *len_r = oct; /* & 0x7F */ + return 1; + } else { + ber_tlv_len_t len; + size_t skipped; + + if(_is_constructed && oct == 0x80) { + *len_r = -1; /* Indefinite length */ + return 1; + } + + if(oct == 0xff) { + /* Reserved in standard for future use. */ + return -1; + } + + oct &= 0x7F; /* Leave only the 7 LS bits */ + for(len = 0, buf++, skipped = 1; + oct && (++skipped <= size); buf++, oct--) { + + len = (len << 8) | *buf; + if(len < 0 + || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) { + /* + * Too large length value. + */ + return -1; + } + } + + if(oct == 0) { + ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; + /* + * Here length may be very close or equal to 2G. + * However, the arithmetics used in some decoders + * may add some (small) quantities to the length, + * to check the resulting value against some limits. + * This may result in integer wrap-around, which + * we try to avoid by checking it earlier here. + */ + if(lenplusepsilon < 0) { + /* Too large length value */ + return -1; + } + + *len_r = len; + return skipped; + } + + return 0; /* Want more */ + } + +} + +ssize_t +ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, + int _is_constructed, const void *ptr, size_t size) { + ber_tlv_len_t vlen; /* Length of V in TLV */ + ssize_t tl; /* Length of L in TLV */ + ssize_t ll; /* Length of L in TLV */ + size_t skip; + + /* + * Make sure we didn't exceed the maximum stack size. + */ + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + return -1; + + /* + * Determine the size of L in TLV. + */ + ll = ber_fetch_length(_is_constructed, ptr, size, &vlen); + if(ll <= 0) return ll; + + /* + * Definite length. + */ + if(vlen >= 0) { + skip = ll + vlen; + if(skip > size) + return 0; /* Want more */ + return skip; + } + + /* + * Indefinite length! + */ + ASN_DEBUG("Skipping indefinite length"); + for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) { + ber_tlv_tag_t tag; + + /* Fetch the tag */ + tl = ber_fetch_tag(ptr, size, &tag); + if(tl <= 0) return tl; + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + ((const char *)ptr) + tl, size - tl); + if(ll <= 0) return ll; + + skip += tl + ll; + + /* + * This may be the end of the indefinite length structure, + * two consecutive 0 octets. + * Check if it is true. + */ + if(((const uint8_t *)ptr)[0] == 0 + && ((const uint8_t *)ptr)[1] == 0) + return skip; + + ptr = ((const char *)ptr) + tl + ll; + size -= tl + ll; + } + + /* UNREACHABLE */ +} + +size_t +der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) { + size_t required_size; /* Size of len encoding */ + uint8_t *buf = (uint8_t *)bufp; + uint8_t *end; + size_t i; + + if(len <= 127) { + /* Encoded in 1 octet */ + if(size) *buf = (uint8_t)len; + return 1; + } + + /* + * Compute the size of the subsequent bytes. + */ + for(required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) { + if(len >> i) + required_size++; + else + break; + } + + if(size <= required_size) + return required_size + 1; + + *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ + + /* + * Produce the len encoding, space permitting. + */ + end = buf + required_size; + for(i -= 8; buf < end; i -= 8, buf++) + *buf = (uint8_t)(len >> i); + + return required_size + 1; +} + diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_length.h b/src/core/libs/supl/asn-rrlp/ber_tlv_length.h new file mode 100644 index 000000000..349680224 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_length.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_TLV_LENGTH_H_ +#define _BER_TLV_LENGTH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ssize_t ber_tlv_len_t; + +/* + * This function tries to fetch the length of the BER TLV value and place it + * in *len_r. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering length. + * >0: Number of bytes used from bufptr. + * On return with >0, len_r is constrained as -1..MAX, where -1 mean + * that the value is of indefinite length. + */ +ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r); + +/* + * This function expects bufptr to be positioned over L in TLV. + * It returns number of bytes occupied by L and V together, suitable + * for skipping. The function properly handles indefinite length. + * RETURN VALUES: + * Standard {-1,0,>0} convention. + */ +ssize_t ber_skip_length( + struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ + int _is_constructed, const void *bufptr, size_t size); + +/* + * This function serializes the length (L from TLV) in DER format. + * It always returns number of bytes necessary to represent the length, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ +size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_TLV_LENGTH_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c new file mode 100644 index 000000000..42708760e --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c @@ -0,0 +1,144 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +ssize_t +ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { + ber_tlv_tag_t val; + ber_tlv_tag_t tclass; + size_t skipped; + + if(size == 0) + return 0; + + val = *(const uint8_t *)ptr; + tclass = (val >> 6); + if((val &= 0x1F) != 0x1F) { + /* + * Simple form: everything encoded in a single octet. + * Tag Class is encoded using two least significant bits. + */ + *tag_r = (val << 2) | tclass; + return 1; + } + + /* + * Each octet contains 7 bits of useful information. + * The MSB is 0 if it is the last octet of the tag. + */ + for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; + skipped <= size; + ptr = ((const char *)ptr) + 1, skipped++) { + unsigned int oct = *(const uint8_t *)ptr; + if(oct & 0x80) { + val = (val << 7) | (oct & 0x7F); + /* + * Make sure there are at least 9 bits spare + * at the MS side of a value. + */ + if(val >> ((8 * sizeof(val)) - 9)) { + /* + * We would not be able to accomodate + * any more tag bits. + */ + return -1; + } + } else { + val = (val << 7) | oct; + *tag_r = (val << 2) | tclass; + return skipped; + } + } + + return 0; /* Want more */ +} + + +ssize_t +ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) { + char buf[sizeof("[APPLICATION ]") + 32]; + ssize_t ret; + + ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf)); + if(ret >= (ssize_t)sizeof(buf) || ret < 2) { + errno = EPERM; + return -1; + } + + return fwrite(buf, 1, ret, f); +} + +ssize_t +ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) { + char *type = 0; + int ret; + + switch(tag & 0x3) { + case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break; + case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break; + case ASN_TAG_CLASS_CONTEXT: type = ""; break; + case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break; + } + + ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2); + if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ + + return ret; +} + +char * +ber_tlv_tag_string(ber_tlv_tag_t tag) { + static char buf[sizeof("[APPLICATION ]") + 32]; + + (void)ber_tlv_tag_snprint(tag, buf, sizeof(buf)); + + return buf; +} + + +size_t +ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { + int tclass = BER_TAG_CLASS(tag); + ber_tlv_tag_t tval = BER_TAG_VALUE(tag); + uint8_t *buf = (uint8_t *)bufp; + uint8_t *end; + size_t required_size; + size_t i; + + if(tval <= 30) { + /* Encoded in 1 octet */ + if(size) buf[0] = (tclass << 6) | tval; + return 1; + } else if(size) { + *buf++ = (tclass << 6) | 0x1F; + size--; + } + + /* + * Compute the size of the subsequent bytes. + */ + for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) { + if(tval >> i) + required_size++; + else + break; + } + + if(size < required_size) + return required_size + 1; + + /* + * Fill in the buffer, space permitting. + */ + end = buf + required_size - 1; + for(i -= 7; buf < end; i -= 7, buf++) + *buf = 0x80 | ((tval >> i) & 0x7F); + *buf = (tval & 0x7F); /* Last octet without high bit */ + + return required_size + 1; +} + diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h new file mode 100644 index 000000000..60e866861 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_TLV_TAG_H_ +#define _BER_TLV_TAG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum asn_tag_class { + ASN_TAG_CLASS_UNIVERSAL = 0, /* 0b00 */ + ASN_TAG_CLASS_APPLICATION = 1, /* 0b01 */ + ASN_TAG_CLASS_CONTEXT = 2, /* 0b10 */ + ASN_TAG_CLASS_PRIVATE = 3 /* 0b11 */ +}; +typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */ + +/* + * Tag class is encoded together with tag value for optimization purposes. + */ +#define BER_TAG_CLASS(tag) ((tag) & 0x3) +#define BER_TAG_VALUE(tag) ((tag) >> 2) +#define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr)&0x20)?1:0) + +#define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) + +/* + * Several functions for printing the TAG in the canonical form + * (i.e. "[PRIVATE 0]"). + * Return values correspond to their libc counterparts (if any). + */ +ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen); +ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *); +char *ber_tlv_tag_string(ber_tlv_tag_t tag); + + +/* + * This function tries to fetch the tag from the input stream. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering tag. + * >0: Number of bytes used from bufptr. tag_r will contain the tag. + */ +ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); + +/* + * This function serializes the tag (T from TLV) in BER format. + * It always returns number of bytes necessary to represent the tag, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ +size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_TLV_TAG_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c new file mode 100644 index 000000000..a9eb71941 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c @@ -0,0 +1,1110 @@ +/* + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * See the definitions. + */ +static int _fetch_present_idx(const void *struct_ptr, int off, int size); +static void _set_present_idx(void *sptr, int offset, int size, int pres); + +/* + * Tags are canonically sorted in the tag to member table. + */ +static int +_search4tag(const void *ap, const void *bp) { + const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; + const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; + + int a_class = BER_TAG_CLASS(a->el_tag); + int b_class = BER_TAG_CLASS(b->el_tag); + + if(a_class == b_class) { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + + if(a_value == b_value) + return 0; + else if(a_value < b_value) + return -1; + else + return 1; + } else if(a_class < b_class) { + return -1; + } else { + return 1; + } +} + +/* + * The decoder of the CHOICE type. + */ +asn_dec_rval_t +CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + ssize_t tag_len; /* Length of TLV's T */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + ASN_DEBUG("Decoding %s as CHOICE", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + if(tag_mode || td->tags_count) { + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, -1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) { + /* ?Substracted below! */ + ctx->left += rval.consumed; + } + ADVANCE(rval.consumed); + } else { + ctx->left = -1; + } + + NEXT_PHASE(ctx); + + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); + + /* Fall through */ + case 1: + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + do { + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + + key.el_tag = tlv_tag; + t2m = (asn_TYPE_tag2member_t *)bsearch(&key, + specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _search4tag); + if(t2m) { + /* + * Found the element corresponding to the tag. + */ + NEXT_PHASE(ctx); + ctx->step = t2m->el_no; + break; + } else if(specs->ext_start == -1) { + ASN_DEBUG("Unexpected tag %s " + "in non-extensible CHOICE %s", + ber_tlv_tag_string(tlv_tag), td->name); + RETURN(RC_FAIL); + } else { + /* Skip this tag */ + ssize_t skip; + + ASN_DEBUG("Skipping unknown tag %s", + ber_tlv_tag_string(tlv_tag)); + + skip = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + + switch(skip) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + RETURN(RC_OK); + } + } while(0); + + case 2: + /* + * PHASE 2. + * Read in the element. + */ + do { + asn_TYPE_member_t *elm;/* CHOICE's element */ + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &elements[ctx->step]; + + /* + * Compute the position of the member inside a structure, + * and also a type of containment (it may be contained + * as pointer or using inline inclusion). + */ + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + /* Set presence to be able to free it properly at any time */ + _set_present_idx(st, specs->pres_offset, + specs->pres_size, ctx->step + 1); + /* + * Invoke the member fetch routine according to member's type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + memb_ptr2, ptr, LEFT, elm->tag_mode); + switch(rval.code) { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + RETURN(RC_FAIL); + case RC_FAIL: /* Fatal error */ + RETURN(rval.code); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } while(0); + + NEXT_PHASE(ctx); + + /* Fall through */ + case 3: + ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", + td->name, (long)ctx->left, (long)size, + tag_mode, td->tags_count); + + if(ctx->left > 0) { + /* + * The type must be fully decoded + * by the CHOICE member-specific decoder. + */ + RETURN(RC_FAIL); + } + + if(ctx->left == -1 + && !(tag_mode || td->tags_count)) { + /* + * This is an untagged CHOICE. + * It doesn't contain nothing + * except for the member itself, including all its tags. + * The decoding is completed. + */ + NEXT_PHASE(ctx); + break; + } + + /* + * Read in the "end of data chunks"'s. + */ + while(ctx->left < 0) { + ssize_t tl; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tl) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + /* + * Expected <0><0>... + */ + if(((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + continue; + } + } else { + ASN_DEBUG("Unexpected continuation in %s", + td->name); + RETURN(RC_FAIL); + } + + /* UNREACHABLE */ + } + + NEXT_PHASE(ctx); + case 4: + /* No meaningful work here */ + break; + } + + RETURN(RC_OK); +} + +asn_enc_rval_t +CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE element */ + asn_enc_rval_t erval; + void *memb_ptr; + size_t computed_size = 0; + int present; + + if(!sptr) _ASN_ENCODE_FAILED; + + ASN_DEBUG("%s %s as CHOICE", + cb?"Encoding":"Estimating", td->name); + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) { + if(present == 0 && td->elements_count == 0) { + /* The CHOICE is empty?! */ + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + _ASN_ENCODE_FAILED; + } + + /* + * Seek over the present member of the structure. + */ + elm = &td->elements[present-1]; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(memb_ptr == 0) { + if(elm->optional) { + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + /* Mandatory element absent */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + /* + * If the CHOICE itself is tagged EXPLICIT: + * T ::= [2] EXPLICIT CHOICE { ... } + * Then emit the appropriate tags. + */ + if(tag_mode == 1 || td->tags_count) { + /* + * For this, we need to pre-compute the member. + */ + ssize_t ret; + + /* Encode member with its tag */ + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, 0, 0); + if(erval.encoded == -1) + return erval; + + /* Encode CHOICE with parent or my own tag */ + ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, + cb, app_key); + if(ret == -1) + _ASN_ENCODE_FAILED; + computed_size += ret; + } + + /* + * Encode the single underlying member. + */ + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, cb, app_key); + if(erval.encoded == -1) + return erval; + + ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", + (long)erval.encoded, (long)computed_size); + + erval.encoded += computed_size; + + return erval; +} + +ber_tlv_tag_t +CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + assert(tag_mode == 0); (void)tag_mode; + assert(tag == 0); (void)tag; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); + + if(present > 0 || present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *) + ((const char *)ptr + elm->memb_offset); + } else { + memb_ptr = (const void *) + ((const char *)ptr + elm->memb_offset); + } + + return asn_TYPE_outmost_tag(elm->type, memb_ptr, + elm->tag_mode, elm->tag); + } else { + return (ber_tlv_tag_t)-1; + } +} + +int +CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + return 0; + _ASN_CTFAIL(app_key, td, sptr, + "%s: mandatory CHOICE element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + if(elm->memb_constraints) { + return elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + } else { + int ret = elm->type->check_constraints(elm->type, + memb_ptr, ctfailcb, app_key); + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + return ret; + } + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: no CHOICE element given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value of a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + if(ctx->phase == 0 && !*xml_tag) + ctx->phase = 1; /* Skip the outer tag checking phase */ + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + * Phase 3: Only waiting for closing tag. + * Phase 4: Skipping unknown extensions. + * Phase 5: PHASED OUT + */ + for(edx = ctx->step; ctx->phase <= 4;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + + /* + * Go inside the member. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &td->elements[edx]; + + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Start/Continue decoding the inner member */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, + elm->type, memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", + elm->type->name, tmprval.code); + if(tmprval.code != RC_OK) + RETURN(tmprval.code); + assert(_fetch_present_idx(st, + specs->pres_offset, specs->pres_size) == 0); + /* Record what we've got */ + _set_present_idx(st, + specs->pres_offset, specs->pres_size, edx + 1); + ctx->phase = 3; + /* Fall through */ + } + + /* No need to wait for closing tag; special mode. */ + if(ctx->phase == 3 && !*xml_tag) { + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", + ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', + ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', + ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', + ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', + xml_tag, tcv); + + /* Skip the extensions section */ + if(ctx->phase == 4) { + ASN_DEBUG("skip_unknown(%d, %ld)", + tcv, (long)ctx->left); + switch(xer_skip_unknown(tcv, &ctx->left)) { + case -1: + ctx->phase = 5; + RETURN(RC_FAIL); + continue; + case 1: + ctx->phase = 3; + /* Fall through */ + case 0: + XER_ADVANCE(ch_size); + continue; + case 2: + ctx->phase = 3; + break; + } + } + + switch(tcv) { + case XCT_BOTH: + break; /* No CHOICE? */ + case XCT_CLOSING: + if(ctx->phase != 3) + break; + XER_ADVANCE(ch_size); + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + if(ctx->phase != 1) + break; /* Really unexpected */ + + /* + * Search which inner member corresponds to this tag. + */ + for(edx = 0; edx < td->elements_count; edx++) { + elm = &td->elements[edx]; + tcv = xer_check_tag(buf_ptr,ch_size,elm->name); + switch(tcv) { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + edx = td->elements_count; + break; /* Phase out */ + } + break; + } + if(edx != td->elements_count) + continue; + + /* It is expected extension */ + if(specs->ext_start != -1) { + ASN_DEBUG("Got anticipated extension"); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if(tcv & XCT_CLOSING) { + /* Found without body */ + ctx->phase = 3; /* Terminating */ + } else { + ctx->left = 1; + ctx->phase = 4; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" + " (ph=%d, tag=%s)", + ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', + ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', + ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', + ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', + td->name, ctx->phase, xml_tag); + break; + } + + ctx->phase = 5; /* Phase out, just in case */ + RETURN(RC_FAIL); +} + + +asn_enc_rval_t +CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs=(asn_CHOICE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int present; + + if(!sptr) + _ASN_ENCODE_FAILED; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + + if(present <= 0 || present > td->elements_count) { + _ASN_ENCODE_FAILED; + } else { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[present-1]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) _ASN_ENCODE_FAILED; + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + er.encoded = 0; + + if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + + er.encoded += 5 + (2 * mlen) + tmper.encoded; + } + + if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +asn_dec_rval_t +CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_dec_rval_t rv; + asn_per_constraint_t *ct; + asn_TYPE_member_t *elm; /* CHOICE's element */ + void *memb_ptr; + void **memb_ptr2; + void *st = *sptr; + int value; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + _ASN_DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) _ASN_DECODE_FAILED; + } + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + value = per_get_few_bits(pd, 1); + if(value < 0) _ASN_DECODE_STARVED; + if(value) ct = 0; /* Not restricted */ + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) _ASN_DECODE_STARVED; + ASN_DEBUG("CHOICE %s got index %d in range %d", + td->name, value, ct->range_bits); + if(value > ct->upper_bound) + _ASN_DECODE_FAILED; + } else { + if(specs->ext_start == -1) + _ASN_DECODE_FAILED; + value = uper_get_nsnnwn(pd); + if(value < 0) _ASN_DECODE_STARVED; + value += specs->ext_start; + if(value >= td->elements_count) + _ASN_DECODE_FAILED; + } + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + value = specs->canonical_order[value]; + + /* Set presence to be able to free it later */ + _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); + + elm = &td->elements[value]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); + + if(ct && ct->range_bits >= 0) { + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } else { + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } + + if(rv.code != RC_OK) + ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", + elm->name, td->name, rv.code); + return rv; +} + +asn_enc_rval_t +CHOICE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_per_constraint_t *ct; + void *memb_ptr; + int present; + + if(!sptr) _ASN_ENCODE_FAILED; + + ASN_DEBUG("Encoding %s as CHOICE", td->name); + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized properly, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) + _ASN_ENCODE_FAILED; + else + present--; + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + present = specs->canonical_order[present]; + + ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); + + if(ct && ct->range_bits >= 0) { + if(present < ct->lower_bound + || present > ct->upper_bound) { + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, 1, 1)) + _ASN_ENCODE_FAILED; + } else { + _ASN_ENCODE_FAILED; + } + ct = 0; + } + } + if(ct && ct->flags & APC_EXTENSIBLE) + if(per_put_few_bits(po, 0, 1)) + _ASN_ENCODE_FAILED; + + elm = &td->elements[present]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) _ASN_ENCODE_FAILED; + } else { + memb_ptr = (char *)sptr + elm->memb_offset; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, present, ct->range_bits)) + _ASN_ENCODE_FAILED; + + return elm->type->uper_encoder(elm->type, elm->per_constraints, + memb_ptr, po); + } else { + asn_enc_rval_t rval; + if(specs->ext_start == -1) + _ASN_ENCODE_FAILED; + if(uper_put_nsnnwn(po, present - specs->ext_start)) + _ASN_ENCODE_FAILED; + if(uper_open_type_put(elm->type, elm->per_constraints, + memb_ptr, po)) + _ASN_ENCODE_FAILED; + rval.encoded = 0; + _ASN_ENCODED_OK(rval); + } +} + + +int +CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + + /* + * Print that element. + */ + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Print member's name and stuff */ + if(0) { + if(cb(elm->name, strlen(elm->name), app_key) < 0 + || cb(": ", 2, app_key) < 0) + return -1; + } + + return elm->type->print_struct(elm->type, memb_ptr, ilevel, + cb, app_key); + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as CHOICE", td->name); + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); + + /* + * Free that element. + */ + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)ptr + elm->memb_offset); + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } else { + memb_ptr = (void *)((char *)ptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } + } + + if(!contents_only) { + FREEMEM(ptr); + } +} + + +/* + * The following functions functions offer protection against -fshort-enums, + * compatible with little- and big-endian machines. + * If assertion is triggered, either disable -fshort-enums, or add an entry + * here with the ->pres_size of your target stracture. + * Unless the target structure is packed, the ".present" member + * is guaranteed to be aligned properly. ASN.1 compiler itself does not + * produce packed code. + */ +static int +_fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { + const void *present_ptr; + int present; + + present_ptr = ((const char *)struct_ptr) + pres_offset; + + switch(pres_size) { + case sizeof(int): present = *(const int *)present_ptr; break; + case sizeof(short): present = *(const short *)present_ptr; break; + case sizeof(char): present = *(const char *)present_ptr; break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + return 0; /* If not aborted, pass back safe value */ + } + + return present; +} + +static void +_set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { + void *present_ptr; + present_ptr = ((char *)struct_ptr) + pres_offset; + + switch(pres_size) { + case sizeof(int): *(int *)present_ptr = present; break; + case sizeof(short): *(short *)present_ptr = present; break; + case sizeof(char): *(char *)present_ptr = present; break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + } +} diff --git a/src/core/libs/supl/asn-rrlp/constr_CHOICE.h b/src/core/libs/supl/asn-rrlp/constr_CHOICE.h new file mode 100644 index 000000000..83404e6d4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_CHOICE.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_CHOICE_H_ +#define _CONSTR_CHOICE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct asn_CHOICE_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_codec_ctx_t member */ + int pres_offset; /* Identifier of the present member */ + int pres_size; /* Size of the identifier (enum) */ + + /* + * Tags to members mapping table. + */ + asn_TYPE_tag2member_t *tag2el; + int tag2el_count; + + /* Canonical ordering of CHOICE elements, for PER */ + int *canonical_order; + + /* + * Extensions-related stuff. + */ + int ext_start; /* First member of extensions, or -1 */ +} asn_CHOICE_specifics_t; + +/* + * A set specialized functions dealing with the CHOICE type. + */ +asn_struct_free_f CHOICE_free; +asn_struct_print_f CHOICE_print; +asn_constr_check_f CHOICE_constraint; +ber_type_decoder_f CHOICE_decode_ber; +der_type_encoder_f CHOICE_encode_der; +xer_type_decoder_f CHOICE_decode_xer; +xer_type_encoder_f CHOICE_encode_xer; +per_type_decoder_f CHOICE_decode_uper; +per_type_encoder_f CHOICE_encode_uper; +asn_outmost_tag_f CHOICE_outmost_tag; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_CHOICE_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c new file mode 100644 index 000000000..db3c92581 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c @@ -0,0 +1,1423 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) +#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * Check whether we are inside the extensions group. + */ +#define IN_EXTENSION_GROUP(specs, memb_idx) \ + ( ((memb_idx) > (specs)->ext_after) \ + &&((memb_idx) < (specs)->ext_before)) + + +/* + * Tags are canonically sorted in the tag2element map. + */ +static int +_t2e_cmp(const void *ap, const void *bp) { + const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; + const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; + + int a_class = BER_TAG_CLASS(a->el_tag); + int b_class = BER_TAG_CLASS(b->el_tag); + + if(a_class == b_class) { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + + if(a_value == b_value) { + if(a->el_no > b->el_no) + return 1; + /* + * Important: we do not check + * for a->el_no <= b->el_no! + */ + return 0; + } else if(a_value < b_value) + return -1; + else + return 1; + } else if(a_class < b_class) { + return -1; + } else { + return 1; + } +} + + +/* + * The decoder of the SEQUENCE type. + */ +asn_dec_rval_t +SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* SEQUENCE element's index */ + + ASN_DEBUG("Decoding %s as SEQUENCE", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) + ctx->left += rval.consumed; /* ?Substracted below! */ + ADVANCE(rval.consumed); + + NEXT_PHASE(ctx); + + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); + + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next member from the list of + * this structure's elements. + * (ctx->step) stores the member being processed + * between invocations and the microphase {0,1} of parsing + * that member: + * step = ( * 2 + ). + */ + for(edx = (ctx->step >> 1); edx < td->elements_count; + edx++, ctx->step = (ctx->step & ~1) + 2) { + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + ssize_t tag_len; /* Length of TLV's T */ + int opt_edx_end; /* Next non-optional element */ + int use_bsearch; + int n; + + if(ctx->step & 1) + goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + ASN_DEBUG("In %s SEQUENCE left %d, edx=%d flags=%d" + " opt=%d ec=%d", + td->name, (int)ctx->left, edx, + elements[edx].flags, elements[edx].optional, + td->elements_count); + + if(ctx->left == 0 /* No more stuff is expected */ + && ( + /* Explicit OPTIONAL specification reaches the end */ + (edx + elements[edx].optional + == td->elements_count) + || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before > td->elements_count) + ) + ) { + ASN_DEBUG("End of SEQUENCE %s", td->name); + /* + * Found the legitimate end of the structure. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("Current tag in %s SEQUENCE for element %d " + "(%s) is %s encoded in %d bytes, of frame %ld", + td->name, edx, elements[edx].name, + ber_tlv_tag_string(tlv_tag), (int)tag_len, (long)LEFT); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + ASN_DEBUG("edx = %d, opt = %d, ec=%d", + edx, elements[edx].optional, + td->elements_count); + if((edx + elements[edx].optional + == td->elements_count) + || (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before + > td->elements_count)) { + /* + * Yeah, baby! Found the terminator + * of the indefinite length structure. + */ + /* + * Proceed to the canonical + * finalization function. + * No advancing is necessary. + */ + goto phase3; + } + } + } + + /* + * Find the next available type with this tag. + */ + use_bsearch = 0; + opt_edx_end = edx + elements[edx].optional + 1; + if(opt_edx_end > td->elements_count) + opt_edx_end = td->elements_count; /* Cap */ + else if(opt_edx_end - edx > 8) { + /* Limit the scope of linear search... */ + opt_edx_end = edx + 8; + use_bsearch = 1; + /* ... and resort to bsearch() */ + } + for(n = edx; n < opt_edx_end; n++) { + if(BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) { + /* + * Found element corresponding to the tag + * being looked at. + * Reposition over the right element. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } else if(elements[n].flags & ATF_OPEN_TYPE) { + /* + * This is the ANY type, which may bear + * any flag whatsoever. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } else if(elements[n].tag == (ber_tlv_tag_t)-1) { + use_bsearch = 1; + break; + } + } + if(use_bsearch) { + /* + * Resort to a binary search over + * sorted array of tags. + */ + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + key.el_tag = tlv_tag; + key.el_no = edx; + t2m = (asn_TYPE_tag2member_t *)bsearch(&key, + specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _t2e_cmp); + if(t2m) { + asn_TYPE_tag2member_t *best = 0; + asn_TYPE_tag2member_t *t2m_f, *t2m_l; + int edx_max = edx + elements[edx].optional; + /* + * Rewind to the first element with that tag, + * `cause bsearch() does not guarantee order. + */ + t2m_f = t2m + t2m->toff_first; + t2m_l = t2m + t2m->toff_last; + for(t2m = t2m_f; t2m <= t2m_l; t2m++) { + if(t2m->el_no > edx_max) break; + if(t2m->el_no < edx) continue; + best = t2m; + } + if(best) { + edx = best->el_no; + ctx->step = 1 + 2 * edx; + goto microphase2; + } + } + n = opt_edx_end; + } + if(n == opt_edx_end) { + /* + * If tag is unknown, it may be either + * an unknown (thus, incorrect) tag, + * or an extension (...), + * or an end of the indefinite-length structure. + */ + if(!IN_EXTENSION_GROUP(specs, + edx + elements[edx].optional)) { + ASN_DEBUG("Unexpected tag %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + ASN_DEBUG("Expected tag %s (%s)%s", + ber_tlv_tag_string(elements[edx].tag), + elements[edx].name, + elements[edx].optional + ?" or alternatives":""); + RETURN(RC_FAIL); + } else { + /* Skip this tag */ + ssize_t skip; + edx += elements[edx].optional; + + ASN_DEBUG("Skipping unexpected %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + skip = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + ASN_DEBUG("Skip length %d in %s", + (int)skip, td->name); + switch(skip) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + ctx->step -= 2; + edx--; + continue; /* Try again with the next tag */ + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); + + /* + * Compute the position of the member inside a structure, + * and also a type of containment (it may be contained + * as pointer or using inline inclusion). + */ + if(elements[edx].flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); + } else { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elements[edx].memb_offset; + memb_ptr2 = &memb_ptr; + } + /* + * Invoke the member fetch routine according to member's type + */ + rval = elements[edx].type->ber_decoder(opt_codec_ctx, + elements[edx].type, + memb_ptr2, ptr, LEFT, + elements[edx].tag_mode); + ASN_DEBUG("In %s SEQUENCE decoded %d %s of %d " + "in %d bytes rval.code %d, size=%d", + td->name, edx, elements[edx].type->name, + (int)LEFT, (int)rval.consumed, rval.code, (int)size); + switch(rval.code) { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + ASN_DEBUG("Size violation (c->l=%ld <= s=%ld)", + (long)ctx->left, (long)size); + /* Fall through */ + case RC_FAIL: /* Fatal error */ + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all structure members) */ + + phase3: + ctx->phase = 3; + case 3: /* 00 and other tags expected */ + case 4: /* only 00's expected */ + + ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", + td->name, (long)ctx->left, (long)size); + + /* + * Skip everything until the end of the SEQUENCE. + */ + while(ctx->left) { + ssize_t tl, ll; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tl) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + /* + * If expected <0><0>... + */ + if(ctx->left < 0 + && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + ctx->phase = 4; + continue; + } + } + + if(!IN_EXTENSION_GROUP(specs, td->elements_count) + || ctx->phase == 4) { + ASN_DEBUG("Unexpected continuation " + "of a non-extensible type " + "%s (SEQUENCE): %s", + td->name, + ber_tlv_tag_string(tlv_tag)); + RETURN(RC_FAIL); + } + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tl, LEFT - tl); + switch(ll) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(tl + ll); + } + + PHASE_OUT(ctx); + } + + RETURN(RC_OK); +} + + +/* + * The DER encoder of the SEQUENCE type. + */ +asn_enc_rval_t +SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, + 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; + ssize_t ret; + int edx; + + ASN_DEBUG("%s %s as SEQUENCE", + cb?"Encoding":"Estimating", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, + 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + ASN_DEBUG("Member %d %s estimated %ld bytes", + edx, elm->name, (long)erval.encoded); + } + + /* + * Encode the TLV for the sequence itself. + */ + ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + ASN_DEBUG("Wrote tags: %ld (+%ld)", (long)ret, (long)computed_size); + if(ret == -1) + _ASN_ENCODE_FAILED; + erval.encoded = computed_size + ret; + + if(!cb) _ASN_ENCODED_OK(erval); + + /* + * Encode all members. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmperval; + void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) continue; + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + tmperval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, + cb, app_key); + if(tmperval.encoded == -1) + return tmperval; + computed_size -= tmperval.encoded; + ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", + edx, elm->name, td->name, (long)tmperval.encoded); + } + + if(computed_size != 0) + /* + * Encoded size is not equal to the computed size. + */ + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(erval); +} + + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * ... and parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ + int edx_end; + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + * Phase 3: Skipping unknown extensions. + * Phase 4: PHASED OUT + */ + for(edx = ctx->step; ctx->phase <= 3;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + int n; + + /* + * Go inside the inner member of a sequence. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &td->elements[edx]; + + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Invoke the inner type decoder, m.b. multiple times */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, + elm->type, memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + if(tmprval.code != RC_OK) + RETURN(tmprval.code); + ctx->phase = 1; /* Back to body processing */ + ctx->step = ++edx; + ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", + ctx->phase, ctx->step); + /* Fall through */ + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, + &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", + tcv, ctx->phase, xml_tag); + + /* Skip the extensions section */ + if(ctx->phase == 3) { + switch(xer_skip_unknown(tcv, &ctx->left)) { + case -1: + ctx->phase = 4; + RETURN(RC_FAIL); + case 0: + XER_ADVANCE(ch_size); + continue; + case 1: + XER_ADVANCE(ch_size); + ctx->phase = 1; + continue; + case 2: + ctx->phase = 1; + break; + } + } + + switch(tcv) { + case XCT_CLOSING: + if(ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if(ctx->phase == 0) { + if(edx >= td->elements_count + || + /* Explicit OPTIONAL specs reaches the end */ + (edx + elements[edx].optional + == td->elements_count) + || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before + > td->elements_count) + ) { + XER_ADVANCE(ch_size); + ctx->phase = 4; /* Phase out */ + RETURN(RC_OK); + } else { + ASN_DEBUG("Premature end of XER SEQUENCE"); + RETURN(RC_FAIL); + } + } + /* Fall through */ + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", + tcv, ctx->phase, edx); + if(ctx->phase != 1) { + break; /* Really unexpected */ + } + + if(edx < td->elements_count) { + /* + * Search which member corresponds to this tag. + */ + edx_end = edx + elements[edx].optional + 1; + if(edx_end > td->elements_count) + edx_end = td->elements_count; + for(n = edx; n < edx_end; n++) { + elm = &td->elements[n]; + tcv = xer_check_tag(buf_ptr, + ch_size, elm->name); + switch(tcv) { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx = n; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + n = edx_end; + break; /* Phase out */ + } + break; + } + if(n != edx_end) + continue; + } else { + ASN_DEBUG("Out of defined members: %d/%d", + edx, td->elements_count); + } + + /* It is expected extension */ + if(IN_EXTENSION_GROUP(specs, + edx + (edx < td->elements_count + ? elements[edx].optional : 0))) { + ASN_DEBUG("Got anticipated extension at %d", + edx); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if(tcv & XCT_CLOSING) { + /* Found without body */ + } else { + ctx->left = 1; + ctx->phase = 3; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", + size>0?((const char *)buf_ptr)[0]:'.', + size>1?((const char *)buf_ptr)[1]:'.', + size>2?((const char *)buf_ptr)[2]:'.', + size>3?((const char *)buf_ptr)[3]:'.', + size>4?((const char *)buf_ptr)[4]:'.', + size>5?((const char *)buf_ptr)[5]:'.'); + break; + } + + ctx->phase = 4; /* "Phase out" on hard failure */ + RETURN(RC_FAIL); +} + +asn_enc_rval_t +SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + int xcan = (flags & XER_F_CANONICAL); + int edx; + + if(!sptr) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + for(edx = 0; edx < td->elements_count; edx++) { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + /* Print the member itself */ + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + er.encoded += 5 + (2 * mlen) + tmper.encoded; + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +int +SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + int edx; + int ret; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* Dump preamble */ + if(cb(td->name, strlen(td->name), app_key) < 0 + || cb(" ::= {", 6, app_key) < 0) + return -1; + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) continue; + /* Print line */ + /* Fall through */ + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Indentation */ + _i_INDENT(1); + + /* Print the member's name and stuff */ + if(cb(elm->name, strlen(elm->name), app_key) < 0 + || cb(": ", 2, app_key) < 0) + return -1; + + /* Print the member itself */ + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, + cb, app_key); + if(ret) return ret; + } + + ilevel--; + _i_INDENT(1); + + return (cb("}", 1, app_key) < 0) ? -1 : 0; +} + +void +SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { + int edx; + + if(!td || !sptr) + return; + + ASN_DEBUG("Freeing %s as SEQUENCE", td->name); + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } + } + + if(!contents_only) { + FREEMEM(sptr); + } +} + +int +SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + int edx; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* + * Iterate over structure members and check their validity. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + continue; + _ASN_CTFAIL(app_key, td, sptr, + "%s: mandatory element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + if(elm->memb_constraints) { + int ret = elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if(ret) return ret; + } else { + int ret = elm->type->check_constraints(elm->type, + memb_ptr, ctfailcb, app_key); + if(ret) return ret; + /* + * Cannot inherit it earlier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + } + } + + return 0; +} + +asn_dec_rval_t +SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + void *st = *sptr; /* Target structure. */ + int extpresent; /* Extension additions are present */ + uint8_t *opres; /* Presence of optional root members */ + asn_per_data_t opmd; + asn_dec_rval_t rv; + int edx; + + (void)constraints; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + _ASN_DECODE_FAILED; + + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) _ASN_DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as SEQUENCE (UPER)", td->name); + + /* Handle extensions */ + if(specs->ext_before >= 0) { + extpresent = per_get_few_bits(pd, 1); + if(extpresent < 0) _ASN_DECODE_STARVED; + } else { + extpresent = 0; + } + + /* Prepare a place and read-in the presence bitmap */ + memset(&opmd, 0, sizeof(opmd)); + if(specs->roms_count) { + opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); + if(!opres) _ASN_DECODE_FAILED; + /* Get the presence map */ + if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { + FREEMEM(opres); + _ASN_DECODE_STARVED; + } + opmd.buffer = opres; + opmd.nbits = specs->roms_count; + ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", + td->name, specs->roms_count, *opres); + } else { + opres = 0; + } + + /* + * Get the sequence ROOT elements. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Deal with optionality */ + if(elm->optional) { + int present = per_get_few_bits(&opmd, 1); + ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", + td->name, elm->name, present, + (int)opmd.nboff, (int)opmd.nbits); + if(present == 0) { + /* This element is not present */ + if(elm->default_value) { + /* Fill-in DEFAULT */ + if(elm->default_value(1, memb_ptr2)) { + FREEMEM(opres); + _ASN_DECODE_FAILED; + } + ASN_DEBUG("Filled-in default"); + } + /* The member is just not present */ + continue; + } + /* Fall through */ + } + + /* Fetch the member from the stream */ + ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + ASN_DEBUG("Failed decode %s in %s", + elm->name, td->name); + FREEMEM(opres); + return rv; + } + } + + /* Optionality map is not needed anymore */ + FREEMEM(opres); + + /* + * Deal with extensions. + */ + if(extpresent) { + ssize_t bmlength; + uint8_t *epres; /* Presence of extension members */ + asn_per_data_t epmd; + + bmlength = uper_get_nslength(pd); + if(bmlength < 0) _ASN_DECODE_STARVED; + + ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); + + epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); + if(!epres) _ASN_DECODE_STARVED; + + /* Get the extensions map */ + if(per_get_many_bits(pd, epres, 0, bmlength)) + _ASN_DECODE_STARVED; + + memset(&epmd, 0, sizeof(epmd)); + epmd.buffer = epres; + epmd.nbits = bmlength; + ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", + td->name, bmlength, *epres); + + /* Go over extensions and read them in */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%d is not extension", edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (void *)((char *)st + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + present = per_get_few_bits(&epmd, 1); + if(present <= 0) { + if(present < 0) break; /* No more extensions */ + continue; + } + + ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + FREEMEM(epres); + return rv; + } + } + + /* Skip over overflow extensions which aren't present + * in this system's version of the protocol */ + for(;;) { + ASN_DEBUG("Getting overflow extensions"); + switch(per_get_few_bits(&epmd, 1)) { + case -1: break; + case 0: continue; + default: + if(uper_open_type_skip(opt_codec_ctx, pd)) { + FREEMEM(epres); + _ASN_DECODE_STARVED; + } + } + break; + } + + FREEMEM(epres); + } + + /* Fill DEFAULT members in extensions */ + for(edx = specs->roms_count; edx < specs->roms_count + + specs->aoms_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void **memb_ptr2; /* Pointer to member pointer */ + + if(!elm->default_value) continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + if(*memb_ptr2) continue; + } else { + continue; /* Extensions are all optionals */ + } + + /* Set default value */ + if(elm->default_value(1, memb_ptr2)) { + _ASN_DECODE_FAILED; + } + } + + rv.consumed = 0; + rv.code = RC_OK; + return rv; +} + +static int +SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, + asn_per_outp_t *po1, asn_per_outp_t *po2) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + int exts_present = 0; + int exts_count = 0; + int edx; + + if(specs->ext_before < 0) + return 0; + + /* Find out which extensions are present */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + ASN_DEBUG("checking %s (@%d) present => %d", + elm->type->name, edx, present); + exts_count++; + exts_present += present; + + /* Encode as presence marker */ + if(po1 && per_put_few_bits(po1, present, 1)) + return -1; + /* Encode as open type field */ + if(po2 && present && uper_open_type_put(elm->type, + elm->per_constraints, *memb_ptr2, po2)) + return -1; + + } + + return exts_present ? exts_count : 0; +} + +asn_enc_rval_t +SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int n_extensions; + int edx; + int i; + + (void)constraints; + + if(!sptr) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE (UPER)", td->name); + + + /* + * X.691#18.1 Whether structure is extensible + * and whether to encode extensions + */ + if(specs->ext_before >= 0) { + n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + per_put_few_bits(po, n_extensions ? 1 : 0, 1); + } else { + n_extensions = 0; /* There are no extensions to encode */ + } + + /* Encode a presence bitmap */ + for(i = 0; i < specs->roms_count; i++) { + asn_TYPE_member_t *elm; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + edx = specs->oms[i]; + elm = &td->elements[edx]; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + /* Eliminate default values */ + if(present && elm->default_value + && elm->default_value(0, memb_ptr2) == 1) + present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", + td->name, elm->name, present ? "present" : "absent"); + if(per_put_few_bits(po, present, 1)) + _ASN_ENCODE_FAILED; + } + + /* + * Encode the sequence ROOT elements. + */ + ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); + for(edx = 0; edx < ((specs->ext_after < 0) + ? td->elements_count : specs->ext_before - 1); edx++) { + + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + ASN_DEBUG("About to encode %s", elm->type->name); + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if(!*memb_ptr2) { + ASN_DEBUG("Element %s %d not present", + elm->name, edx); + if(elm->optional) + continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + /* Eliminate default values */ + if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) + continue; + + ASN_DEBUG("Encoding %s->%s", td->name, elm->name); + er = elm->type->uper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if(er.encoded == -1) + return er; + } + + /* No extensions to encode */ + if(!n_extensions) _ASN_ENCODED_OK(er); + + ASN_DEBUG("Length of %d bit-map", n_extensions); + /* #18.8. Write down the presence bit-map length. */ + if(uper_put_nslength(po, n_extensions)) + _ASN_ENCODE_FAILED; + + ASN_DEBUG("Bit-map of %d elements", n_extensions); + /* #18.7. Encoding the extensions presence bit-map. */ + /* TODO: act upon NOTE in #18.7 for canonical PER */ + if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + _ASN_ENCODE_FAILED; + + ASN_DEBUG("Writing %d extensions", n_extensions); + /* #18.9. Encode extensions as open type fields. */ + if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h new file mode 100644 index 000000000..5f589d5c1 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SEQUENCE_H_ +#define _CONSTR_SEQUENCE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct asn_SEQUENCE_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + /* + * Tags to members mapping table (sorted). + */ + asn_TYPE_tag2member_t *tag2el; + int tag2el_count; + + /* + * Optional members of the extensions root (roms) or additions (aoms). + * Meaningful for PER. + */ + int *oms; /* Optional MemberS */ + int roms_count; /* Root optional members count */ + int aoms_count; /* Additions optional members count */ + + /* + * Description of an extensions group. + */ + int ext_after; /* Extensions start after this member */ + int ext_before; /* Extensions stop before this member */ +} asn_SEQUENCE_specifics_t; + + +/* + * A set specialized functions dealing with the SEQUENCE type. + */ +asn_struct_free_f SEQUENCE_free; +asn_struct_print_f SEQUENCE_print; +asn_constr_check_f SEQUENCE_constraint; +ber_type_decoder_f SEQUENCE_decode_ber; +der_type_encoder_f SEQUENCE_encode_der; +xer_type_decoder_f SEQUENCE_decode_xer; +xer_type_encoder_f SEQUENCE_encode_xer; +per_type_decoder_f SEQUENCE_decode_uper; +per_type_encoder_f SEQUENCE_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SEQUENCE_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c new file mode 100644 index 000000000..aa101176d --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c @@ -0,0 +1,208 @@ +/*- + * Copyright (c) 2003, 2004, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * The DER encoder of the SEQUENCE OF type. + */ +asn_enc_rval_t +SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr); + size_t computed_size = 0; + ssize_t encoding_size = 0; + asn_enc_rval_t erval; + int edx; + + ASN_DEBUG("Estimating size of SEQUENCE OF %s", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, + 0, elm->tag, + 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + } + + /* + * Encode the TLV for the sequence itself. + */ + encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, + cb, app_key); + if(encoding_size == -1) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + computed_size += encoding_size; + if(!cb) { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } + + ASN_DEBUG("Encoding members of SEQUENCE OF %s", td->name); + + /* + * Encode all members. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, + 0, elm->tag, + cb, app_key); + if(erval.encoded == -1) + return erval; + encoding_size += erval.encoded; + } + + if(computed_size != (size_t)encoding_size) { + /* + * Encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } else { + erval.encoded = computed_size; + erval.structure_ptr = 0; + erval.failed_type = 0; + } + + return erval; +} + +asn_enc_rval_t +SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, 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_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr); + const char *mname = specs->as_XMLValueList + ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + unsigned int mlen = mname ? strlen(mname) : 0; + int xcan = (flags & XER_F_CANONICAL); + int i; + + if(!sptr) _ASN_ENCODE_FAILED; + + er.encoded = 0; + + for(i = 0; i < list->count; i++) { + asn_enc_rval_t tmper; + void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + if(mname) { + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + } + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + if(tmper.encoded == 0 && specs->as_XMLValueList) { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel + 1); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if(mname) { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +asn_enc_rval_t +SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_anonymous_sequence_ *list; + asn_per_constraint_t *ct; + asn_enc_rval_t er; + asn_TYPE_member_t *elm = td->elements; + int seq; + + if(!sptr) _ASN_ENCODE_FAILED; + list = _A_SEQUENCE_FROM_VOID(sptr); + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count); + + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->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; + } + + for(seq = -1; seq < list->count;) { + ssize_t mayEncode; + if(seq < 0) seq = 0; + if(ct && ct->effective_bits >= 0) { + mayEncode = list->count; + } else { + mayEncode = uper_put_length(po, list->count - seq); + if(mayEncode < 0) _ASN_ENCODE_FAILED; + } + + while(mayEncode--) { + void *memb_ptr = list->array[seq++]; + if(!memb_ptr) _ASN_ENCODE_FAILED; + er = elm->type->uper_encoder(elm->type, + elm->per_constraints, memb_ptr, po); + if(er.encoded == -1) + _ASN_ENCODE_FAILED; + } + } + + _ASN_ENCODED_OK(er); +} + diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.h b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.h new file mode 100644 index 000000000..e2272f326 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SEQUENCE_OF_H_ +#define _CONSTR_SEQUENCE_OF_H_ + +#include +#include /* Implemented using SET OF */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A set specialized functions dealing with the SEQUENCE OF type. + * Generally implemented using SET OF. + */ +#define SEQUENCE_OF_free SET_OF_free +#define SEQUENCE_OF_print SET_OF_print +#define SEQUENCE_OF_constraint SET_OF_constraint +#define SEQUENCE_OF_decode_ber SET_OF_decode_ber +#define SEQUENCE_OF_decode_xer SET_OF_decode_xer +#define SEQUENCE_OF_decode_uper SET_OF_decode_uper +der_type_encoder_f SEQUENCE_OF_encode_der; +xer_type_encoder_f SEQUENCE_OF_encode_xer; +per_type_encoder_f SEQUENCE_OF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SET_OF_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c new file mode 100644 index 000000000..11eac57a2 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c @@ -0,0 +1,953 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) +#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * The decoder of the SET OF type. + */ +asn_dec_rval_t +SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + ASN_DEBUG("Decoding %s as SET OF", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) + ctx->left += rval.consumed; /* ?Substracted below! */ + ADVANCE(rval.consumed); + + ASN_DEBUG("Structure consumes %ld bytes, " + "buffer %ld", (long)ctx->left, (long)size); + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next item. + */ + for(;; ctx->step = 0) { + ssize_t tag_len; /* Length of TLV's T */ + + if(ctx->step & 1) + goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + + if(ctx->left == 0) { + ASN_DEBUG("End of SET OF %s", td->name); + /* + * No more things to decode. + * Exit out of here. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Found the terminator of the + * indefinite length structure. + */ + break; + } + } + + /* Outmost tag may be unknown and cannot be fetched/compared */ + if(elm->tag != (ber_tlv_tag_t)-1) { + if(BER_TAGS_EQUAL(tlv_tag, elm->tag)) { + /* + * The new list member of expected type has arrived. + */ + } else { + ASN_DEBUG("Unexpected tag %s fixed SET OF %s", + ber_tlv_tag_string(tlv_tag), td->name); + ASN_DEBUG("%s SET OF has tag %s", + td->name, ber_tlv_tag_string(elm->tag)); + RETURN(RC_FAIL); + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + + /* + * Invoke the member fetch routine according to member's type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, + elm->type, &ctx->ptr, ptr, LEFT, 0); + ASN_DEBUG("In %s SET OF %s code %d consumed %d", + td->name, elm->type->name, + rval.code, (int)rval.consumed); + switch(rval.code) { + case RC_OK: + { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if(ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + else + ctx->ptr = 0; + } + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + /* Fall through */ + case RC_FAIL: /* Fatal error */ + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all list members) */ + + NEXT_PHASE(ctx); + case 2: + /* + * Read in all "end of content" TLVs. + */ + while(ctx->left < 0) { + if(LEFT < 2) { + if(LEFT > 0 && ((const char *)ptr)[0] != 0) { + /* Unexpected tag */ + RETURN(RC_FAIL); + } else { + RETURN(RC_WMORE); + } + } + if(((const char *)ptr)[0] == 0 + && ((const char *)ptr)[1] == 0) { + ADVANCE(2); + ctx->left++; + } else { + RETURN(RC_FAIL); + } + } + + PHASE_OUT(ctx); + } + + RETURN(RC_OK); +} + +/* + * Internally visible buffer holding a single encoded element. + */ +struct _el_buffer { + uint8_t *buf; + size_t length; + size_t size; +}; +/* Append bytes to the above structure */ +static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) { + struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr; + + if(el_buf->length + size > el_buf->size) + return -1; + + memcpy(el_buf->buf + el_buf->length, buffer, size); + + el_buf->length += size; + return 0; +} +static int _el_buf_cmp(const void *ap, const void *bp) { + const struct _el_buffer *a = (const struct _el_buffer *)ap; + const struct _el_buffer *b = (const struct _el_buffer *)bp; + int ret; + size_t common_len; + + if(a->length < b->length) + common_len = a->length; + else + common_len = b->length; + + ret = memcmp(a->buf, b->buf, common_len); + if(ret == 0) { + if(a->length < b->length) + ret = -1; + else if(a->length > b->length) + ret = 1; + } + + return ret; +} + +/* + * The DER encoder of the SET OF type. + */ +asn_enc_rval_t +SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_TYPE_descriptor_t *elm_type = elm->type; + der_type_encoder_f *der_encoder = elm_type->der_encoder; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + size_t computed_size = 0; + ssize_t encoding_size = 0; + struct _el_buffer *encoded_els; + ssize_t eels_count = 0; + size_t max_encoded_len = 1; + asn_enc_rval_t erval; + int ret; + int edx; + + ASN_DEBUG("Estimating size for SET OF %s", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + + /* Compute maximum encoding's size */ + if(max_encoded_len < (size_t)erval.encoded) + max_encoded_len = erval.encoded; + } + + /* + * Encode the TLV for the sequence itself. + */ + encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, + cb, app_key); + if(encoding_size == -1) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + computed_size += encoding_size; + + if(!cb || list->count == 0) { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } + + /* + * DER mandates dynamic sorting of the SET OF elements + * according to their encodings. Build an array of the + * encoded elements. + */ + encoded_els = (struct _el_buffer *)MALLOC( + list->count * sizeof(encoded_els[0])); + if(encoded_els == NULL) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + ASN_DEBUG("Encoding members of %s SET OF", td->name); + + /* + * Encode all members. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + struct _el_buffer *encoded_el = &encoded_els[eels_count]; + + if(!memb_ptr) continue; + + /* + * Prepare space for encoding. + */ + encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); + if(encoded_el->buf) { + encoded_el->length = 0; + encoded_el->size = max_encoded_len; + } else { + for(edx--; edx >= 0; edx--) + FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + /* + * Encode the member into the prepared space. + */ + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, + _el_addbytes, encoded_el); + if(erval.encoded == -1) { + for(; edx >= 0; edx--) + FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + return erval; + } + encoding_size += erval.encoded; + eels_count++; + } + + /* + * Sort the encoded elements according to their encoding. + */ + qsort(encoded_els, eels_count, sizeof(encoded_els[0]), _el_buf_cmp); + + /* + * Report encoded elements to the application. + * Dispose of temporary sorted members table. + */ + ret = 0; + for(edx = 0; edx < eels_count; edx++) { + struct _el_buffer *encoded_el = &encoded_els[edx]; + /* Report encoded chunks to the application */ + if(ret == 0 + && cb(encoded_el->buf, encoded_el->length, app_key) < 0) + ret = -1; + FREEMEM(encoded_el->buf); + } + FREEMEM(encoded_els); + + if(ret || computed_size != (size_t)encoding_size) { + /* + * Standard callback failed, or + * encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } else { + erval.encoded = computed_size; + } + + _ASN_ENCODED_OK(erval); +} + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *element = td->elements; + const char *elm_tag; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * ... and parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* Which tag is expected for the downstream */ + if(specs->as_XMLValueList) { + elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; + } else { + elm_tag = (*element->name) + ? element->name : element->type->xml_tag; + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + */ + for(; ctx->phase <= 2;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + + /* + * Go inside the inner member of a set. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + + /* Invoke the inner type decoder, m.b. multiple times */ + ASN_DEBUG("XER/SET OF element [%s]", elm_tag); + tmprval = element->type->xer_decoder(opt_codec_ctx, + element->type, &ctx->ptr, elm_tag, + buf_ptr, size); + if(tmprval.code == RC_OK) { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if(ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + ctx->ptr = 0; + XER_ADVANCE(tmprval.consumed); + } else { + XER_ADVANCE(tmprval.consumed); + RETURN(tmprval.code); + } + ctx->phase = 1; /* Back to body processing */ + ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); + /* Fall through */ + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, + buf_ptr, size, &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", + tcv, ctx->phase, xml_tag); + switch(tcv) { + case XCT_CLOSING: + if(ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if(ctx->phase == 0) { + /* No more things to decode */ + XER_ADVANCE(ch_size); + ctx->phase = 3; /* Phase out */ + RETURN(RC_OK); + } + /* Fall through */ + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); + if(ctx->phase == 1) { + /* + * Process a single possible member. + */ + ctx->phase = 2; + continue; + } + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SET OF"); + break; + } + + ctx->phase = 3; /* "Phase out" on hard failure */ + RETURN(RC_FAIL); +} + + + +typedef struct xer_tmp_enc_s { + void *buffer; + size_t offset; + size_t size; +} xer_tmp_enc_t; +static int +SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { + xer_tmp_enc_t *t = (xer_tmp_enc_t *)key; + if(t->offset + size >= t->size) { + size_t newsize = (t->size << 2) + size; + void *p = REALLOC(t->buffer, newsize); + if(!p) return -1; + t->buffer = p; + t->size = newsize; + } + memcpy((char *)t->buffer + t->offset, buffer, size); + t->offset += size; + return 0; +} +static int +SET_OF_xer_order(const void *aptr, const void *bptr) { + const xer_tmp_enc_t *a = (const xer_tmp_enc_t *)aptr; + const xer_tmp_enc_t *b = (const xer_tmp_enc_t *)bptr; + size_t minlen = a->offset; + int ret; + if(b->offset < minlen) minlen = b->offset; + /* Well-formed UTF-8 has this nice lexicographical property... */ + ret = memcmp(a->buffer, b->buffer, minlen); + if(ret != 0) return ret; + if(a->offset == b->offset) + return 0; + if(a->offset == minlen) + return -1; + return 1; +} + + +asn_enc_rval_t +SET_OF_encode_xer(asn_TYPE_descriptor_t *td, 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_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr); + const char *mname = specs->as_XMLValueList + ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + size_t mlen = mname ? strlen(mname) : 0; + int xcan = (flags & XER_F_CANONICAL); + xer_tmp_enc_t *encs = 0; + size_t encs_count = 0; + void *original_app_key = app_key; + asn_app_consume_bytes_f *original_cb = cb; + int i; + + if(!sptr) _ASN_ENCODE_FAILED; + + if(xcan) { + encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); + if(!encs) _ASN_ENCODE_FAILED; + cb = SET_OF_encode_xer_callback; + } + + er.encoded = 0; + + for(i = 0; i < list->count; i++) { + asn_enc_rval_t tmper; + + void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + if(encs) { + memset(&encs[encs_count], 0, sizeof(encs[0])); + app_key = &encs[encs_count]; + encs_count++; + } + + if(mname) { + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + } + + if(!xcan && specs->as_XMLValueList == 1) + _i_ASN_TEXT_INDENT(1, ilevel + 1); + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + (specs->as_XMLValueList != 2), + flags, cb, app_key); + if(tmper.encoded == -1) { + td = tmper.failed_type; + sptr = tmper.structure_ptr; + goto cb_failed; + } + if(tmper.encoded == 0 && specs->as_XMLValueList) { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if(mname) { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + if(encs) { + xer_tmp_enc_t *enc = encs; + xer_tmp_enc_t *end = encs + encs_count; + ssize_t control_size = 0; + + cb = original_cb; + app_key = original_app_key; + qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); + + for(; enc < end; enc++) { + _ASN_CALLBACK(enc->buffer, enc->offset); + FREEMEM(enc->buffer); + enc->buffer = 0; + control_size += enc->offset; + } + assert(control_size == er.encoded); + } + + goto cleanup; +cb_failed: + er.encoded = -1; + er.failed_type = td; + er.structure_ptr = sptr; +cleanup: + if(encs) { + while(encs_count-- > 0) { + if(encs[encs_count].buffer) + FREEMEM(encs[encs_count].buffer); + } + FREEMEM(encs); + } + _ASN_ENCODED_OK(er); +} + +int +SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); + int ret; + int i; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* Dump preamble */ + if(cb(td->name, strlen(td->name), app_key) < 0 + || cb(" ::= {", 6, app_key) < 0) + return -1; + + for(i = 0; i < list->count; i++) { + const void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + _i_INDENT(1); + + ret = elm->type->print_struct(elm->type, memb_ptr, + ilevel + 1, cb, app_key); + if(ret) return ret; + } + + ilevel--; + _i_INDENT(1); + + return (cb("}", 1, app_key) < 0) ? -1 : 0; +} + +void +SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + if(td && ptr) { + asn_SET_OF_specifics_t *specs; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + asn_struct_ctx_t *ctx; /* Decoder context */ + int i; + + /* + * Could not use set_of_empty() because of (*free) + * incompatibility. + */ + for(i = 0; i < list->count; i++) { + void *memb_ptr = list->array[i]; + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + list->count = 0; /* No meaningful elements left */ + + asn_set_empty(list); /* Remove (list->array) */ + + specs = (asn_SET_OF_specifics_t *)td->specifics; + ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); + if(ctx->ptr) { + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + } + + if(!contents_only) { + FREEMEM(ptr); + } + } +} + +int +SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_constr_check_f *constr; + const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); + int i; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + constr = elm->memb_constraints; + if(!constr) constr = elm->type->check_constraints; + + /* + * Iterate over the members of an array. + * Validate each in turn, until one fails. + */ + for(i = 0; i < list->count; i++) { + const void *memb_ptr = list->array[i]; + int ret; + + if(!memb_ptr) continue; + + ret = constr(elm->type, memb_ptr, ctfailcb, app_key); + if(ret) return ret; + } + + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + if(!elm->memb_constraints) + elm->memb_constraints = elm->type->check_constraints; + + return 0; +} + +asn_dec_rval_t +SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + void *st = *sptr; + asn_anonymous_set_ *list; + asn_per_constraint_t *ct; + int repeat = 0; + ssize_t nelems; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + _ASN_DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) _ASN_DECODE_FAILED; + } + list = _A_SET_FROM_VOID(st); + + /* Figure out which constraints to use */ + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->per_constraints->size; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int value = per_get_few_bits(pd, 1); + if(value < 0) _ASN_DECODE_STARVED; + if(value) ct = 0; /* Not restricted! */ + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ + nelems = per_get_few_bits(pd, ct->effective_bits); + ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", + (long)nelems, ct->lower_bound, td->name); + if(nelems < 0) _ASN_DECODE_STARVED; + nelems += ct->lower_bound; + } else { + nelems = -1; + } + + do { + int i; + if(nelems < 0) { + nelems = uper_get_length(pd, + ct ? ct->effective_bits : -1, &repeat); + ASN_DEBUG("Got to decode %d elements (eff %d)", + (int)nelems, (int)ct ? ct->effective_bits : -1); + if(nelems < 0) _ASN_DECODE_STARVED; + } + + for(i = 0; i < nelems; i++) { + void *ptr = 0; + ASN_DEBUG("SET OF %s decoding", elm->type->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, &ptr, pd); + ASN_DEBUG("%s SET OF %s decoded %d, %p", + td->name, elm->type->name, rv.code, ptr); + if(rv.code == RC_OK) { + if(ASN_SET_ADD(list, ptr) == 0) + continue; + ASN_DEBUG("Failed to add element into %s", + td->name); + /* Fall through */ + rv.code = RC_FAIL; + } else { + ASN_DEBUG("Failed decoding %s of %s (SET OF)", + elm->type->name, td->name); + } + if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); + return rv; + } + + nelems = -1; /* Allow uper_get_length() */ + } while(repeat); + + ASN_DEBUG("Decoded %s as SET OF", td->name); + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + diff --git a/src/core/libs/supl/asn-rrlp/constr_SET_OF.h b/src/core/libs/supl/asn-rrlp/constr_SET_OF.h new file mode 100644 index 000000000..bcd096629 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_SET_OF.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SET_OF_H_ +#define _CONSTR_SET_OF_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct asn_SET_OF_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + /* XER-specific stuff */ + int as_XMLValueList; /* The member type must be encoded like this */ +} asn_SET_OF_specifics_t; + +/* + * A set specialized functions dealing with the SET OF type. + */ +asn_struct_free_f SET_OF_free; +asn_struct_print_f SET_OF_print; +asn_constr_check_f SET_OF_constraint; +ber_type_decoder_f SET_OF_decode_ber; +der_type_encoder_f SET_OF_encode_der; +xer_type_decoder_f SET_OF_decode_xer; +xer_type_encoder_f SET_OF_encode_xer; +per_type_decoder_f SET_OF_decode_uper; +per_type_encoder_f SET_OF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SET_OF_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/constr_TYPE.c b/src/core/libs/supl/asn-rrlp/constr_TYPE.c new file mode 100644 index 000000000..4bc88d44f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_TYPE.c @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Version of the ASN.1 infrastructure shipped with compiler. + */ +int get_asn1c_environment_version() { return ASN1C_ENVIRONMENT_VERSION; } + +static asn_app_consume_bytes_f _print2fp; + +/* + * Return the outmost tag of the type. + */ +ber_tlv_tag_t +asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag) { + + if(tag_mode) + return tag; + + if(type_descriptor->tags_count) + return type_descriptor->tags[0]; + + return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0); +} + +/* + * Print the target language's structure in human readable form. + */ +int +asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) { + if(!stream) stream = stdout; + if(!td || !struct_ptr) { + errno = EINVAL; + return -1; + } + + /* Invoke type-specific printer */ + if(td->print_struct(td, struct_ptr, 1, _print2fp, stream)) + return -1; + + /* Terminate the output */ + if(_print2fp("\n", 1, stream)) + return -1; + + return fflush(stream); +} + +/* Dump the data into the specified stdio stream */ +static int +_print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + + +/* + * Some compilers do not support variable args macros. + * This function is a replacement of ASN_DEBUG() macro. + */ +void ASN_DEBUG_f(const char *fmt, ...); +void ASN_DEBUG_f(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} diff --git a/src/core/libs/supl/asn-rrlp/constr_TYPE.h b/src/core/libs/supl/asn-rrlp/constr_TYPE.h new file mode 100644 index 000000000..95507c809 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constr_TYPE.h @@ -0,0 +1,180 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This file contains the declaration structure called "ASN.1 Type Definition", + * which holds all information necessary for encoding and decoding routines. + * This structure even contains pointer to these encoding and decoding routines + * for each defined ASN.1 type. + */ +#ifndef _CONSTR_TYPE_H_ +#define _CONSTR_TYPE_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ +struct asn_TYPE_member_s; /* Forward declaration */ + +/* + * This type provides the context information for various ASN.1 routines, + * primarily ones doing decoding. A member _asn_ctx of this type must be + * included into certain target language's structures, such as compound types. + */ +typedef struct asn_struct_ctx_s { + short phase; /* Decoding phase */ + short step; /* Elementary step of a phase */ + int context; /* Other context information */ + void *ptr; /* Decoder-specific stuff (stack elements) */ + ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */ +} asn_struct_ctx_t; + +#include /* Basic Encoding Rules decoder */ +#include /* Distinguished Encoding Rules encoder */ +#include /* Decoder of XER (XML, text) */ +#include /* Encoder into XER (XML, text) */ +#include /* Packet Encoding Rules decoder */ +#include /* Packet Encoding Rules encoder */ +#include /* Subtype constraints support */ + +/* + * Free the structure according to its specification. + * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) + * will not be freed. (It may be useful in case the structure is allocated + * statically or arranged on the stack, yet its elements are allocated + * dynamically.) + */ +typedef void (asn_struct_free_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, int free_contents_only); +#define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF),ptr,0) +#define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ + (asn_DEF).free_struct(&(asn_DEF),ptr,1) + +/* + * Print the structure according to its specification. + */ +typedef int (asn_struct_print_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, + int level, /* Indentation level */ + asn_app_consume_bytes_f *callback, void *app_key); + +/* + * Return the outmost tag of the type. + * If the type is untagged CHOICE, the dynamic operation is performed. + * NOTE: This function pointer type is only useful internally. + * Do not use it in your application. + */ +typedef ber_tlv_tag_t (asn_outmost_tag_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); +/* The instance of the above function type; used internally. */ +asn_outmost_tag_f asn_TYPE_outmost_tag; + + +/* + * The definitive description of the destination language's structure. + */ +typedef struct asn_TYPE_descriptor_s { + char *name; /* A name of the ASN.1 type. "" in some cases. */ + char *xml_tag; /* Name used in XML tag */ + + /* + * Generalized functions for dealing with the specific type. + * May be directly invoked by applications. + */ + asn_struct_free_f *free_struct; /* Free the structure */ + asn_struct_print_f *print_struct; /* Human readable output */ + asn_constr_check_f *check_constraints; /* Constraints validator */ + ber_type_decoder_f *ber_decoder; /* Generic BER decoder */ + der_type_encoder_f *der_encoder; /* Canonical DER encoder */ + xer_type_decoder_f *xer_decoder; /* Generic XER decoder */ + xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */ + per_type_decoder_f *uper_decoder; /* Unaligned PER decoder */ + per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ + + /*********************************************************************** + * Internally useful members. Not to be used by applications directly. * + **********************************************************************/ + + /* + * Tags that are expected to occur. + */ + asn_outmost_tag_f *outmost_tag; /* */ + ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ + int tags_count; /* Number of tags which are expected */ + ber_tlv_tag_t *all_tags;/* Every tag for BER/containment */ + int all_tags_count; /* Number of tags */ + + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + + /* + * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). + */ + struct asn_TYPE_member_s *elements; + int elements_count; + + /* + * Additional information describing the type, used by appropriate + * functions above. + */ + void *specifics; +} asn_TYPE_descriptor_t; + +/* + * This type describes an element of the constructed type, + * i.e. SEQUENCE, SET, CHOICE, etc. + */ + enum asn_TYPE_flags_e { + ATF_NOFLAGS, + ATF_POINTER = 0x01, /* Represented by the pointer */ + ATF_OPEN_TYPE = 0x02 /* ANY type, without meaningful tag */ + }; +typedef struct asn_TYPE_member_s { + enum asn_TYPE_flags_e flags; /* Element's presentation flags */ + int optional; /* Following optional members, including current */ + int memb_offset; /* Offset of the element */ + ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ + int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_constr_check_f *memb_constraints; /* Constraints validator */ + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + int (*default_value)(int setval, void **sptr); /* DEFAULT */ + char *name; /* ASN.1 identifier of the element */ +} asn_TYPE_member_t; + +/* + * BER tag to element number mapping. + */ +typedef struct asn_TYPE_tag2member_s { + ber_tlv_tag_t el_tag; /* Outmost tag of the member */ + int 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, relatvie */ +} asn_TYPE_tag2member_t; + +/* + * This function is a wrapper around (td)->print_struct, which prints out + * the contents of the target language's structure (struct_ptr) into the + * file pointer (stream) in human readable form. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem dumping the structure. + * (See also xer_fprint() in xer_encoder.h) + */ +int asn_fprint(FILE *stream, /* Destination stream descriptor */ + asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ + const void *struct_ptr); /* Structure to be printed */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_TYPE_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/constraints.c b/src/core/libs/supl/asn-rrlp/constraints.c new file mode 100644 index 000000000..1bdda73e5 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constraints.c @@ -0,0 +1,93 @@ +#include "asn_internal.h" +#include "constraints.h" + +int +asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { + + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ + + /* Nothing to check */ + return 0; +} + +int +asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { + + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ + + /* Unknown how to check */ + return 0; +} + +struct errbufDesc { + asn_TYPE_descriptor_t *failed_type; + const void *failed_struct_ptr; + char *errbuf; + size_t errlen; +}; + +static void +_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { + struct errbufDesc *arg = key; + va_list ap; + ssize_t vlen; + ssize_t maxlen; + + arg->failed_type = td; + arg->failed_struct_ptr = sptr; + + maxlen = arg->errlen; + if(maxlen <= 0) + return; + + va_start(ap, fmt); + vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); + va_end(ap); + if(vlen >= maxlen) { + arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ + arg->errlen = maxlen - 1; /* Not counting termination */ + return; + } else if(vlen >= 0) { + arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ + arg->errlen = vlen; /* Not counting termination */ + } else { + /* + * The libc on this system is broken. + */ + vlen = sizeof("") - 1; + maxlen--; + arg->errlen = vlen < maxlen ? vlen : maxlen; + memcpy(arg->errbuf, "", arg->errlen); + arg->errbuf[arg->errlen] = 0; + } + + return; +} + +int +asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, char *errbuf, size_t *errlen) { + struct errbufDesc arg; + int ret; + + arg.failed_type = 0; + arg.failed_struct_ptr = 0; + arg.errbuf = errbuf; + arg.errlen = errlen ? *errlen : 0; + + ret = type_descriptor->check_constraints(type_descriptor, + struct_ptr, _asn_i_ctfailcb, &arg); + if(ret == -1 && errlen) + *errlen = arg.errlen; + + return ret; +} + diff --git a/src/core/libs/supl/asn-rrlp/constraints.h b/src/core/libs/supl/asn-rrlp/constraints.h new file mode 100644 index 000000000..5032345ee --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/constraints.h @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ASN1_CONSTRAINTS_VALIDATOR_H_ +#define _ASN1_CONSTRAINTS_VALIDATOR_H_ + +#include /* Platform-dependent types */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Validate the structure according to the ASN.1 constraints. + * If errbuf and errlen are given, they shall be pointing to the appropriate + * buffer space and its length before calling this function. Alternatively, + * they could be passed as NULL's. If constraints validation fails, + * errlen will contain the actual number of bytes taken from the errbuf + * to encode an error message (properly 0-terminated). + * + * RETURN VALUES: + * This function returns 0 in case all ASN.1 constraints are met + * and -1 if one or more constraints were failed. + */ +int +asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, /* Target language's structure */ + char *errbuf, /* Returned error description */ + size_t *errlen /* Length of the error description */ + ); + + +/* + * Generic type for constraint checking callback, + * associated with every type descriptor. + */ +typedef int (asn_constr_check_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *optional_callback, /* Log the error */ + void *optional_app_key /* Opaque key passed to a callback */ + ); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ +asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ + +/* + * Invoke the callback with a complete error message. + */ +#define _ASN_CTFAIL if(ctfailcb) ctfailcb + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN1_CONSTRAINTS_VALIDATOR_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/converter-sample.c b/src/core/libs/supl/asn-rrlp/converter-sample.c new file mode 100644 index 000000000..0a682a275 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/converter-sample.c @@ -0,0 +1,834 @@ +/* + * Generic converter template for a selected ASN.1 type. + * Copyright (c) 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * + * To compile with your own ASN.1 type, please redefine the PDU as shown: + * + * cc -DPDU=MyCustomType -o myDecoder.o -c converter-sample.c + */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include /* for atoi(3) */ +#include /* for getopt(3) */ +#include /* for strerror(3) */ +#include /* for EX_* exit codes */ +#include /* for errno */ + +#include +#include /* for _ASN_DEFAULT_STACK_MAX */ + +/* Convert "Type" defined by -DPDU into "asn_DEF_Type" */ +#define ASN_DEF_PDU(t) asn_DEF_ ## t +#define DEF_PDU_Type(t) ASN_DEF_PDU(t) +#define PDU_Type DEF_PDU_Type(PDU) + +extern asn_TYPE_descriptor_t PDU_Type; /* ASN.1 type to be decoded */ +#ifdef ASN_PDU_COLLECTION /* Generated by asn1c: -pdu=... */ +extern asn_TYPE_descriptor_t *asn_pdu_collection[]; +#endif + +/* + * Open file and parse its contens. + */ +static void *data_decode_from_file(asn_TYPE_descriptor_t *asnTypeOfPDU, + FILE *file, const char *name, ssize_t suggested_bufsize, int first_pdu); +static int write_out(const void *buffer, size_t size, void *key); +static FILE *argument_to_file(char *av[], int idx); +static char *argument_to_name(char *av[], int idx); + + int opt_debug; /* -d (or -dd) */ +static int opt_check; /* -c (constraints checking) */ +static int opt_stack; /* -s (maximum stack size) */ +static int opt_nopad; /* -per-nopad (PER input is not padded) */ +static int opt_onepdu; /* -1 (decode single PDU) */ + +/* Input data format selector */ +static enum input_format { + INP_BER, /* -iber: BER input */ + INP_XER, /* -ixer: XER input */ + INP_PER /* -iper: Unaligned PER input */ +} iform; /* -i */ + +/* Output data format selector */ +static enum output_format { + OUT_XER, /* -oxer: XER (XML) output */ + OUT_DER, /* -oder: DER (BER) output */ + OUT_PER, /* -oper: Unaligned PER output */ + OUT_TEXT, /* -otext: semi-structured text */ + OUT_NULL /* -onull: No pretty-printing */ +} oform; /* -o */ + +#ifdef JUNKTEST /* Enable -J */ +#define JUNKOPT "J:" +static double opt_jprob; /* Junk bit probability */ +static int junk_failures; +static void junk_bytes_with_probability(uint8_t *, size_t, double prob); +#else +#define JUNKOPT +#endif + +/* Debug output function */ +static inline void +DEBUG(const char *fmt, ...) { + va_list ap; + if(!opt_debug) return; + fprintf(stderr, "AD: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +int +main(int ac, char *av[]) { + static asn_TYPE_descriptor_t *pduType = &PDU_Type; + ssize_t suggested_bufsize = 8192; /* close or equal to stdio buffer */ + int number_of_iterations = 1; + int num; + int ch; + + /* Figure out if Unaligned PER needs to be default */ + if(pduType->uper_decoder) + iform = INP_PER; + + /* + * Pocess the command-line argments. + */ + while((ch = getopt(ac, av, "i:o:1b:cdn:p:hs:" JUNKOPT)) != -1) + switch(ch) { + case 'i': + if(optarg[0] == 'b') { iform = INP_BER; break; } + if(optarg[0] == 'x') { iform = INP_XER; break; } + if(pduType->uper_decoder + && optarg[0] == 'p') { iform = INP_PER; break; } + fprintf(stderr, "-i: '%s': improper format selector\n", + optarg); + exit(EX_UNAVAILABLE); + case 'o': + if(optarg[0] == 'd') { oform = OUT_DER; break; } + if(pduType->uper_encoder + && optarg[0] == 'p') { oform = OUT_PER; break; } + if(optarg[0] == 'x') { oform = OUT_XER; break; } + if(optarg[0] == 't') { oform = OUT_TEXT; break; } + if(optarg[0] == 'n') { oform = OUT_NULL; break; } + fprintf(stderr, "-o: '%s': improper format selector\n", + optarg); + exit(EX_UNAVAILABLE); + case '1': + opt_onepdu = 1; + break; + case 'b': + suggested_bufsize = atoi(optarg); + if(suggested_bufsize < 1 + || suggested_bufsize > 16 * 1024 * 1024) { + fprintf(stderr, + "-b %s: Improper buffer size (1..16M)\n", + optarg); + exit(EX_UNAVAILABLE); + } + break; + case 'c': + opt_check = 1; + break; + case 'd': + opt_debug++; /* Double -dd means ASN.1 debug */ + break; + case 'n': + number_of_iterations = atoi(optarg); + if(number_of_iterations < 1) { + fprintf(stderr, + "-n %s: Improper iterations count\n", optarg); + exit(EX_UNAVAILABLE); + } + break; + case 'p': + if(strcmp(optarg, "er-nopad") == 0) { + opt_nopad = 1; + break; + } +#ifdef ASN_PDU_COLLECTION + if(strcmp(optarg, "list") == 0) { + asn_TYPE_descriptor_t **pdu = asn_pdu_collection; + fprintf(stderr, "Available PDU types:\n"); + for(; *pdu; pdu++) printf("%s\n", (*pdu)->name); + exit(0); + } else if(optarg[0] >= 'A' && optarg[0] <= 'Z') { + asn_TYPE_descriptor_t **pdu = asn_pdu_collection; + while(*pdu && strcmp((*pdu)->name, optarg)) pdu++; + if(*pdu) { pduType = *pdu; break; } + fprintf(stderr, "-p %s: Unrecognized PDU\n", optarg); + } +#endif /* ASN_PDU_COLLECTION */ + fprintf(stderr, "-p %s: Unrecognized option\n", optarg); + exit(EX_UNAVAILABLE); + case 's': + opt_stack = atoi(optarg); + if(opt_stack < 0) { + fprintf(stderr, + "-s %s: Non-negative value expected\n", + optarg); + exit(EX_UNAVAILABLE); + } + break; +#ifdef JUNKTEST + case 'J': + opt_jprob = strtod(optarg, 0); + if(opt_jprob <= 0.0 || opt_jprob > 1.0) { + fprintf(stderr, + "-J %s: Probability range 0..1 expected \n", + optarg); + exit(EX_UNAVAILABLE); + } + break; +#endif /* JUNKTEST */ + case 'h': + default: +#ifdef ASN_CONVERTER_TITLE +#define _AXS(x) #x +#define _ASX(x) _AXS(x) + fprintf(stderr, "%s\n", _ASX(ASN_CONVERTER_TITLE)); +#endif + fprintf(stderr, "Usage: %s [options] ...\n", av[0]); + fprintf(stderr, "Where options are:\n"); + if(pduType->uper_decoder) + fprintf(stderr, + " -iper Input is in Unaligned PER (Packed Encoding Rules) (DEFAULT)\n"); + fprintf(stderr, + " -iber Input is in BER (Basic Encoding Rules)%s\n", + iform == INP_PER ? "" : " (DEFAULT)"); + fprintf(stderr, + " -ixer Input is in XER (XML Encoding Rules)\n"); + if(pduType->uper_encoder) + fprintf(stderr, + " -oper Output in Unaligned PER (Packed Encoding Rules)\n"); + fprintf(stderr, + " -oder Output in DER (Distinguished Encoding Rules)\n" + " -oxer Output in XER (XML Encoding Rules) (DEFAULT)\n" + " -otext Output in plain semi-structured text (dump)\n" + " -onull Verify (decode) input, but do not output\n"); + if(pduType->uper_decoder) + fprintf(stderr, + " -per-nopad Assume PER PDUs are not padded (-iper)\n"); +#ifdef ASN_PDU_COLLECTION + fprintf(stderr, + " -p Specify PDU type to decode\n" + " -p list List available PDUs\n"); +#endif /* ASN_PDU_COLLECTION */ + fprintf(stderr, + " -1 Decode only the first PDU in file\n" + " -b Set the i/o buffer size (default is %ld)\n" + " -c Check ASN.1 constraints after decoding\n" + " -d Enable debugging (-dd is even better)\n" + " -n Process files times\n" + " -s Set the stack usage limit (default is %d)\n" +#ifdef JUNKTEST + " -J Set random junk test bit garbaging probability\n" +#endif + , (long)suggested_bufsize, _ASN_DEFAULT_STACK_MAX); + exit(EX_USAGE); + } + + ac -= optind; + av += optind; + + if(ac < 1) { + fprintf(stderr, "%s: No input files specified. " + "Try '-h' for more information\n", + av[-optind]); + exit(EX_USAGE); + } + + setvbuf(stdout, 0, _IOLBF, 0); + + for(num = 0; num < number_of_iterations; num++) { + int ac_i; + /* + * Process all files in turn. + */ + for(ac_i = 0; ac_i < ac; ac_i++) { + asn_enc_rval_t erv; + void *structure; /* Decoded structure */ + FILE *file = argument_to_file(av, ac_i); + char *name = argument_to_name(av, ac_i); + int first_pdu; + + for(first_pdu = 1; first_pdu || !opt_onepdu; first_pdu = 0) { + /* + * Decode the encoded structure from file. + */ + structure = data_decode_from_file(pduType, + file, name, suggested_bufsize, first_pdu); + if(!structure) { + if(errno) { + /* Error message is already printed */ + exit(EX_DATAERR); + } else { + /* EOF */ + break; + } + } + + /* Check ASN.1 constraints */ + if(opt_check) { + char errbuf[128]; + size_t errlen = sizeof(errbuf); + if(asn_check_constraints(pduType, structure, + errbuf, &errlen)) { + fprintf(stderr, "%s: ASN.1 constraint " + "check failed: %s\n", name, errbuf); + exit(EX_DATAERR); + } + } + + switch(oform) { + case OUT_NULL: +#ifdef JUNKTEST + if(opt_jprob == 0.0) +#endif + fprintf(stderr, "%s: decoded successfully\n", name); + break; + case OUT_TEXT: /* -otext */ + asn_fprint(stdout, pduType, structure); + break; + case OUT_XER: /* -oxer */ + if(xer_fprint(stdout, pduType, structure)) { + fprintf(stderr, + "%s: Cannot convert %s into XML\n", + name, pduType->name); + exit(EX_UNAVAILABLE); + } + break; + case OUT_DER: + erv = der_encode(pduType, structure, write_out, stdout); + if(erv.encoded < 0) { + fprintf(stderr, + "%s: Cannot convert %s into DER\n", + name, pduType->name); + exit(EX_UNAVAILABLE); + } + DEBUG("Encoded in %ld bytes of DER", (long)erv.encoded); + break; + case OUT_PER: + erv = uper_encode(pduType, structure, write_out, stdout); + if(erv.encoded < 0) { + fprintf(stderr, + "%s: Cannot convert %s into Unaligned PER\n", + name, pduType->name); + exit(EX_UNAVAILABLE); + } + DEBUG("Encoded in %ld bits of UPER", (long)erv.encoded); + break; + } + + ASN_STRUCT_FREE(*pduType, structure); + } + + if(file && file != stdin) + fclose(file); + } + } + +#ifdef JUNKTEST + if(opt_jprob > 0.0) { + fprintf(stderr, "Junked %f OK (%d/%d)\n", + opt_jprob, junk_failures, number_of_iterations); + } +#endif /* JUNKTEST */ + + return 0; +} + +static struct dynamic_buffer { + uint8_t *data; /* Pointer to the data bytes */ + size_t offset; /* Offset from the start */ + size_t length; /* Length of meaningful contents */ + size_t unbits; /* Unused bits in the last byte */ + size_t allocated; /* Allocated memory for data */ + int nreallocs; /* Number of data reallocations */ + off_t bytes_shifted; /* Number of bytes ever shifted */ +} DynamicBuffer; + +static void +buffer_dump() { + uint8_t *p = DynamicBuffer.data + DynamicBuffer.offset; + uint8_t *e = p + DynamicBuffer.length - (DynamicBuffer.unbits ? 1 : 0); + if(!opt_debug) return; + DEBUG("Buffer: { d=%p, o=%ld, l=%ld, u=%ld, a=%ld, s=%ld }", + DynamicBuffer.data, + (long)DynamicBuffer.offset, + (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.allocated, + (long)DynamicBuffer.bytes_shifted); + for(; p < e; p++) { + fprintf(stderr, " %c%c%c%c%c%c%c%c", + ((*p >> 7) & 1) ? '1' : '0', + ((*p >> 6) & 1) ? '1' : '0', + ((*p >> 5) & 1) ? '1' : '0', + ((*p >> 4) & 1) ? '1' : '0', + ((*p >> 3) & 1) ? '1' : '0', + ((*p >> 2) & 1) ? '1' : '0', + ((*p >> 1) & 1) ? '1' : '0', + ((*p >> 0) & 1) ? '1' : '0'); + } + if(DynamicBuffer.unbits) { + unsigned int shift; + fprintf(stderr, " "); + for(shift = 7; shift >= DynamicBuffer.unbits; shift--) + fprintf(stderr, "%c", ((*p >> shift) & 1) ? '1' : '0'); + fprintf(stderr, " %ld:%ld\n", + (long)DynamicBuffer.length - 1, + (long)8 - DynamicBuffer.unbits); + } else { + fprintf(stderr, " %d\n", DynamicBuffer.length); + } +} + +/* + * Move the buffer content left N bits, possibly joining it with + * preceeding content. + */ +static void +buffer_shift_left(size_t offset, int bits) { + uint8_t *ptr = DynamicBuffer.data + DynamicBuffer.offset + offset; + uint8_t *end = DynamicBuffer.data + DynamicBuffer.offset + + DynamicBuffer.length - 1; + + if(!bits) return; + + DEBUG("Shifting left %d bits off %ld (o=%ld, u=%ld, l=%ld)", + bits, (long)offset, + (long)DynamicBuffer.offset, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.length); + + if(offset) { + int right; + right = ptr[0] >> (8 - bits); + + DEBUG("oleft: %c%c%c%c%c%c%c%c", + ((ptr[-1] >> 7) & 1) ? '1' : '0', + ((ptr[-1] >> 6) & 1) ? '1' : '0', + ((ptr[-1] >> 5) & 1) ? '1' : '0', + ((ptr[-1] >> 4) & 1) ? '1' : '0', + ((ptr[-1] >> 3) & 1) ? '1' : '0', + ((ptr[-1] >> 2) & 1) ? '1' : '0', + ((ptr[-1] >> 1) & 1) ? '1' : '0', + ((ptr[-1] >> 0) & 1) ? '1' : '0'); + + DEBUG("oriht: %c%c%c%c%c%c%c%c", + ((ptr[0] >> 7) & 1) ? '1' : '0', + ((ptr[0] >> 6) & 1) ? '1' : '0', + ((ptr[0] >> 5) & 1) ? '1' : '0', + ((ptr[0] >> 4) & 1) ? '1' : '0', + ((ptr[0] >> 3) & 1) ? '1' : '0', + ((ptr[0] >> 2) & 1) ? '1' : '0', + ((ptr[0] >> 1) & 1) ? '1' : '0', + ((ptr[0] >> 0) & 1) ? '1' : '0'); + + DEBUG("mriht: %c%c%c%c%c%c%c%c", + ((right >> 7) & 1) ? '1' : '0', + ((right >> 6) & 1) ? '1' : '0', + ((right >> 5) & 1) ? '1' : '0', + ((right >> 4) & 1) ? '1' : '0', + ((right >> 3) & 1) ? '1' : '0', + ((right >> 2) & 1) ? '1' : '0', + ((right >> 1) & 1) ? '1' : '0', + ((right >> 0) & 1) ? '1' : '0'); + + ptr[-1] = (ptr[-1] & (0xff << bits)) | right; + + DEBUG("after: %c%c%c%c%c%c%c%c", + ((ptr[-1] >> 7) & 1) ? '1' : '0', + ((ptr[-1] >> 6) & 1) ? '1' : '0', + ((ptr[-1] >> 5) & 1) ? '1' : '0', + ((ptr[-1] >> 4) & 1) ? '1' : '0', + ((ptr[-1] >> 3) & 1) ? '1' : '0', + ((ptr[-1] >> 2) & 1) ? '1' : '0', + ((ptr[-1] >> 1) & 1) ? '1' : '0', + ((ptr[-1] >> 0) & 1) ? '1' : '0'); + } + + buffer_dump(); + + for(; ptr < end; ptr++) { + int right = ptr[1] >> (8 - bits); + *ptr = (*ptr << bits) | right; + } + *ptr <<= bits; + + DEBUG("Unbits [%d=>", (int)DynamicBuffer.unbits); + if(DynamicBuffer.unbits == 0) { + DynamicBuffer.unbits += bits; + } else { + DynamicBuffer.unbits += bits; + if(DynamicBuffer.unbits > 7) { + DynamicBuffer.unbits -= 8; + DynamicBuffer.length--; + DynamicBuffer.bytes_shifted++; + } + } + DEBUG("Unbits =>%d]", (int)DynamicBuffer.unbits); + + buffer_dump(); + + DEBUG("Shifted. Now (o=%ld, u=%ld l=%ld)", + (long)DynamicBuffer.offset, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.length); + + +} + +/* + * Ensure that the buffer contains at least this amount of free space. + */ +static void add_bytes_to_buffer(const void *data2add, size_t bytes) { + + if(bytes == 0) return; + + DEBUG("=> add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", + (long)bytes, + (long)DynamicBuffer.offset, + (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.allocated); + + if(DynamicBuffer.allocated + >= (DynamicBuffer.offset + DynamicBuffer.length + bytes)) { + DEBUG("\tNo buffer reallocation is necessary"); + } else if(bytes <= DynamicBuffer.offset) { + DEBUG("\tContents shifted by %ld", DynamicBuffer.offset); + + /* Shift the buffer contents */ + memmove(DynamicBuffer.data, + DynamicBuffer.data + DynamicBuffer.offset, + DynamicBuffer.length); + DynamicBuffer.bytes_shifted += DynamicBuffer.offset; + DynamicBuffer.offset = 0; + } else { + size_t newsize = (DynamicBuffer.allocated << 2) + bytes; + void *p = MALLOC(newsize); + if(!p) { + perror("malloc()"); + exit(EX_OSERR); + } + memcpy(p, + DynamicBuffer.data + DynamicBuffer.offset, + DynamicBuffer.length); + FREEMEM(DynamicBuffer.data); + DynamicBuffer.data = (uint8_t *)p; + DynamicBuffer.offset = 0; + DynamicBuffer.allocated = newsize; + DynamicBuffer.nreallocs++; + DEBUG("\tBuffer reallocated to %ld (%d time)", + newsize, DynamicBuffer.nreallocs); + } + + memcpy(DynamicBuffer.data + + DynamicBuffer.offset + DynamicBuffer.length, + data2add, bytes); + DynamicBuffer.length += bytes; + if(DynamicBuffer.unbits) { + int bits = DynamicBuffer.unbits; + DynamicBuffer.unbits = 0; + buffer_shift_left(DynamicBuffer.length - bytes, bits); + } + + DEBUG("<= add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", + (long)bytes, + (long)DynamicBuffer.offset, + (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.allocated); +} + +static void * +data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *name, ssize_t suggested_bufsize, int on_first_pdu) { + static uint8_t *fbuf; + static ssize_t fbuf_size; + static asn_codec_ctx_t s_codec_ctx; + asn_codec_ctx_t *opt_codec_ctx = 0; + void *structure = 0; + asn_dec_rval_t rval; + size_t old_offset; + size_t new_offset; + int tolerate_eof; + size_t rd; + + if(!file) { + fprintf(stderr, "%s: %s\n", name, strerror(errno)); + errno = EINVAL; + return 0; + } + + if(opt_stack) { + s_codec_ctx.max_stack_size = opt_stack; + opt_codec_ctx = &s_codec_ctx; + } + + DEBUG("Processing %s", name); + + /* prepare the file buffer */ + if(fbuf_size != suggested_bufsize) { + fbuf = (uint8_t *)REALLOC(fbuf, suggested_bufsize); + if(!fbuf) { + perror("realloc()"); + exit(EX_OSERR); + } + fbuf_size = suggested_bufsize; + } + + if(on_first_pdu) { + DynamicBuffer.offset = 0; + DynamicBuffer.length = 0; + DynamicBuffer.unbits = 0; + DynamicBuffer.allocated = 0; + DynamicBuffer.bytes_shifted = 0; + DynamicBuffer.nreallocs = 0; + } + + old_offset = DynamicBuffer.bytes_shifted + DynamicBuffer.offset; + + /* Pretend immediate EOF */ + rval.code = RC_WMORE; + rval.consumed = 0; + + for(tolerate_eof = 1; /* Allow EOF first time buffer is non-empty */ + (rd = fread(fbuf, 1, fbuf_size, file)) + || feof(file) == 0 + || (tolerate_eof && DynamicBuffer.length) + ;) { + int ecbits = 0; /* Extra consumed bits in case of PER */ + uint8_t *i_bptr; + size_t i_size; + + /* + * Copy the data over, or use the original buffer. + */ + if(DynamicBuffer.allocated) { + /* Append new data into the existing dynamic buffer */ + add_bytes_to_buffer(fbuf, rd); + i_bptr = DynamicBuffer.data + DynamicBuffer.offset; + i_size = DynamicBuffer.length; + } else { + i_bptr = fbuf; + i_size = rd; + } + + DEBUG("Decoding %ld bytes", (long)i_size); + +#ifdef JUNKTEST + junk_bytes_with_probability(i_bptr, i_size, opt_jprob); +#endif + + switch(iform) { + case INP_BER: + rval = ber_decode(opt_codec_ctx, pduType, + (void **)&structure, i_bptr, i_size); + break; + case INP_XER: + rval = xer_decode(opt_codec_ctx, pduType, + (void **)&structure, i_bptr, i_size); + break; + case INP_PER: + if(opt_nopad) + rval = uper_decode(opt_codec_ctx, pduType, + (void **)&structure, i_bptr, i_size, 0, + DynamicBuffer.unbits); + else + rval = uper_decode_complete(opt_codec_ctx, pduType, + (void **)&structure, i_bptr, i_size); + switch(rval.code) { + case RC_OK: + /* Fall through */ + case RC_FAIL: + if(opt_nopad) { + /* uper_decode() returns bits! */ + /* Extra bits */ + ecbits = rval.consumed % 8; + /* Convert into bytes! */ + rval.consumed /= 8; + } + break; + case RC_WMORE: + /* PER does not support restartability */ + ASN_STRUCT_FREE(*pduType, structure); + structure = 0; + rval.consumed = 0; + /* Continue accumulating data */ + break; + } + break; + } + DEBUG("decode(%ld) consumed %ld+%db (%ld), code %d", + (long)DynamicBuffer.length, + (long)rval.consumed, ecbits, (long)i_size, + rval.code); + + if(DynamicBuffer.allocated == 0) { + /* + * Flush remainder into the intermediate buffer. + */ + if(rval.code != RC_FAIL && rval.consumed < rd) { + add_bytes_to_buffer(fbuf + rval.consumed, + rd - rval.consumed); + buffer_shift_left(0, ecbits); + DynamicBuffer.bytes_shifted = rval.consumed; + rval.consumed = 0; + ecbits = 0; + } + } + + /* + * Adjust position inside the source buffer. + */ + if(DynamicBuffer.allocated) { + DynamicBuffer.offset += rval.consumed; + DynamicBuffer.length -= rval.consumed; + } else { + DynamicBuffer.bytes_shifted += rval.consumed; + } + + switch(rval.code) { + case RC_OK: + if(ecbits) buffer_shift_left(0, ecbits); + DEBUG("RC_OK, finishing up with %ld+%d", + (long)rval.consumed, ecbits); + return structure; + case RC_WMORE: + DEBUG("RC_WMORE, continuing read=%ld, cons=%ld " + " with %ld..%ld-%ld..%ld", + (long)rd, + (long)rval.consumed, + (long)DynamicBuffer.offset, + (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.allocated); + if(!rd) tolerate_eof--; + continue; + case RC_FAIL: + break; + } + break; + } + + DEBUG("Clean up partially decoded structure"); + ASN_STRUCT_FREE(*pduType, structure); + + new_offset = DynamicBuffer.bytes_shifted + DynamicBuffer.offset; + + /* + * Print a message and return failure only if not EOF, + * unless this is our first PDU (empty file). + */ + if(on_first_pdu + || DynamicBuffer.length + || new_offset - old_offset > ((iform == INP_XER)?sizeof("\r\n")-1:0) + ) { + +#ifdef JUNKTEST + /* + * Nothing's wrong with being unable to decode junk. + * Simulate EOF. + */ + if(opt_jprob != 0.0) { + junk_failures++; + errno = 0; + return 0; + } +#endif + + DEBUG("ofp %d, no=%ld, oo=%ld, dbl=%ld", + on_first_pdu, (long)new_offset, (long)old_offset, + (long)DynamicBuffer.length); + fprintf(stderr, "%s: " + "Decode failed past byte %ld: %s\n", + name, (long)new_offset, + (rval.code == RC_WMORE) + ? "Unexpected end of input" + : "Input processing error"); +#ifndef ENOMSG +#define ENOMSG EINVAL +#endif +#ifndef EBADMSG +#define EBADMSG EINVAL +#endif + errno = (rval.code == RC_WMORE) ? ENOMSG : EBADMSG; + } else { + /* Got EOF after a few successful PDUs */ + errno = 0; + } + + return 0; +} + +/* Dump the buffer out to the specified FILE */ +static int write_out(const void *buffer, size_t size, void *key) { + FILE *fp = (FILE *)key; + return (fwrite(buffer, 1, size, fp) == size) ? 0 : -1; +} + +static int argument_is_stdin(char *av[], int idx) { + if(strcmp(av[idx], "-")) { + return 0; /* Certainly not */ + } else { + /* This might be , unless `./program -- -` */ + if(strcmp(av[-1], "--")) + return 1; + else + return 0; + } +} + +static FILE *argument_to_file(char *av[], int idx) { + return argument_is_stdin(av, idx) + ? stdin + : fopen(av[idx], "r"); +} + +static char *argument_to_name(char *av[], int idx) { + return argument_is_stdin(av, idx) + ? "standard input" + : av[idx]; +} + +#ifdef JUNKTEST +/* + * Fill bytes with some garbage with specified probability (more or less). + */ +static void +junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) { + static int junkmode; + uint8_t *ptr; + uint8_t *end; + if(opt_jprob <= 0.0) return; + for(ptr = buf, end = ptr + size; ptr < end; ptr++) { + int byte = *ptr; + if(junkmode++ & 1) { + if((((double)random() / RAND_MAX) < prob)) + byte = random() & 0xff; + } else { +#define BPROB(b) ((((double)random() / RAND_MAX) < prob) ? b : 0) + byte ^= BPROB(0x80); + byte ^= BPROB(0x40); + byte ^= BPROB(0x20); + byte ^= BPROB(0x10); + byte ^= BPROB(0x08); + byte ^= BPROB(0x04); + byte ^= BPROB(0x02); + byte ^= BPROB(0x01); + } + if(byte != *ptr) { + DEBUG("Junk buf[%d] %02x -> %02x", + ptr - buf, *ptr, byte); + *ptr = byte; + } + } +} +#endif /* JUNKTEST */ + diff --git a/src/core/libs/supl/asn-rrlp/der_encoder.c b/src/core/libs/supl/asn-rrlp/der_encoder.c new file mode 100644 index 000000000..6c859e1b0 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/der_encoder.c @@ -0,0 +1,199 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, int constructed); + +/* + * The DER encoder of any type. + */ +asn_enc_rval_t +der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, + asn_app_consume_bytes_f *consume_bytes, void *app_key) { + + ASN_DEBUG("DER encoder invoked for %s", + type_descriptor->name); + + /* + * Invoke type-specific encoder. + */ + return type_descriptor->der_encoder(type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + 0, 0, + consume_bytes, app_key); +} + +/* + * Argument type and callback necessary for der_encode_to_buffer(). + */ +typedef struct enc_to_buf_arg { + void *buffer; + size_t left; +} enc_to_buf_arg; +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { + enc_to_buf_arg *arg = (enc_to_buf_arg *)key; + + if(arg->left < size) + return -1; /* Data exceeds the available buffer size */ + + memcpy(arg->buffer, buffer, size); + arg->buffer = ((char *)arg->buffer) + size; + arg->left -= size; + + return 0; +} + +/* + * A variant of the der_encode() which encodes the data into the provided buffer + */ +asn_enc_rval_t +der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, + void *buffer, size_t buffer_size) { + enc_to_buf_arg arg; + asn_enc_rval_t ec; + + arg.buffer = buffer; + arg.left = buffer_size; + + ec = type_descriptor->der_encoder(type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + 0, 0, encode_to_buffer_cb, &arg); + if(ec.encoded != -1) { + assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); + /* Return the encoded contents size */ + } + return ec; +} + + +/* + * Write out leading TL[v] sequence according to the type definition. + */ +ssize_t +der_write_tags(asn_TYPE_descriptor_t *sd, + size_t struct_length, + int tag_mode, int last_tag_form, + ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ + asn_app_consume_bytes_f *cb, + void *app_key) { + ber_tlv_tag_t *tags; /* Copy of tags stream */ + int tags_count; /* Number of tags */ + size_t overall_length; + ssize_t *lens; + int i; + + ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", + sd->name, tag_mode, sd->tags_count, + ber_tlv_tag_string(tag), + tag_mode + ?(sd->tags_count+1 + -((tag_mode == -1) && sd->tags_count)) + :sd->tags_count + ); + + if(tag_mode) { + /* + * Instead of doing shaman dance like we do in ber_check_tags(), + * allocate a small array on the stack + * and initialize it appropriately. + */ + int stag_offset; + tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t)); + if(!tags) { /* Can fail on !x86 */ + errno = ENOMEM; + return -1; + } + tags_count = sd->tags_count + + 1 /* EXPLICIT or IMPLICIT tag is given */ + - ((tag_mode == -1) && sd->tags_count); + /* Copy tags over */ + tags[0] = tag; + stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); + for(i = 1; i < tags_count; i++) + tags[i] = sd->tags[i + stag_offset]; + } else { + tags = sd->tags; + tags_count = sd->tags_count; + } + + /* No tags to write */ + if(tags_count == 0) + return 0; + + lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); + if(!lens) { + errno = ENOMEM; + return -1; + } + + /* + * Array of tags is initialized. + * Now, compute the size of the TLV pairs, from right to left. + */ + overall_length = struct_length; + for(i = tags_count - 1; i >= 0; --i) { + lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); + if(lens[i] == -1) return -1; + overall_length += lens[i]; + lens[i] = overall_length - lens[i]; + } + + if(!cb) return overall_length - struct_length; + + ASN_DEBUG("%s %s TL sequence (%d elements)", + cb?"Encoding":"Estimating", sd->name, tags_count); + + /* + * Encode the TL sequence for real. + */ + for(i = 0; i < tags_count; i++) { + ssize_t len; + int _constr; + + /* Check if this tag happens to be constructed */ + _constr = (last_tag_form || i < (tags_count - 1)); + + len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); + if(len == -1) return -1; + } + + return overall_length - struct_length; +} + +static ssize_t +der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, + int constructed) { + uint8_t buf[32]; + size_t size = 0; + int buf_size = cb?sizeof(buf):0; + ssize_t tmp; + + /* Serialize tag (T from TLV) into possibly zero-length buffer */ + tmp = ber_tlv_tag_serialize(tag, buf, buf_size); + if(tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; + size += tmp; + + /* Serialize length (L from TLV) into possibly zero-length buffer */ + tmp = der_tlv_length_serialize(len, buf+size, buf_size?buf_size-size:0); + if(tmp == -1) return -1; + size += tmp; + + if(size > sizeof(buf)) + return -1; + + /* + * If callback is specified, invoke it, and check its return value. + */ + if(cb) { + if(constructed) *buf |= 0x20; + if(cb(buf, size, app_key) < 0) + return -1; + } + + return size; +} diff --git a/src/core/libs/supl/asn-rrlp/der_encoder.h b/src/core/libs/supl/asn-rrlp/der_encoder.h new file mode 100644 index 000000000..61431c6db --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/der_encoder.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _DER_ENCODER_H_ +#define _DER_ENCODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * The DER encoder of any type. May be invoked by the application. + * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). + */ +asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ + ); + +/* A variant of der_encode() which encodes data into the pre-allocated buffer */ +asn_enc_rval_t der_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (maximum) */ + ); + +/* + * Type of the generic DER encoder. + */ +typedef asn_enc_rval_t (der_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ + ); + + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Write out leading TL[v] sequence according to the type definition. + */ +ssize_t der_write_tags( + struct asn_TYPE_descriptor_s *type_descriptor, + size_t struct_length, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {0,!0}: prim, constructed */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_ENCODER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/per_decoder.c b/src/core/libs/supl/asn-rrlp/per_decoder.c new file mode 100644 index 000000000..2b3d2e298 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_decoder.c @@ -0,0 +1,93 @@ +#include +#include +#include + +/* + * Decode a "Production of a complete encoding", X.691#10.1. + * The complete encoding contains at least one byte, and is an integral + * multiple of 8 bytes. + */ +asn_dec_rval_t +uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { + asn_dec_rval_t rval; + + rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); + if(rval.consumed) { + /* + * We've always given 8-aligned data, + * so convert bits to integral bytes. + */ + rval.consumed += 7; + rval.consumed >>= 3; + } else if(rval.code == RC_OK) { + if(size) { + if(((uint8_t *)buffer)[0] == 0) { + rval.consumed = 1; /* 1 byte */ + } else { + ASN_DEBUG("Expecting single zeroed byte"); + rval.code = RC_FAIL; + } + } else { + /* Must contain at least 8 bits. */ + rval.code = RC_WMORE; + } + } + + return rval; +} + +asn_dec_rval_t +uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { + asn_codec_ctx_t s_codec_ctx; + asn_dec_rval_t rval; + asn_per_data_t pd; + + if(skip_bits < 0 || skip_bits > 7 + || unused_bits < 0 || unused_bits > 7 + || (unused_bits > 0 && !size)) + _ASN_DECODE_FAILED; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* Fill in the position indicator */ + memset(&pd, 0, sizeof(pd)); + pd.buffer = (const uint8_t *)buffer; + pd.nboff = skip_bits; + pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ + if(pd.nboff > pd.nbits) + _ASN_DECODE_FAILED; + + /* + * Invoke type-specific decoder. + */ + if(!td->uper_decoder) + _ASN_DECODE_FAILED; /* PER is not compiled in */ + rval = td->uper_decoder(opt_codec_ctx, td, 0, sptr, &pd); + if(rval.code == RC_OK) { + /* Return the number of consumed bits */ + rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + + pd.nboff - skip_bits; + ASN_DEBUG("PER decoding consumed %d, counted %d", + rval.consumed, pd.moved); + assert(rval.consumed == pd.moved); + } else { + /* PER codec is not a restartable */ + rval.consumed = 0; + } + return rval; +} + diff --git a/src/core/libs/supl/asn-rrlp/per_decoder.h b/src/core/libs/supl/asn-rrlp/per_decoder.h new file mode 100644 index 000000000..8397a545f --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_decoder.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2005, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_DECODER_H_ +#define _PER_DECODER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. + * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. + */ +asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); + +/* + * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. + * WARNING: This call returns the number of BITS read from the stream. Beware. + */ +asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size, /* Size of data buffer */ + int skip_bits, /* Number of unused leading bits, 0..7 */ + int unused_bits /* Number of unused tailing bits, 0..7 */ + ); + + +/* + * Type of the type-specific PER decoder function. + */ +typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void **struct_ptr, + asn_per_data_t *per_data + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_DECODER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/per_encoder.c b/src/core/libs/supl/asn-rrlp/per_encoder.c new file mode 100644 index 000000000..f4bace060 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_encoder.c @@ -0,0 +1,151 @@ +#include +#include +#include + +static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); + +asn_enc_rval_t +uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + return uper_encode_internal(td, 0, sptr, cb, app_key); +} + +/* + * Argument type and callback necessary for uper_encode_to_buffer(). + */ +typedef struct enc_to_buf_arg { + void *buffer; + size_t left; +} enc_to_buf_arg; +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { + enc_to_buf_arg *arg = (enc_to_buf_arg *)key; + + if(arg->left < size) + return -1; /* Data exceeds the available buffer size */ + + memcpy(arg->buffer, buffer, size); + arg->buffer = ((char *)arg->buffer) + size; + arg->left -= size; + + return 0; +} + +asn_enc_rval_t +uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { + enc_to_buf_arg key; + + key.buffer = buffer; + key.left = buffer_size; + + if(td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); + + return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); +} + +typedef struct enc_dyn_arg { + void *buffer; + size_t length; + size_t allocated; +} enc_dyn_arg; +static int +encode_dyn_cb(const void *buffer, size_t size, void *key) { + enc_dyn_arg *arg = key; + if(arg->length + size >= arg->allocated) { + void *p; + arg->allocated = arg->allocated ? (arg->allocated << 2) : size; + p = REALLOC(arg->buffer, arg->allocated); + if(!p) { + FREEMEM(arg->buffer); + memset(arg, 0, sizeof(*arg)); + return -1; + } + arg->buffer = p; + } + memcpy(((char *)arg->buffer) + arg->length, buffer, size); + arg->length += size; + return 0; +} +ssize_t +uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { + asn_enc_rval_t er; + enc_dyn_arg key; + + memset(&key, 0, sizeof(key)); + + er = uper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); + switch(er.encoded) { + case -1: + FREEMEM(key.buffer); + return -1; + case 0: + FREEMEM(key.buffer); + key.buffer = MALLOC(1); + if(key.buffer) { + *(char *)key.buffer = '\0'; + *buffer_r = key.buffer; + return 1; + } else { + return -1; + } + default: + *buffer_r = key.buffer; + ASN_DEBUG("Complete encoded in %d bits", er.encoded); + return ((er.encoded + 7) >> 3); + } +} + +/* + * Internally useful functions. + */ + +/* Flush partially filled buffer */ +static int +_uper_encode_flush_outp(asn_per_outp_t *po) { + uint8_t *buf; + + if(po->nboff == 0 && po->buffer == po->tmpspace) + return 0; + + buf = po->buffer + (po->nboff >> 3); + /* Make sure we account for the last, partially filled */ + if(po->nboff & 0x07) { + buf[0] &= 0xff << (8 - (po->nboff & 0x07)); + buf++; + } + + return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); +} + +static asn_enc_rval_t +uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + asn_per_outp_t po; + asn_enc_rval_t er; + + /* + * Invoke type-specific encoder. + */ + if(!td || !td->uper_encoder) + _ASN_ENCODE_FAILED; /* PER is not compiled in */ + + po.buffer = po.tmpspace; + po.nboff = 0; + po.nbits = 8 * sizeof(po.tmpspace); + po.outper = cb; + po.op_key = app_key; + po.flushed_bytes = 0; + + er = td->uper_encoder(td, constraints, sptr, &po); + if(er.encoded != -1) { + size_t bits_to_flush; + + bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; + + /* Set number of bits encoded to a firm value */ + er.encoded = (po.flushed_bytes << 3) + bits_to_flush; + + if(_uper_encode_flush_outp(&po)) + _ASN_ENCODE_FAILED; + } + + return er; +} + diff --git a/src/core/libs/supl/asn-rrlp/per_encoder.h b/src/core/libs/supl/asn-rrlp/per_encoder.h new file mode 100644 index 000000000..95a6506e4 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_encoder.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2006, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_ENCODER_H_ +#define _PER_ENCODER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. Use the following formula to convert to bytes: + * bytes = ((.encoded + 7) / 8) + */ +asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ + void *app_key /* Arbitrary callback argument */ +); + +/* + * A variant of uper_encode() which encodes data into the existing buffer + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. + */ +asn_enc_rval_t uper_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (max) */ +); + +/* + * A variant of uper_encode_to_buffer() which allocates buffer itself. + * Returns the number of bytes in the buffer or -1 in case of failure. + * WARNING: This function produces a "Production of the complete encoding", + * with length of at least one octet. Contrast this to precise bit-packing + * encoding of uper_encode() and uper_encode_to_buffer(). + */ +ssize_t uper_encode_to_new_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void *struct_ptr, /* Structure to be encoded */ + void **buffer_r /* Buffer allocated and returned */ +); + +/* + * Type of the generic PER encoder function. + */ +typedef asn_enc_rval_t (per_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void *struct_ptr, + asn_per_outp_t *per_output +); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_ENCODER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/per_opentype.c b/src/core/libs/supl/asn-rrlp/per_opentype.c new file mode 100644 index 000000000..c749c8c6c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_opentype.c @@ -0,0 +1,373 @@ +/* + * Copyright (c) 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include + +typedef struct uper_ugot_key { + asn_per_data_t oldpd; /* Old per data source */ + size_t unclaimed; + size_t ot_moved; /* Number of bits moved by OT processing */ + int repeat; +} uper_ugot_key; + +static int uper_ugot_refill(asn_per_data_t *pd); +static int per_skip_bits(asn_per_data_t *pd, int skip_nbits); +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + +int asn_debug_indent; + +/* + * Encode an "open type field". + * #10.1, #10.2 + */ +int +uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + void *buf; + void *bptr; + ssize_t size; + size_t toGo; + + ASN_DEBUG("Open type put %s ...", td->name); + + size = uper_encode_to_new_buffer(td, constraints, sptr, &buf); + if(size <= 0) return -1; + + for(bptr = buf, toGo = size; toGo;) { + ssize_t maySave = uper_put_length(po, toGo); + if(maySave < 0) break; + if(per_put_many_bits(po, bptr, maySave * 8)) break; + bptr = (char *)bptr + maySave; + toGo -= maySave; + } + + FREEMEM(buf); + if(toGo) return -1; + + ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", + td->name, size); + + return 0; +} + +static asn_dec_rval_t +uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + ssize_t chunk_bytes; + int repeat; + uint8_t *buf = 0; + size_t bufLen = 0; + size_t bufSize = 0; + asn_per_data_t spd; + size_t padding; + + _ASN_STACK_OVERFLOW_CHECK(ctx); + + ASN_DEBUG("Getting open type %s...", td->name); + + do { + chunk_bytes = uper_get_length(pd, -1, &repeat); + if(chunk_bytes < 0) { + FREEMEM(buf); + _ASN_DECODE_STARVED; + } + if(bufLen + chunk_bytes > bufSize) { + void *ptr; + bufSize = chunk_bytes + (bufSize << 2); + ptr = REALLOC(buf, bufSize); + if(!ptr) { + FREEMEM(buf); + _ASN_DECODE_FAILED; + } + buf = ptr; + } + if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { + FREEMEM(buf); + _ASN_DECODE_STARVED; + } + bufLen += chunk_bytes; + } while(repeat); + + ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, + bufLen); + + memset(&spd, 0, sizeof(spd)); + spd.buffer = buf; + spd.nbits = bufLen << 3; + + asn_debug_indent += 4; + rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); + asn_debug_indent -= 4; + + if(rv.code == RC_OK) { + /* Check padding validity */ + padding = spd.nbits - spd.nboff; + if(padding < 8 && per_get_few_bits(&spd, padding) == 0) { + /* Everything is cool */ + FREEMEM(buf); + return rv; + } + FREEMEM(buf); + if(padding >= 8) { + ASN_DEBUG("Too large padding %d in open type", padding); + _ASN_DECODE_FAILED; + } else { + ASN_DEBUG("Non-zero padding"); + _ASN_DECODE_FAILED; + } + } else { + FREEMEM(buf); + /* rv.code could be RC_WMORE, nonsense in this context */ + rv.code = RC_FAIL; /* Noone would give us more */ + } + + return rv; +} + +static asn_dec_rval_t GCC_NOTUSED +uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + uper_ugot_key arg; + asn_dec_rval_t rv; + ssize_t padding; + + _ASN_STACK_OVERFLOW_CHECK(ctx); + + ASN_DEBUG("Getting open type %s from %s", td->name, + per_data_string(pd)); + arg.oldpd = *pd; + arg.unclaimed = 0; + arg.ot_moved = 0; + arg.repeat = 1; + pd->refill = uper_ugot_refill; + pd->refill_key = &arg; + pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */ + pd->moved = 0; /* This now counts the open type size in bits */ + + asn_debug_indent += 4; + rv = td->uper_decoder(ctx, td, constraints, sptr, pd); + asn_debug_indent -= 4; + +#define UPDRESTOREPD do { \ + /* buffer and nboff are valid, preserve them. */ \ + pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ + pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ + pd->refill = arg.oldpd.refill; \ + pd->refill_key = arg.oldpd.refill_key; \ + } while(0) + + if(rv.code != RC_OK) { + UPDRESTOREPD; + return rv; + } + + ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d" + , td->name, + per_data_string(pd), + per_data_string(&arg.oldpd), + arg.unclaimed, arg.repeat); + + padding = pd->moved % 8; + if(padding) { + int32_t pvalue; + if(padding > 7) { + ASN_DEBUG("Too large padding %d in open type", + padding); + rv.code = RC_FAIL; + UPDRESTOREPD; + return rv; + } + padding = 8 - padding; + ASN_DEBUG("Getting padding of %d bits", padding); + pvalue = per_get_few_bits(pd, padding); + switch(pvalue) { + case -1: + ASN_DEBUG("Padding skip failed"); + UPDRESTOREPD; + _ASN_DECODE_STARVED; + case 0: break; + default: + ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", + padding, (int)pvalue); + UPDRESTOREPD; + _ASN_DECODE_FAILED; + } + } + if(pd->nboff != pd->nbits) { + ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, + per_data_string(pd), per_data_string(&arg.oldpd)); + if(1) { + UPDRESTOREPD; + _ASN_DECODE_FAILED; + } else { + arg.unclaimed += pd->nbits - pd->nboff; + } + } + + /* Adjust pd back so it points to original data */ + UPDRESTOREPD; + + /* Skip data not consumed by the decoder */ + if(arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed); + if(arg.unclaimed) { + switch(per_skip_bits(pd, arg.unclaimed)) { + case -1: + ASN_DEBUG("Claim of %d failed", arg.unclaimed); + _ASN_DECODE_STARVED; + case 0: + ASN_DEBUG("Got claim of %d", arg.unclaimed); + break; + default: + /* Padding must be blank */ + ASN_DEBUG("Non-blank unconsumed padding"); + _ASN_DECODE_FAILED; + } + arg.unclaimed = 0; + } + + if(arg.repeat) { + ASN_DEBUG("Not consumed the whole thing"); + rv.code = RC_FAIL; + return rv; + } + + return rv; +} + + +asn_dec_rval_t +uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + return uper_open_type_get_simple(ctx, td, constraints, + sptr, pd); + +} + +int +uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) { + asn_TYPE_descriptor_t s_td; + asn_dec_rval_t rv; + + s_td.name = ""; + s_td.uper_decoder = uper_sot_suck; + + rv = uper_open_type_get(ctx, &s_td, 0, 0, pd); + if(rv.code != RC_OK) + return -1; + else + return 0; +} + +/* + * Internal functions. + */ + +static asn_dec_rval_t +uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)ctx; + (void)td; + (void)constraints; + (void)sptr; + + while(per_get_few_bits(pd, 24) >= 0); + + rv.code = RC_OK; + rv.consumed = pd->moved; + + return rv; +} + +static int +uper_ugot_refill(asn_per_data_t *pd) { + uper_ugot_key *arg = pd->refill_key; + ssize_t next_chunk_bytes, next_chunk_bits; + ssize_t avail; + + asn_per_data_t *oldpd = &arg->oldpd; + + ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", + pd->moved, oldpd->moved); + + /* Advance our position to where pd is */ + oldpd->buffer = pd->buffer; + oldpd->nboff = pd->nboff; + oldpd->nbits -= pd->moved - arg->ot_moved; + oldpd->moved += pd->moved - arg->ot_moved; + arg->ot_moved = pd->moved; + + if(arg->unclaimed) { + /* Refill the container */ + if(per_get_few_bits(oldpd, 1)) + return -1; + if(oldpd->nboff == 0) { + assert(0); + return -1; + } + pd->buffer = oldpd->buffer; + pd->nboff = oldpd->nboff - 1; + pd->nbits = oldpd->nbits; + ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved); + return 0; + } + + if(!arg->repeat) { + ASN_DEBUG("Want more but refill doesn't have it"); + return -1; + } + + next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); + ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", + next_chunk_bytes, oldpd->moved, arg->repeat); + if(next_chunk_bytes < 0) return -1; + if(next_chunk_bytes == 0) { + pd->refill = 0; /* No more refills, naturally */ + assert(!arg->repeat); /* Implementation guarantee */ + } + next_chunk_bits = next_chunk_bytes << 3; + avail = oldpd->nbits - oldpd->nboff; + if(avail >= next_chunk_bits) { + pd->nbits = oldpd->nboff + next_chunk_bits; + arg->unclaimed = 0; + ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", + next_chunk_bits, oldpd->moved, + oldpd->nboff, oldpd->nbits, + oldpd->nbits - oldpd->nboff); + } else { + pd->nbits = oldpd->nbits; + arg->unclaimed = next_chunk_bits - avail; + ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); + } + pd->buffer = oldpd->buffer; + pd->nboff = oldpd->nboff; + ASN_DEBUG("Refilled pd%s old%s", + per_data_string(pd), per_data_string(oldpd)); + return 0; +} + +static int +per_skip_bits(asn_per_data_t *pd, int skip_nbits) { + int hasNonZeroBits = 0; + while(skip_nbits > 0) { + int skip; + if(skip_nbits < skip) + skip = skip_nbits; + else + skip = 24; + skip_nbits -= skip; + + switch(per_get_few_bits(pd, skip)) { + case -1: return -1; /* Starving */ + case 0: continue; /* Skipped empty space */ + default: hasNonZeroBits = 1; continue; + } + } + return hasNonZeroBits; +} diff --git a/src/core/libs/supl/asn-rrlp/per_opentype.h b/src/core/libs/supl/asn-rrlp/per_opentype.h new file mode 100644 index 000000000..facfaa637 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_opentype.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_OPENTYPE_H_ +#define _PER_OPENTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + +int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); + +int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_OPENTYPE_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/per_support.c b/src/core/libs/supl/asn-rrlp/per_support.c new file mode 100644 index 000000000..e8299c730 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_support.c @@ -0,0 +1,425 @@ +/* + * Copyright (c) 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +char * +per_data_string(asn_per_data_t *pd) { + static char buf[2][32]; + static int n; + n = (n+1) % 2; + snprintf(buf[n], sizeof(buf), + "{m=%d span %+d[%d..%d] (%d)}", + pd->moved, + (((int)pd->buffer) & 0xf), + pd->nboff, pd->nbits, + pd->nbits - pd->nboff); + return buf[n]; +} + +void +per_get_undo(asn_per_data_t *pd, int nbits) { + if((ssize_t)pd->nboff < nbits) { + assert((ssize_t)pd->nboff < nbits); + } else { + pd->nboff -= nbits; + pd->moved -= nbits; + } +} + +/* + * Extract a small number of bits (<= 31) from the specified PER data pointer. + */ +int32_t +per_get_few_bits(asn_per_data_t *pd, int nbits) { + size_t off; /* Next after last bit offset */ + ssize_t nleft; /* Number of bits left in this stream */ + uint32_t accum; + const uint8_t *buf; + + if(nbits < 0) + return -1; + + nleft = pd->nbits - pd->nboff; + if(nbits > nleft) { + int32_t tailv, vhead; + if(!pd->refill || nbits > 31) return -1; + /* Accumulate unused bytes before refill */ + ASN_DEBUG("Obtain the rest %d bits (want %d)", nleft, nbits); + tailv = per_get_few_bits(pd, nleft); + if(tailv < 0) return -1; + /* Refill (replace pd contents with new data) */ + if(pd->refill(pd)) + return -1; + nbits -= nleft; + vhead = per_get_few_bits(pd, nbits); + /* Combine the rest of previous pd with the head of new one */ + tailv = (tailv << nbits) | vhead; /* Could == -1 */ + return tailv; + } + + /* + * Normalize position indicator. + */ + if(pd->nboff >= 8) { + pd->buffer += (pd->nboff >> 3); + pd->nbits -= (pd->nboff & ~0x07); + pd->nboff &= 0x07; + } + pd->moved += nbits; + pd->nboff += nbits; + off = pd->nboff; + buf = pd->buffer; + + /* + * Extract specified number of bits. + */ + if(off <= 8) + accum = nbits ? (buf[0]) >> (8 - off) : 0; + else if(off <= 16) + accum = ((buf[0] << 8) + buf[1]) >> (16 - off); + else if(off <= 24) + accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); + else if(off <= 31) + accum = ((buf[0] << 24) + (buf[1] << 16) + + (buf[2] << 8) + (buf[3])) >> (32 - off); + else if(nbits <= 31) { + asn_per_data_t tpd = *pd; + /* Here are we with our 31-bits limit plus 1..7 bits offset. */ + per_get_undo(&tpd, nbits); + /* The number of available bits in the stream allow + * for the following operations to take place without + * invoking the ->refill() function */ + accum = per_get_few_bits(&tpd, nbits - 24) << 24; + accum |= per_get_few_bits(&tpd, 24); + } else { + per_get_undo(pd, nbits); + return -1; + } + + accum &= (((uint32_t)1 << nbits) - 1); + + ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+d[%d..%d]:%02x (%d) => 0x%x]", + nbits, nleft, + pd->moved, + (((int)pd->buffer) & 0xf), + pd->nboff, pd->nbits, + pd->buffer[0], + pd->nbits - pd->nboff, + (int)accum); + + return accum; +} + +/* + * Extract a large number of bits from the specified PER data pointer. + */ +int +per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { + int32_t value; + + if(alright && (nbits & 7)) { + /* Perform right alignment of a first few bits */ + value = per_get_few_bits(pd, nbits & 0x07); + if(value < 0) return -1; + *dst++ = value; /* value is already right-aligned */ + nbits &= ~7; + } + + while(nbits) { + if(nbits >= 24) { + value = per_get_few_bits(pd, 24); + if(value < 0) return -1; + *(dst++) = value >> 16; + *(dst++) = value >> 8; + *(dst++) = value; + nbits -= 24; + } else { + value = per_get_few_bits(pd, nbits); + if(value < 0) return -1; + if(nbits & 7) { /* implies left alignment */ + value <<= 8 - (nbits & 7), + nbits += 8 - (nbits & 7); + if(nbits > 24) + *dst++ = value >> 24; + } + if(nbits > 16) + *dst++ = value >> 16; + if(nbits > 8) + *dst++ = value >> 8; + *dst++ = value; + break; + } + } + + return 0; +} + +/* + * Get the length "n" from the stream. + */ +ssize_t +uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { + ssize_t value; + + *repeat = 0; + + if(ebits >= 0) return per_get_few_bits(pd, ebits); + + value = per_get_few_bits(pd, 8); + if(value < 0) return -1; + if((value & 128) == 0) /* #10.9.3.6 */ + return (value & 0x7F); + if((value & 64) == 0) { /* #10.9.3.7 */ + value = ((value & 63) << 8) | per_get_few_bits(pd, 8); + if(value < 0) return -1; + return value; + } + value &= 63; /* this is "m" from X.691, #10.9.3.8 */ + if(value < 1 || value > 4) + return -1; + *repeat = 1; + return (16384 * value); +} + +/* + * Get the normally small length "n". + * This procedure used to decode length of extensions bit-maps + * for SET and SEQUENCE types. + */ +ssize_t +uper_get_nslength(asn_per_data_t *pd) { + ssize_t length; + + ASN_DEBUG("Getting normally small length"); + + if(per_get_few_bits(pd, 1) == 0) { + length = per_get_few_bits(pd, 6) + 1; + if(length <= 0) return -1; + ASN_DEBUG("l=%d", length); + return length; + } else { + int repeat; + length = uper_get_length(pd, -1, &repeat); + if(length >= 0 && !repeat) return length; + return -1; /* Error, or do not support >16K extensions */ + } +} + +/* + * Get the normally small non-negative whole number. + * X.691, #10.6 + */ +ssize_t +uper_get_nsnnwn(asn_per_data_t *pd) { + ssize_t value; + + 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; +} + +/* + * Put the normally small non-negative whole number. + * X.691, #10.6 + */ +int +uper_put_nsnnwn(asn_per_outp_t *po, int n) { + int bytes; + + 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); +} + + +/* + * Put a small number of bits (<= 31). + */ +int +per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { + size_t off; /* Next after last bit offset */ + size_t omsk; /* Existing last byte meaningful bits mask */ + uint8_t *buf; + + if(obits <= 0 || obits >= 32) return obits ? -1 : 0; + + ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", + obits, (int)bits, po->buffer, po->nboff); + + /* + * Normalize position indicator. + */ + if(po->nboff >= 8) { + po->buffer += (po->nboff >> 3); + po->nbits -= (po->nboff & ~0x07); + po->nboff &= 0x07; + } + + /* + * Flush whole-bytes output, if necessary. + */ + if(po->nboff + obits > po->nbits) { + int complete_bytes = (po->buffer - po->tmpspace); + ASN_DEBUG("[PER output %d complete + %d]", + complete_bytes, po->flushed_bytes); + if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + return -1; + if(po->nboff) + po->tmpspace[0] = po->buffer[0]; + po->buffer = po->tmpspace; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; + } + + /* + * Now, due to sizeof(tmpspace), we are guaranteed large enough space. + */ + buf = po->buffer; + omsk = ~((1 << (8 - po->nboff)) - 1); + off = (po->nboff += obits); + + /* Clear data of debris before meaningful bits */ + bits &= (((uint32_t)1 << obits) - 1); + + ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, + (int)bits, (int)bits, + po->nboff - obits, off, buf[0], omsk&0xff, buf[0] & omsk); + + if(off <= 8) /* Completely within 1 byte */ + bits <<= (8 - off), + buf[0] = (buf[0] & omsk) | bits; + else if(off <= 16) + bits <<= (16 - off), + buf[0] = (buf[0] & omsk) | (bits >> 8), + buf[1] = bits; + else if(off <= 24) + bits <<= (24 - off), + buf[0] = (buf[0] & omsk) | (bits >> 16), + buf[1] = bits >> 8, + buf[2] = bits; + else if(off <= 31) + bits <<= (32 - off), + buf[0] = (buf[0] & omsk) | (bits >> 24), + buf[1] = bits >> 16, + buf[2] = bits >> 8, + buf[3] = bits; + else { + ASN_DEBUG("->[PER out split %d]", obits); + per_put_few_bits(po, bits >> 8, 24); + per_put_few_bits(po, bits, obits - 24); + ASN_DEBUG("<-[PER out split %d]", obits); + } + + ASN_DEBUG("[PER out %u/%x => %02x buf+%d]", + (int)bits, (int)bits, buf[0], po->buffer - po->tmpspace); + + return 0; +} + + +/* + * Output a large number of bits. + */ +int +per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { + + while(nbits) { + uint32_t value; + + if(nbits >= 24) { + value = (src[0] << 16) | (src[1] << 8) | src[2]; + src += 3; + nbits -= 24; + if(per_put_few_bits(po, value, 24)) + return -1; + } else { + value = src[0]; + if(nbits > 8) + value = (value << 8) | src[1]; + if(nbits > 16) + value = (value << 8) | src[2]; + if(nbits & 0x07) + value >>= (8 - (nbits & 0x07)); + if(per_put_few_bits(po, value, nbits)) + return -1; + break; + } + } + + return 0; +} + +/* + * Put the length "n" (or part of it) into the stream. + */ +ssize_t +uper_put_length(asn_per_outp_t *po, size_t length) { + + if(length <= 127) /* #10.9.3.6 */ + return per_put_few_bits(po, length, 8) + ? -1 : (ssize_t)length; + else if(length < 16384) /* #10.9.3.7 */ + return per_put_few_bits(po, length|0x8000, 16) + ? -1 : (ssize_t)length; + + length >>= 14; + if(length > 4) length = 4; + + return per_put_few_bits(po, 0xC0 | length, 8) + ? -1 : (ssize_t)(length << 14); +} + + +/* + * Put the normally small length "n" into the stream. + * This procedure used to encode length of extensions bit-maps + * for SET and SEQUENCE types. + */ +int +uper_put_nslength(asn_per_outp_t *po, size_t length) { + + if(length <= 64) { + /* #10.9.3.4 */ + if(length == 0) return -1; + return per_put_few_bits(po, length-1, 7) ? -1 : 0; + } else { + if(uper_put_length(po, length) != (ssize_t)length) { + /* This might happen in case of >16K extensions */ + return -1; + } + } + + return 0; +} + diff --git a/src/core/libs/supl/asn-rrlp/per_support.h b/src/core/libs/supl/asn-rrlp/per_support.h new file mode 100644 index 000000000..7cb1a0ca3 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/per_support.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_SUPPORT_H_ +#define _PER_SUPPORT_H_ + +#include /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Pre-computed PER constraints. + */ +typedef struct asn_per_constraint_s { + enum asn_per_constraint_flags { + APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ + APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ + APC_CONSTRAINED = 0x2, /* Fully constrained */ + APC_EXTENSIBLE = 0x4 /* May have extension */ + } 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 */ +} asn_per_constraint_t; +typedef struct asn_per_constraints_s { + asn_per_constraint_t value; + asn_per_constraint_t size; + int (*value2code)(unsigned int value); + int (*code2value)(unsigned int code); +} asn_per_constraints_t; + +/* + * This structure describes a position inside an incoming PER bit stream. + */ +typedef struct asn_per_data_s { + const uint8_t *buffer; /* Pointer to the octet stream */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits in the stream */ + size_t moved; /* Number of bits moved through this bit stream */ + int (*refill)(struct asn_per_data_s *); + void *refill_key; +} asn_per_data_t; + +/* + * Extract a small number of bits (<= 31) from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ +int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); + +/* Undo the immediately preceeding "get_few_bits" operation */ +void per_get_undo(asn_per_data_t *per_data, int get_nbits); + +/* + * Extract a large number of bits from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ +int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, + int get_nbits); + +/* + * Get the length "n" from the Unaligned PER stream. + */ +ssize_t uper_get_length(asn_per_data_t *pd, + int effective_bound_bits, + int *repeat); + +/* + * Get the normally small length "n". + */ +ssize_t uper_get_nslength(asn_per_data_t *pd); + +/* + * Get the normally small non-negative whole number. + */ +ssize_t uper_get_nsnnwn(asn_per_data_t *pd); + +/* Non-thread-safe debugging function, don't use it */ +char *per_data_string(asn_per_data_t *pd); + +/* + * This structure supports forming PER output. + */ +typedef struct asn_per_outp_s { + uint8_t *buffer; /* Pointer into the (tmpspace) */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits left in (tmpspace) */ + uint8_t tmpspace[32]; /* Preliminary storage to hold data */ + int (*outper)(const void *data, size_t size, void *op_key); + void *op_key; /* Key for (outper) data callback */ + size_t flushed_bytes; /* Bytes already flushed through (outper) */ +} asn_per_outp_t; + +/* Output a small number of bits (<= 31) */ +int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); + +/* Output a large number of bits */ +int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); + +/* + * Put the length "n" to the Unaligned PER stream. + * This function returns the number of units which may be flushed + * in the next units saving iteration. + */ +ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); + +/* + * Put the normally small length "n" to the Unaligned PER stream. + * Returns 0 or -1. + */ +int uper_put_nslength(asn_per_outp_t *po, size_t length); + +/* + * Put the normally small non-negative whole number. + */ +int uper_put_nsnnwn(asn_per_outp_t *po, int n); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_SUPPORT_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/xer_decoder.c b/src/core/libs/supl/asn-rrlp/xer_decoder.c new file mode 100644 index 000000000..161dc78ce --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/xer_decoder.c @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2004, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include /* XER/XML parsing support */ + + +/* + * Decode the XER encoding of a given type. + */ +asn_dec_rval_t +xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *buffer, size_t size) { + asn_codec_ctx_t s_codec_ctx; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* + * Invoke type-specific decoder. + */ + return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size); +} + + + +struct xer__cb_arg { + pxml_chunk_type_e chunk_type; + size_t chunk_size; + const void *chunk_buf; + int callback_not_invoked; +}; + +static int +xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key) { + struct xer__cb_arg *arg = (struct xer__cb_arg *)key; + arg->chunk_type = type; + arg->chunk_size = _chunk_size; + arg->chunk_buf = _chunk_data; + arg->callback_not_invoked = 0; + return -1; /* Terminate the XML parsing */ +} + +/* + * Fetch the next token from the XER/XML stream. + */ +ssize_t +xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type) { + struct xer__cb_arg arg; + int new_stateContext = *stateContext; + ssize_t ret; + + arg.callback_not_invoked = 1; + ret = pxml_parse(&new_stateContext, buffer, size, xer__token_cb, &arg); + if(ret < 0) return -1; + if(arg.callback_not_invoked) { + assert(ret == 0); /* No data was consumed */ + return 0; /* Try again with more data */ + } else { + assert(arg.chunk_size); + assert(arg.chunk_buf == buffer); + } + + /* + * Translate the XML chunk types into more convenient ones. + */ + switch(arg.chunk_type) { + case PXML_TEXT: + *ch_type = PXER_TEXT; + break; + case PXML_TAG: return 0; /* Want more */ + case PXML_TAG_END: + *ch_type = PXER_TAG; + break; + case PXML_COMMENT: + case PXML_COMMENT_END: + *ch_type = PXER_COMMENT; + break; + } + + *stateContext = new_stateContext; + return arg.chunk_size; +} + +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define RANGLE 0x3e /* '>' */ + +xer_check_tag_e +xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { + const char *buf = (const char *)buf_ptr; + const char *end; + xer_check_tag_e ct = XCT_OPENING; + + if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) { + if(size >= 2) + ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); + return XCT_BROKEN; + } + + /* + * Determine the tag class. + */ + if(buf[1] == CSLASH) { + buf += 2; /* advance past "" */ + ct = XCT_CLOSING; + if(size > 0 && buf[size-1] == CSLASH) + return XCT_BROKEN; /* */ + } else { + buf++; /* advance past "<" */ + size -= 2; /* strip "<" and ">" */ + if(size > 0 && buf[size-1] == CSLASH) { + ct = XCT_BOTH; + size--; /* One more, for "/" */ + } + } + + /* Sometimes we don't care about the tag */ + if(!need_tag || !*need_tag) + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + + /* + * Determine the tag name. + */ + for(end = buf + size; buf < end; buf++, need_tag++) { + int b = *buf, n = *need_tag; + if(b != n) { + if(n == 0) { + switch(b) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* "": whitespace is normal */ + return ct; + } + } + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + } + if(b == 0) + return XCT_BROKEN; /* Embedded 0 in buf?! */ + } + if(*need_tag) + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + + return ct; +} + + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + if(rval.code != RC_OK) \ + ASN_DEBUG("Failed with %d", rval.code); \ + return rval; \ + } while(0) + +#define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ + ssize_t converted_size = body_receiver \ + (struct_key, chunk_buf, chunk_size, \ + (size_t)chunk_size < size); \ + if(converted_size == -1) RETURN(RC_FAIL); \ + if(converted_size == 0 \ + && size == (size_t)chunk_size) \ + RETURN(RC_WMORE); \ + chunk_size = converted_size; \ + } while(0) +#define XER_GOT_EMPTY() do { \ + if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ + RETURN(RC_FAIL); \ + } while(0) + +/* + * Generalized function for decoding the primitive values. + */ +asn_dec_rval_t +xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, + const char *xml_tag, /* Expected XML tag */ + const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_key, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_key, const void *chunk_buf, size_t chunk_size, + int have_more) + ) { + + asn_dec_rval_t rval; + ssize_t consumed_myself = 0; + + (void)opt_codec_ctx; + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + */ + if(ctx->phase > 1) RETURN(RC_FAIL); + for(;;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, + &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TEXT: + if(ctx->phase == 0) { + /* + * We have to ignore whitespace here, + * but in order to be forward compatible + * with EXTENDED-XER (EMBED-VALUES, #25) + * any text is just ignored here. + */ + } else { + XER_GOT_BODY(buf_ptr, ch_size, size); + } + ADVANCE(ch_size); + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + assert(ch_type == PXER_TAG && size); + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + /* + * Phase 0: + * Expecting the opening tag + * for the type being processed. + * Phase 1: + * Waiting for the closing XML tag. + */ + switch(tcv) { + case XCT_BOTH: + if(ctx->phase) break; + /* Finished decoding of an empty element */ + XER_GOT_EMPTY(); + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if(ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + case XCT_CLOSING: + if(!ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_UNKNOWN_BO: + /* + * Certain tags in the body may be expected. + */ + if(opt_unexpected_tag_decoder + && opt_unexpected_tag_decoder(struct_key, + buf_ptr, ch_size) >= 0) { + /* Tag's processed fine */ + ADVANCE(ch_size); + if(!ctx->phase) { + /* We are not expecting + * the closing tag anymore. */ + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + } + continue; + } + /* Fall through */ + default: + break; /* Unexpected tag */ + } + + ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); + break; /* Dark and mysterious things have just happened */ + } + + RETURN(RC_FAIL); +} + + +int +xer_is_whitespace(const void *chunk_buf, size_t chunk_size) { + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + + for(; p < pend; p++) { + switch(*p) { + /* X.693, #8.1.4 + * HORISONTAL TAB (9) + * LINE FEED (10) + * CARRIAGE RETURN (13) + * SPACE (32) + */ + case 0x09: case 0x0a: case 0x0d: case 0x20: + break; + default: + return 0; + } + } + return 1; /* All whitespace */ +} + +/* + * This is a vastly simplified, non-validating XML tree skipper. + */ +int +xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) { + assert(*depth > 0); + switch(tcv) { + case XCT_BOTH: + case XCT_UNKNOWN_BO: + /* These negate each other. */ + return 0; + case XCT_OPENING: + case XCT_UNKNOWN_OP: + ++(*depth); + return 0; + case XCT_CLOSING: + case XCT_UNKNOWN_CL: + if(--(*depth) == 0) + return (tcv == XCT_CLOSING) ? 2 : 1; + return 0; + default: + return -1; + } +} diff --git a/src/core/libs/supl/asn-rrlp/xer_decoder.h b/src/core/libs/supl/asn-rrlp/xer_decoder.h new file mode 100644 index 000000000..cf0d846fe --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/xer_decoder.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_DECODER_H_ +#define _XER_DECODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * The XER decoder of any ASN.1 type. May be invoked by the application. + */ +asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); + +/* + * Type of the type-specific XER decoder function. + */ +typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, + const char *opt_mname, /* Member name */ + const void *buf_ptr, size_t size + ); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Generalized function for decoding the primitive values. + * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 + * and others. This function should not be used by applications, as its API + * is subject to changes. + */ +asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, /* Treated as opaque pointer */ + const char *xml_tag, /* Expected XML tag name */ + const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_key, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_key, const void *chunk_buf, size_t chunk_size, + int have_more) + ); + + +/* + * Fetch the next XER (XML) token from the stream. + * The function returns the number of bytes occupied by the chunk type, + * returned in the _ch_type. The _ch_type is only set (and valid) when + * the return value is greater than 0. + */ + typedef enum pxer_chunk_type { + PXER_TAG, /* Complete XER tag */ + PXER_TEXT, /* Plain text between XER tags */ + PXER_COMMENT /* A comment, may be part of */ + } pxer_chunk_type_e; +ssize_t xer_next_token(int *stateContext, + const void *buffer, size_t size, pxer_chunk_type_e *_ch_type); + +/* + * This function checks the buffer against the tag name is expected to occur. + */ + typedef enum xer_check_tag { + XCT_BROKEN = 0, /* The tag is broken */ + XCT_OPENING = 1, /* This is the tag */ + XCT_CLOSING = 2, /* This is the tag */ + XCT_BOTH = 3, /* This is the tag */ + XCT__UNK__MASK = 4, /* Mask of everything unexpected */ + XCT_UNKNOWN_OP = 5, /* Unexpected tag */ + XCT_UNKNOWN_CL = 6, /* Unexpected tag */ + XCT_UNKNOWN_BO = 7 /* Unexpected tag */ + } xer_check_tag_e; +xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, + const char *need_tag); + +/* + * Check whether this buffer consists of entirely XER whitespace characters. + * RETURN VALUES: + * 1: Whitespace or empty string + * 0: Non-whitespace + */ +int xer_is_whitespace(const void *chunk_buf, size_t chunk_size); + +/* + * Skip the series of anticipated extensions. + */ +int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_DECODER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/xer_encoder.c b/src/core/libs/supl/asn-rrlp/xer_encoder.c new file mode 100644 index 000000000..aa7cf040a --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/xer_encoder.c @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * The XER encoder of any type. May be invoked by the application. + */ +asn_enc_rval_t +xer_encode(asn_TYPE_descriptor_t *td, void *sptr, + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er, tmper; + const char *mname; + size_t mlen; + int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2; + + if(!td || !sptr) goto cb_failed; + + mname = td->xml_tag; + mlen = strlen(mname); + + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("\n", xcan); + + er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded; + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +/* + * This is a helper function for xer_fprint, which directs all incoming data + * into the provided file descriptor. + */ +static int +xer__print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + +int +xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) { + asn_enc_rval_t er; + + if(!stream) stream = stdout; + if(!td || !sptr) + return -1; + + er = xer_encode(td, sptr, XER_F_BASIC, xer__print2fp, stream); + if(er.encoded == -1) + return -1; + + return fflush(stream); +} diff --git a/src/core/libs/supl/asn-rrlp/xer_encoder.h b/src/core/libs/supl/asn-rrlp/xer_encoder.h new file mode 100644 index 000000000..055e73c0c --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/xer_encoder.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_ENCODER_H_ +#define _XER_ENCODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ +enum xer_encoder_flags_e { + /* Mode of encoding */ + XER_F_BASIC = 0x01, /* BASIC-XER (pretty-printing) */ + XER_F_CANONICAL = 0x02 /* Canonical XER (strict rules) */ +}; + +/* + * The XER encoder of any type. May be invoked by the application. + */ +asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ + ); + +/* + * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) + * output into the chosen file pointer. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem printing the structure. + * WARNING: No sensible errno value is returned. + */ +int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); + +/* + * Type of the generic XER encoder. + */ +typedef asn_enc_rval_t (xer_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + int ilevel, /* Level of indentation */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_ENCODER_H_ */ diff --git a/src/core/libs/supl/asn-rrlp/xer_support.c b/src/core/libs/supl/asn-rrlp/xer_support.c new file mode 100644 index 000000000..9e34e6923 --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/xer_support.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +/* Parser states */ +typedef enum { + ST_TEXT, + ST_TAG_START, + ST_TAG_BODY, + ST_TAG_QUOTE_WAIT, + ST_TAG_QUOTED_STRING, + ST_TAG_UNQUOTED_STRING, + ST_COMMENT_WAIT_DASH1, /* ""[0] */ + ST_COMMENT_CLO_RT /* "-->"[1] */ +} pstate_e; + +static pxml_chunk_type_e final_chunk_type[] = { + PXML_TEXT, + PXML_TAG_END, + PXML_COMMENT_END, + PXML_TAG_END, + PXML_COMMENT_END, +}; + + +static int +_charclass[256] = { + 0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0, + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */ + 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */ + 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */ + 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */ + 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */ +}; +#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) +#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) +#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) + +/* Aliases for characters, ASCII/UTF-8 */ +#define EXCLAM 0x21 /* '!' */ +#define CQUOTE 0x22 /* '"' */ +#define CDASH 0x2d /* '-' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define CEQUAL 0x3d /* '=' */ +#define RANGLE 0x3e /* '>' */ +#define CQUEST 0x3f /* '?' */ + +/* Invoke token callback */ +#define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ + int _ret; \ + pstate_e ns = _ns; \ + ssize_t _sz = (p - chunk_start) + _current_too; \ + if (!_sz) { \ + /* Shortcut */ \ + state = _ns; \ + break; \ + } \ + _ret = cb(type, chunk_start, _sz, key); \ + if(_ret < _sz) { \ + if(_current_too && _ret == -1) \ + state = ns; \ + goto finish; \ + } \ + chunk_start = p + _current_too; \ + state = ns; \ + } while(0) + +#define TOKEN_CB(_type, _ns, _current_too) \ + TOKEN_CB_CALL(_type, _ns, _current_too, 0) + +#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ + TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1) + +/* + * Parser itself + */ +ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) { + pstate_e state = (pstate_e)*stateContext; + const char *chunk_start = (const char *)xmlbuf; + const char *p = chunk_start; + const char *end = p + size; + + for(; p < end; p++) { + int C = *(const unsigned char *)p; + switch(state) { + case ST_TEXT: + /* + * Initial state: we're in the middle of some text, + * or just have started. + */ + if (C == LANGLE) + /* We're now in the tag, probably */ + TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); + break; + case ST_TAG_START: + if (ALPHA(C) || (C == CSLASH)) + state = ST_TAG_BODY; + else if (C == EXCLAM) + state = ST_COMMENT_WAIT_DASH1; + else + /* + * Not characters and not whitespace. + * Must be something like "3 < 4". + */ + TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */ + break; + case ST_TAG_BODY: + switch(C) { + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + case LANGLE: + /* + * The previous tag wasn't completed, but still + * recognized as valid. (Mozilla-compatible) + */ + TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); + break; + case CEQUAL: + state = ST_TAG_QUOTE_WAIT; + break; + } + break; + case ST_TAG_QUOTE_WAIT: + /* + * State after the equal sign ("=") in the tag. + */ + switch(C) { + case CQUOTE: + state = ST_TAG_QUOTED_STRING; + break; + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + default: + if(!WHITESPACE(C)) + /* Unquoted string value */ + state = ST_TAG_UNQUOTED_STRING; + } + break; + case ST_TAG_QUOTED_STRING: + /* + * Tag attribute's string value in quotes. + */ + if(C == CQUOTE) { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_TAG_UNQUOTED_STRING: + if(C == RANGLE) { + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + } else if(WHITESPACE(C)) { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH1: + if(C == CDASH) { + state = ST_COMMENT_WAIT_DASH2; + } else { + /* Some ordinary tag. */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH2: + if(C == CDASH) { + /* Seen "<--" */ + state = ST_COMMENT; + } else { + /* Some ordinary tag */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT: + if(C == CDASH) { + state = ST_COMMENT_CLO_DASH2; + } + break; + case ST_COMMENT_CLO_DASH2: + if(C == CDASH) { + state = ST_COMMENT_CLO_RT; + } else { + /* This is not an end of a comment */ + state = ST_COMMENT; + } + break; + case ST_COMMENT_CLO_RT: + if(C == RANGLE) { + TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); + } else if(C == CDASH) { + /* Maintain current state, still waiting for '>' */ + } else { + state = ST_COMMENT; + } + break; + } /* switch(*ptr) */ + } /* for() */ + + /* + * Flush the partially processed chunk, state permitting. + */ + if(p - chunk_start) { + switch (state) { + case ST_COMMENT: + TOKEN_CB(PXML_COMMENT, state, 0); + break; + case ST_TEXT: + TOKEN_CB(PXML_TEXT, state, 0); + break; + default: break; /* a no-op */ + } + } + +finish: + *stateContext = (int)state; + return chunk_start - (const char *)xmlbuf; +} + diff --git a/src/core/libs/supl/asn-rrlp/xer_support.h b/src/core/libs/supl/asn-rrlp/xer_support.h new file mode 100644 index 000000000..8b01944ab --- /dev/null +++ b/src/core/libs/supl/asn-rrlp/xer_support.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_SUPPORT_H_ +#define _XER_SUPPORT_H_ + +#include /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Types of data transferred to the application. + */ +typedef enum { + PXML_TEXT, /* Plain text between XML tags. */ + PXML_TAG, /* A tag, starting with '<'. */ + PXML_COMMENT, /* An XML comment, including "". */ + /* + * The following chunk types are reported if the chunk + * terminates the specified XML element. + */ + PXML_TAG_END, /* Tag ended */ + PXML_COMMENT_END /* Comment ended */ +} pxml_chunk_type_e; + +/* + * Callback function that is called by the parser when parsed data is + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the text + * data is the piece of buffer identified by _bufid (as supplied to + * pxml_feed() call) starting at offset _offset and of _size bytes size. + * The chunk is NOT '\0'-terminated. + */ +typedef int (pxml_callback_f)(pxml_chunk_type_e _type, + const void *_chunk_data, size_t _chunk_size, void *_key); + +/* + * 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. + * It will always be lesser than or equal to the specified _size. + * The next invocation of this function must account the difference. + */ +ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size, + pxml_callback_f *cb, void *_key); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_SUPPORT_H_ */ diff --git a/src/core/libs/supl/asn-supl/AltitudeInfo.c b/src/core/libs/supl/asn-supl/AltitudeInfo.c new file mode 100644 index 000000000..70f48f49c --- /dev/null +++ b/src/core/libs/supl/asn-supl/AltitudeInfo.c @@ -0,0 +1,278 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "AltitudeInfo.h" + +static int +altitudeDirection_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +altitudeDirection_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +static void +altitudeDirection_2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +altitudeDirection_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +altitudeDirection_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +altitudeDirection_2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +altitudeDirection_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +altitudeDirection_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static asn_dec_rval_t +altitudeDirection_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +static asn_enc_rval_t +altitudeDirection_2_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + altitudeDirection_2_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static int +memb_altitude_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_altUncertainty_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_type_altitudeDirection_constr_2 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_altitude_constr_5 = { + { APC_CONSTRAINED, 15, 15, 0, 32767 } /* (0..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_altUncertainty_constr_6 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_altitudeDirection_value2enum_2[] = { + { 0, 6, "height" }, + { 1, 5, "depth" } +}; +static unsigned int asn_MAP_altitudeDirection_enum2value_2[] = { + 1, /* depth(1) */ + 0 /* height(0) */ +}; +static asn_INTEGER_specifics_t asn_SPC_altitudeDirection_specs_2 = { + asn_MAP_altitudeDirection_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_altitudeDirection_enum2value_2, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_altitudeDirection_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_altitudeDirection_2 = { + "altitudeDirection", + "altitudeDirection", + altitudeDirection_2_free, + altitudeDirection_2_print, + altitudeDirection_2_constraint, + altitudeDirection_2_decode_ber, + altitudeDirection_2_encode_der, + altitudeDirection_2_decode_xer, + altitudeDirection_2_encode_xer, + altitudeDirection_2_decode_uper, + altitudeDirection_2_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_altitudeDirection_tags_2, + sizeof(asn_DEF_altitudeDirection_tags_2) + /sizeof(asn_DEF_altitudeDirection_tags_2[0]) - 1, /* 1 */ + asn_DEF_altitudeDirection_tags_2, /* Same as above */ + sizeof(asn_DEF_altitudeDirection_tags_2) + /sizeof(asn_DEF_altitudeDirection_tags_2[0]), /* 2 */ + &asn_PER_type_altitudeDirection_constr_2, + 0, 0, /* Defined elsewhere */ + &asn_SPC_altitudeDirection_specs_2 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_AltitudeInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altitudeDirection), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_altitudeDirection_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeDirection" + }, + { ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altitude), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_altitude_constraint_1, + &asn_PER_memb_altitude_constr_5, + 0, + "altitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_altUncertainty_constraint_1, + &asn_PER_memb_altUncertainty_constr_6, + 0, + "altUncertainty" + }, +}; +static ber_tlv_tag_t asn_DEF_AltitudeInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_AltitudeInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* altitudeDirection at 86 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* altitude at 87 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* altUncertainty at 88 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_AltitudeInfo_specs_1 = { + sizeof(struct AltitudeInfo), + offsetof(struct AltitudeInfo, _asn_ctx), + asn_MAP_AltitudeInfo_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_AltitudeInfo = { + "AltitudeInfo", + "AltitudeInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_AltitudeInfo_tags_1, + sizeof(asn_DEF_AltitudeInfo_tags_1) + /sizeof(asn_DEF_AltitudeInfo_tags_1[0]), /* 1 */ + asn_DEF_AltitudeInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_AltitudeInfo_tags_1) + /sizeof(asn_DEF_AltitudeInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_AltitudeInfo_1, + 3, /* Elements count */ + &asn_SPC_AltitudeInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/AltitudeInfo.h b/src/core/libs/supl/asn-supl/AltitudeInfo.h new file mode 100644 index 000000000..5048d16ad --- /dev/null +++ b/src/core/libs/supl/asn-supl/AltitudeInfo.h @@ -0,0 +1,51 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _AltitudeInfo_H_ +#define _AltitudeInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum altitudeDirection { + altitudeDirection_height = 0, + altitudeDirection_depth = 1 +} e_altitudeDirection; + +/* AltitudeInfo */ +typedef struct AltitudeInfo { + ENUMERATED_t altitudeDirection; + long altitude; + long altUncertainty; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} AltitudeInfo_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_altitudeDirection_2; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_AltitudeInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _AltitudeInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/BIT_STRING.c b/src/core/libs/supl/asn-supl/BIT_STRING.c new file mode 100644 index 000000000..9b9827127 --- /dev/null +++ b/src/core/libs/supl/asn-supl/BIT_STRING.c @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * BIT STRING basic type description. + */ +static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = { + sizeof(BIT_STRING_t), + offsetof(BIT_STRING_t, _asn_ctx), + ASN_OSUBV_BIT +}; +asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { + "BIT STRING", + "BIT_STRING", + OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ + BIT_STRING_print, + BIT_STRING_constraint, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_xer_binary, + BIT_STRING_encode_xer, + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_BIT_STRING_tags, + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + asn_DEF_BIT_STRING_tags, /* Same as above */ + sizeof(asn_DEF_BIT_STRING_tags) + / sizeof(asn_DEF_BIT_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_DEF_BIT_STRING_specs +}; + +/* + * BIT STRING generic constraint. + */ +int +BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + + if(st && st->buf) { + if((st->size == 0 && st->bits_unused) + || st->bits_unused < 0 || st->bits_unused > 7) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: invalid padding byte (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} + +static char *_bit_pattern[16] = { + "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", + "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" +}; + +asn_enc_rval_t +BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + char scratch[128]; + char *p = scratch; + char *scend = scratch + (sizeof(scratch) - 10); + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + int xcan = (flags & XER_F_CANONICAL); + uint8_t *buf; + uint8_t *end; + + if(!st || !st->buf) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + buf = st->buf; + end = buf + st->size - 1; /* Last byte is special */ + + /* + * Binary dump + */ + for(; buf < end; buf++) { + int v = *buf; + int nline = xcan?0:(((buf - st->buf) % 8) == 0); + if(p >= scend || nline) { + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + p = scratch; + if(nline) _i_ASN_TEXT_INDENT(1, ilevel); + } + memcpy(p + 0, _bit_pattern[v >> 4], 4); + memcpy(p + 4, _bit_pattern[v & 0x0f], 4); + p += 8; + } + + if(!xcan && ((buf - st->buf) % 8) == 0) + _i_ASN_TEXT_INDENT(1, ilevel); + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + p = scratch; + + if(buf == end) { + int v = *buf; + int ubits = st->bits_unused; + int i; + for(i = 7; i >= ubits; i--) + *p++ = (v & (1 << i)) ? 0x31 : 0x30; + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + + +/* + * BIT STRING specific contents printer. + */ +int +BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + static const char *h2c = "0123456789ABCDEF"; + char scratch[64]; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + uint8_t *buf; + uint8_t *end; + char *p = scratch; + + (void)td; /* Unused argument */ + + if(!st || !st->buf) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + ilevel++; + buf = st->buf; + end = buf + st->size; + + /* + * Hexadecimal dump. + */ + for(; buf < end; buf++) { + if((buf - st->buf) % 16 == 0 && (st->size > 16) + && buf != st->buf) { + _i_INDENT(1); + /* Dump the string */ + if(cb(scratch, p - scratch, app_key) < 0) return -1; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Eat the tailing space */ + + if((st->size > 16)) { + _i_INDENT(1); + } + + /* Dump the incomplete 16-bytes row */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + return 0; +} + diff --git a/src/core/libs/supl/asn-supl/BIT_STRING.h b/src/core/libs/supl/asn-supl/BIT_STRING.h new file mode 100644 index 000000000..732e878bc --- /dev/null +++ b/src/core/libs/supl/asn-supl/BIT_STRING.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BIT_STRING_H_ +#define _BIT_STRING_H_ + +#include /* Some help from OCTET STRING */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct BIT_STRING_s { + uint8_t *buf; /* BIT STRING body */ + int size; /* Size of the above buffer */ + + int bits_unused;/* Unused trailing bits in the last octet (0..7) */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} BIT_STRING_t; + +extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING; + +asn_struct_print_f BIT_STRING_print; /* Human-readable output */ +asn_constr_check_f BIT_STRING_constraint; +xer_type_encoder_f BIT_STRING_encode_xer; + +#ifdef __cplusplus +} +#endif + +#endif /* _BIT_STRING_H_ */ diff --git a/src/core/libs/supl/asn-supl/BOOLEAN.c b/src/core/libs/supl/asn-supl/BOOLEAN.c new file mode 100644 index 000000000..2c2bbcf2f --- /dev/null +++ b/src/core/libs/supl/asn-supl/BOOLEAN.c @@ -0,0 +1,284 @@ +/*- + * 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 ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { + "BOOLEAN", + "BOOLEAN", + BOOLEAN_free, + BOOLEAN_print, + asn_generic_no_constraint, + BOOLEAN_decode_ber, + BOOLEAN_encode_der, + BOOLEAN_decode_xer, + BOOLEAN_encode_xer, + BOOLEAN_decode_uper, /* Unaligned PER decoder */ + BOOLEAN_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + 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, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode BOOLEAN type. + */ +asn_dec_rval_t +BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + 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(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t erval; + BOOLEAN_t *st = (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(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 { + if(xer_is_whitespace(chunk_buf, chunk_size)) + return XPBD_NOT_BODY_IGNORE; + else + return XPBD_BROKEN_ENCODING; + } +} + + +asn_dec_rval_t +BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + 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(asn_TYPE_descriptor_t *td, 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; + + (void)ilevel; + (void)flags; + + if(!st) _ASN_ENCODE_FAILED; + + if(*st) { + _ASN_CALLBACK("", 7); + er.encoded = 7; + } else { + _ASN_CALLBACK("", 8); + er.encoded = 8; + } + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +int +BOOLEAN_print(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(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + if(td && ptr && !contents_only) { + FREEMEM(ptr); + } +} + +asn_dec_rval_t +BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + 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; + + 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(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; + asn_enc_rval_t er; + + (void)constraints; + + if(!st) _ASN_ENCODE_FAILED; + + per_put_few_bits(po, *st ? 1 : 0, 1); + + _ASN_ENCODED_OK(er); +} diff --git a/src/core/libs/supl/asn-supl/BOOLEAN.h b/src/core/libs/supl/asn-supl/BOOLEAN.h new file mode 100644 index 000000000..217d0f163 --- /dev/null +++ b/src/core/libs/supl/asn-supl/BOOLEAN.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2003 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; + +asn_struct_free_f BOOLEAN_free; +asn_struct_print_f BOOLEAN_print; +ber_type_decoder_f BOOLEAN_decode_ber; +der_type_encoder_f BOOLEAN_encode_der; +xer_type_decoder_f BOOLEAN_decode_xer; +xer_type_encoder_f BOOLEAN_encode_xer; +per_type_decoder_f BOOLEAN_decode_uper; +per_type_encoder_f BOOLEAN_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _BOOLEAN_H_ */ diff --git a/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c new file mode 100644 index 000000000..0445a22cb --- /dev/null +++ b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CPICH-Ec-N0.h" + +int +CPICH_Ec_N0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +CPICH_Ec_N0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +CPICH_Ec_N0_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +CPICH_Ec_N0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +CPICH_Ec_N0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +CPICH_Ec_N0_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +CPICH_Ec_N0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +CPICH_Ec_N0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +CPICH_Ec_N0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +CPICH_Ec_N0_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_CPICH_Ec_N0_constr_1 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_CPICH_Ec_N0_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_CPICH_Ec_N0 = { + "CPICH-Ec-N0", + "CPICH-Ec-N0", + CPICH_Ec_N0_free, + CPICH_Ec_N0_print, + CPICH_Ec_N0_constraint, + CPICH_Ec_N0_decode_ber, + CPICH_Ec_N0_encode_der, + CPICH_Ec_N0_decode_xer, + CPICH_Ec_N0_encode_xer, + CPICH_Ec_N0_decode_uper, + CPICH_Ec_N0_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CPICH_Ec_N0_tags_1, + sizeof(asn_DEF_CPICH_Ec_N0_tags_1) + /sizeof(asn_DEF_CPICH_Ec_N0_tags_1[0]), /* 1 */ + asn_DEF_CPICH_Ec_N0_tags_1, /* Same as above */ + sizeof(asn_DEF_CPICH_Ec_N0_tags_1) + /sizeof(asn_DEF_CPICH_Ec_N0_tags_1[0]), /* 1 */ + &asn_PER_type_CPICH_Ec_N0_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h new file mode 100644 index 000000000..164ff7b32 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CPICH_Ec_N0_H_ +#define _CPICH_Ec_N0_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CPICH-Ec-N0 */ +typedef long CPICH_Ec_N0_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CPICH_Ec_N0; +asn_struct_free_f CPICH_Ec_N0_free; +asn_struct_print_f CPICH_Ec_N0_print; +asn_constr_check_f CPICH_Ec_N0_constraint; +ber_type_decoder_f CPICH_Ec_N0_decode_ber; +der_type_encoder_f CPICH_Ec_N0_encode_der; +xer_type_decoder_f CPICH_Ec_N0_decode_xer; +xer_type_encoder_f CPICH_Ec_N0_encode_xer; +per_type_decoder_f CPICH_Ec_N0_decode_uper; +per_type_encoder_f CPICH_Ec_N0_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CPICH_Ec_N0_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/CPICH-RSCP.c b/src/core/libs/supl/asn-supl/CPICH-RSCP.c new file mode 100644 index 000000000..81726e708 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CPICH-RSCP.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CPICH-RSCP.h" + +int +CPICH_RSCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +CPICH_RSCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +CPICH_RSCP_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +CPICH_RSCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +CPICH_RSCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +CPICH_RSCP_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +CPICH_RSCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +CPICH_RSCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +CPICH_RSCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +CPICH_RSCP_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CPICH_RSCP_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_CPICH_RSCP_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_CPICH_RSCP_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_CPICH_RSCP = { + "CPICH-RSCP", + "CPICH-RSCP", + CPICH_RSCP_free, + CPICH_RSCP_print, + CPICH_RSCP_constraint, + CPICH_RSCP_decode_ber, + CPICH_RSCP_encode_der, + CPICH_RSCP_decode_xer, + CPICH_RSCP_encode_xer, + CPICH_RSCP_decode_uper, + CPICH_RSCP_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CPICH_RSCP_tags_1, + sizeof(asn_DEF_CPICH_RSCP_tags_1) + /sizeof(asn_DEF_CPICH_RSCP_tags_1[0]), /* 1 */ + asn_DEF_CPICH_RSCP_tags_1, /* Same as above */ + sizeof(asn_DEF_CPICH_RSCP_tags_1) + /sizeof(asn_DEF_CPICH_RSCP_tags_1[0]), /* 1 */ + &asn_PER_type_CPICH_RSCP_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/CPICH-RSCP.h b/src/core/libs/supl/asn-supl/CPICH-RSCP.h new file mode 100644 index 000000000..80551bb1c --- /dev/null +++ b/src/core/libs/supl/asn-supl/CPICH-RSCP.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CPICH_RSCP_H_ +#define _CPICH_RSCP_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CPICH-RSCP */ +typedef long CPICH_RSCP_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CPICH_RSCP; +asn_struct_free_f CPICH_RSCP_free; +asn_struct_print_f CPICH_RSCP_print; +asn_constr_check_f CPICH_RSCP_constraint; +ber_type_decoder_f CPICH_RSCP_decode_ber; +der_type_encoder_f CPICH_RSCP_encode_der; +xer_type_decoder_f CPICH_RSCP_decode_xer; +xer_type_encoder_f CPICH_RSCP_encode_xer; +per_type_decoder_f CPICH_RSCP_decode_uper; +per_type_encoder_f CPICH_RSCP_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CPICH_RSCP_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/CdmaCellInformation.c b/src/core/libs/supl/asn-supl/CdmaCellInformation.c new file mode 100644 index 000000000..d08ecc007 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CdmaCellInformation.c @@ -0,0 +1,369 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CdmaCellInformation.h" + +static int +memb_refNID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refSID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 32767)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refBASEID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refBASELAT_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4194303)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_reBASELONG_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refREFPN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refWeekNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refSeconds_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 4194303)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refNID_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refSID_constr_3 = { + { APC_CONSTRAINED, 15, 15, 0, 32767 } /* (0..32767) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refBASEID_constr_4 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refBASELAT_constr_5 = { + { APC_CONSTRAINED, 22, -1, 0, 4194303 } /* (0..4194303) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_reBASELONG_constr_6 = { + { APC_CONSTRAINED, 23, -1, 0, 8388607 } /* (0..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refREFPN_constr_7 = { + { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refWeekNumber_constr_8 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refSeconds_constr_9 = { + { APC_CONSTRAINED, 22, -1, 0, 4194303 } /* (0..4194303) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_CdmaCellInformation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refNID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refNID_constraint_1, + &asn_PER_memb_refNID_constr_2, + 0, + "refNID" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refSID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refSID_constraint_1, + &asn_PER_memb_refSID_constr_3, + 0, + "refSID" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refBASEID), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refBASEID_constraint_1, + &asn_PER_memb_refBASEID_constr_4, + 0, + "refBASEID" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refBASELAT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refBASELAT_constraint_1, + &asn_PER_memb_refBASELAT_constr_5, + 0, + "refBASELAT" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, reBASELONG), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_reBASELONG_constraint_1, + &asn_PER_memb_reBASELONG_constr_6, + 0, + "reBASELONG" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refREFPN), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refREFPN_constraint_1, + &asn_PER_memb_refREFPN_constr_7, + 0, + "refREFPN" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refWeekNumber), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refWeekNumber_constraint_1, + &asn_PER_memb_refWeekNumber_constr_8, + 0, + "refWeekNumber" + }, + { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refSeconds), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refSeconds_constraint_1, + &asn_PER_memb_refSeconds_constr_9, + 0, + "refSeconds" + }, +}; +static ber_tlv_tag_t asn_DEF_CdmaCellInformation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CdmaCellInformation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refNID at 92 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refSID at 93 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* refBASEID at 94 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* refBASELAT at 95 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* reBASELONG at 96 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* refREFPN at 97 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* refWeekNumber at 98 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* refSeconds at 99 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CdmaCellInformation_specs_1 = { + sizeof(struct CdmaCellInformation), + offsetof(struct CdmaCellInformation, _asn_ctx), + asn_MAP_CdmaCellInformation_tag2el_1, + 8, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 7, /* Start extensions */ + 9 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CdmaCellInformation = { + "CdmaCellInformation", + "CdmaCellInformation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CdmaCellInformation_tags_1, + sizeof(asn_DEF_CdmaCellInformation_tags_1) + /sizeof(asn_DEF_CdmaCellInformation_tags_1[0]), /* 1 */ + asn_DEF_CdmaCellInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_CdmaCellInformation_tags_1) + /sizeof(asn_DEF_CdmaCellInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_CdmaCellInformation_1, + 8, /* Elements count */ + &asn_SPC_CdmaCellInformation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/CdmaCellInformation.h b/src/core/libs/supl/asn-supl/CdmaCellInformation.h new file mode 100644 index 000000000..6ee49963e --- /dev/null +++ b/src/core/libs/supl/asn-supl/CdmaCellInformation.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CdmaCellInformation_H_ +#define _CdmaCellInformation_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CdmaCellInformation */ +typedef struct CdmaCellInformation { + long refNID; + long refSID; + long refBASEID; + long refBASELAT; + long reBASELONG; + long refREFPN; + long refWeekNumber; + long refSeconds; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CdmaCellInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CdmaCellInformation; + +#ifdef __cplusplus +} +#endif + +#endif /* _CdmaCellInformation_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/CellInfo.c b/src/core/libs/supl/asn-supl/CellInfo.c new file mode 100644 index 000000000..77eb080ba --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellInfo.c @@ -0,0 +1,80 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CellInfo.h" + +static asn_per_constraints_t asn_PER_type_CellInfo_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 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_CellInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.gsmCell), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_GsmCellInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "gsmCell" + }, + { ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.wcdmaCell), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_WcdmaCellInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "wcdmaCell" + }, + { ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.cdmaCell), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CdmaCellInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cdmaCell" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_CellInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gsmCell at 61 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* wcdmaCell at 62 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* cdmaCell at 63 */ +}; +static asn_CHOICE_specifics_t asn_SPC_CellInfo_specs_1 = { + sizeof(struct CellInfo), + offsetof(struct CellInfo, _asn_ctx), + offsetof(struct CellInfo, present), + sizeof(((struct CellInfo *)0)->present), + asn_MAP_CellInfo_tag2el_1, + 3, /* Count of tags in the map */ + 0, + 3 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_CellInfo = { + "CellInfo", + "CellInfo", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_CellInfo_constr_1, + asn_MBR_CellInfo_1, + 3, /* Elements count */ + &asn_SPC_CellInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/CellInfo.h b/src/core/libs/supl/asn-supl/CellInfo.h new file mode 100644 index 000000000..c797c2699 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellInfo.h @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CellInfo_H_ +#define _CellInfo_H_ + + +#include + +/* Including external dependencies */ +#include "GsmCellInformation.h" +#include "WcdmaCellInformation.h" +#include "CdmaCellInformation.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum CellInfo_PR { + CellInfo_PR_NOTHING, /* No components present */ + CellInfo_PR_gsmCell, + CellInfo_PR_wcdmaCell, + CellInfo_PR_cdmaCell, + /* Extensions may appear below */ + +} CellInfo_PR; + +/* CellInfo */ +typedef struct CellInfo { + CellInfo_PR present; + union CellInfo_u { + GsmCellInformation_t gsmCell; + WcdmaCellInformation_t wcdmaCell; + CdmaCellInformation_t cdmaCell; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CellInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CellInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _CellInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResults.c b/src/core/libs/supl/asn-supl/CellMeasuredResults.c new file mode 100644 index 000000000..0b1a9f7c1 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellMeasuredResults.c @@ -0,0 +1,344 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CellMeasuredResults.h" + +static int +memb_cellIdentity_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 268435455)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_type_modeSpecificInfo_constr_3 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_cellIdentity_constr_2 = { + { APC_CONSTRAINED, 28, -1, 0, 268435455 } /* (0..268435455) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_fdd_4[] = { + { ATF_NOFLAGS, 0, offsetof(struct fdd, primaryCPICH_Info), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PrimaryCPICH_Info, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "primaryCPICH-Info" + }, + { ATF_POINTER, 3, offsetof(struct fdd, cpich_Ec_N0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CPICH_Ec_N0, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cpich-Ec-N0" + }, + { ATF_POINTER, 2, offsetof(struct fdd, cpich_RSCP), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CPICH_RSCP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cpich-RSCP" + }, + { ATF_POINTER, 1, offsetof(struct fdd, pathloss), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Pathloss, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "pathloss" + }, +}; +static int asn_MAP_fdd_oms_4[] = { 1, 2, 3 }; +static ber_tlv_tag_t asn_DEF_fdd_tags_4[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_fdd_tag2el_4[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* primaryCPICH-Info at 163 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cpich-Ec-N0 at 164 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* cpich-RSCP at 165 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* pathloss at 166 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_fdd_specs_4 = { + sizeof(struct fdd), + offsetof(struct fdd, _asn_ctx), + asn_MAP_fdd_tag2el_4, + 4, /* Count of tags in the map */ + asn_MAP_fdd_oms_4, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_fdd_4 = { + "fdd", + "fdd", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_fdd_tags_4, + sizeof(asn_DEF_fdd_tags_4) + /sizeof(asn_DEF_fdd_tags_4[0]) - 1, /* 1 */ + asn_DEF_fdd_tags_4, /* Same as above */ + sizeof(asn_DEF_fdd_tags_4) + /sizeof(asn_DEF_fdd_tags_4[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_fdd_4, + 4, /* Elements count */ + &asn_SPC_fdd_specs_4 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_tdd_9[] = { + { ATF_NOFLAGS, 0, offsetof(struct tdd, cellParametersID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellParametersID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cellParametersID" + }, + { ATF_POINTER, 4, offsetof(struct tdd, proposedTGSN), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TGSN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "proposedTGSN" + }, + { ATF_POINTER, 3, offsetof(struct tdd, primaryCCPCH_RSCP), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PrimaryCCPCH_RSCP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "primaryCCPCH-RSCP" + }, + { ATF_POINTER, 2, offsetof(struct tdd, pathloss), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Pathloss, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "pathloss" + }, + { ATF_POINTER, 1, offsetof(struct tdd, timeslotISCP_List), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeslotISCP_List, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timeslotISCP-List" + }, +}; +static int asn_MAP_tdd_oms_9[] = { 1, 2, 3, 4 }; +static ber_tlv_tag_t asn_DEF_tdd_tags_9[] = { + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_tdd_tag2el_9[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellParametersID at 168 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* proposedTGSN at 169 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* primaryCCPCH-RSCP at 170 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pathloss at 171 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* timeslotISCP-List at 172 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_tdd_specs_9 = { + sizeof(struct tdd), + offsetof(struct tdd, _asn_ctx), + asn_MAP_tdd_tag2el_9, + 5, /* Count of tags in the map */ + asn_MAP_tdd_oms_9, /* Optional members */ + 4, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_tdd_9 = { + "tdd", + "tdd", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_tdd_tags_9, + sizeof(asn_DEF_tdd_tags_9) + /sizeof(asn_DEF_tdd_tags_9[0]) - 1, /* 1 */ + asn_DEF_tdd_tags_9, /* Same as above */ + sizeof(asn_DEF_tdd_tags_9) + /sizeof(asn_DEF_tdd_tags_9[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_tdd_9, + 5, /* Elements count */ + &asn_SPC_tdd_specs_9 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_modeSpecificInfo_3[] = { + { ATF_NOFLAGS, 0, offsetof(struct modeSpecificInfo, choice.fdd), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + 0, + &asn_DEF_fdd_4, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fdd" + }, + { ATF_NOFLAGS, 0, offsetof(struct modeSpecificInfo, choice.tdd), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + 0, + &asn_DEF_tdd_9, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tdd" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_modeSpecificInfo_tag2el_3[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fdd at 163 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* tdd at 168 */ +}; +static asn_CHOICE_specifics_t asn_SPC_modeSpecificInfo_specs_3 = { + sizeof(struct modeSpecificInfo), + offsetof(struct modeSpecificInfo, _asn_ctx), + offsetof(struct modeSpecificInfo, present), + sizeof(((struct modeSpecificInfo *)0)->present), + asn_MAP_modeSpecificInfo_tag2el_3, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_modeSpecificInfo_3 = { + "modeSpecificInfo", + "modeSpecificInfo", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_modeSpecificInfo_constr_3, + asn_MBR_modeSpecificInfo_3, + 2, /* Elements count */ + &asn_SPC_modeSpecificInfo_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_CellMeasuredResults_1[] = { + { ATF_POINTER, 1, offsetof(struct CellMeasuredResults, cellIdentity), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_cellIdentity_constraint_1, + &asn_PER_memb_cellIdentity_constr_2, + 0, + "cellIdentity" + }, + { ATF_NOFLAGS, 0, offsetof(struct CellMeasuredResults, modeSpecificInfo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_modeSpecificInfo_3, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "modeSpecificInfo" + }, +}; +static int asn_MAP_CellMeasuredResults_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_CellMeasuredResults_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CellMeasuredResults_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellIdentity at 160 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* modeSpecificInfo at 166 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CellMeasuredResults_specs_1 = { + sizeof(struct CellMeasuredResults), + offsetof(struct CellMeasuredResults, _asn_ctx), + asn_MAP_CellMeasuredResults_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_CellMeasuredResults_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CellMeasuredResults = { + "CellMeasuredResults", + "CellMeasuredResults", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CellMeasuredResults_tags_1, + sizeof(asn_DEF_CellMeasuredResults_tags_1) + /sizeof(asn_DEF_CellMeasuredResults_tags_1[0]), /* 1 */ + asn_DEF_CellMeasuredResults_tags_1, /* Same as above */ + sizeof(asn_DEF_CellMeasuredResults_tags_1) + /sizeof(asn_DEF_CellMeasuredResults_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_CellMeasuredResults_1, + 2, /* Elements count */ + &asn_SPC_CellMeasuredResults_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResults.h b/src/core/libs/supl/asn-supl/CellMeasuredResults.h new file mode 100644 index 000000000..8b1ccc72b --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellMeasuredResults.h @@ -0,0 +1,85 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CellMeasuredResults_H_ +#define _CellMeasuredResults_H_ + + +#include + +/* Including external dependencies */ +#include +#include "PrimaryCPICH-Info.h" +#include "CPICH-Ec-N0.h" +#include "CPICH-RSCP.h" +#include "Pathloss.h" +#include +#include "CellParametersID.h" +#include "TGSN.h" +#include "PrimaryCCPCH-RSCP.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum modeSpecificInfo_PR { + modeSpecificInfo_PR_NOTHING, /* No components present */ + modeSpecificInfo_PR_fdd, + modeSpecificInfo_PR_tdd +} modeSpecificInfo_PR; + +/* Forward declarations */ +struct TimeslotISCP_List; + +/* CellMeasuredResults */ +typedef struct CellMeasuredResults { + long *cellIdentity /* OPTIONAL */; + struct modeSpecificInfo { + modeSpecificInfo_PR present; + union CellMeasuredResults__modeSpecificInfo_u { + struct fdd { + PrimaryCPICH_Info_t primaryCPICH_Info; + CPICH_Ec_N0_t *cpich_Ec_N0 /* OPTIONAL */; + CPICH_RSCP_t *cpich_RSCP /* OPTIONAL */; + Pathloss_t *pathloss /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } fdd; + struct tdd { + CellParametersID_t cellParametersID; + TGSN_t *proposedTGSN /* OPTIONAL */; + PrimaryCCPCH_RSCP_t *primaryCCPCH_RSCP /* OPTIONAL */; + Pathloss_t *pathloss /* OPTIONAL */; + struct TimeslotISCP_List *timeslotISCP_List /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } tdd; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } modeSpecificInfo; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CellMeasuredResults_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CellMeasuredResults; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "TimeslotISCP-List.h" + +#endif /* _CellMeasuredResults_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c new file mode 100644 index 000000000..567dcf35f --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CellMeasuredResultsList.h" + +static asn_per_constraints_t asn_PER_type_CellMeasuredResultsList_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_CellMeasuredResultsList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_CellMeasuredResults, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_CellMeasuredResultsList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_CellMeasuredResultsList_specs_1 = { + sizeof(struct CellMeasuredResultsList), + offsetof(struct CellMeasuredResultsList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_CellMeasuredResultsList = { + "CellMeasuredResultsList", + "CellMeasuredResultsList", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CellMeasuredResultsList_tags_1, + sizeof(asn_DEF_CellMeasuredResultsList_tags_1) + /sizeof(asn_DEF_CellMeasuredResultsList_tags_1[0]), /* 1 */ + asn_DEF_CellMeasuredResultsList_tags_1, /* Same as above */ + sizeof(asn_DEF_CellMeasuredResultsList_tags_1) + /sizeof(asn_DEF_CellMeasuredResultsList_tags_1[0]), /* 1 */ + &asn_PER_type_CellMeasuredResultsList_constr_1, + asn_MBR_CellMeasuredResultsList_1, + 1, /* Single element */ + &asn_SPC_CellMeasuredResultsList_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h new file mode 100644 index 000000000..5fa99af82 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CellMeasuredResultsList_H_ +#define _CellMeasuredResultsList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct CellMeasuredResults; + +/* CellMeasuredResultsList */ +typedef struct CellMeasuredResultsList { + A_SEQUENCE_OF(struct CellMeasuredResults) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CellMeasuredResultsList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CellMeasuredResultsList; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "CellMeasuredResults.h" + +#endif /* _CellMeasuredResultsList_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/CellParametersID.c b/src/core/libs/supl/asn-supl/CellParametersID.c new file mode 100644 index 000000000..4092e8585 --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellParametersID.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "CellParametersID.h" + +int +CellParametersID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +CellParametersID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +CellParametersID_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + CellParametersID_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +CellParametersID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +CellParametersID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +CellParametersID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +CellParametersID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +CellParametersID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +CellParametersID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +CellParametersID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CellParametersID_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_CellParametersID_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_CellParametersID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_CellParametersID = { + "CellParametersID", + "CellParametersID", + CellParametersID_free, + CellParametersID_print, + CellParametersID_constraint, + CellParametersID_decode_ber, + CellParametersID_encode_der, + CellParametersID_decode_xer, + CellParametersID_encode_xer, + CellParametersID_decode_uper, + CellParametersID_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CellParametersID_tags_1, + sizeof(asn_DEF_CellParametersID_tags_1) + /sizeof(asn_DEF_CellParametersID_tags_1[0]), /* 1 */ + asn_DEF_CellParametersID_tags_1, /* Same as above */ + sizeof(asn_DEF_CellParametersID_tags_1) + /sizeof(asn_DEF_CellParametersID_tags_1[0]), /* 1 */ + &asn_PER_type_CellParametersID_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/CellParametersID.h b/src/core/libs/supl/asn-supl/CellParametersID.h new file mode 100644 index 000000000..b331debbd --- /dev/null +++ b/src/core/libs/supl/asn-supl/CellParametersID.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _CellParametersID_H_ +#define _CellParametersID_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CellParametersID */ +typedef long CellParametersID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CellParametersID; +asn_struct_free_f CellParametersID_free; +asn_struct_print_f CellParametersID_print; +asn_constr_check_f CellParametersID_constraint; +ber_type_decoder_f CellParametersID_decode_ber; +der_type_encoder_f CellParametersID_encode_der; +xer_type_decoder_f CellParametersID_decode_xer; +xer_type_encoder_f CellParametersID_encode_xer; +per_type_decoder_f CellParametersID_decode_uper; +per_type_encoder_f CellParametersID_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CellParametersID_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/DUMMY.c b/src/core/libs/supl/asn-supl/DUMMY.c new file mode 100644 index 000000000..11edcf77d --- /dev/null +++ b/src/core/libs/supl/asn-supl/DUMMY.c @@ -0,0 +1,123 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP" + * found in "../supl-ulp.asn" + */ + +#include "DUMMY.h" + +int +DUMMY_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_INTEGER.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using INTEGER, + * so here we adjust the DEF accordingly. + */ +static void +DUMMY_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_INTEGER.per_constraints; + td->elements = asn_DEF_INTEGER.elements; + td->elements_count = asn_DEF_INTEGER.elements_count; + td->specifics = asn_DEF_INTEGER.specifics; +} + +void +DUMMY_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + DUMMY_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +DUMMY_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +DUMMY_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +DUMMY_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +DUMMY_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +DUMMY_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +DUMMY_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +DUMMY_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + DUMMY_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static ber_tlv_tag_t asn_DEF_DUMMY_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_DUMMY = { + "DUMMY", + "DUMMY", + DUMMY_free, + DUMMY_print, + DUMMY_constraint, + DUMMY_decode_ber, + DUMMY_encode_der, + DUMMY_decode_xer, + DUMMY_encode_xer, + DUMMY_decode_uper, + DUMMY_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_DUMMY_tags_1, + sizeof(asn_DEF_DUMMY_tags_1) + /sizeof(asn_DEF_DUMMY_tags_1[0]), /* 1 */ + asn_DEF_DUMMY_tags_1, /* Same as above */ + sizeof(asn_DEF_DUMMY_tags_1) + /sizeof(asn_DEF_DUMMY_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/DUMMY.h b/src/core/libs/supl/asn-supl/DUMMY.h new file mode 100644 index 000000000..c9385e2cb --- /dev/null +++ b/src/core/libs/supl/asn-supl/DUMMY.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP" + * found in "../supl-ulp.asn" + */ + +#ifndef _DUMMY_H_ +#define _DUMMY_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* DUMMY */ +typedef INTEGER_t DUMMY_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DUMMY; +asn_struct_free_f DUMMY_free; +asn_struct_print_f DUMMY_print; +asn_constr_check_f DUMMY_constraint; +ber_type_decoder_f DUMMY_decode_ber; +der_type_encoder_f DUMMY_encode_der; +xer_type_decoder_f DUMMY_decode_xer; +xer_type_encoder_f DUMMY_encode_xer; +per_type_decoder_f DUMMY_decode_uper; +per_type_encoder_f DUMMY_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _DUMMY_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/ENUMERATED.c b/src/core/libs/supl/asn-supl/ENUMERATED.c new file mode 100644 index 000000000..90761a2d7 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ENUMERATED.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2003, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include /* Encoder and decoder of a primitive type */ + +/* + * ENUMERATED basic type description. + */ +static ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { + "ENUMERATED", + "ENUMERATED", + ASN__PRIMITIVE_TYPE_free, + INTEGER_print, /* Implemented in terms of INTEGER */ + asn_generic_no_constraint, + ber_decode_primitive, + INTEGER_encode_der, /* Implemented in terms of INTEGER */ + INTEGER_decode_xer, /* This is temporary! */ + INTEGER_encode_xer, + ENUMERATED_decode_uper, /* Unaligned PER decoder */ + ENUMERATED_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ENUMERATED_tags, + sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), + asn_DEF_ENUMERATED_tags, /* Same as above */ + sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_dec_rval_t +ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rval; + ENUMERATED_t *st = (ENUMERATED_t *)*sptr; + long value; + void *vptr = &value; + + if(!st) { + st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) _ASN_DECODE_FAILED; + } + + rval = NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, + (void **)&vptr, pd); + if(rval.code == RC_OK) + if(asn_long2INTEGER(st, value)) + rval.code = RC_FAIL; + return rval; +} + +asn_enc_rval_t +ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + ENUMERATED_t *st = (ENUMERATED_t *)sptr; + long value; + + if(asn_INTEGER2long(st, &value)) + _ASN_ENCODE_FAILED; + + return NativeEnumerated_encode_uper(td, constraints, &value, po); +} + diff --git a/src/core/libs/supl/asn-supl/ENUMERATED.h b/src/core/libs/supl/asn-supl/ENUMERATED.h new file mode 100644 index 000000000..542dcae94 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ENUMERATED.h @@ -0,0 +1,25 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ENUMERATED_H_ +#define _ENUMERATED_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef INTEGER_t ENUMERATED_t; /* Implemented via INTEGER */ + +extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED; + +per_type_decoder_f ENUMERATED_decode_uper; +per_type_encoder_f ENUMERATED_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _ENUMERATED_H_ */ diff --git a/src/core/libs/supl/asn-supl/EncodingType.c b/src/core/libs/supl/asn-supl/EncodingType.c new file mode 100644 index 000000000..ff25bfa80 --- /dev/null +++ b/src/core/libs/supl/asn-supl/EncodingType.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "EncodingType.h" + +int +EncodingType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +EncodingType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +EncodingType_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + EncodingType_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +EncodingType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +EncodingType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +EncodingType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +EncodingType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +EncodingType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +EncodingType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +EncodingType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + EncodingType_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_EncodingType_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_EncodingType_value2enum_1[] = { + { 0, 4, "ucs2" }, + { 1, 10, "gsmDefault" }, + { 2, 4, "utf8" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_EncodingType_enum2value_1[] = { + 1, /* gsmDefault(1) */ + 0, /* ucs2(0) */ + 2 /* utf8(2) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_EncodingType_specs_1 = { + asn_MAP_EncodingType_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_EncodingType_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 4, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_EncodingType_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_EncodingType = { + "EncodingType", + "EncodingType", + EncodingType_free, + EncodingType_print, + EncodingType_constraint, + EncodingType_decode_ber, + EncodingType_encode_der, + EncodingType_decode_xer, + EncodingType_encode_xer, + EncodingType_decode_uper, + EncodingType_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_EncodingType_tags_1, + sizeof(asn_DEF_EncodingType_tags_1) + /sizeof(asn_DEF_EncodingType_tags_1[0]), /* 1 */ + asn_DEF_EncodingType_tags_1, /* Same as above */ + sizeof(asn_DEF_EncodingType_tags_1) + /sizeof(asn_DEF_EncodingType_tags_1[0]), /* 1 */ + &asn_PER_type_EncodingType_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_EncodingType_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/EncodingType.h b/src/core/libs/supl/asn-supl/EncodingType.h new file mode 100644 index 000000000..4dd21e4be --- /dev/null +++ b/src/core/libs/supl/asn-supl/EncodingType.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _EncodingType_H_ +#define _EncodingType_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum EncodingType { + EncodingType_ucs2 = 0, + EncodingType_gsmDefault = 1, + EncodingType_utf8 = 2 + /* + * Enumeration is extensible + */ +} e_EncodingType; + +/* EncodingType */ +typedef ENUMERATED_t EncodingType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_EncodingType; +asn_struct_free_f EncodingType_free; +asn_struct_print_f EncodingType_print; +asn_constr_check_f EncodingType_constraint; +ber_type_decoder_f EncodingType_decode_ber; +der_type_encoder_f EncodingType_encode_der; +xer_type_decoder_f EncodingType_decode_xer; +xer_type_encoder_f EncodingType_encode_xer; +per_type_decoder_f EncodingType_decode_uper; +per_type_encoder_f EncodingType_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _EncodingType_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/FQDN.c b/src/core/libs/supl/asn-supl/FQDN.c new file mode 100644 index 000000000..84c9d1f0a --- /dev/null +++ b/src/core/libs/supl/asn-supl/FQDN.c @@ -0,0 +1,190 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "FQDN.h" + +static int permitted_alphabet_table_1[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, /* -. */ + 3, 4, 5, 6, 7, 8, 9,10,11,12, 0, 0, 0, 0, 0, 0, /* 0123456789 */ + 0,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, /* ABCDEFGHIJKLMNO */ +28,29,30,31,32,33,34,35,36,37,38, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ + 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ +54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ +}; +static int permitted_alphabet_code2value_1[64] = { +45,46,48,49,50,51,52,53,54,55,56,57,65,66,67,68, +69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84, +85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106, +107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, +}; + + +static int check_permitted_alphabet_1(const void *sptr) { + int *table = permitted_alphabet_table_1; + /* The underlying type is VisibleString */ + const VisibleString_t *st = (const VisibleString_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!table[cv]) return -1; + } + return 0; +} + +int +FQDN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const VisibleString_t *st = (const VisibleString_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 255) + && !check_permitted_alphabet_1(st)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int asn_PER_MAP_FQDN_1_v2c(unsigned int value) { + if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) + return -1; + return permitted_alphabet_table_1[value] - 1; +} +static int asn_PER_MAP_FQDN_1_c2v(unsigned int code) { + if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) + return -1; + return permitted_alphabet_code2value_1[code]; +} +/* + * This type is implemented using VisibleString, + * so here we adjust the DEF accordingly. + */ +static void +FQDN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_VisibleString.free_struct; + td->print_struct = asn_DEF_VisibleString.print_struct; + td->ber_decoder = asn_DEF_VisibleString.ber_decoder; + td->der_encoder = asn_DEF_VisibleString.der_encoder; + td->xer_decoder = asn_DEF_VisibleString.xer_decoder; + td->xer_encoder = asn_DEF_VisibleString.xer_encoder; + td->uper_decoder = asn_DEF_VisibleString.uper_decoder; + td->uper_encoder = asn_DEF_VisibleString.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_VisibleString.per_constraints; + td->elements = asn_DEF_VisibleString.elements; + td->elements_count = asn_DEF_VisibleString.elements_count; + td->specifics = asn_DEF_VisibleString.specifics; +} + +void +FQDN_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FQDN_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FQDN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FQDN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FQDN_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FQDN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FQDN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FQDN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FQDN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FQDN_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FQDN_constr_1 = { + { APC_CONSTRAINED, 6, 6, 45, 122 } /* (45..122) */, + { APC_CONSTRAINED, 8, 8, 1, 255 } /* (SIZE(1..255)) */, + asn_PER_MAP_FQDN_1_v2c, /* Value to PER code map */ + asn_PER_MAP_FQDN_1_c2v /* PER code to value map */ +}; +static ber_tlv_tag_t asn_DEF_FQDN_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FQDN = { + "FQDN", + "FQDN", + FQDN_free, + FQDN_print, + FQDN_constraint, + FQDN_decode_ber, + FQDN_encode_der, + FQDN_decode_xer, + FQDN_encode_xer, + FQDN_decode_uper, + FQDN_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FQDN_tags_1, + sizeof(asn_DEF_FQDN_tags_1) + /sizeof(asn_DEF_FQDN_tags_1[0]), /* 1 */ + asn_DEF_FQDN_tags_1, /* Same as above */ + sizeof(asn_DEF_FQDN_tags_1) + /sizeof(asn_DEF_FQDN_tags_1[0]), /* 1 */ + &asn_PER_type_FQDN_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/FQDN.h b/src/core/libs/supl/asn-supl/FQDN.h new file mode 100644 index 000000000..37291766a --- /dev/null +++ b/src/core/libs/supl/asn-supl/FQDN.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _FQDN_H_ +#define _FQDN_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FQDN */ +typedef VisibleString_t FQDN_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FQDN; +asn_struct_free_f FQDN_free; +asn_struct_print_f FQDN_print; +asn_constr_check_f FQDN_constraint; +ber_type_decoder_f FQDN_decode_ber; +der_type_encoder_f FQDN_encode_der; +xer_type_decoder_f FQDN_decode_xer; +xer_type_encoder_f FQDN_encode_xer; +per_type_decoder_f FQDN_decode_uper; +per_type_encoder_f FQDN_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FQDN_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/FormatIndicator.c b/src/core/libs/supl/asn-supl/FormatIndicator.c new file mode 100644 index 000000000..9a17c684c --- /dev/null +++ b/src/core/libs/supl/asn-supl/FormatIndicator.c @@ -0,0 +1,159 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "FormatIndicator.h" + +int +FormatIndicator_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +FormatIndicator_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +FormatIndicator_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +FormatIndicator_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +FormatIndicator_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +FormatIndicator_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +FormatIndicator_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +FormatIndicator_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +FormatIndicator_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +FormatIndicator_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + FormatIndicator_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_FormatIndicator_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 7 } /* (0..7,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_FormatIndicator_value2enum_1[] = { + { 0, 11, "logicalName" }, + { 1, 13, "e-mailAddress" }, + { 2, 6, "msisdn" }, + { 3, 3, "url" }, + { 4, 6, "sipUrl" }, + { 5, 3, "min" }, + { 6, 3, "mdn" }, + { 7, 17, "imsPublicIdentity" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_FormatIndicator_enum2value_1[] = { + 1, /* e-mailAddress(1) */ + 7, /* imsPublicIdentity(7) */ + 0, /* logicalName(0) */ + 6, /* mdn(6) */ + 5, /* min(5) */ + 2, /* msisdn(2) */ + 4, /* sipUrl(4) */ + 3 /* url(3) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_FormatIndicator_specs_1 = { + asn_MAP_FormatIndicator_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FormatIndicator_enum2value_1, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 9, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_FormatIndicator_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_FormatIndicator = { + "FormatIndicator", + "FormatIndicator", + FormatIndicator_free, + FormatIndicator_print, + FormatIndicator_constraint, + FormatIndicator_decode_ber, + FormatIndicator_encode_der, + FormatIndicator_decode_xer, + FormatIndicator_encode_xer, + FormatIndicator_decode_uper, + FormatIndicator_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FormatIndicator_tags_1, + sizeof(asn_DEF_FormatIndicator_tags_1) + /sizeof(asn_DEF_FormatIndicator_tags_1[0]), /* 1 */ + asn_DEF_FormatIndicator_tags_1, /* Same as above */ + sizeof(asn_DEF_FormatIndicator_tags_1) + /sizeof(asn_DEF_FormatIndicator_tags_1[0]), /* 1 */ + &asn_PER_type_FormatIndicator_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_FormatIndicator_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/FormatIndicator.h b/src/core/libs/supl/asn-supl/FormatIndicator.h new file mode 100644 index 000000000..6ac65a25d --- /dev/null +++ b/src/core/libs/supl/asn-supl/FormatIndicator.h @@ -0,0 +1,55 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _FormatIndicator_H_ +#define _FormatIndicator_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum FormatIndicator { + FormatIndicator_logicalName = 0, + FormatIndicator_e_mailAddress = 1, + FormatIndicator_msisdn = 2, + FormatIndicator_url = 3, + FormatIndicator_sipUrl = 4, + FormatIndicator_min = 5, + FormatIndicator_mdn = 6, + FormatIndicator_imsPublicIdentity = 7 + /* + * Enumeration is extensible + */ +} e_FormatIndicator; + +/* FormatIndicator */ +typedef ENUMERATED_t FormatIndicator_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FormatIndicator; +asn_struct_free_f FormatIndicator_free; +asn_struct_print_f FormatIndicator_print; +asn_constr_check_f FormatIndicator_constraint; +ber_type_decoder_f FormatIndicator_decode_ber; +der_type_encoder_f FormatIndicator_encode_der; +xer_type_decoder_f FormatIndicator_decode_xer; +xer_type_encoder_f FormatIndicator_encode_xer; +per_type_decoder_f FormatIndicator_decode_uper; +per_type_encoder_f FormatIndicator_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _FormatIndicator_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/FrequencyInfo.c b/src/core/libs/supl/asn-supl/FrequencyInfo.c new file mode 100644 index 000000000..6aa75a010 --- /dev/null +++ b/src/core/libs/supl/asn-supl/FrequencyInfo.c @@ -0,0 +1,122 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "FrequencyInfo.h" + +static asn_per_constraints_t asn_PER_type_fmodeSpecificInfo_constr_2 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_fmodeSpecificInfo_2[] = { + { ATF_NOFLAGS, 0, offsetof(struct fmodeSpecificInfo, choice.fdd), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfoFDD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fdd" + }, + { ATF_NOFLAGS, 0, offsetof(struct fmodeSpecificInfo, choice.tdd), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfoTDD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tdd" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_fmodeSpecificInfo_tag2el_2[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fdd at 122 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* tdd at 123 */ +}; +static asn_CHOICE_specifics_t asn_SPC_fmodeSpecificInfo_specs_2 = { + sizeof(struct fmodeSpecificInfo), + offsetof(struct fmodeSpecificInfo, _asn_ctx), + offsetof(struct fmodeSpecificInfo, present), + sizeof(((struct fmodeSpecificInfo *)0)->present), + asn_MAP_fmodeSpecificInfo_tag2el_2, + 2, /* Count of tags in the map */ + 0, + 2 /* Extensions start */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_fmodeSpecificInfo_2 = { + "fmodeSpecificInfo", + "fmodeSpecificInfo", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_fmodeSpecificInfo_constr_2, + asn_MBR_fmodeSpecificInfo_2, + 2, /* Elements count */ + &asn_SPC_fmodeSpecificInfo_specs_2 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_FrequencyInfo_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfo, fmodeSpecificInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_fmodeSpecificInfo_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fmodeSpecificInfo" + }, +}; +static ber_tlv_tag_t asn_DEF_FrequencyInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_FrequencyInfo_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* fmodeSpecificInfo at 122 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfo_specs_1 = { + sizeof(struct FrequencyInfo), + offsetof(struct FrequencyInfo, _asn_ctx), + asn_MAP_FrequencyInfo_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FrequencyInfo = { + "FrequencyInfo", + "FrequencyInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FrequencyInfo_tags_1, + sizeof(asn_DEF_FrequencyInfo_tags_1) + /sizeof(asn_DEF_FrequencyInfo_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfo_tags_1) + /sizeof(asn_DEF_FrequencyInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FrequencyInfo_1, + 1, /* Elements count */ + &asn_SPC_FrequencyInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/FrequencyInfo.h b/src/core/libs/supl/asn-supl/FrequencyInfo.h new file mode 100644 index 000000000..3bdeb0ba5 --- /dev/null +++ b/src/core/libs/supl/asn-supl/FrequencyInfo.h @@ -0,0 +1,65 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _FrequencyInfo_H_ +#define _FrequencyInfo_H_ + + +#include + +/* Including external dependencies */ +#include "FrequencyInfoFDD.h" +#include "FrequencyInfoTDD.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum fmodeSpecificInfo_PR { + fmodeSpecificInfo_PR_NOTHING, /* No components present */ + fmodeSpecificInfo_PR_fdd, + fmodeSpecificInfo_PR_tdd, + /* Extensions may appear below */ + +} fmodeSpecificInfo_PR; + +/* FrequencyInfo */ +typedef struct FrequencyInfo { + struct fmodeSpecificInfo { + fmodeSpecificInfo_PR present; + union FrequencyInfo__fmodeSpecificInfo_u { + FrequencyInfoFDD_t fdd; + FrequencyInfoTDD_t tdd; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } fmodeSpecificInfo; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FrequencyInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FrequencyInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrequencyInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c new file mode 100644 index 000000000..cdc31c52c --- /dev/null +++ b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "FrequencyInfoFDD.h" + +static asn_TYPE_member_t asn_MBR_FrequencyInfoFDD_1[] = { + { ATF_POINTER, 1, offsetof(struct FrequencyInfoFDD, uarfcn_UL), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UARFCN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uarfcn-UL" + }, + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoFDD, uarfcn_DL), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UARFCN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uarfcn-DL" + }, +}; +static int asn_MAP_FrequencyInfoFDD_oms_1[] = { 0 }; +static ber_tlv_tag_t asn_DEF_FrequencyInfoFDD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_FrequencyInfoFDD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uarfcn-UL at 128 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* uarfcn-DL at 129 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoFDD_specs_1 = { + sizeof(struct FrequencyInfoFDD), + offsetof(struct FrequencyInfoFDD, _asn_ctx), + asn_MAP_FrequencyInfoFDD_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_FrequencyInfoFDD_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FrequencyInfoFDD = { + "FrequencyInfoFDD", + "FrequencyInfoFDD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FrequencyInfoFDD_tags_1, + sizeof(asn_DEF_FrequencyInfoFDD_tags_1) + /sizeof(asn_DEF_FrequencyInfoFDD_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfoFDD_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfoFDD_tags_1) + /sizeof(asn_DEF_FrequencyInfoFDD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FrequencyInfoFDD_1, + 2, /* Elements count */ + &asn_SPC_FrequencyInfoFDD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h new file mode 100644 index 000000000..3ed4ee8d8 --- /dev/null +++ b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _FrequencyInfoFDD_H_ +#define _FrequencyInfoFDD_H_ + + +#include + +/* Including external dependencies */ +#include "UARFCN.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FrequencyInfoFDD */ +typedef struct FrequencyInfoFDD { + UARFCN_t *uarfcn_UL /* OPTIONAL */; + UARFCN_t uarfcn_DL; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FrequencyInfoFDD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FrequencyInfoFDD; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrequencyInfoFDD_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c new file mode 100644 index 000000000..2b6057e37 --- /dev/null +++ b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "FrequencyInfoTDD.h" + +static asn_TYPE_member_t asn_MBR_FrequencyInfoTDD_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoTDD, uarfcn_Nt), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UARFCN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uarfcn-Nt" + }, +}; +static ber_tlv_tag_t asn_DEF_FrequencyInfoTDD_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_FrequencyInfoTDD_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* uarfcn-Nt at 132 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoTDD_specs_1 = { + sizeof(struct FrequencyInfoTDD), + offsetof(struct FrequencyInfoTDD, _asn_ctx), + asn_MAP_FrequencyInfoTDD_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_FrequencyInfoTDD = { + "FrequencyInfoTDD", + "FrequencyInfoTDD", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_FrequencyInfoTDD_tags_1, + sizeof(asn_DEF_FrequencyInfoTDD_tags_1) + /sizeof(asn_DEF_FrequencyInfoTDD_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfoTDD_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfoTDD_tags_1) + /sizeof(asn_DEF_FrequencyInfoTDD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_FrequencyInfoTDD_1, + 1, /* Elements count */ + &asn_SPC_FrequencyInfoTDD_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h new file mode 100644 index 000000000..f0d6f0e13 --- /dev/null +++ b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _FrequencyInfoTDD_H_ +#define _FrequencyInfoTDD_H_ + + +#include + +/* Including external dependencies */ +#include "UARFCN.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* FrequencyInfoTDD */ +typedef struct FrequencyInfoTDD { + UARFCN_t uarfcn_Nt; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} FrequencyInfoTDD_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_FrequencyInfoTDD; + +#ifdef __cplusplus +} +#endif + +#endif /* _FrequencyInfoTDD_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/GeneralizedTime.c b/src/core/libs/supl/asn-supl/GeneralizedTime.c new file mode 100644 index 000000000..9d683efe4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/GeneralizedTime.c @@ -0,0 +1,692 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#define _POSIX_PTHREAD_SEMANTICS /* for Sun */ +#define _REENTRANT /* for Sun */ +#include +#include +#include + +#ifdef __CYGWIN__ +#include "/usr/include/time.h" +#else +#include +#endif /* __CYGWIN__ */ + +#if defined(WIN32) +#pragma message( "PLEASE STOP AND READ!") +#pragma message( " localtime_r is implemented via localtime(), which may be not thread-safe.") +#pragma message( " gmtime_r is implemented via gmtime(), which may be not thread-safe.") +#pragma message( " ") +#pragma message( " You must fix the code by inserting appropriate locking") +#pragma message( " if you want to use asn_GT2time() or asn_UT2time().") +#pragma message( "PLEASE STOP AND READ!") + +static struct tm *localtime_r(const time_t *tloc, struct tm *result) { + struct tm *tm; + if((tm = localtime(tloc))) + return memcpy(result, tm, sizeof(struct tm)); + return 0; +} + +static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { + struct tm *tm; + if((tm = gmtime(tloc))) + return memcpy(result, tm, sizeof(struct tm)); + return 0; +} + +#define tzset() _tzset() +#define putenv(c) _putenv(c) +#define _EMULATE_TIMEGM + +#endif /* WIN32 */ + +#if defined(sun) || defined(_sun_) || defined(__solaris__) +#define _EMULATE_TIMEGM +#endif + +/* + * Where to look for offset from GMT, Phase I. + * Several platforms are known. + */ +#if defined(__FreeBSD__) \ + || (defined(__GNUC__) && defined(__APPLE_CC__)) \ + || (defined __GLIBC__ && __GLIBC__ >= 2) +#undef HAVE_TM_GMTOFF +#define HAVE_TM_GMTOFF +#endif /* BSDs and newer glibc */ + +/* + * Where to look for offset from GMT, Phase II. + */ +#ifdef HAVE_TM_GMTOFF +#define GMTOFF(tm) ((tm).tm_gmtoff) +#else /* HAVE_TM_GMTOFF */ +#define GMTOFF(tm) (-timezone) +#endif /* HAVE_TM_GMTOFF */ + +#if (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF)) +#warning "PLEASE STOP AND READ!" +#warning " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe." +#warning " " +#warning " You must fix the code by inserting appropriate locking" +#warning " if you want to use asn_GT2time() or asn_UT2time()." +#warning "PLEASE STOP AND READ!" +#endif /* _EMULATE_TIMEGM */ + +/* + * Override our GMTOFF decision for other known platforms. + */ +#ifdef __CYGWIN__ +#undef GMTOFF +static long GMTOFF(struct tm a){ + struct tm *lt; + time_t local_time, gmt_time; + long zone; + + tzset(); + gmt_time = time (NULL); + + lt = gmtime(&gmt_time); + + local_time = mktime(lt); + return (gmt_time - local_time); +} +#define _EMULATE_TIMEGM + +#endif /* __CYGWIN__ */ + +#define ATZVARS do { \ + char tzoldbuf[64]; \ + char *tzold +#define ATZSAVETZ do { \ + tzold = getenv("TZ"); \ + if(tzold) { \ + size_t tzlen = strlen(tzold); \ + if(tzlen < sizeof(tzoldbuf)) { \ + tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \ + } else { \ + char *dupptr = tzold; \ + tzold = MALLOC(tzlen + 1); \ + if(tzold) memcpy(tzold, dupptr, tzlen + 1); \ + } \ + setenv("TZ", "UTC", 1); \ + } \ + tzset(); \ +} while(0) +#define ATZOLDTZ do { \ + if (tzold) { \ + setenv("TZ", tzold, 1); \ + *tzoldbuf = 0; \ + if(tzold != tzoldbuf) \ + FREEMEM(tzold); \ + } else { \ + unsetenv("TZ"); \ + } \ + tzset(); \ +} while(0); } while(0); + +#ifdef _EMULATE_TIMEGM +static time_t timegm(struct tm *tm) { + time_t tloc; + ATZVARS; + ATZSAVETZ; + tloc = mktime(tm); + ATZOLDTZ; + return tloc; +} +#endif /* _EMULATE_TIMEGM */ + + +#ifndef __ASN_INTERNAL_TEST_MODE__ + +/* + * GeneralizedTime basic type description. + */ +static ber_tlv_tag_t asn_DEF_GeneralizedTime_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (24 << 2)), /* [UNIVERSAL 24] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +static asn_per_constraints_t asn_DEF_GeneralizedTime_constraints = { + { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = { + "GeneralizedTime", + "GeneralizedTime", + OCTET_STRING_free, + GeneralizedTime_print, + GeneralizedTime_constraint, /* Check validity of time */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + GeneralizedTime_encode_der, + OCTET_STRING_decode_xer_utf8, + GeneralizedTime_encode_xer, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GeneralizedTime_tags, + sizeof(asn_DEF_GeneralizedTime_tags) + / sizeof(asn_DEF_GeneralizedTime_tags[0]) - 2, + asn_DEF_GeneralizedTime_tags, + sizeof(asn_DEF_GeneralizedTime_tags) + / sizeof(asn_DEF_GeneralizedTime_tags[0]), + &asn_DEF_GeneralizedTime_constraints, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +#endif /* __ASN_INTERNAL_TEST_MODE__ */ + +/* + * Check that the time looks like the time. + */ +int +GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; + time_t tloc; + + errno = EPERM; /* Just an unlikely error code */ + tloc = asn_GT2time(st, 0, 0); + if(tloc == -1 && errno != EPERM) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: Invalid time format: %s (%s:%d)", + td->name, strerror(errno), __FILE__, __LINE__); + return -1; + } + + return 0; +} + +asn_enc_rval_t +GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + GeneralizedTime_t *st = (GeneralizedTime_t *)sptr; + asn_enc_rval_t erval; + int fv, fd; /* seconds fraction value and number of digits */ + struct tm tm; + time_t tloc; + + /* + * Encode as a canonical DER. + */ + errno = EPERM; + tloc = asn_GT2time_frac(st, &fv, &fd, &tm, 1); /* Recognize time */ + if(tloc == -1 && errno != EPERM) + /* Failed to recognize time. Fail completely. */ + _ASN_ENCODE_FAILED; + + st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */ + if(!st) _ASN_ENCODE_FAILED; /* Memory allocation failure. */ + + erval = OCTET_STRING_encode_der(td, st, tag_mode, tag, cb, app_key); + + FREEMEM(st->buf); + FREEMEM(st); + + return erval; +} + +#ifndef __ASN_INTERNAL_TEST_MODE__ + +asn_enc_rval_t +GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + + if(flags & XER_F_CANONICAL) { + GeneralizedTime_t *gt; + asn_enc_rval_t rv; + int fv, fd; /* fractional parts */ + struct tm tm; + + errno = EPERM; + if(asn_GT2time_frac((GeneralizedTime_t *)sptr, + &fv, &fd, &tm, 1) == -1 + && errno != EPERM) + _ASN_ENCODE_FAILED; + + gt = asn_time2GT_frac(0, &tm, fv, fd, 1); + if(!gt) _ASN_ENCODE_FAILED; + + rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, + cb, app_key); + ASN_STRUCT_FREE(asn_DEF_GeneralizedTime, gt); + return rv; + } else { + return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, + cb, app_key); + } +} + +#endif /* __ASN_INTERNAL_TEST_MODE__ */ + +int +GeneralizedTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(st && st->buf) { + char buf[32]; + struct tm tm; + int ret; + + errno = EPERM; + if(asn_GT2time(st, &tm, 1) == -1 && errno != EPERM) + return (cb("", 11, app_key) < 0) ? -1 : 0; + + ret = snprintf(buf, sizeof(buf), + "%04d-%02d-%02d %02d:%02d:%02d (GMT)", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + assert(ret > 0 && ret < (int)sizeof(buf)); + return (cb(buf, ret, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +time_t +asn_GT2time(const GeneralizedTime_t *st, struct tm *ret_tm, int as_gmt) { + return asn_GT2time_frac(st, 0, 0, ret_tm, as_gmt); +} + +time_t +asn_GT2time_prec(const GeneralizedTime_t *st, int *frac_value, int frac_digits, struct tm *ret_tm, int as_gmt) { + time_t tloc; + int fv, fd = 0; + + if(frac_value) + tloc = asn_GT2time_frac(st, &fv, &fd, ret_tm, as_gmt); + else + return asn_GT2time_frac(st, 0, 0, ret_tm, as_gmt); + if(fd == 0 || frac_digits <= 0) { + *frac_value = 0; + } else { + while(fd > frac_digits) + fv /= 10, fd--; + while(fd < frac_digits) { + int new_fv = fv * 10; + if(new_fv / 10 != fv) { + /* Too long precision request */ + fv = 0; + break; + } + fv = new_fv, fd++; + } + + *frac_value = fv; + } + + return tloc; +} + +time_t +asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value, int *frac_digits, struct tm *ret_tm, int as_gmt) { + struct tm tm_s; + uint8_t *buf; + uint8_t *end; + int gmtoff_h = 0; + int gmtoff_m = 0; + int gmtoff = 0; /* h + m */ + int offset_specified = 0; + int fvalue = 0; + int fdigits = 0; + time_t tloc; + + if(!st || !st->buf) { + errno = EINVAL; + return -1; + } else { + buf = st->buf; + end = buf + st->size; + } + + if(st->size < 10) { + errno = EINVAL; + return -1; + } + + /* + * Decode first 10 bytes: "AAAAMMJJhh" + */ + memset(&tm_s, 0, sizeof(tm_s)); +#undef B2F +#undef B2T +#define B2F(var) do { \ + unsigned ch = *buf; \ + if(ch < 0x30 || ch > 0x39) { \ + errno = EINVAL; \ + return -1; \ + } else { \ + var = var * 10 + (ch - 0x30); \ + buf++; \ + } \ + } while(0) +#define B2T(var) B2F(tm_s.var) + + B2T(tm_year); /* 1: A */ + B2T(tm_year); /* 2: A */ + B2T(tm_year); /* 3: A */ + B2T(tm_year); /* 4: A */ + B2T(tm_mon); /* 5: M */ + B2T(tm_mon); /* 6: M */ + B2T(tm_mday); /* 7: J */ + B2T(tm_mday); /* 8: J */ + B2T(tm_hour); /* 9: h */ + B2T(tm_hour); /* 0: h */ + + if(buf == end) goto local_finish; + + /* + * Parse [mm[ss[(.|,)ffff]]] + * ^^ + */ + switch(*buf) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + tm_s.tm_min = (*buf++) - 0x30; + if(buf == end) { errno = EINVAL; return -1; } + B2T(tm_min); + break; + case 0x2B: case 0x2D: /* +, - */ + goto offset; + case 0x5A: /* Z */ + goto utc_finish; + default: + errno = EINVAL; + return -1; + } + + if(buf == end) goto local_finish; + + /* + * Parse [mm[ss[(.|,)ffff]]] + * ^^ + */ + switch(*buf) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + tm_s.tm_sec = (*buf++) - 0x30; + if(buf == end) { errno = EINVAL; return -1; } + B2T(tm_sec); + break; + case 0x2B: case 0x2D: /* +, - */ + goto offset; + case 0x5A: /* Z */ + goto utc_finish; + default: + errno = EINVAL; + return -1; + } + + if(buf == end) goto local_finish; + + /* + * Parse [mm[ss[(.|,)ffff]]] + * ^ ^ + */ + switch(*buf) { + case 0x2C: case 0x2E: /* (.|,) */ + /* + * Process fractions of seconds. + */ + for(buf++; buf < end; buf++) { + int v = *buf; + int new_fvalue; + switch(v) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + new_fvalue = fvalue * 10 + (v - 0x30); + if(new_fvalue / 10 != fvalue) { + /* Not enough precision, ignore */ + } else { + fvalue = new_fvalue; + fdigits++; + } + continue; + default: + break; + } + break; + } + } + + if(buf == end) goto local_finish; + + switch(*buf) { + case 0x2B: case 0x2D: /* +, - */ + goto offset; + case 0x5A: /* Z */ + goto utc_finish; + default: + errno = EINVAL; + return -1; + } + + +offset: + + if(end - buf < 3) { + errno = EINVAL; + return -1; + } + buf++; + B2F(gmtoff_h); + B2F(gmtoff_h); + if(buf[-3] == 0x2D) /* Negative */ + gmtoff = -1; + else + gmtoff = 1; + + if((end - buf) == 2) { + B2F(gmtoff_m); + B2F(gmtoff_m); + } else if(end != buf) { + errno = EINVAL; + return -1; + } + + gmtoff = gmtoff * (3600 * gmtoff_h + 60 * gmtoff_m); + + /* Fall through */ +utc_finish: + + offset_specified = 1; + + /* Fall through */ +local_finish: + + /* + * Validation. + */ + if((tm_s.tm_mon > 12 || tm_s.tm_mon < 1) + || (tm_s.tm_mday > 31 || tm_s.tm_mday < 1) + || (tm_s.tm_hour > 23) + || (tm_s.tm_sec > 60) + ) { + errno = EINVAL; + return -1; + } + + /* Canonicalize */ + tm_s.tm_mon -= 1; /* 0 - 11 */ + tm_s.tm_year -= 1900; + tm_s.tm_isdst = -1; + + tm_s.tm_sec -= gmtoff; + + /*** AT THIS POINT tm_s is either GMT or local (unknown) ****/ + + if(offset_specified) { + tloc = timegm(&tm_s); + } else { + /* + * Without an offset (or "Z"), + * we can only guess that it is a local zone. + * Interpret it in this fashion. + */ + tloc = mktime(&tm_s); + } + if(tloc == -1) { + errno = EINVAL; + return -1; + } + + if(ret_tm) { + if(as_gmt) { + if(offset_specified) { + *ret_tm = tm_s; + } else { + if(gmtime_r(&tloc, ret_tm) == 0) { + errno = EINVAL; + return -1; + } + } + } else { + if(localtime_r(&tloc, ret_tm) == 0) { + errno = EINVAL; + return -1; + } + } + } + + /* Fractions of seconds */ + if(frac_value) *frac_value = fvalue; + if(frac_digits) *frac_digits = fdigits; + + return tloc; +} + +GeneralizedTime_t * +asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, int force_gmt) { + return asn_time2GT_frac(opt_gt, tm, 0, 0, force_gmt); +} + +GeneralizedTime_t * +asn_time2GT_frac(GeneralizedTime_t *opt_gt, const struct tm *tm, int frac_value, int frac_digits, int force_gmt) { + struct tm tm_s; + long gmtoff; + const unsigned int buf_size = + 4 + 2 + 2 /* yyyymmdd */ + + 2 + 2 + 2 /* hhmmss */ + + 1 + 6 /* .ffffff */ + + 1 + 4 /* +hhmm */ + + 1 /* '\0' */ + ; + char *buf; + char *p; + int size; + + /* Check arguments */ + if(!tm) { + errno = EINVAL; + return 0; + } + + /* Pre-allocate a buffer of sufficient yet small length */ + buf = (char *)MALLOC(buf_size); + if(!buf) return 0; + + gmtoff = GMTOFF(*tm); + + if(force_gmt && gmtoff) { + tm_s = *tm; + tm_s.tm_sec -= gmtoff; + timegm(&tm_s); /* Fix the time */ + tm = &tm_s; +#ifdef HAVE_TM_GMTOFF + assert(!GMTOFF(tm_s)); /* Will fix itself */ +#else /* !HAVE_TM_GMTOFF */ + gmtoff = 0; +#endif + } + + size = snprintf(buf, buf_size, "%04d%02d%02d%02d%02d%02d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec + ); + if(size != 14) { + /* Could be assert(size == 14); */ + FREEMEM(buf); + errno = EINVAL; + return 0; + } + + p = buf + size; + + /* + * Deal with fractions. + */ + if(frac_value > 0 && frac_digits > 0) { + char *end = p + 1 + 6; /* '.' + maximum 6 digits */ + char *z = p; + long fbase; + *z++ = '.'; + + /* Place bounds on precision */ + while(frac_digits-- > 6) + frac_value /= 10; + + /* emulate fbase = pow(10, frac_digits) */ + for(fbase = 1; frac_digits--;) + fbase *= 10; + + do { + int digit = frac_value / fbase; + if(digit > 9) { z = 0; break; } + *z++ = digit + 0x30; + frac_value %= fbase; + fbase /= 10; + } while(fbase > 0 && frac_value > 0 && z < end); + if(z) { + for(--z; *z == 0x30; --z); /* Strip zeroes */ + p = z + (*z != '.'); + size = p - buf; + } + } + + if(force_gmt) { + *p++ = 0x5a; /* "Z" */ + *p++ = 0; + size++; + } else { + int ret; + gmtoff %= 86400; + ret = snprintf(p, buf_size - size, "%+03ld%02ld", + gmtoff / 3600, labs(gmtoff % 3600) / 60); + if(ret != 5) { + FREEMEM(buf); + errno = EINVAL; + return 0; + } + size += ret; + } + + if(opt_gt) { + if(opt_gt->buf) + FREEMEM(opt_gt->buf); + } else { + opt_gt = (GeneralizedTime_t *)CALLOC(1, sizeof *opt_gt); + if(!opt_gt) { FREEMEM(buf); return 0; } + } + + opt_gt->buf = (unsigned char *)buf; + opt_gt->size = size; + + return opt_gt; +} + + diff --git a/src/core/libs/supl/asn-supl/GeneralizedTime.h b/src/core/libs/supl/asn-supl/GeneralizedTime.h new file mode 100644 index 000000000..1ea06b068 --- /dev/null +++ b/src/core/libs/supl/asn-supl/GeneralizedTime.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _GeneralizedTime_H_ +#define _GeneralizedTime_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t GeneralizedTime_t; /* Implemented via OCTET STRING */ + +extern asn_TYPE_descriptor_t asn_DEF_GeneralizedTime; + +asn_struct_print_f GeneralizedTime_print; +asn_constr_check_f GeneralizedTime_constraint; +der_type_encoder_f GeneralizedTime_encode_der; +xer_type_encoder_f GeneralizedTime_encode_xer; + +/*********************** + * Some handy helpers. * + ***********************/ + +struct tm; /* */ + +/* + * Convert a GeneralizedTime structure into time_t + * and optionally into struct tm. + * If as_gmt is given, the resulting _optional_tm4fill will have a GMT zone, + * instead of default local one. + * On error returns -1 and errno set to EINVAL + */ +time_t asn_GT2time(const GeneralizedTime_t *, struct tm *_optional_tm4fill, + int as_gmt); + +/* A version of the above function also returning the fractions of seconds */ +time_t asn_GT2time_frac(const GeneralizedTime_t *, + int *frac_value, int *frac_digits, /* (value / (10 ^ digits)) */ + struct tm *_optional_tm4fill, int as_gmt); + +/* + * Another version returning fractions with defined precision + * For example, parsing of the time ending with ".1" seconds + * with frac_digits=3 (msec) would yield frac_value = 100. + */ +time_t asn_GT2time_prec(const GeneralizedTime_t *, + int *frac_value, int frac_digits, + struct tm *_optional_tm4fill, int as_gmt); + +/* + * Convert a struct tm into GeneralizedTime. + * If _optional_gt is not given, this function will try to allocate one. + * If force_gmt is given, the resulting GeneralizedTime will be forced + * into a GMT time zone (encoding ends with a "Z"). + * On error, this function returns 0 and sets errno. + */ +GeneralizedTime_t *asn_time2GT(GeneralizedTime_t *_optional_gt, + const struct tm *, int force_gmt); +GeneralizedTime_t *asn_time2GT_frac(GeneralizedTime_t *_optional_gt, + const struct tm *, int frac_value, int frac_digits, int force_gmt); + +#ifdef __cplusplus +} +#endif + +#endif /* _GeneralizedTime_H_ */ diff --git a/src/core/libs/supl/asn-supl/GsmCellInformation.c b/src/core/libs/supl/asn-supl/GsmCellInformation.c new file mode 100644 index 000000000..14aed828a --- /dev/null +++ b/src/core/libs/supl/asn-supl/GsmCellInformation.c @@ -0,0 +1,261 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "GsmCellInformation.h" + +static int +memb_refMCC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refMNC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refLAC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refCI_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_tA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refMCC_constr_2 = { + { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refMNC_constr_3 = { + { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refLAC_constr_4 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refCI_constr_5 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_tA_constr_7 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_GsmCellInformation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refMCC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refMCC_constraint_1, + &asn_PER_memb_refMCC_constr_2, + 0, + "refMCC" + }, + { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refMNC), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refMNC_constraint_1, + &asn_PER_memb_refMNC_constr_3, + 0, + "refMNC" + }, + { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refLAC), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refLAC_constraint_1, + &asn_PER_memb_refLAC_constr_4, + 0, + "refLAC" + }, + { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refCI), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refCI_constraint_1, + &asn_PER_memb_refCI_constr_5, + 0, + "refCI" + }, + { ATF_POINTER, 2, offsetof(struct GsmCellInformation, nMR), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NMR, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "nMR" + }, + { ATF_POINTER, 1, offsetof(struct GsmCellInformation, tA), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_tA_constraint_1, + &asn_PER_memb_tA_constr_7, + 0, + "tA" + }, +}; +static int asn_MAP_GsmCellInformation_oms_1[] = { 4, 5 }; +static ber_tlv_tag_t asn_DEF_GsmCellInformation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_GsmCellInformation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refMCC at 103 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refMNC at 104 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* refLAC at 105 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* refCI at 106 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* nMR at 107 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* tA at 108 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_GsmCellInformation_specs_1 = { + sizeof(struct GsmCellInformation), + offsetof(struct GsmCellInformation, _asn_ctx), + asn_MAP_GsmCellInformation_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_GsmCellInformation_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_GsmCellInformation = { + "GsmCellInformation", + "GsmCellInformation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_GsmCellInformation_tags_1, + sizeof(asn_DEF_GsmCellInformation_tags_1) + /sizeof(asn_DEF_GsmCellInformation_tags_1[0]), /* 1 */ + asn_DEF_GsmCellInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_GsmCellInformation_tags_1) + /sizeof(asn_DEF_GsmCellInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_GsmCellInformation_1, + 6, /* Elements count */ + &asn_SPC_GsmCellInformation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/GsmCellInformation.h b/src/core/libs/supl/asn-supl/GsmCellInformation.h new file mode 100644 index 000000000..6c978ebee --- /dev/null +++ b/src/core/libs/supl/asn-supl/GsmCellInformation.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _GsmCellInformation_H_ +#define _GsmCellInformation_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct NMR; + +/* GsmCellInformation */ +typedef struct GsmCellInformation { + long refMCC; + long refMNC; + long refLAC; + long refCI; + struct NMR *nMR /* OPTIONAL */; + long *tA /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} GsmCellInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_GsmCellInformation; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "NMR.h" + +#endif /* _GsmCellInformation_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Horandveruncert.c b/src/core/libs/supl/asn-supl/Horandveruncert.c new file mode 100644 index 000000000..6df8af075 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horandveruncert.c @@ -0,0 +1,325 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Horandveruncert.h" + +static int +memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 9)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_horuncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_veruncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_verdirect_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_bearing_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_horspeed_constr_4 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_verspeed_constr_5 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_horuncertspeed_constr_6 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_veruncertspeed_constr_7 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verdirect), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_verdirect_constraint_1, + &asn_PER_memb_verdirect_constr_2, + 0, + "verdirect" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, bearing), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_bearing_constraint_1, + &asn_PER_memb_bearing_constr_3, + 0, + "bearing" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horspeed), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_horspeed_constraint_1, + &asn_PER_memb_horspeed_constr_4, + 0, + "horspeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verspeed), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_verspeed_constraint_1, + &asn_PER_memb_verspeed_constr_5, + 0, + "verspeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horuncertspeed), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_horuncertspeed_constraint_1, + &asn_PER_memb_horuncertspeed_constr_6, + 0, + "horuncertspeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, veruncertspeed), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_veruncertspeed_constraint_1, + &asn_PER_memb_veruncertspeed_constr_7, + 0, + "veruncertspeed" + }, +}; +static ber_tlv_tag_t asn_DEF_Horandveruncert_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Horandveruncert_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* verdirect at 251 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bearing at 252 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* horspeed at 253 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* verspeed at 254 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* horuncertspeed at 255 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* veruncertspeed at 256 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Horandveruncert_specs_1 = { + sizeof(struct Horandveruncert), + offsetof(struct Horandveruncert, _asn_ctx), + asn_MAP_Horandveruncert_tag2el_1, + 6, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Horandveruncert = { + "Horandveruncert", + "Horandveruncert", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Horandveruncert_tags_1, + sizeof(asn_DEF_Horandveruncert_tags_1) + /sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ + asn_DEF_Horandveruncert_tags_1, /* Same as above */ + sizeof(asn_DEF_Horandveruncert_tags_1) + /sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Horandveruncert_1, + 6, /* Elements count */ + &asn_SPC_Horandveruncert_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Horandveruncert.h b/src/core/libs/supl/asn-supl/Horandveruncert.h new file mode 100644 index 000000000..e72377ddd --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horandveruncert.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Horandveruncert_H_ +#define _Horandveruncert_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Horandveruncert */ +typedef struct Horandveruncert { + BIT_STRING_t verdirect; + BIT_STRING_t bearing; + BIT_STRING_t horspeed; + BIT_STRING_t verspeed; + BIT_STRING_t horuncertspeed; + BIT_STRING_t veruncertspeed; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Horandveruncert_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Horandveruncert; + +#ifdef __cplusplus +} +#endif + +#endif /* _Horandveruncert_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Horandvervel.c b/src/core/libs/supl/asn-supl/Horandvervel.c new file mode 100644 index 000000000..cfc81cfc9 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horandvervel.c @@ -0,0 +1,233 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Horandvervel.h" + +static int +memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 1)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 9)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_verdirect_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_bearing_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_horspeed_constr_4 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_verspeed_constr_5 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verdirect), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_verdirect_constraint_1, + &asn_PER_memb_verdirect_constr_2, + 0, + "verdirect" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandvervel, bearing), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_bearing_constraint_1, + &asn_PER_memb_bearing_constr_3, + 0, + "bearing" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandvervel, horspeed), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_horspeed_constraint_1, + &asn_PER_memb_horspeed_constr_4, + 0, + "horspeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verspeed), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_verspeed_constraint_1, + &asn_PER_memb_verspeed_constr_5, + 0, + "verspeed" + }, +}; +static ber_tlv_tag_t asn_DEF_Horandvervel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Horandvervel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* verdirect at 238 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bearing at 239 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* horspeed at 240 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* verspeed at 241 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Horandvervel_specs_1 = { + sizeof(struct Horandvervel), + offsetof(struct Horandvervel, _asn_ctx), + asn_MAP_Horandvervel_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 3, /* Start extensions */ + 5 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Horandvervel = { + "Horandvervel", + "Horandvervel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Horandvervel_tags_1, + sizeof(asn_DEF_Horandvervel_tags_1) + /sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ + asn_DEF_Horandvervel_tags_1, /* Same as above */ + sizeof(asn_DEF_Horandvervel_tags_1) + /sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Horandvervel_1, + 4, /* Elements count */ + &asn_SPC_Horandvervel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Horandvervel.h b/src/core/libs/supl/asn-supl/Horandvervel.h new file mode 100644 index 000000000..dccb0ebfc --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horandvervel.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Horandvervel_H_ +#define _Horandvervel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Horandvervel */ +typedef struct Horandvervel { + BIT_STRING_t verdirect; + BIT_STRING_t bearing; + BIT_STRING_t horspeed; + BIT_STRING_t verspeed; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Horandvervel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Horandvervel; + +#ifdef __cplusplus +} +#endif + +#endif /* _Horandvervel_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Horvel.c b/src/core/libs/supl/asn-supl/Horvel.c new file mode 100644 index 000000000..bf9914452 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horvel.c @@ -0,0 +1,141 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Horvel.h" + +static int +memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 9)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_bearing_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_horspeed_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Horvel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Horvel, bearing), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_bearing_constraint_1, + &asn_PER_memb_bearing_constr_2, + 0, + "bearing" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horvel, horspeed), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_horspeed_constraint_1, + &asn_PER_memb_horspeed_constr_3, + 0, + "horspeed" + }, +}; +static ber_tlv_tag_t asn_DEF_Horvel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Horvel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bearing at 233 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* horspeed at 234 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Horvel_specs_1 = { + sizeof(struct Horvel), + offsetof(struct Horvel, _asn_ctx), + asn_MAP_Horvel_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Horvel = { + "Horvel", + "Horvel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Horvel_tags_1, + sizeof(asn_DEF_Horvel_tags_1) + /sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */ + asn_DEF_Horvel_tags_1, /* Same as above */ + sizeof(asn_DEF_Horvel_tags_1) + /sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Horvel_1, + 2, /* Elements count */ + &asn_SPC_Horvel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Horvel.h b/src/core/libs/supl/asn-supl/Horvel.h new file mode 100644 index 000000000..8dfca28c4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horvel.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Horvel_H_ +#define _Horvel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Horvel */ +typedef struct Horvel { + BIT_STRING_t bearing; + BIT_STRING_t horspeed; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Horvel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Horvel; + +#ifdef __cplusplus +} +#endif + +#endif /* _Horvel_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Horveluncert.c b/src/core/libs/supl/asn-supl/Horveluncert.c new file mode 100644 index 000000000..ca12ff352 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horveluncert.c @@ -0,0 +1,187 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Horveluncert.h" + +static int +memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 9)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_uncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_bearing_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_horspeed_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_uncertspeed_constr_4 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Horveluncert, bearing), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_bearing_constraint_1, + &asn_PER_memb_bearing_constr_2, + 0, + "bearing" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horveluncert, horspeed), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_horspeed_constraint_1, + &asn_PER_memb_horspeed_constr_3, + 0, + "horspeed" + }, + { ATF_NOFLAGS, 0, offsetof(struct Horveluncert, uncertspeed), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_uncertspeed_constraint_1, + &asn_PER_memb_uncertspeed_constr_4, + 0, + "uncertspeed" + }, +}; +static ber_tlv_tag_t asn_DEF_Horveluncert_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Horveluncert_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bearing at 245 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* horspeed at 246 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* uncertspeed at 247 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Horveluncert_specs_1 = { + sizeof(struct Horveluncert), + offsetof(struct Horveluncert, _asn_ctx), + asn_MAP_Horveluncert_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Horveluncert = { + "Horveluncert", + "Horveluncert", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Horveluncert_tags_1, + sizeof(asn_DEF_Horveluncert_tags_1) + /sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ + asn_DEF_Horveluncert_tags_1, /* Same as above */ + sizeof(asn_DEF_Horveluncert_tags_1) + /sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Horveluncert_1, + 3, /* Elements count */ + &asn_SPC_Horveluncert_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Horveluncert.h b/src/core/libs/supl/asn-supl/Horveluncert.h new file mode 100644 index 000000000..2dffd83ec --- /dev/null +++ b/src/core/libs/supl/asn-supl/Horveluncert.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Horveluncert_H_ +#define _Horveluncert_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Horveluncert */ +typedef struct Horveluncert { + BIT_STRING_t bearing; + BIT_STRING_t horspeed; + BIT_STRING_t uncertspeed; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Horveluncert_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Horveluncert; + +#ifdef __cplusplus +} +#endif + +#endif /* _Horveluncert_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/IA5String.c b/src/core/libs/supl/asn-supl/IA5String.c new file mode 100644 index 000000000..02ecd3ee7 --- /dev/null +++ b/src/core/libs/supl/asn-supl/IA5String.c @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +/* + * IA5String basic type description. + */ +static ber_tlv_tag_t asn_DEF_IA5String_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), /* [UNIVERSAL 22] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +static asn_per_constraints_t asn_DEF_IA5String_constraints = { + { APC_CONSTRAINED, 7, 7, 0, 0x7f }, /* Value */ + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_IA5String = { + "IA5String", + "IA5String", + OCTET_STRING_free, + OCTET_STRING_print_utf8, /* ASCII subset */ + IA5String_constraint, /* Constraint on the alphabet */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_utf8, + OCTET_STRING_encode_xer_utf8, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_IA5String_tags, + sizeof(asn_DEF_IA5String_tags) + / sizeof(asn_DEF_IA5String_tags[0]) - 1, + asn_DEF_IA5String_tags, + sizeof(asn_DEF_IA5String_tags) + / sizeof(asn_DEF_IA5String_tags[0]), + &asn_DEF_IA5String_constraints, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +int +IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + + if(st && st->buf) { + uint8_t *buf = st->buf; + uint8_t *end = buf + st->size; + /* + * IA5String is generally equivalent to 7bit ASCII. + * ISO/ITU-T T.50, 1963. + */ + for(; buf < end; buf++) { + if(*buf > 0x7F) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value byte %ld out of range: " + "%d > 127 (%s:%d)", + td->name, + (long)((buf - st->buf) + 1), + *buf, + __FILE__, __LINE__); + return -1; + } + } + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} + diff --git a/src/core/libs/supl/asn-supl/IA5String.h b/src/core/libs/supl/asn-supl/IA5String.h new file mode 100644 index 000000000..e2a909dd5 --- /dev/null +++ b/src/core/libs/supl/asn-supl/IA5String.h @@ -0,0 +1,27 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _IA5String_H_ +#define _IA5String_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t IA5String_t; /* Implemented via OCTET STRING */ + +/* + * IA5String ASN.1 type definition. + */ +extern asn_TYPE_descriptor_t asn_DEF_IA5String; + +asn_constr_check_f IA5String_constraint; + +#ifdef __cplusplus +} +#endif + +#endif /* _IA5String_H_ */ diff --git a/src/core/libs/supl/asn-supl/INTEGER.c b/src/core/libs/supl/asn-supl/INTEGER.c new file mode 100644 index 000000000..f016131a1 --- /dev/null +++ b/src/core/libs/supl/asn-supl/INTEGER.c @@ -0,0 +1,934 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include /* Encoder and decoder of a primitive type */ +#include + +/* + * INTEGER basic type description. + */ +static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_INTEGER = { + "INTEGER", + "INTEGER", + ASN__PRIMITIVE_TYPE_free, + INTEGER_print, + asn_generic_no_constraint, + ber_decode_primitive, + INTEGER_encode_der, + INTEGER_decode_xer, + INTEGER_encode_xer, + INTEGER_decode_uper, /* Unaligned PER decoder */ + INTEGER_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_INTEGER_tags, + sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), + asn_DEF_INTEGER_tags, /* Same as above */ + sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Encode INTEGER type using DER. + */ +asn_enc_rval_t +INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + INTEGER_t *st = (INTEGER_t *)sptr; + + ASN_DEBUG("%s %s as INTEGER (tm=%d)", + cb?"Encoding":"Estimating", td->name, tag_mode); + + /* + * Canonicalize integer in the buffer. + * (Remove too long sign extension, remove some first 0x00 bytes) + */ + if(st->buf) { + uint8_t *buf = st->buf; + uint8_t *end1 = buf + st->size - 1; + int shift; + + /* Compute the number of superfluous leading bytes */ + for(; buf < end1; buf++) { + /* + * If the contents octets of an integer value encoding + * consist of more than one octet, then the bits of the + * first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + switch(*buf) { + case 0x00: if((buf[1] & 0x80) == 0) + continue; + break; + case 0xff: if((buf[1] & 0x80)) + continue; + break; + } + break; + } + + /* Remove leading superfluous bytes from the integer */ + shift = buf - st->buf; + if(shift) { + uint8_t *nb = st->buf; + uint8_t *end; + + st->size -= shift; /* New size, minus bad bytes */ + end = nb + st->size; + + for(; nb < end; nb++, buf++) + *nb = *buf; + } + + } /* if(1) */ + + return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); +} + +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); + +/* + * INTEGER specific human-readable output. + */ +static ssize_t +INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit integer */ + uint8_t *buf = st->buf; + uint8_t *buf_end = st->buf + st->size; + signed long accum; + ssize_t wrote = 0; + char *p; + int ret; + + /* + * Advance buf pointer until the start of the value's body. + * This will make us able to process large integers using simple case, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip the insignificant leading bytes */ + for(; buf < buf_end-1; buf++) { + switch(*buf) { + case 0x00: if((buf[1] & 0x80) == 0) continue; break; + case 0xff: if((buf[1] & 0x80) != 0) continue; break; + } + break; + } + + /* Simple case: the integer size is small */ + if((size_t)(buf_end - buf) <= sizeof(accum)) { + const asn_INTEGER_enum_map_t *el; + size_t scrsize; + char *scr; + + if(buf == buf_end) { + accum = 0; + } else { + accum = (*buf & 0x80) ? -1 : 0; + for(; buf < buf_end; buf++) + accum = (accum << 8) | *buf; + } + + el = INTEGER_map_value2enum(specs, accum); + if(el) { + scrsize = el->enum_len + 32; + scr = (char *)alloca(scrsize); + if(plainOrXER == 0) + ret = snprintf(scr, scrsize, + "%ld (%s)", accum, el->enum_name); + else + ret = snprintf(scr, scrsize, + "<%s/>", el->enum_name); + } else if(plainOrXER && specs && specs->strict_enumeration) { + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } else { + scrsize = sizeof(scratch); + scr = scratch; + ret = snprintf(scr, scrsize, + (specs && specs->field_unsigned) + ?"%lu":"%ld", accum); + } + assert(ret > 0 && (size_t)ret < scrsize); + return (cb(scr, ret, app_key) < 0) ? -1 : ret; + } else if(plainOrXER && specs && specs->strict_enumeration) { + /* + * Here and earlier, we cannot encode the ENUMERATED values + * if there is no corresponding identifier. + */ + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } + + /* Output in the long xx:yy:zz... format */ + /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */ + for(p = scratch; buf < buf_end; buf++) { + static const char *h2c = "0123456789ABCDEF"; + if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) { + /* Flush buffer */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + wrote += p - scratch; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x3a; /* ":" */ + } + if(p != scratch) + p--; /* Remove the last ":" */ + + wrote += p - scratch; + return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote; +} + +/* + * INTEGER specific human-readable output. + */ +int +INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const INTEGER_t *st = (const INTEGER_t *)sptr; + ssize_t ret; + + (void)td; + (void)ilevel; + + if(!st || !st->buf) + ret = cb("", 8, app_key); + else + ret = INTEGER__dump(td, st, cb, app_key, 0); + + return (ret < 0) ? -1 : 0; +} + +struct e2v_key { + const char *start; + const char *stop; + asn_INTEGER_enum_map_t *vemap; + unsigned int *evmap; +}; +static int +INTEGER__compar_enum2value(const void *kp, const void *am) { + const struct e2v_key *key = (const struct e2v_key *)kp; + const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; + const char *ptr, *end, *name; + + /* Remap the element (sort by different criterion) */ + el = key->vemap + key->evmap[el - key->vemap]; + + /* Compare strings */ + for(ptr = key->start, end = key->stop, name = el->enum_name; + ptr < end; ptr++, name++) { + if(*ptr != *name) + return *(const unsigned char *)ptr + - *(const unsigned char *)name; + } + return name[0] ? -1 : 0; +} + +static const asn_INTEGER_enum_map_t * +INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { + asn_INTEGER_enum_map_t *el_found; + int count = specs ? specs->map_count : 0; + struct e2v_key key; + const char *lp; + + if(!count) return NULL; + + /* Guaranteed: assert(lstart < lstop); */ + /* Figure out the tag name */ + for(lstart++, lp = lstart; lp < lstop; lp++) { + switch(*lp) { + case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */ + case 0x2f: /* '/' */ case 0x3e: /* '>' */ + break; + default: + continue; + } + break; + } + if(lp == lstop) return NULL; /* No tag found */ + lstop = lp; + + key.start = lstart; + key.stop = lstop; + key.vemap = specs->value2enum; + key.evmap = specs->enum2value; + el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, + specs->value2enum, count, sizeof(specs->value2enum[0]), + INTEGER__compar_enum2value); + if(el_found) { + /* Remap enum2value into value2enum */ + el_found = key.vemap + key.evmap[el_found - key.vemap]; + } + return el_found; +} + +static int +INTEGER__compar_value2enum(const void *kp, const void *am) { + long a = *(const long *)kp; + const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; + long b = el->nat_value; + if(a < b) return -1; + else if(a == b) return 0; + else return 1; +} + +const asn_INTEGER_enum_map_t * +INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) { + int count = specs ? specs->map_count : 0; + if(!count) return 0; + return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, + count, sizeof(specs->value2enum[0]), + INTEGER__compar_value2enum); +} + +static int +INTEGER_st_prealloc(INTEGER_t *st, int min_size) { + void *p = MALLOC(min_size + 1); + if(p) { + void *b = st->buf; + st->size = 0; + st->buf = p; + FREEMEM(b); + return 0; + } else { + return -1; + } +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +static enum xer_pbd_rval +INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { + INTEGER_t *st = (INTEGER_t *)sptr; + long sign = 1; + long value; + const char *lp; + const char *lstart = (const char *)chunk_buf; + const char *lstop = lstart + chunk_size; + enum { + ST_SKIPSPACE, + ST_SKIPSPHEX, + ST_WAITDIGITS, + ST_DIGITS, + ST_HEXDIGIT1, + ST_HEXDIGIT2, + ST_HEXCOLON, + ST_EXTRASTUFF + } state = ST_SKIPSPACE; + + if(chunk_size) + ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", + (long)chunk_size, *lstart, lstop[-1]); + + /* + * We may have received a tag here. It will be processed inline. + * Use strtoul()-like code and serialize the result. + */ + for(value = 0, lp = lstart; lp < lstop; lp++) { + int lv = *lp; + switch(lv) { + case 0x09: case 0x0a: case 0x0d: case 0x20: + switch(state) { + case ST_SKIPSPACE: + case ST_SKIPSPHEX: + continue; + case ST_HEXCOLON: + if(xer_is_whitespace(lp, lstop - lp)) { + lp = lstop - 1; + continue; + } + break; + default: + break; + } + break; + case 0x2d: /* '-' */ + if(state == ST_SKIPSPACE) { + sign = -1; + state = ST_WAITDIGITS; + continue; + } + break; + case 0x2b: /* '+' */ + if(state == ST_SKIPSPACE) { + state = ST_WAITDIGITS; + continue; + } + break; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: + switch(state) { + case ST_DIGITS: break; + case ST_SKIPSPHEX: /* Fall through */ + case ST_HEXDIGIT1: + value = (lv - 0x30) << 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += (lv - 0x30); + state = ST_HEXCOLON; + st->buf[st->size++] = (uint8_t)value; + continue; + case ST_HEXCOLON: + return XPBD_BROKEN_ENCODING; + default: + state = ST_DIGITS; + break; + } + + { + long new_value = value * 10; + + if(new_value / 10 != value) + /* Overflow */ + return XPBD_DECODER_LIMIT; + + value = new_value + (lv - 0x30); + /* Check for two's complement overflow */ + if(value < 0) { + /* Check whether it is a LONG_MIN */ + if(sign == -1 + && (unsigned long)value + == ~((unsigned long)-1 >> 1)) { + sign = 1; + } else { + /* Overflow */ + return XPBD_DECODER_LIMIT; + } + } + } + continue; + case 0x3c: /* '<' */ + if(state == ST_SKIPSPACE) { + const asn_INTEGER_enum_map_t *el; + el = INTEGER_map_enum2value( + (asn_INTEGER_specifics_t *) + td->specifics, lstart, lstop); + if(el) { + ASN_DEBUG("Found \"%s\" => %ld", + el->enum_name, el->nat_value); + state = ST_DIGITS; + value = el->nat_value; + lp = lstop - 1; + continue; + } + ASN_DEBUG("Unknown identifier for INTEGER"); + } + return XPBD_BROKEN_ENCODING; + case 0x3a: /* ':' */ + if(state == ST_HEXCOLON) { + /* This colon is expected */ + state = ST_HEXDIGIT1; + continue; + } else if(state == ST_DIGITS) { + /* The colon here means that we have + * decoded the first two hexadecimal + * places as a decimal value. + * Switch decoding mode. */ + ASN_DEBUG("INTEGER re-evaluate as hex form"); + if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + } else { + ASN_DEBUG("state %d at %d", state, lp - lstart); + break; + } + /* [A-Fa-f] */ + case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46: + case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66: + switch(state) { + case ST_SKIPSPHEX: + case ST_SKIPSPACE: /* Fall through */ + case ST_HEXDIGIT1: + value = lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + value <<= 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + st->buf[st->size++] = (uint8_t)value; + state = ST_HEXCOLON; + continue; + case ST_DIGITS: + ASN_DEBUG("INTEGER re-evaluate as hex form"); + if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + default: + break; + } + break; + } + + /* Found extra non-numeric stuff */ + ASN_DEBUG("Found non-numeric 0x%2x at %d", + lv, lp - lstart); + state = ST_EXTRASTUFF; + break; + } + + switch(state) { + case ST_DIGITS: + /* Everything is cool */ + break; + case ST_HEXCOLON: + st->buf[st->size] = 0; /* Just in case termination */ + return XPBD_BODY_CONSUMED; + case ST_HEXDIGIT1: + case ST_HEXDIGIT2: + case ST_SKIPSPHEX: + return XPBD_BROKEN_ENCODING; + default: + if(xer_is_whitespace(lp, lstop - lp)) { + if(state != ST_EXTRASTUFF) + return XPBD_NOT_BODY_IGNORE; + break; + } else { + ASN_DEBUG("INTEGER: No useful digits (state %d)", + state); + return XPBD_BROKEN_ENCODING; /* No digits */ + } + break; + } + + value *= sign; /* Change sign, if needed */ + + if(asn_long2INTEGER(st, value)) + return XPBD_SYSTEM_FAILURE; + + return XPBD_BODY_CONSUMED; +} + +asn_dec_rval_t +INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + 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(INTEGER_t), opt_mname, + buf_ptr, size, INTEGER__xer_body_decode); +} + +asn_enc_rval_t +INTEGER_encode_xer(asn_TYPE_descriptor_t *td, 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; + + (void)ilevel; + (void)flags; + + if(!st || !st->buf) + _ASN_ENCODE_FAILED; + + er.encoded = INTEGER__dump(td, st, cb, app_key, 1); + if(er.encoded < 0) _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + +asn_dec_rval_t +INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + INTEGER_t *st = (INTEGER_t *)*sptr; + asn_per_constraint_t *ct; + int repeat; + + (void)opt_codec_ctx; + + if(!st) { + st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) _ASN_DECODE_FAILED; + } + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) _ASN_DECODE_STARVED; + if(inext) ct = 0; + } + + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + if(ct) { + if(ct->flags & APC_SEMI_CONSTRAINED) { + st->buf = (uint8_t *)CALLOC(1, 2); + if(!st->buf) _ASN_DECODE_FAILED; + st->size = 1; + } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { + size_t size = (ct->range_bits + 7) >> 3; + st->buf = (uint8_t *)MALLOC(1 + size + 1); + if(!st->buf) _ASN_DECODE_FAILED; + st->size = size; + } + } + + /* X.691, #12.2.2 */ + if(ct && ct->flags != APC_UNCONSTRAINED) { + /* #10.5.6 */ + ASN_DEBUG("Integer with range %d bits", ct->range_bits); + if(ct->range_bits >= 0) { + long value; + if(ct->range_bits == 32) { + long lhalf; + value = per_get_few_bits(pd, 16); + if(value < 0) _ASN_DECODE_STARVED; + lhalf = per_get_few_bits(pd, 16); + if(lhalf < 0) _ASN_DECODE_STARVED; + value = (value << 16) | lhalf; + } else { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) _ASN_DECODE_STARVED; + } + ASN_DEBUG("Got value %ld + low %ld", + value, ct->lower_bound); + value += ct->lower_bound; + if((specs && specs->field_unsigned) + ? asn_ulong2INTEGER(st, value) + : asn_long2INTEGER(st, value)) + _ASN_DECODE_FAILED; + return rval; + } + } else { + ASN_DEBUG("Decoding unconstrained integer %s", td->name); + } + + /* X.691, #12.2.3, #12.2.4 */ + do { + ssize_t len; + void *p; + int ret; + + /* Get the PER length */ + len = uper_get_length(pd, -1, &repeat); + if(len < 0) _ASN_DECODE_STARVED; + + p = REALLOC(st->buf, st->size + len + 1); + if(!p) _ASN_DECODE_FAILED; + st->buf = (uint8_t *)p; + + ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); + if(ret < 0) _ASN_DECODE_STARVED; + st->size += len; + } while(repeat); + st->buf[st->size] = 0; /* JIC */ + + /* #12.2.3 */ + if(ct && ct->lower_bound) { + /* + * TODO: replace by in-place arithmetics. + */ + long value; + if(asn_INTEGER2long(st, &value)) + _ASN_DECODE_FAILED; + if(asn_long2INTEGER(st, value + ct->lower_bound)) + _ASN_DECODE_FAILED; + } + + return rval; +} + +asn_enc_rval_t +INTEGER_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + INTEGER_t *st = (INTEGER_t *)sptr; + const uint8_t *buf; + const uint8_t *end; + asn_per_constraint_t *ct; + long value = 0; + + if(!st || st->size == 0) _ASN_ENCODE_FAILED; + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + er.encoded = 0; + + if(ct) { + int inext = 0; + if(specs && specs->field_unsigned) { + unsigned long uval; + if(asn_INTEGER2ulong(st, &uval)) + _ASN_ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(uval < (unsigned long)ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(uval < (unsigned long)ct->lower_bound + || uval > (unsigned long)ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", + uval, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + value = uval; + } else { + if(asn_INTEGER2long(st, &value)) + _ASN_ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(value < ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(value < ct->lower_bound + || value > ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", + value, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + _ASN_ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + _ASN_ENCODE_FAILED; + } + } + + + /* X.691, #12.2.2 */ + if(ct && ct->range_bits >= 0) { + /* #10.5.6 */ + ASN_DEBUG("Encoding integer with range %d bits", + ct->range_bits); + if(ct->range_bits == 32) { + /* TODO: extend to >32 bits */ + long v = value - ct->lower_bound; + if(per_put_few_bits(po, v >> 1, 31) + || per_put_few_bits(po, v, 1)) + _ASN_ENCODE_FAILED; + } else { + if(per_put_few_bits(po, value - ct->lower_bound, + ct->range_bits)) + _ASN_ENCODE_FAILED; + } + _ASN_ENCODED_OK(er); + } + + if(ct && ct->lower_bound) { + ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); + /* TODO: adjust lower bound */ + _ASN_ENCODE_FAILED; + } + + for(buf = st->buf, end = st->buf + st->size; buf < end;) { + ssize_t mayEncode = uper_put_length(po, end - buf); + if(mayEncode < 0) + _ASN_ENCODE_FAILED; + if(per_put_many_bits(po, buf, 8 * mayEncode)) + _ASN_ENCODE_FAILED; + buf += mayEncode; + } + + _ASN_ENCODED_OK(er); +} + +int +asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { + uint8_t *b, *end; + size_t size; + long l; + + /* Sanity checking */ + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + /* Cache the begin/end of the buffer */ + b = iptr->buf; /* Start of the INTEGER buffer */ + size = iptr->size; + end = b + size; /* Where to stop */ + + if(size > sizeof(long)) { + uint8_t *end1 = end - 1; + /* + * Slightly more advanced processing, + * able to >sizeof(long) bytes, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip out the insignificant leading bytes */ + for(; b < end1; b++) { + switch(*b) { + case 0x00: if((b[1] & 0x80) == 0) continue; break; + case 0xff: if((b[1] & 0x80) != 0) continue; break; + } + break; + } + + size = end - b; + if(size > sizeof(long)) { + /* Still cannot fit the long */ + errno = ERANGE; + return -1; + } + } + + /* Shortcut processing of a corner case */ + if(end == b) { + *lptr = 0; + return 0; + } + + /* Perform the sign initialization */ + /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ + if((*b >> 7)) l = -1; else l = 0; + + /* Conversion engine */ + for(; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + +int +asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { + uint8_t *b, *end; + unsigned long l; + size_t size; + + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + b = iptr->buf; + size = iptr->size; + end = b + size; + + /* If all extra leading bytes are zeroes, ignore them */ + for(; size > sizeof(unsigned long); b++, size--) { + if(*b) { + /* Value won't fit unsigned long */ + errno = ERANGE; + return -1; + } + } + + /* Conversion engine */ + for(l = 0; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + +int +asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { + uint8_t *buf; + uint8_t *end; + uint8_t *b; + int shr; + + if(value <= LONG_MAX) + return asn_long2INTEGER(st, value); + + buf = (uint8_t *)MALLOC(1 + sizeof(value)); + if(!buf) return -1; + + end = buf + (sizeof(value) + 1); + buf[0] = 0; + for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++) + *b = (uint8_t)(value >> shr); + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = 1 + sizeof(value); + + return 0; +} + +int +asn_long2INTEGER(INTEGER_t *st, long value) { + uint8_t *buf, *bp; + uint8_t *p; + uint8_t *pstart; + uint8_t *pend1; + int littleEndian = 1; /* Run-time detection */ + int add; + + if(!st) { + errno = EINVAL; + return -1; + } + + buf = (uint8_t *)MALLOC(sizeof(value)); + if(!buf) return -1; + + if(*(char *)&littleEndian) { + pstart = (uint8_t *)&value + sizeof(value) - 1; + pend1 = (uint8_t *)&value; + add = -1; + } else { + pstart = (uint8_t *)&value; + pend1 = pstart + sizeof(value) - 1; + add = 1; + } + + /* + * If the contents octet consists of more than one octet, + * then bits of the first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + for(p = pstart; p != pend1; p += add) { + switch(*p) { + case 0x00: if((*(p+add) & 0x80) == 0) + continue; + break; + case 0xff: if((*(p+add) & 0x80)) + continue; + break; + } + break; + } + /* Copy the integer body */ + for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) + *bp++ = *p; + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = bp - buf; + + return 0; +} diff --git a/src/core/libs/supl/asn-supl/INTEGER.h b/src/core/libs/supl/asn-supl/INTEGER.h new file mode 100644 index 000000000..8411bfcdd --- /dev/null +++ b/src/core/libs/supl/asn-supl/INTEGER.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _INTEGER_H_ +#define _INTEGER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; + +extern asn_TYPE_descriptor_t asn_DEF_INTEGER; + +/* Map with to integer value association */ +typedef struct asn_INTEGER_enum_map_s { + long nat_value; /* associated native integer value */ + size_t enum_len; /* strlen("tag") */ + const char *enum_name; /* "tag" */ +} asn_INTEGER_enum_map_t; + +/* This type describes an enumeration for INTEGER and ENUMERATED types */ +typedef struct asn_INTEGER_specifics_s { + asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ + unsigned int *enum2value; /* "tag" => N; sorted by tag */ + int map_count; /* Elements in either map */ + int extension; /* This map is extensible */ + int strict_enumeration; /* Enumeration set is fixed */ + int field_width; /* Size of native integer */ + int field_unsigned; /* Signed=0, unsigned=1 */ +} asn_INTEGER_specifics_t; + +asn_struct_print_f INTEGER_print; +ber_type_decoder_f INTEGER_decode_ber; +der_type_encoder_f INTEGER_encode_der; +xer_type_decoder_f INTEGER_decode_xer; +xer_type_encoder_f INTEGER_encode_xer; +per_type_decoder_f INTEGER_decode_uper; +per_type_encoder_f INTEGER_encode_uper; + +/*********************************** + * Some handy conversion routines. * + ***********************************/ + +/* + * Returns 0 if it was possible to convert, -1 otherwise. + * -1/EINVAL: Mandatory argument missing + * -1/ERANGE: Value encoded is out of range for long representation + * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). + */ +int asn_INTEGER2long(const INTEGER_t *i, long *l); +int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); +int asn_long2INTEGER(INTEGER_t *i, long l); +int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); + +/* + * Convert the integer value into the corresponding enumeration map entry. + */ +const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); + +#ifdef __cplusplus +} +#endif + +#endif /* _INTEGER_H_ */ diff --git a/src/core/libs/supl/asn-supl/IPAddress.c b/src/core/libs/supl/asn-supl/IPAddress.c new file mode 100644 index 000000000..ddbef08c4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/IPAddress.c @@ -0,0 +1,132 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "IPAddress.h" + +static int +memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 4)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 16)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_ipv4Address_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_ipv6Address_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_type_IPAddress_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_IPAddress_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv4Address), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_ipv4Address_constraint_1, + &asn_PER_memb_ipv4Address_constr_2, + 0, + "ipv4Address" + }, + { ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv6Address), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_ipv6Address_constraint_1, + &asn_PER_memb_ipv6Address_constr_3, + 0, + "ipv6Address" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_IPAddress_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ipv4Address at 41 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ipv6Address at 42 */ +}; +static asn_CHOICE_specifics_t asn_SPC_IPAddress_specs_1 = { + sizeof(struct IPAddress), + offsetof(struct IPAddress, _asn_ctx), + offsetof(struct IPAddress, present), + sizeof(((struct IPAddress *)0)->present), + asn_MAP_IPAddress_tag2el_1, + 2, /* Count of tags in the map */ + 0, + -1 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_IPAddress = { + "IPAddress", + "IPAddress", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_IPAddress_constr_1, + asn_MBR_IPAddress_1, + 2, /* Elements count */ + &asn_SPC_IPAddress_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/IPAddress.h b/src/core/libs/supl/asn-supl/IPAddress.h new file mode 100644 index 000000000..9058a5d27 --- /dev/null +++ b/src/core/libs/supl/asn-supl/IPAddress.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _IPAddress_H_ +#define _IPAddress_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum IPAddress_PR { + IPAddress_PR_NOTHING, /* No components present */ + IPAddress_PR_ipv4Address, + IPAddress_PR_ipv6Address +} IPAddress_PR; + +/* IPAddress */ +typedef struct IPAddress { + IPAddress_PR present; + union IPAddress_u { + OCTET_STRING_t ipv4Address; + OCTET_STRING_t ipv6Address; + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} IPAddress_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_IPAddress; + +#ifdef __cplusplus +} +#endif + +#endif /* _IPAddress_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/KeyIdentity.c b/src/core/libs/supl/asn-supl/KeyIdentity.c new file mode 100644 index 000000000..210eacb06 --- /dev/null +++ b/src/core/libs/supl/asn-supl/KeyIdentity.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "KeyIdentity.h" + +int +KeyIdentity_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 128)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +KeyIdentity_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +KeyIdentity_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +KeyIdentity_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +KeyIdentity_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +KeyIdentity_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +KeyIdentity_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +KeyIdentity_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +KeyIdentity_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + KeyIdentity_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_KeyIdentity_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 128, 128 } /* (SIZE(128..128)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_KeyIdentity_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_KeyIdentity = { + "KeyIdentity", + "KeyIdentity", + KeyIdentity_free, + KeyIdentity_print, + KeyIdentity_constraint, + KeyIdentity_decode_ber, + KeyIdentity_encode_der, + KeyIdentity_decode_xer, + KeyIdentity_encode_xer, + KeyIdentity_decode_uper, + KeyIdentity_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_KeyIdentity_tags_1, + sizeof(asn_DEF_KeyIdentity_tags_1) + /sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ + asn_DEF_KeyIdentity_tags_1, /* Same as above */ + sizeof(asn_DEF_KeyIdentity_tags_1) + /sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ + &asn_PER_type_KeyIdentity_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/KeyIdentity.h b/src/core/libs/supl/asn-supl/KeyIdentity.h new file mode 100644 index 000000000..edf2f28dc --- /dev/null +++ b/src/core/libs/supl/asn-supl/KeyIdentity.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _KeyIdentity_H_ +#define _KeyIdentity_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* KeyIdentity */ +typedef BIT_STRING_t KeyIdentity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_KeyIdentity; +asn_struct_free_f KeyIdentity_free; +asn_struct_print_f KeyIdentity_print; +asn_constr_check_f KeyIdentity_constraint; +ber_type_decoder_f KeyIdentity_decode_ber; +der_type_encoder_f KeyIdentity_encode_der; +xer_type_decoder_f KeyIdentity_decode_xer; +xer_type_encoder_f KeyIdentity_encode_xer; +per_type_decoder_f KeyIdentity_decode_uper; +per_type_encoder_f KeyIdentity_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _KeyIdentity_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/KeyIdentity4.c b/src/core/libs/supl/asn-supl/KeyIdentity4.c new file mode 100644 index 000000000..1a993f1bd --- /dev/null +++ b/src/core/libs/supl/asn-supl/KeyIdentity4.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-RESPONSE" + * found in "../supl-response.asn" + */ + +#include "KeyIdentity4.h" + +int +KeyIdentity4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 128)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +KeyIdentity4_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +KeyIdentity4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +KeyIdentity4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +KeyIdentity4_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +KeyIdentity4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +KeyIdentity4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +KeyIdentity4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +KeyIdentity4_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + KeyIdentity4_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_KeyIdentity4_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 128, 128 } /* (SIZE(128..128)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_KeyIdentity4_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_KeyIdentity4 = { + "KeyIdentity4", + "KeyIdentity4", + KeyIdentity4_free, + KeyIdentity4_print, + KeyIdentity4_constraint, + KeyIdentity4_decode_ber, + KeyIdentity4_encode_der, + KeyIdentity4_decode_xer, + KeyIdentity4_encode_xer, + KeyIdentity4_decode_uper, + KeyIdentity4_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_KeyIdentity4_tags_1, + sizeof(asn_DEF_KeyIdentity4_tags_1) + /sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ + asn_DEF_KeyIdentity4_tags_1, /* Same as above */ + sizeof(asn_DEF_KeyIdentity4_tags_1) + /sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ + &asn_PER_type_KeyIdentity4_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/KeyIdentity4.h b/src/core/libs/supl/asn-supl/KeyIdentity4.h new file mode 100644 index 000000000..bb25f736d --- /dev/null +++ b/src/core/libs/supl/asn-supl/KeyIdentity4.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-RESPONSE" + * found in "../supl-response.asn" + */ + +#ifndef _KeyIdentity4_H_ +#define _KeyIdentity4_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* KeyIdentity4 */ +typedef BIT_STRING_t KeyIdentity4_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_KeyIdentity4; +asn_struct_free_f KeyIdentity4_free; +asn_struct_print_f KeyIdentity4_print; +asn_constr_check_f KeyIdentity4_constraint; +ber_type_decoder_f KeyIdentity4_decode_ber; +der_type_encoder_f KeyIdentity4_encode_der; +xer_type_decoder_f KeyIdentity4_decode_xer; +xer_type_encoder_f KeyIdentity4_encode_xer; +per_type_decoder_f KeyIdentity4_decode_uper; +per_type_encoder_f KeyIdentity4_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _KeyIdentity4_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/LocationId.c b/src/core/libs/supl/asn-supl/LocationId.c new file mode 100644 index 000000000..1d6248dec --- /dev/null +++ b/src/core/libs/supl/asn-supl/LocationId.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "LocationId.h" + +static asn_TYPE_member_t asn_MBR_LocationId_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct LocationId, cellInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_CellInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cellInfo" + }, + { ATF_NOFLAGS, 0, offsetof(struct LocationId, status), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Status, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "status" + }, +}; +static ber_tlv_tag_t asn_DEF_LocationId_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_LocationId_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellInfo at 53 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* status at 54 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_LocationId_specs_1 = { + sizeof(struct LocationId), + offsetof(struct LocationId, _asn_ctx), + asn_MAP_LocationId_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_LocationId = { + "LocationId", + "LocationId", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_LocationId_tags_1, + sizeof(asn_DEF_LocationId_tags_1) + /sizeof(asn_DEF_LocationId_tags_1[0]), /* 1 */ + asn_DEF_LocationId_tags_1, /* Same as above */ + sizeof(asn_DEF_LocationId_tags_1) + /sizeof(asn_DEF_LocationId_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_LocationId_1, + 2, /* Elements count */ + &asn_SPC_LocationId_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/LocationId.h b/src/core/libs/supl/asn-supl/LocationId.h new file mode 100644 index 000000000..524af12cf --- /dev/null +++ b/src/core/libs/supl/asn-supl/LocationId.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _LocationId_H_ +#define _LocationId_H_ + + +#include + +/* Including external dependencies */ +#include "CellInfo.h" +#include "Status.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* LocationId */ +typedef struct LocationId { + CellInfo_t cellInfo; + Status_t status; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} LocationId_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_LocationId; + +#ifdef __cplusplus +} +#endif + +#endif /* _LocationId_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/MAC.c b/src/core/libs/supl/asn-supl/MAC.c new file mode 100644 index 000000000..03ab5da2c --- /dev/null +++ b/src/core/libs/supl/asn-supl/MAC.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "MAC.h" + +int +MAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 64)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +MAC_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + MAC_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +MAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + MAC_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +MAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + MAC_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +MAC_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + MAC_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +MAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + MAC_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +MAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + MAC_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +MAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + MAC_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +MAC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + MAC_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_MAC_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 64, 64 } /* (SIZE(64..64)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_MAC_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_MAC = { + "MAC", + "MAC", + MAC_free, + MAC_print, + MAC_constraint, + MAC_decode_ber, + MAC_encode_der, + MAC_decode_xer, + MAC_encode_xer, + MAC_decode_uper, + MAC_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MAC_tags_1, + sizeof(asn_DEF_MAC_tags_1) + /sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */ + asn_DEF_MAC_tags_1, /* Same as above */ + sizeof(asn_DEF_MAC_tags_1) + /sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */ + &asn_PER_type_MAC_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/MAC.h b/src/core/libs/supl/asn-supl/MAC.h new file mode 100644 index 000000000..178896171 --- /dev/null +++ b/src/core/libs/supl/asn-supl/MAC.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _MAC_H_ +#define _MAC_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* MAC */ +typedef BIT_STRING_t MAC_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MAC; +asn_struct_free_f MAC_free; +asn_struct_print_f MAC_print; +asn_constr_check_f MAC_constraint; +ber_type_decoder_f MAC_decode_ber; +der_type_encoder_f MAC_encode_der; +xer_type_decoder_f MAC_decode_xer; +xer_type_encoder_f MAC_encode_xer; +per_type_decoder_f MAC_decode_uper; +per_type_encoder_f MAC_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _MAC_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/MeasuredResults.c b/src/core/libs/supl/asn-supl/MeasuredResults.c new file mode 100644 index 000000000..896780b76 --- /dev/null +++ b/src/core/libs/supl/asn-supl/MeasuredResults.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "MeasuredResults.h" + +static asn_TYPE_member_t asn_MBR_MeasuredResults_1[] = { + { ATF_POINTER, 3, offsetof(struct MeasuredResults, frequencyInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencyInfo" + }, + { ATF_POINTER, 2, offsetof(struct MeasuredResults, utra_CarrierRSSI), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTRA_CarrierRSSI, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "utra-CarrierRSSI" + }, + { ATF_POINTER, 1, offsetof(struct MeasuredResults, cellMeasuredResultsList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellMeasuredResultsList, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "cellMeasuredResultsList" + }, +}; +static int asn_MAP_MeasuredResults_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_MeasuredResults_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_MeasuredResults_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyInfo at 148 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* utra-CarrierRSSI at 149 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* cellMeasuredResultsList at 150 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_MeasuredResults_specs_1 = { + sizeof(struct MeasuredResults), + offsetof(struct MeasuredResults, _asn_ctx), + asn_MAP_MeasuredResults_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_MeasuredResults_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_MeasuredResults = { + "MeasuredResults", + "MeasuredResults", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MeasuredResults_tags_1, + sizeof(asn_DEF_MeasuredResults_tags_1) + /sizeof(asn_DEF_MeasuredResults_tags_1[0]), /* 1 */ + asn_DEF_MeasuredResults_tags_1, /* Same as above */ + sizeof(asn_DEF_MeasuredResults_tags_1) + /sizeof(asn_DEF_MeasuredResults_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_MeasuredResults_1, + 3, /* Elements count */ + &asn_SPC_MeasuredResults_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/MeasuredResults.h b/src/core/libs/supl/asn-supl/MeasuredResults.h new file mode 100644 index 000000000..29a09a839 --- /dev/null +++ b/src/core/libs/supl/asn-supl/MeasuredResults.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _MeasuredResults_H_ +#define _MeasuredResults_H_ + + +#include + +/* Including external dependencies */ +#include "UTRA-CarrierRSSI.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FrequencyInfo; +struct CellMeasuredResultsList; + +/* MeasuredResults */ +typedef struct MeasuredResults { + struct FrequencyInfo *frequencyInfo /* OPTIONAL */; + UTRA_CarrierRSSI_t *utra_CarrierRSSI /* OPTIONAL */; + struct CellMeasuredResultsList *cellMeasuredResultsList /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MeasuredResults_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MeasuredResults; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FrequencyInfo.h" +#include "CellMeasuredResultsList.h" + +#endif /* _MeasuredResults_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/MeasuredResultsList.c b/src/core/libs/supl/asn-supl/MeasuredResultsList.c new file mode 100644 index 000000000..1108ef45e --- /dev/null +++ b/src/core/libs/supl/asn-supl/MeasuredResultsList.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "MeasuredResultsList.h" + +static asn_per_constraints_t asn_PER_type_MeasuredResultsList_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_MeasuredResultsList_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_MeasuredResults, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_MeasuredResultsList_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_MeasuredResultsList_specs_1 = { + sizeof(struct MeasuredResultsList), + offsetof(struct MeasuredResultsList, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_MeasuredResultsList = { + "MeasuredResultsList", + "MeasuredResultsList", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_MeasuredResultsList_tags_1, + sizeof(asn_DEF_MeasuredResultsList_tags_1) + /sizeof(asn_DEF_MeasuredResultsList_tags_1[0]), /* 1 */ + asn_DEF_MeasuredResultsList_tags_1, /* Same as above */ + sizeof(asn_DEF_MeasuredResultsList_tags_1) + /sizeof(asn_DEF_MeasuredResultsList_tags_1[0]), /* 1 */ + &asn_PER_type_MeasuredResultsList_constr_1, + asn_MBR_MeasuredResultsList_1, + 1, /* Single element */ + &asn_SPC_MeasuredResultsList_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/MeasuredResultsList.h b/src/core/libs/supl/asn-supl/MeasuredResultsList.h new file mode 100644 index 000000000..fe174cdc4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/MeasuredResultsList.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _MeasuredResultsList_H_ +#define _MeasuredResultsList_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct MeasuredResults; + +/* MeasuredResultsList */ +typedef struct MeasuredResultsList { + A_SEQUENCE_OF(struct MeasuredResults) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} MeasuredResultsList_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_MeasuredResultsList; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "MeasuredResults.h" + +#endif /* _MeasuredResultsList_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/NMR.c b/src/core/libs/supl/asn-supl/NMR.c new file mode 100644 index 000000000..f64caffbe --- /dev/null +++ b/src/core/libs/supl/asn-supl/NMR.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "NMR.h" + +static asn_per_constraints_t asn_PER_type_NMR_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_NMR_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_NMRelement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_NMR_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_NMR_specs_1 = { + sizeof(struct NMR), + offsetof(struct NMR, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_NMR = { + "NMR", + "NMR", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NMR_tags_1, + sizeof(asn_DEF_NMR_tags_1) + /sizeof(asn_DEF_NMR_tags_1[0]), /* 1 */ + asn_DEF_NMR_tags_1, /* Same as above */ + sizeof(asn_DEF_NMR_tags_1) + /sizeof(asn_DEF_NMR_tags_1[0]), /* 1 */ + &asn_PER_type_NMR_constr_1, + asn_MBR_NMR_1, + 1, /* Single element */ + &asn_SPC_NMR_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/NMR.h b/src/core/libs/supl/asn-supl/NMR.h new file mode 100644 index 000000000..de1916002 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NMR.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _NMR_H_ +#define _NMR_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct NMRelement; + +/* NMR */ +typedef struct NMR { + A_SEQUENCE_OF(struct NMRelement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NMR_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NMR; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "NMRelement.h" + +#endif /* _NMR_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/NMRelement.c b/src/core/libs/supl/asn-supl/NMRelement.c new file mode 100644 index 000000000..79d122d82 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NMRelement.c @@ -0,0 +1,169 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "NMRelement.h" + +static int +memb_aRFCN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_bSIC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_rxLev_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_aRFCN_constr_2 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_bSIC_constr_3 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_rxLev_constr_4 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_NMRelement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct NMRelement, aRFCN), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_aRFCN_constraint_1, + &asn_PER_memb_aRFCN_constr_2, + 0, + "aRFCN" + }, + { ATF_NOFLAGS, 0, offsetof(struct NMRelement, bSIC), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_bSIC_constraint_1, + &asn_PER_memb_bSIC_constr_3, + 0, + "bSIC" + }, + { ATF_NOFLAGS, 0, offsetof(struct NMRelement, rxLev), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_rxLev_constraint_1, + &asn_PER_memb_rxLev_constr_4, + 0, + "rxLev" + }, +}; +static ber_tlv_tag_t asn_DEF_NMRelement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_NMRelement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* aRFCN at 140 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bSIC at 141 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rxLev at 142 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_NMRelement_specs_1 = { + sizeof(struct NMRelement), + offsetof(struct NMRelement, _asn_ctx), + asn_MAP_NMRelement_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_NMRelement = { + "NMRelement", + "NMRelement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NMRelement_tags_1, + sizeof(asn_DEF_NMRelement_tags_1) + /sizeof(asn_DEF_NMRelement_tags_1[0]), /* 1 */ + asn_DEF_NMRelement_tags_1, /* Same as above */ + sizeof(asn_DEF_NMRelement_tags_1) + /sizeof(asn_DEF_NMRelement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_NMRelement_1, + 3, /* Elements count */ + &asn_SPC_NMRelement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/NMRelement.h b/src/core/libs/supl/asn-supl/NMRelement.h new file mode 100644 index 000000000..aa0873bb0 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NMRelement.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _NMRelement_H_ +#define _NMRelement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* NMRelement */ +typedef struct NMRelement { + long aRFCN; + long bSIC; + long rxLev; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} NMRelement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NMRelement; + +#ifdef __cplusplus +} +#endif + +#endif /* _NMRelement_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/NativeEnumerated.c b/src/core/libs/supl/asn-supl/NativeEnumerated.c new file mode 100644 index 000000000..1554220f8 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NativeEnumerated.c @@ -0,0 +1,207 @@ +/*- + * Copyright (c) 2004, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include +#include + +/* + * NativeEnumerated basic type description. + */ +static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { + "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ + "ENUMERATED", + NativeInteger_free, + NativeInteger_print, + asn_generic_no_constraint, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeEnumerated_encode_xer, + NativeEnumerated_decode_uper, + NativeEnumerated_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NativeEnumerated_tags, + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + asn_DEF_NativeEnumerated_tags, /* Same as above */ + sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +asn_enc_rval_t +NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + const long *native = (const long *)sptr; + const asn_INTEGER_enum_map_t *el; + + (void)ilevel; + (void)flags; + + if(!native) _ASN_ENCODE_FAILED; + + el = INTEGER_map_value2enum(specs, *native); + if(el) { + size_t srcsize = el->enum_len + 5; + char *src = (char *)alloca(srcsize); + + er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); + assert(er.encoded > 0 && (size_t)er.encoded < srcsize); + if(cb(src, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } else { + ASN_DEBUG("ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + _ASN_ENCODE_FAILED; + } +} + +asn_dec_rval_t +NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + long *native = (long *)*sptr; + asn_per_constraint_t *ct; + long value; + + (void)opt_codec_ctx; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else _ASN_DECODE_FAILED; /* Mandatory! */ + if(!specs) _ASN_DECODE_FAILED; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) _ASN_DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); + + if(ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) _ASN_DECODE_STARVED; + if(inext) ct = 0; + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) _ASN_DECODE_STARVED; + if(value >= (specs->extension + ? specs->extension - 1 : specs->map_count)) + _ASN_DECODE_FAILED; + } else { + if(!specs->extension) + _ASN_DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if(value < 0) _ASN_DECODE_STARVED; + value += specs->extension - 1; + if(value >= specs->map_count) + _ASN_DECODE_FAILED; + } + + *native = specs->value2enum[value].nat_value; + ASN_DEBUG("Decoded %s = %ld", td->name, *native); + + return rval; +} + +static int +NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { + const asn_INTEGER_enum_map_t *a = ap; + const asn_INTEGER_enum_map_t *b = bp; + if(a->nat_value == b->nat_value) + return 0; + if(a->nat_value < b->nat_value) + return -1; + return 1; +} + +asn_enc_rval_t +NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native, value; + asn_per_constraint_t *ct; + int inext = 0; + asn_INTEGER_enum_map_t key; + asn_INTEGER_enum_map_t *kf; + + if(!sptr) _ASN_ENCODE_FAILED; + if(!specs) _ASN_ENCODE_FAILED; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else _ASN_ENCODE_FAILED; /* Mandatory! */ + + ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); + + er.encoded = 0; + + native = *(long *)sptr; + if(native < 0) _ASN_ENCODE_FAILED; + + key.nat_value = native; + kf = bsearch(&key, specs->value2enum, specs->map_count, + sizeof(key), NativeEnumerated__compar_value2enum); + if(!kf) { + ASN_DEBUG("No element corresponds to %ld", native); + _ASN_ENCODE_FAILED; + } + value = kf - specs->value2enum; + + if(ct->range_bits >= 0) { + int cmpWith = specs->extension + ? specs->extension - 1 : specs->map_count; + if(value >= cmpWith) + inext = 1; + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + _ASN_ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + _ASN_ENCODE_FAILED; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, value, ct->range_bits)) + _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + if(!specs->extension) + _ASN_ENCODE_FAILED; + + /* + * X.691, #10.6: normally small non-negative whole number; + */ + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", + value, specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + diff --git a/src/core/libs/supl/asn-supl/NativeEnumerated.h b/src/core/libs/supl/asn-supl/NativeEnumerated.h new file mode 100644 index 000000000..c59bb1ba9 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NativeEnumerated.h @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard ENUMERATED in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeEnumerated_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeEnumerated_H_ +#define _NativeEnumerated_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; + +xer_type_encoder_f NativeEnumerated_encode_xer; +per_type_decoder_f NativeEnumerated_decode_uper; +per_type_encoder_f NativeEnumerated_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeEnumerated_H_ */ diff --git a/src/core/libs/supl/asn-supl/NativeInteger.c b/src/core/libs/supl/asn-supl/NativeInteger.c new file mode 100644 index 000000000..abdb71a8c --- /dev/null +++ b/src/core/libs/supl/asn-supl/NativeInteger.c @@ -0,0 +1,332 @@ +/*- + * Copyright (c) 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Read the NativeInteger.h for the explanation wrt. differences between + * INTEGER and NativeInteger. + * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this + * implementation deals with the standard (machine-specific) representation + * of them instead of using the platform-independent buffer. + */ +#include +#include + +/* + * NativeInteger basic type description. + */ +static ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NativeInteger = { + "INTEGER", /* The ASN.1 type is still INTEGER */ + "INTEGER", + NativeInteger_free, + NativeInteger_print, + asn_generic_no_constraint, + NativeInteger_decode_ber, + NativeInteger_encode_der, + NativeInteger_decode_xer, + NativeInteger_encode_xer, + NativeInteger_decode_uper, /* Unaligned PER decoder */ + NativeInteger_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NativeInteger_tags, + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + asn_DEF_NativeInteger_tags, /* Same as above */ + sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +/* + * Decode INTEGER type. + */ +asn_dec_rval_t +NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + long *native = (long *)*nint_ptr; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + /* + * If the structure is not there, allocate it. + */ + if(native == NULL) { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if(native == NULL) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + } + + ASN_DEBUG("Decoding %s as INTEGER (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("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this 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; + } + + /* + * ASN.1 encoded INTEGER: buf_ptr, length + * Fill the native, at the same time checking for overflow. + * If overflow occured, return with RC_FAIL. + */ + { + INTEGER_t tmp; + union { + const void *constbuf; + void *nonconstbuf; + } unconst_buf; + long l; + + unconst_buf.constbuf = buf_ptr; + tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; + tmp.size = length; + + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmp, &l) + : asn_INTEGER2long(&tmp, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } + + *native = l; + } + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", + (long)rval.consumed, (long)length, td->name, (long)*native); + + return rval; +} + +/* + * Encode the NativeInteger using the standard INTEGER type DER encoder. + */ +asn_enc_rval_t +NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */ + asn_enc_rval_t erval; + INTEGER_t tmp; + +#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ + + tmp.buf = (uint8_t *)&native; + tmp.size = sizeof(native); + +#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ + uint8_t buf[sizeof(native)]; + uint8_t *p; + + /* Prepare a fake INTEGER */ + for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) + *p = (uint8_t)native; + + tmp.buf = buf; + tmp.size = sizeof(buf); +#endif /* WORDS_BIGENDIAN */ + + /* Encode fake INTEGER */ + erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); + if(erval.encoded == -1) { + assert(erval.structure_ptr == &tmp); + erval.structure_ptr = ptr; + } + return erval; +} + +/* + * Decode the chunk of XML text encoding INTEGER. + */ +asn_dec_rval_t +NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + INTEGER_t st; + void *st_ptr = (void *)&st; + long *native = (long *)*sptr; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) _ASN_DECODE_FAILED; + } + + memset(&st, 0, sizeof(st)); + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, + opt_mname, buf_ptr, size); + if(rval.code == RC_OK) { + long l; + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&st, &l) + : asn_INTEGER2long(&st, &l)) { + rval.code = RC_FAIL; + rval.consumed = 0; + } else { + *native = l; + } + } else { + /* + * Cannot restart from the middle; + * there is no place to save state in the native type. + * Request a continuation from the very beginning. + */ + rval.consumed = 0; + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); + return rval; +} + + +asn_enc_rval_t +NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit int */ + asn_enc_rval_t er; + const long *native = (const long *)sptr; + + (void)ilevel; + (void)flags; + + if(!native) _ASN_ENCODE_FAILED; + + er.encoded = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) + || cb(scratch, er.encoded, app_key) < 0) + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + +asn_dec_rval_t +NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + long *native = (long *)*sptr; + INTEGER_t tmpint; + void *tmpintptr = &tmpint; + + (void)opt_codec_ctx; + ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) _ASN_DECODE_FAILED; + } + + memset(&tmpint, 0, sizeof tmpint); + rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, + &tmpintptr, pd); + if(rval.code == RC_OK) { + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", + td->name, *native); + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + + return rval; +} + +asn_enc_rval_t +NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native; + INTEGER_t tmpint; + + if(!sptr) _ASN_ENCODE_FAILED; + + native = *(long *)sptr; + + ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); + + memset(&tmpint, 0, sizeof(tmpint)); + if((specs&&specs->field_unsigned) + ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) + _ASN_ENCODE_FAILED; + er = INTEGER_encode_uper(td, constraints, &tmpint, po); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; +} + +/* + * INTEGER specific human-readable output. + */ +int +NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + const long *native = (const long *)sptr; + char scratch[32]; /* Enough for 64-bit int */ + int ret; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(native) { + ret = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) + ? "%lu" : "%ld", *native); + assert(ret > 0 && (size_t)ret < sizeof(scratch)); + return (cb(scratch, ret, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", + td->name, contents_only, ptr); + + if(!contents_only) { + FREEMEM(ptr); + } +} + diff --git a/src/core/libs/supl/asn-supl/NativeInteger.h b/src/core/libs/supl/asn-supl/NativeInteger.h new file mode 100644 index 000000000..4e63a8355 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NativeInteger.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This type differs from the standard INTEGER in that it is modelled using + * the fixed machine type (long, int, short), so it can hold only values of + * limited length. There is no type (i.e., NativeInteger_t, any integer type + * will do). + * This type may be used when integer range is limited by subtype constraints. + */ +#ifndef _NativeInteger_H_ +#define _NativeInteger_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern asn_TYPE_descriptor_t asn_DEF_NativeInteger; + +asn_struct_free_f NativeInteger_free; +asn_struct_print_f NativeInteger_print; +ber_type_decoder_f NativeInteger_decode_ber; +der_type_encoder_f NativeInteger_encode_der; +xer_type_decoder_f NativeInteger_decode_xer; +xer_type_encoder_f NativeInteger_encode_xer; +per_type_decoder_f NativeInteger_decode_uper; +per_type_encoder_f NativeInteger_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NativeInteger_H_ */ diff --git a/src/core/libs/supl/asn-supl/Notification.c b/src/core/libs/supl/asn-supl/Notification.c new file mode 100644 index 000000000..7643e9048 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Notification.c @@ -0,0 +1,173 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "Notification.h" + +static int +memb_requestorId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 50)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_clientName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 50)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_requestorId_constr_4 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 50 } /* (SIZE(1..50)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_clientName_constr_6 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 6, 6, 1, 50 } /* (SIZE(1..50)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Notification_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Notification, notificationType), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NotificationType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "notificationType" + }, + { ATF_POINTER, 5, offsetof(struct Notification, encodingType), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_EncodingType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "encodingType" + }, + { ATF_POINTER, 4, offsetof(struct Notification, requestorId), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_requestorId_constraint_1, + &asn_PER_memb_requestorId_constr_4, + 0, + "requestorId" + }, + { ATF_POINTER, 3, offsetof(struct Notification, requestorIdType), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FormatIndicator, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "requestorIdType" + }, + { ATF_POINTER, 2, offsetof(struct Notification, clientName), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_clientName_constraint_1, + &asn_PER_memb_clientName_constr_6, + 0, + "clientName" + }, + { ATF_POINTER, 1, offsetof(struct Notification, clientNameType), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FormatIndicator, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "clientNameType" + }, +}; +static int asn_MAP_Notification_oms_1[] = { 1, 2, 3, 4, 5 }; +static ber_tlv_tag_t asn_DEF_Notification_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Notification_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* notificationType at 20 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* encodingType at 21 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* requestorId at 22 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* requestorIdType at 23 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* clientName at 24 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* clientNameType at 25 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Notification_specs_1 = { + sizeof(struct Notification), + offsetof(struct Notification, _asn_ctx), + asn_MAP_Notification_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_Notification_oms_1, /* Optional members */ + 5, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Notification = { + "Notification", + "Notification", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Notification_tags_1, + sizeof(asn_DEF_Notification_tags_1) + /sizeof(asn_DEF_Notification_tags_1[0]), /* 1 */ + asn_DEF_Notification_tags_1, /* Same as above */ + sizeof(asn_DEF_Notification_tags_1) + /sizeof(asn_DEF_Notification_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Notification_1, + 6, /* Elements count */ + &asn_SPC_Notification_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Notification.h b/src/core/libs/supl/asn-supl/Notification.h new file mode 100644 index 000000000..696de7da6 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Notification.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _Notification_H_ +#define _Notification_H_ + + +#include + +/* Including external dependencies */ +#include "NotificationType.h" +#include "EncodingType.h" +#include +#include "FormatIndicator.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Notification */ +typedef struct Notification { + NotificationType_t notificationType; + EncodingType_t *encodingType /* OPTIONAL */; + OCTET_STRING_t *requestorId /* OPTIONAL */; + FormatIndicator_t *requestorIdType /* OPTIONAL */; + OCTET_STRING_t *clientName /* OPTIONAL */; + FormatIndicator_t *clientNameType /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Notification_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Notification; + +#ifdef __cplusplus +} +#endif + +#endif /* _Notification_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/NotificationType.c b/src/core/libs/supl/asn-supl/NotificationType.c new file mode 100644 index 000000000..8c1178a98 --- /dev/null +++ b/src/core/libs/supl/asn-supl/NotificationType.c @@ -0,0 +1,153 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "NotificationType.h" + +int +NotificationType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +NotificationType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +NotificationType_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + NotificationType_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +NotificationType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +NotificationType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +NotificationType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +NotificationType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +NotificationType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +NotificationType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +NotificationType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NotificationType_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_NotificationType_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4 } /* (0..4,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_NotificationType_value2enum_1[] = { + { 0, 28, "noNotificationNoVerification" }, + { 1, 16, "notificationOnly" }, + { 2, 35, "notificationAndVerficationAllowedNA" }, + { 3, 34, "notificationAndVerficationDeniedNA" }, + { 4, 15, "privacyOverride" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_NotificationType_enum2value_1[] = { + 0, /* noNotificationNoVerification(0) */ + 2, /* notificationAndVerficationAllowedNA(2) */ + 3, /* notificationAndVerficationDeniedNA(3) */ + 1, /* notificationOnly(1) */ + 4 /* privacyOverride(4) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_NotificationType_specs_1 = { + asn_MAP_NotificationType_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_NotificationType_enum2value_1, /* N => "tag"; sorted by N */ + 5, /* Number of elements in the maps */ + 6, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_NotificationType_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_NotificationType = { + "NotificationType", + "NotificationType", + NotificationType_free, + NotificationType_print, + NotificationType_constraint, + NotificationType_decode_ber, + NotificationType_encode_der, + NotificationType_decode_xer, + NotificationType_encode_xer, + NotificationType_decode_uper, + NotificationType_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_NotificationType_tags_1, + sizeof(asn_DEF_NotificationType_tags_1) + /sizeof(asn_DEF_NotificationType_tags_1[0]), /* 1 */ + asn_DEF_NotificationType_tags_1, /* Same as above */ + sizeof(asn_DEF_NotificationType_tags_1) + /sizeof(asn_DEF_NotificationType_tags_1[0]), /* 1 */ + &asn_PER_type_NotificationType_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_NotificationType_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/NotificationType.h b/src/core/libs/supl/asn-supl/NotificationType.h new file mode 100644 index 000000000..939b259ca --- /dev/null +++ b/src/core/libs/supl/asn-supl/NotificationType.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _NotificationType_H_ +#define _NotificationType_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum NotificationType { + NotificationType_noNotificationNoVerification = 0, + NotificationType_notificationOnly = 1, + NotificationType_notificationAndVerficationAllowedNA = 2, + NotificationType_notificationAndVerficationDeniedNA = 3, + NotificationType_privacyOverride = 4 + /* + * Enumeration is extensible + */ +} e_NotificationType; + +/* NotificationType */ +typedef ENUMERATED_t NotificationType_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_NotificationType; +asn_struct_free_f NotificationType_free; +asn_struct_print_f NotificationType_print; +asn_constr_check_f NotificationType_constraint; +ber_type_decoder_f NotificationType_decode_ber; +der_type_encoder_f NotificationType_encode_der; +xer_type_decoder_f NotificationType_decode_xer; +xer_type_encoder_f NotificationType_encode_xer; +per_type_decoder_f NotificationType_decode_uper; +per_type_encoder_f NotificationType_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _NotificationType_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/OCTET_STRING.c b/src/core/libs/supl/asn-supl/OCTET_STRING.c new file mode 100644 index 000000000..584def8b4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/OCTET_STRING.c @@ -0,0 +1,1805 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include /* for .bits_unused member */ +#include + +/* + * OCTET STRING basic type description. + */ +static ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) +}; +static asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = { + sizeof(OCTET_STRING_t), + offsetof(OCTET_STRING_t, _asn_ctx), + ASN_OSUBV_STR +}; +static asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = { + { APC_CONSTRAINED, 8, 8, 0, 255 }, + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { + "OCTET STRING", /* Canonical name */ + "OCTET_STRING", /* XML tag name */ + OCTET_STRING_free, + OCTET_STRING_print, /* non-ascii stuff, generally */ + asn_generic_no_constraint, + OCTET_STRING_decode_ber, + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_hex, + OCTET_STRING_encode_xer, + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_OCTET_STRING_tags, + sizeof(asn_DEF_OCTET_STRING_tags) + / sizeof(asn_DEF_OCTET_STRING_tags[0]), + asn_DEF_OCTET_STRING_tags, /* Same as above */ + sizeof(asn_DEF_OCTET_STRING_tags) + / sizeof(asn_DEF_OCTET_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_DEF_OCTET_STRING_specs +}; + +#undef _CH_PHASE +#undef NEXT_PHASE +#undef PREV_PHASE +#define _CH_PHASE(ctx, inc) do { \ + if(ctx->phase == 0) \ + ctx->context = 0; \ + ctx->phase += inc; \ + } while(0) +#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) +#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +#undef RETURN +#define RETURN(_code) do { \ + asn_dec_rval_t tmprval; \ + tmprval.code = _code; \ + tmprval.consumed = consumed_myself; \ + return tmprval; \ + } while(0) + +#undef APPEND +#define APPEND(bufptr, bufsize) do { \ + size_t _bs = (bufsize); /* Append size */ \ + size_t _ns = ctx->context; /* Allocated now */ \ + size_t _es = st->size + _bs; /* Expected size */ \ + /* int is really a typeof(st->size): */ \ + if((int)_es < 0) RETURN(RC_FAIL); \ + if(_ns <= _es) { \ + void *ptr; \ + /* Be nice and round to the memory allocator */ \ + do { _ns = _ns ? _ns << 1 : 16; } \ + while(_ns <= _es); \ + /* int is really a typeof(st->size): */ \ + if((int)_ns < 0) RETURN(RC_FAIL); \ + ptr = REALLOC(st->buf, _ns); \ + if(ptr) { \ + st->buf = (uint8_t *)ptr; \ + ctx->context = _ns; \ + } else { \ + RETURN(RC_FAIL); \ + } \ + ASN_DEBUG("Reallocating into %ld", (long)_ns); \ + } \ + memcpy(st->buf + st->size, bufptr, _bs); \ + /* Convenient nul-termination */ \ + st->buf[_es] = '\0'; \ + st->size = _es; \ + } while(0) + +/* + * 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. + * No, I am not going to explain what the following stuff is. + */ +struct _stack_el { + ber_tlv_len_t left; /* What's left to read (or -1) */ + ber_tlv_len_t got; /* What was actually processed */ + int cont_level; /* Depth of subcontainment */ + int want_nulls; /* Want null "end of content" octets? */ + int bits_chopped; /* Flag in BIT STRING mode */ + ber_tlv_tag_t tag; /* For debugging purposes */ + struct _stack_el *prev; + struct _stack_el *next; +}; +struct _stack { + struct _stack_el *tail; + struct _stack_el *cur_ptr; +}; + +static struct _stack_el * +OS__add_stack_el(struct _stack *st) { + struct _stack_el *nel; + + /* + * Reuse the old stack frame or allocate a new one. + */ + if(st->cur_ptr && st->cur_ptr->next) { + nel = st->cur_ptr->next; + nel->bits_chopped = 0; + nel->got = 0; + /* Retain the nel->cont_level, it's correct. */ + } else { + nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); + if(nel == NULL) + return NULL; + + if(st->tail) { + /* Increase a subcontainment depth */ + nel->cont_level = st->tail->cont_level + 1; + st->tail->next = nel; + } + nel->prev = st->tail; + st->tail = nel; + } + + st->cur_ptr = nel; + + return nel; +} + +static struct _stack * +_new_stack() { + return (struct _stack *)CALLOC(1, sizeof(struct _stack)); +} + +/* + * Decode OCTET STRING type. + */ +asn_dec_rval_t +OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const void *buf_ptr, size_t size, int tag_mode) { + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + asn_dec_rval_t rval; + asn_struct_ctx_t *ctx; + ssize_t consumed_myself = 0; + struct _stack *stck; /* Expectations stack structure */ + struct _stack_el *sel = 0; /* Stack element */ + int tlv_constr; + enum asn_OS_Subvariant type_variant = specs->subvariant; + + ASN_DEBUG("Decoding %s as %s (frame %ld)", + td->name, + (type_variant == ASN_OSUBV_STR) ? + "OCTET STRING" : "OS-SpecialCase", + (long)size); + + /* + * Create the string if does not exist. + */ + if(st == NULL) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(st == NULL) RETURN(RC_FAIL); + } + + /* Restore parsing context */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + switch(ctx->phase) { + case 0: + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, ctx, + buf_ptr, size, tag_mode, -1, + &ctx->left, &tlv_constr); + if(rval.code != RC_OK) + return rval; + + if(tlv_constr) { + /* + * Complex operation, requires stack of expectations. + */ + ctx->ptr = _new_stack(); + if(ctx->ptr) { + stck = (struct _stack *)ctx->ptr; + } else { + RETURN(RC_FAIL); + } + } else { + /* + * Jump into stackless primitive decoding. + */ + _CH_PHASE(ctx, 3); + if(type_variant == ASN_OSUBV_ANY && tag_mode != 1) + APPEND(buf_ptr, rval.consumed); + ADVANCE(rval.consumed); + goto phase3; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + phase1: + /* + * Fill the stack with expectations. + */ + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + do { + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_tag_t expected_tag; + ssize_t tl, ll, tlvl; + /* This one works even if (sel->left == -1) */ + ssize_t Left = ((!sel||(size_t)sel->left >= size) + ?(ssize_t)size:sel->left); + + + ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, + (long)(sel?sel->left:0), + (long)(sel?sel->want_nulls:0), + (long)(sel?sel->got:0) + ); + if(sel && sel->left <= 0 && sel->want_nulls == 0) { + if(sel->prev) { + struct _stack_el *prev = sel->prev; + if(prev->left != -1) { + if(prev->left < sel->got) + RETURN(RC_FAIL); + prev->left -= sel->got; + } + prev->got += sel->got; + sel = stck->cur_ptr = prev; + if(!sel) break; + tlv_constr = 1; + continue; + } else { + sel = stck->cur_ptr = 0; + break; /* Nothing to wait */ + } + } + + tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); + ASN_DEBUG("fetch tag(size=%ld,L=%ld), %sstack, left=%ld, wn=%ld, tl=%ld", + (long)size, (long)Left, sel?"":"!", + (long)(sel?sel->left:0), + (long)(sel?sel->want_nulls:0), + (long)tl); + switch(tl) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); + + ll = ber_fetch_length(tlv_constr, + (const char *)buf_ptr + tl,Left - tl,&tlv_len); + ASN_DEBUG("Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld", + ber_tlv_tag_string(tlv_tag), tlv_constr, + (long)Left, (long)tl, (long)tlv_len, (long)ll); + switch(ll) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + if(sel && sel->want_nulls + && ((const uint8_t *)buf_ptr)[0] == 0 + && ((const uint8_t *)buf_ptr)[1] == 0) + { + + ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); + + if(type_variant == ASN_OSUBV_ANY + && (tag_mode != 1 || sel->cont_level)) + APPEND("\0\0", 2); + + ADVANCE(2); + sel->got += 2; + if(sel->left != -1) { + sel->left -= 2; /* assert(sel->left >= 2) */ + } + + sel->want_nulls--; + if(sel->want_nulls == 0) { + /* Move to the next expectation */ + sel->left = 0; + tlv_constr = 1; + } + + continue; + } + + /* + * Set up expected tags, + * depending on ASN.1 type being decoded. + */ + switch(type_variant) { + case ASN_OSUBV_BIT: + /* X.690: 8.6.4.1, NOTE 2 */ + /* Fall through */ + case ASN_OSUBV_STR: + default: + if(sel) { + int level = sel->cont_level; + if(level < td->all_tags_count) { + expected_tag = td->all_tags[level]; + break; + } else if(td->all_tags_count) { + expected_tag = td->all_tags + [td->all_tags_count - 1]; + break; + } + /* else, Fall through */ + } + /* Fall through */ + case ASN_OSUBV_ANY: + expected_tag = tlv_tag; + break; + } + + + if(tlv_tag != expected_tag) { + char buf[2][32]; + ber_tlv_tag_snprint(tlv_tag, + buf[0], sizeof(buf[0])); + ber_tlv_tag_snprint(td->tags[td->tags_count-1], + buf[1], sizeof(buf[1])); + ASN_DEBUG("Tag does not match expectation: %s != %s", + buf[0], buf[1]); + RETURN(RC_FAIL); + } + + tlvl = tl + ll; /* Combined length of T and L encoding */ + if((tlv_len + tlvl) < 0) { + /* tlv_len value is too big */ + ASN_DEBUG("TLV encoding + length (%ld) is too big", + (long)tlv_len); + RETURN(RC_FAIL); + } + + /* + * Append a new expectation. + */ + sel = OS__add_stack_el(stck); + if(!sel) RETURN(RC_FAIL); + + sel->tag = tlv_tag; + + sel->want_nulls = (tlv_len==-1); + if(sel->prev && sel->prev->left != -1) { + /* Check that the parent frame is big enough */ + if(sel->prev->left < tlvl + (tlv_len==-1?0:tlv_len)) + RETURN(RC_FAIL); + if(tlv_len == -1) + sel->left = sel->prev->left - tlvl; + else + sel->left = tlv_len; + } else { + sel->left = tlv_len; + } + if(type_variant == ASN_OSUBV_ANY + && (tag_mode != 1 || sel->cont_level)) + APPEND(buf_ptr, tlvl); + sel->got += tlvl; + ADVANCE(tlvl); + + ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", + (long)sel->got, (long)sel->left, + sel->want_nulls, sel->cont_level); + + } while(tlv_constr); + if(sel == NULL) { + /* Finished operation, "phase out" */ + ASN_DEBUG("Phase out"); + _CH_PHASE(ctx, +3); + break; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 2: + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", + (long)sel->left, (long)size, (long)sel->got, + sel->want_nulls); + { + ber_tlv_len_t len; + + assert(sel->left >= 0); + + len = ((ber_tlv_len_t)size < sel->left) + ? (ber_tlv_len_t)size : sel->left; + if(len > 0) { + if(type_variant == ASN_OSUBV_BIT + && sel->bits_chopped == 0) { + /* Put the unused-bits-octet away */ + st->bits_unused = *(const uint8_t *)buf_ptr; + APPEND(((const char *)buf_ptr+1), (len - 1)); + sel->bits_chopped = 1; + } else { + APPEND(buf_ptr, len); + } + ADVANCE(len); + sel->left -= len; + sel->got += len; + } + + if(sel->left) { + ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", + (long)sel->left, (long)size, sel->want_nulls); + RETURN(RC_WMORE); + } + + PREV_PHASE(ctx); + goto phase1; + } + break; + case 3: + phase3: + /* + * Primitive form, no stack required. + */ + assert(ctx->left >= 0); + + if(size < (size_t)ctx->left) { + if(!size) RETURN(RC_WMORE); + if(type_variant == ASN_OSUBV_BIT && !ctx->context) { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, size); + assert(ctx->context > 0); + ctx->left -= size; + ADVANCE(size); + RETURN(RC_WMORE); + } else { + if(type_variant == ASN_OSUBV_BIT + && !ctx->context && ctx->left) { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, ctx->left); + ADVANCE(ctx->left); + ctx->left = 0; + + NEXT_PHASE(ctx); + } + break; + } + + if(sel) { + ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", + sel->prev, sel->want_nulls, + (long)sel->left, (long)sel->got, (long)size); + if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { + RETURN(RC_WMORE); + } + } + + /* + * BIT STRING-specific processing. + */ + if(type_variant == ASN_OSUBV_BIT && st->size) { + /* Finalize BIT STRING: zero out unused bits. */ + st->buf[st->size-1] &= 0xff << st->bits_unused; + } + + ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", + (long)consumed_myself, td->name, + (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", + (long)st->size); + + + RETURN(RC_OK); +} + +/* + * Encode OCTET STRING type using DER. + */ +asn_enc_rval_t +OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, 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_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + BIT_STRING_t *st = (BIT_STRING_t *)sptr; + enum asn_OS_Subvariant type_variant = specs->subvariant; + int fix_last_byte = 0; + + ASN_DEBUG("%s %s as OCTET STRING", + cb?"Estimating":"Encoding", td->name); + + /* + * Write tags. + */ + if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) { + er.encoded = der_write_tags(td, + (type_variant == ASN_OSUBV_BIT) + st->size, + tag_mode, type_variant == ASN_OSUBV_ANY, tag, + cb, app_key); + if(er.encoded == -1) { + er.failed_type = td; + er.structure_ptr = sptr; + return er; + } + } else { + /* Disallow: [] IMPLICIT ANY */ + assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); + er.encoded = 0; + } + + if(!cb) { + er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; + _ASN_ENCODED_OK(er); + } + + /* + * Prepare to deal with the last octet of BIT STRING. + */ + if(type_variant == ASN_OSUBV_BIT) { + uint8_t b = st->bits_unused & 0x07; + if(b && st->size) fix_last_byte = 1; + _ASN_CALLBACK(&b, 1); + er.encoded++; + } + + /* Invoke callback for the main part of the buffer */ + _ASN_CALLBACK(st->buf, st->size - fix_last_byte); + + /* The last octet should be stripped off the unused bits */ + if(fix_last_byte) { + uint8_t b = st->buf[st->size-1] & (0xff << st->bits_unused); + _ASN_CALLBACK(&b, 1); + } + + er.encoded += st->size; + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +asn_enc_rval_t +OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + static const char *h2c = "0123456789ABCDEF"; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + asn_enc_rval_t er; + char scratch[16 * 3 + 4]; + char *p = scratch; + uint8_t *buf; + uint8_t *end; + size_t i; + + if(!st || (!st->buf && st->size)) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + /* + * Dump the contents of the buffer in hexadecimal. + */ + buf = st->buf; + end = buf + st->size; + if(flags & XER_F_CANONICAL) { + char *scend = scratch + (sizeof(scratch) - 2); + for(; buf < end; buf++) { + if(p >= scend) { + _ASN_CALLBACK(scratch, p - scratch); + er.encoded += p - scratch; + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + } + + _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ + er.encoded += p - scratch; + } else { + for(i = 0; buf < end; buf++, i++) { + if(!(i % 16) && (i || st->size > 16)) { + _ASN_CALLBACK(scratch, p-scratch); + er.encoded += (p-scratch); + p = scratch; + _i_ASN_TEXT_INDENT(1, ilevel); + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + if(p - scratch) { + p--; /* Remove the tail space */ + _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ + er.encoded += p - scratch; + if(st->size > 16) + _i_ASN_TEXT_INDENT(1, ilevel-1); + } + } + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +static struct OCTET_STRING__xer_escape_table_s { + char *string; + int size; +} OCTET_STRING__xer_escape_table[] = { +#define OSXET(s) { s, sizeof(s) - 1 } + OSXET("\074\156\165\154\057\076"), /* */ + OSXET("\074\163\157\150\057\076"), /* */ + OSXET("\074\163\164\170\057\076"), /* */ + OSXET("\074\145\164\170\057\076"), /* */ + OSXET("\074\145\157\164\057\076"), /* */ + OSXET("\074\145\156\161\057\076"), /* */ + OSXET("\074\141\143\153\057\076"), /* */ + OSXET("\074\142\145\154\057\076"), /* */ + OSXET("\074\142\163\057\076"), /* */ + OSXET("\011"), /* \t */ + OSXET("\012"), /* \n */ + OSXET("\074\166\164\057\076"), /* */ + OSXET("\074\146\146\057\076"), /* */ + OSXET("\015"), /* \r */ + OSXET("\074\163\157\057\076"), /* */ + OSXET("\074\163\151\057\076"), /* */ + OSXET("\074\144\154\145\057\076"), /* */ + OSXET("\074\144\143\061\057\076"), /* */ + OSXET("\074\144\143\062\057\076"), /* */ + OSXET("\074\144\143\063\057\076"), /* */ + OSXET("\074\144\143\064\057\076"), /* */ + OSXET("\074\156\141\153\057\076"), /* */ + OSXET("\074\163\171\156\057\076"), /* */ + OSXET("\074\145\164\142\057\076"), /* */ + OSXET("\074\143\141\156\057\076"), /* */ + OSXET("\074\145\155\057\076"), /* */ + OSXET("\074\163\165\142\057\076"), /* */ + OSXET("\074\145\163\143\057\076"), /* */ + OSXET("\074\151\163\064\057\076"), /* */ + OSXET("\074\151\163\063\057\076"), /* */ + OSXET("\074\151\163\062\057\076"), /* */ + OSXET("\074\151\163\061\057\076"), /* */ + { 0, 0 }, /* " " */ + { 0, 0 }, /* ! */ + { 0, 0 }, /* \" */ + { 0, 0 }, /* # */ + { 0, 0 }, /* $ */ + { 0, 0 }, /* % */ + OSXET("\046\141\155\160\073"), /* & */ + { 0, 0 }, /* ' */ + {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */ + {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */ + {0,0},{0,0},{0,0},{0,0}, /* 89:; */ + OSXET("\046\154\164\073"), /* < */ + { 0, 0 }, /* = */ + OSXET("\046\147\164\073"), /* > */ +}; + +static int +OS__check_escaped_control_char(const void *buf, int size) { + size_t i; + /* + * Inefficient algorithm which translates the escape sequences + * defined above into characters. Returns -1 if not found. + * TODO: replace by a faster algorithm (bsearch(), hash or + * nested table lookups). + */ + for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) { + struct OCTET_STRING__xer_escape_table_s *el; + el = &OCTET_STRING__xer_escape_table[i]; + if(el->size == size && memcmp(buf, el->string, size) == 0) + return i; + } + return -1; +} + +static int +OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) { + /* + * This might be one of the escape sequences + * for control characters. Check it out. + * #11.15.5 + */ + int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size); + if(control_char >= 0) { + OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; + void *p = REALLOC(st->buf, st->size + 2); + if(p) { + st->buf = (uint8_t *)p; + st->buf[st->size++] = control_char; + st->buf[st->size] = '\0'; /* nul-termination */ + return 0; + } + } + + return -1; /* No, it's not */ +} + +asn_enc_rval_t +OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, 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; + uint8_t *buf, *end; + uint8_t *ss; /* Sequence start */ + ssize_t encoded_len = 0; + + (void)ilevel; /* Unused argument */ + (void)flags; /* Unused argument */ + + if(!st || (!st->buf && st->size)) + _ASN_ENCODE_FAILED; + + buf = st->buf; + end = buf + st->size; + for(ss = buf; buf < end; buf++) { + unsigned int ch = *buf; + int s_len; /* Special encoding sequence length */ + + /* + * Escape certain characters: X.680/11.15 + */ + if(ch < sizeof(OCTET_STRING__xer_escape_table) + /sizeof(OCTET_STRING__xer_escape_table[0]) + && (s_len = OCTET_STRING__xer_escape_table[ch].size)) { + if(((buf - ss) && cb(ss, buf - ss, app_key) < 0) + || cb(OCTET_STRING__xer_escape_table[ch].string, s_len, + app_key) < 0) + _ASN_ENCODE_FAILED; + encoded_len += (buf - ss) + s_len; + ss = buf + 1; + } + } + + encoded_len += (buf - ss); + if((buf - ss) && cb(ss, buf - ss, app_key) < 0) + _ASN_ENCODE_FAILED; + + er.encoded = encoded_len; + _ASN_ENCODED_OK(er); +} + +/* + * Convert from hexadecimal format (cstring): "AB CD EF" + */ +static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + const char *chunk_stop = (const char *)chunk_buf; + const char *p = chunk_stop; + const char *pend = p + chunk_size; + unsigned int clv = 0; + int half = 0; /* Half bit */ + uint8_t *buf; + + /* Reallocate buffer according to high cap estimation */ + ssize_t _ns = st->size + (chunk_size + 1) / 2; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + /* + * If something like " a b c " appears here, the " a b":3 will be + * converted, and the rest skipped. That is, unless buf_size is greater + * than chunk_size, then it'll be equivalent to "ABC0". + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + switch(ch) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* Ignore whitespace */ + continue; + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ + clv = (clv << 4) + (ch - 0x30); + break; + case 0x41: case 0x42: case 0x43: /* ABC */ + case 0x44: case 0x45: case 0x46: /* DEF */ + clv = (clv << 4) + (ch - 0x41 + 10); + break; + case 0x61: case 0x62: case 0x63: /* abc */ + case 0x64: case 0x65: case 0x66: /* def */ + clv = (clv << 4) + (ch - 0x61 + 10); + break; + default: + *buf = 0; /* JIC */ + return -1; + } + if(half++) { + half = 0; + *buf++ = clv; + chunk_stop = p + 1; + } + } + + /* + * Check partial decoding. + */ + if(half) { + if(have_more) { + /* + * Partial specification is fine, + * because no more more PXER_TEXT data is available. + */ + *buf++ = clv << 4; + chunk_stop = p; + } + } else { + chunk_stop = p; + } + + st->size = buf - st->buf; /* Adjust the buffer size */ + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return (chunk_stop - (const char *)chunk_buf); /* Converted size */ +} + +/* + * Convert from binary format: "00101011101" + */ +static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + BIT_STRING_t *st = (BIT_STRING_t *)sptr; + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + int bits_unused = st->bits_unused & 0x7; + uint8_t *buf; + + /* Reallocate buffer according to high cap estimation */ + ssize_t _ns = st->size + (chunk_size + 7) / 8; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + (void)have_more; + + if(bits_unused == 0) + bits_unused = 8; + else if(st->size) + buf--; + + /* + * Convert series of 0 and 1 into the octet string. + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + switch(ch) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* Ignore whitespace */ + break; + case 0x30: + case 0x31: + if(bits_unused-- <= 0) { + *++buf = 0; /* Clean the cell */ + bits_unused = 7; + } + *buf |= (ch&1) << bits_unused; + break; + default: + st->bits_unused = bits_unused; + return -1; + } + } + + if(bits_unused == 8) { + st->size = buf - st->buf; + st->bits_unused = 0; + } else { + st->size = buf - st->buf + 1; + st->bits_unused = bits_unused; + } + + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return chunk_size; /* Converted in full */ +} + +/* + * Something like strtod(), but with stricter rules. + */ +static int +OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { + int32_t val = 0; + const char *p; + + for(p = buf; p < end; p++) { + int ch = *p; + + /* Strange huge value */ + if((val * base + base) < 0) + return -1; + + switch(ch) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ + val = val * base + (ch - 0x30); + break; + case 0x41: case 0x42: case 0x43: /* ABC */ + case 0x44: case 0x45: case 0x46: /* DEF */ + val = val * base + (ch - 0x41 + 10); + break; + case 0x61: case 0x62: case 0x63: /* abc */ + case 0x64: case 0x65: case 0x66: /* def */ + val = val * base + (ch - 0x61 + 10); + break; + case 0x3b: /* ';' */ + *ret_value = val; + return (p - buf) + 1; + default: + return -1; /* Character set error */ + } + } + + *ret_value = -1; + return (p - buf); +} + +/* + * Convert from the plain UTF-8 format, expanding entity references: "2 < 3" + */ +static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + uint8_t *buf; + + /* Reallocate buffer */ + ssize_t _ns = st->size + chunk_size; + void *nptr = REALLOC(st->buf, _ns + 1); + if(!nptr) return -1; + st->buf = (uint8_t *)nptr; + buf = st->buf + st->size; + + /* + * Convert series of 0 and 1 into the octet string. + */ + for(; p < pend; p++) { + int ch = *(const unsigned char *)p; + int len; /* Length of the rest of the chunk */ + + if(ch != 0x26 /* '&' */) { + *buf++ = ch; + continue; /* That was easy... */ + } + + /* + * Process entity reference. + */ + len = chunk_size - (p - (const char *)chunk_buf); + if(len == 1 /* "&" */) goto want_more; + if(p[1] == 0x23 /* '#' */) { + const char *pval; /* Pointer to start of digits */ + int32_t val = 0; /* Entity reference value */ + int base; + + if(len == 2 /* "&#" */) goto want_more; + if(p[2] == 0x78 /* 'x' */) + pval = p + 3, base = 16; + else + pval = p + 2, base = 10; + len = OS__strtoent(base, pval, p + len, &val); + if(len == -1) { + /* Invalid charset. Just copy verbatim. */ + *buf++ = ch; + continue; + } + if(!len || pval[len-1] != 0x3b) goto want_more; + assert(val > 0); + p += (pval - p) + len - 1; /* Advance past entref */ + + if(val < 0x80) { + *buf++ = (char)val; + } else if(val < 0x800) { + *buf++ = 0xc0 | ((val >> 6)); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x10000) { + *buf++ = 0xe0 | ((val >> 12)); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x200000) { + *buf++ = 0xf0 | ((val >> 18)); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else if(val < 0x4000000) { + *buf++ = 0xf8 | ((val >> 24)); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } else { + *buf++ = 0xfc | ((val >> 30) & 0x1); + *buf++ = 0x80 | ((val >> 24) & 0x3f); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + } else { + /* + * Ugly, limited parsing of & > < + */ + char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); + if(!sc) goto want_more; + if((sc - p) == 4 + && p[1] == 0x61 /* 'a' */ + && p[2] == 0x6d /* 'm' */ + && p[3] == 0x70 /* 'p' */) { + *buf++ = 0x26; + p = sc; + continue; + } + if((sc - p) == 3) { + if(p[1] == 0x6c) { + *buf = 0x3c; /* '<' */ + } else if(p[1] == 0x67) { + *buf = 0x3e; /* '>' */ + } else { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + if(p[2] != 0x74) { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + buf++; + p = sc; + continue; + } + /* Unsupported entity reference */ + *buf++ = ch; + } + + continue; + want_more: + if(have_more) { + /* + * We know that no more data (of the same type) + * is coming. Copy the rest verbatim. + */ + *buf++ = ch; + continue; + } + chunk_size = (p - (const char *)chunk_buf); + /* Processing stalled: need more data */ + break; + } + + st->size = buf - st->buf; + assert(st->size <= _ns); + st->buf[st->size] = 0; /* Courtesy termination */ + + return chunk_size; /* Converted in full */ +} + +/* + * Decode OCTET STRING from the XML element's body. + */ +static asn_dec_rval_t +OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_ptr, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_ptr, const void *chunk_buf, size_t chunk_size, + int have_more) +) { + OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr; + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + asn_struct_ctx_t *ctx; /* Per-structure parser context */ + asn_dec_rval_t rval; /* Return value from the decoder */ + int st_allocated; + + /* + * Create the string if does not exist. + */ + if(!st) { + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + *sptr = (void *)st; + if(!st) goto sta_failed; + st_allocated = 1; + } else { + st_allocated = 0; + } + if(!st->buf) { + /* This is separate from above section */ + st->buf = (uint8_t *)CALLOC(1, 1); + if(!st->buf) { + if(st_allocated) { + *sptr = 0; + goto stb_failed; + } else { + goto sta_failed; + } + } + } + + /* Restore parsing context */ + ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset); + + return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, + buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); + +stb_failed: + FREEMEM(st); +sta_failed: + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; +} + +/* + * Decode OCTET STRING from the hexadecimal data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal); +} + +/* + * Decode OCTET STRING from the binary (0/1) data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, 0, OCTET_STRING__convert_binary); +} + +/* + * Decode OCTET STRING from the string (ASCII/UTF-8) data. + */ +asn_dec_rval_t +OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, size_t size) { + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, + buf_ptr, size, + OCTET_STRING__handle_control_chars, + OCTET_STRING__convert_entrefs); +} + +static int +OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, + size_t units, unsigned int bpc, unsigned int unit_bits, + long lb, long ub, asn_per_constraints_t *pc) { + uint8_t *end = buf + units * bpc; + + ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", + (int)units, lb, ub, unit_bits); + + /* X.691: 27.5.4 */ + if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + /* Decode without translation */ + lb = 0; + } else if(pc && pc->code2value) { + if(unit_bits > 16) + return 1; /* FATAL: can't have constrained + * UniversalString with more than + * 16 million code points */ + for(; buf < end; buf += bpc) { + int value; + int code = per_get_few_bits(po, unit_bits); + if(code < 0) return -1; /* WMORE */ + value = pc->code2value(code); + if(value < 0) { + ASN_DEBUG("Code %d (0x%02x) is" + " not in map (%ld..%ld)", + code, code, lb, ub); + return 1; /* FATAL */ + } + switch(bpc) { + case 1: *buf = value; break; + case 2: buf[0] = value >> 8; buf[1] = value; break; + case 4: buf[0] = value >> 24; buf[1] = value >> 16; + buf[2] = value >> 8; buf[3] = value; break; + } + } + return 0; + } + + /* Shortcut the no-op copying to the aligned structure */ + if(lb == 0 && (unit_bits == 8 * bpc)) { + return per_get_many_bits(po, buf, 0, unit_bits * units); + } + + for(; buf < end; buf += bpc) { + int code = per_get_few_bits(po, unit_bits); + int ch = code + lb; + if(code < 0) return -1; /* WMORE */ + if(ch > ub) { + ASN_DEBUG("Code %d is out of range (%ld..%ld)", + ch, lb, ub); + return 1; /* FATAL */ + } + switch(bpc) { + case 1: *buf = ch; break; + case 2: buf[0] = ch >> 8; buf[1] = ch; break; + case 4: buf[0] = ch >> 24; buf[1] = ch >> 16; + buf[2] = ch >> 8; buf[3] = ch; break; + } + } + + return 0; +} + +static int +OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, + size_t units, unsigned int bpc, unsigned int unit_bits, + long lb, long ub, asn_per_constraints_t *pc) { + const uint8_t *end = buf + units * bpc; + + ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", + (int)units, lb, ub, unit_bits, bpc); + + /* X.691: 27.5.4 */ + if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + /* Encode as is */ + lb = 0; + } else if(pc && pc->value2code) { + for(; buf < end; buf += bpc) { + int code; + uint32_t value; + switch(bpc) { + case 1: value = *(const uint8_t *)buf; break; + case 2: value = (buf[0] << 8) | buf[1]; break; + case 4: value = (buf[0] << 24) | (buf[1] << 16) + | (buf[2] << 8) | buf[3]; break; + default: return -1; + } + code = pc->value2code(value); + if(code < 0) { + ASN_DEBUG("Character %d (0x%02x) is" + " not in map (%ld..%ld)", + *buf, *buf, lb, ub); + return -1; + } + if(per_put_few_bits(po, code, unit_bits)) + return -1; + } + } + + /* Shortcut the no-op copying to the aligned structure */ + if(lb == 0 && (unit_bits == 8 * bpc)) { + return per_put_many_bits(po, buf, unit_bits * units); + } + + for(ub -= lb; buf < end; buf += bpc) { + int ch; + uint32_t value; + switch(bpc) { + case 1: value = *(const uint8_t *)buf; break; + case 2: value = (buf[0] << 8) | buf[1]; break; + case 4: value = (buf[0] << 24) | (buf[1] << 16) + | (buf[2] << 8) | buf[3]; break; + default: return -1; + } + ch = value - lb; + if(ch < 0 || ch > ub) { + ASN_DEBUG("Character %d (0x%02x)" + " is out of range (%ld..%ld)", + *buf, *buf, lb, ub + lb); + return -1; + } + if(per_put_few_bits(po, ch, unit_bits)) + return -1; + } + + return 0; +} + +asn_dec_rval_t +OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + asn_dec_rval_t rval = { RC_OK, 0 }; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + ssize_t consumed_myself = 0; + int repeat; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + + (void)opt_codec_ctx; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + + switch(specs->subvariant) { + default: + case ASN_OSUBV_ANY: + ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); + RETURN(RC_FAIL); + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + break; + } + + /* + * Allocate the string. + */ + if(!st) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(!st) RETURN(RC_FAIL); + } + + ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + + if(csiz->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) RETURN(RC_WMORE); + if(inext) { + csiz = &asn_DEF_OCTET_STRING_constraints.size; + cval = &asn_DEF_OCTET_STRING_constraints.value; + unit_bits = canonical_unit_bits; + } + } + + if(csiz->effective_bits >= 0) { + FREEMEM(st->buf); + if(bpc) { + st->size = csiz->upper_bound * bpc; + } else { + st->size = (csiz->upper_bound + 7) >> 3; + } + st->buf = (uint8_t *)MALLOC(st->size + 1); + if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits == 0) { + int ret; + if(bpc) { + ASN_DEBUG("Encoding OCTET STRING size %ld", + csiz->upper_bound); + ret = OCTET_STRING_per_get_characters(pd, st->buf, + csiz->upper_bound, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ASN_DEBUG("Encoding BIT STRING size %ld", + csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, + unit_bits * csiz->upper_bound); + } + if(ret < 0) RETURN(RC_WMORE); + consumed_myself += unit_bits * csiz->upper_bound; + st->buf[st->size] = 0; + if(bpc == 0) { + int ubs = (csiz->upper_bound & 0x7); + st->bits_unused = ubs ? 8 - ubs : 0; + } + RETURN(RC_OK); + } + + st->size = 0; + do { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; + + /* Get the PER length */ + raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); + if(raw_len < 0) RETURN(RC_WMORE); + raw_len += csiz->lower_bound; + + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + if(bpc) { + len_bytes = raw_len * bpc; + len_bits = len_bytes * unit_bits; + } else { + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if(len_bits & 0x7) + st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + } + p = REALLOC(st->buf, st->size + len_bytes + 1); + if(!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + if(bpc) { + ret = OCTET_STRING_per_get_characters(pd, + &st->buf[st->size], raw_len, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ret = per_get_many_bits(pd, &st->buf[st->size], + 0, len_bits); + } + if(ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; + } while(repeat); + st->buf[st->size] = 0; /* nul-terminate */ + + return rval; +} + +asn_enc_rval_t +OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; + int inext = 0; /* Lies not within extension root */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + unsigned int sizeinunits; + const uint8_t *buf; + int ret; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + int ct_extensible; + + if(!st || (!st->buf && st->size)) + _ASN_ENCODE_FAILED; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + ct_extensible = csiz->flags & APC_EXTENSIBLE; + + switch(specs->subvariant) { + default: + case ASN_OSUBV_ANY: + _ASN_ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", + sizeinunits, st->bits_unused); + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + sizeinunits = st->size; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + sizeinunits = st->size / 2; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + sizeinunits = st->size / 4; + break; + } + + ASN_DEBUG("Encoding %s into %d units of %d bits" + " (%ld..%ld, effective %d)%s", + td->name, sizeinunits, unit_bits, + csiz->lower_bound, csiz->upper_bound, + csiz->effective_bits, ct_extensible ? " EXT" : ""); + + /* Figure out wheter size lies within PER visible constraint */ + + if(csiz->effective_bits >= 0) { + if((int)sizeinunits < csiz->lower_bound + || (int)sizeinunits > csiz->upper_bound) { + if(ct_extensible) { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + unit_bits = canonical_unit_bits; + inext = 1; + } else + _ASN_ENCODE_FAILED; + } + } else { + inext = 0; + } + + if(ct_extensible) { + /* Declare whether length is [not] within extension root */ + if(per_put_few_bits(po, inext, 1)) + _ASN_ENCODE_FAILED; + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits >= 0) { + ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", + st->size, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + if(ret) _ASN_ENCODE_FAILED; + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, st->buf, + sizeinunits, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, st->buf, + sizeinunits * unit_bits); + } + if(ret) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + ASN_DEBUG("Encoding %d bytes", st->size); + + if(sizeinunits == 0) { + if(uper_put_length(po, 0)) + _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + buf = st->buf; + while(sizeinunits) { + ssize_t maySave = uper_put_length(po, sizeinunits); + if(maySave < 0) _ASN_ENCODE_FAILED; + + ASN_DEBUG("Encoding %ld of %ld", + (long)maySave, (long)sizeinunits); + + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, buf, + maySave, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, buf, maySave * unit_bits); + } + if(ret) _ASN_ENCODE_FAILED; + + if(bpc) + buf += maySave * bpc; + else + buf += maySave >> 3; + sizeinunits -= maySave; + assert(!(maySave & 0x07) || !sizeinunits); + } + + _ASN_ENCODED_OK(er); +} + +int +OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + static const char *h2c = "0123456789ABCDEF"; + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + char scratch[16 * 3 + 4]; + char *p = scratch; + uint8_t *buf; + uint8_t *end; + size_t i; + + (void)td; /* Unused argument */ + + if(!st || (!st->buf && st->size)) + return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* + * Dump the contents of the buffer in hexadecimal. + */ + buf = st->buf; + end = buf + st->size; + for(i = 0; buf < end; buf++, i++) { + if(!(i % 16) && (i || st->size > 16)) { + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + _i_INDENT(1); + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + + if(p > scratch) { + p--; /* Remove the tail space */ + if(cb(scratch, p - scratch, app_key) < 0) + return -1; + } + + return 0; +} + +int +OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(st && (st->buf || !st->size)) { + return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { + OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_struct_ctx_t *ctx = (asn_struct_ctx_t *) + ((char *)st + specs->ctx_offset); + struct _stack *stck; + + if(!td || !st) + return; + + ASN_DEBUG("Freeing %s as OCTET STRING", td->name); + + if(st->buf) { + FREEMEM(st->buf); + st->buf = 0; + } + + /* + * Remove decode-time stack. + */ + stck = (struct _stack *)ctx->ptr; + if(stck) { + while(stck->tail) { + struct _stack_el *sel = stck->tail; + stck->tail = sel->prev; + FREEMEM(sel); + } + FREEMEM(stck); + } + + if(!contents_only) { + FREEMEM(st); + } +} + +/* + * Conversion routines. + */ +int +OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { + void *buf; + + if(st == 0 || (str == 0 && len)) { + errno = EINVAL; + return -1; + } + + /* + * Clear the OCTET STRING. + */ + if(str == NULL) { + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + return 0; + } + + /* Determine the original string size, if not explicitly given */ + if(len < 0) + len = strlen(str); + + /* Allocate and fill the memory */ + buf = MALLOC(len + 1); + if(buf == NULL) + return -1; + + memcpy(buf, str, len); + ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ + FREEMEM(st->buf); + st->buf = (uint8_t *)buf; + st->size = len; + + return 0; +} + +OCTET_STRING_t * +OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + OCTET_STRING_t *st; + + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + if(st && str && OCTET_STRING_fromBuf(st, str, len)) { + FREEMEM(st); + st = NULL; + } + + return st; +} + diff --git a/src/core/libs/supl/asn-supl/OCTET_STRING.h b/src/core/libs/supl/asn-supl/OCTET_STRING.h new file mode 100644 index 000000000..8df9a182d --- /dev/null +++ b/src/core/libs/supl/asn-supl/OCTET_STRING.h @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _OCTET_STRING_H_ +#define _OCTET_STRING_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OCTET_STRING { + uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */ + int size; /* Size of the buffer */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} OCTET_STRING_t; + +extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING; + +asn_struct_free_f OCTET_STRING_free; +asn_struct_print_f OCTET_STRING_print; +asn_struct_print_f OCTET_STRING_print_utf8; +ber_type_decoder_f OCTET_STRING_decode_ber; +der_type_encoder_f OCTET_STRING_encode_der; +xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */ +xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */ +xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */ +xer_type_encoder_f OCTET_STRING_encode_xer; +xer_type_encoder_f OCTET_STRING_encode_xer_utf8; +per_type_decoder_f OCTET_STRING_decode_uper; +per_type_encoder_f OCTET_STRING_encode_uper; + +/****************************** + * Handy conversion routines. * + ******************************/ + +/* + * This function clears the previous value of the OCTET STRING (if any) + * and then allocates a new memory with the specified content (str/size). + * If size = -1, the size of the original string will be determined + * using strlen(str). + * If str equals to NULL, the function will silently clear the + * current contents of the OCTET STRING. + * Returns 0 if it was possible to perform operation, -1 otherwise. + */ +int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size); + +/* Handy conversion from the C string into the OCTET STRING. */ +#define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1) + +/* + * Allocate and fill the new OCTET STRING and return a pointer to the newly + * allocated object. NULL is permitted in str: the function will just allocate + * empty OCTET STRING. + */ +OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, + const char *str, int size); + +/**************************** + * Internally useful stuff. * + ****************************/ + +typedef struct asn_OCTET_STRING_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the structure */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + enum asn_OS_Subvariant { + ASN_OSUBV_ANY, /* The open type (ANY) */ + ASN_OSUBV_BIT, /* BIT STRING */ + ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */ + ASN_OSUBV_U16, /* 16-bit character (BMPString) */ + ASN_OSUBV_U32 /* 32-bit character (UniversalString) */ + } subvariant; +} asn_OCTET_STRING_specifics_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _OCTET_STRING_H_ */ diff --git a/src/core/libs/supl/asn-supl/Pathloss.c b/src/core/libs/supl/asn-supl/Pathloss.c new file mode 100644 index 000000000..3bbec50fb --- /dev/null +++ b/src/core/libs/supl/asn-supl/Pathloss.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Pathloss.h" + +int +Pathloss_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 46 && value <= 173)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +Pathloss_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +Pathloss_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Pathloss_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Pathloss_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Pathloss_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Pathloss_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Pathloss_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Pathloss_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +Pathloss_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +Pathloss_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Pathloss_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_Pathloss_constr_1 = { + { APC_CONSTRAINED, 7, 7, 46, 173 } /* (46..173) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_Pathloss_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Pathloss = { + "Pathloss", + "Pathloss", + Pathloss_free, + Pathloss_print, + Pathloss_constraint, + Pathloss_decode_ber, + Pathloss_encode_der, + Pathloss_decode_xer, + Pathloss_encode_xer, + Pathloss_decode_uper, + Pathloss_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Pathloss_tags_1, + sizeof(asn_DEF_Pathloss_tags_1) + /sizeof(asn_DEF_Pathloss_tags_1[0]), /* 1 */ + asn_DEF_Pathloss_tags_1, /* Same as above */ + sizeof(asn_DEF_Pathloss_tags_1) + /sizeof(asn_DEF_Pathloss_tags_1[0]), /* 1 */ + &asn_PER_type_Pathloss_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/Pathloss.h b/src/core/libs/supl/asn-supl/Pathloss.h new file mode 100644 index 000000000..b7cf2c5fc --- /dev/null +++ b/src/core/libs/supl/asn-supl/Pathloss.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Pathloss_H_ +#define _Pathloss_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Pathloss */ +typedef long Pathloss_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Pathloss; +asn_struct_free_f Pathloss_free; +asn_struct_print_f Pathloss_print; +asn_constr_check_f Pathloss_constraint; +ber_type_decoder_f Pathloss_decode_ber; +der_type_encoder_f Pathloss_encode_der; +xer_type_decoder_f Pathloss_decode_xer; +xer_type_encoder_f Pathloss_encode_xer; +per_type_decoder_f Pathloss_decode_uper; +per_type_encoder_f Pathloss_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Pathloss_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PosMethod.c b/src/core/libs/supl/asn-supl/PosMethod.c new file mode 100644 index 000000000..d65c13b6f --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosMethod.c @@ -0,0 +1,163 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "PosMethod.h" + +int +PosMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +PosMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +PosMethod_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + PosMethod_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +PosMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +PosMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +PosMethod_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +PosMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +PosMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +PosMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +PosMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PosMethod_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_PosMethod_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 9 } /* (0..9,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_PosMethod_value2enum_1[] = { + { 0, 15, "agpsSETassisted" }, + { 1, 12, "agpsSETbased" }, + { 2, 19, "agpsSETassistedpref" }, + { 3, 16, "agpsSETbasedpref" }, + { 4, 13, "autonomousGPS" }, + { 5, 4, "aFLT" }, + { 6, 4, "eCID" }, + { 7, 4, "eOTD" }, + { 8, 5, "oTDOA" }, + { 9, 10, "noPosition" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_PosMethod_enum2value_1[] = { + 5, /* aFLT(5) */ + 0, /* agpsSETassisted(0) */ + 2, /* agpsSETassistedpref(2) */ + 1, /* agpsSETbased(1) */ + 3, /* agpsSETbasedpref(3) */ + 4, /* autonomousGPS(4) */ + 6, /* eCID(6) */ + 7, /* eOTD(7) */ + 9, /* noPosition(9) */ + 8 /* oTDOA(8) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_PosMethod_specs_1 = { + asn_MAP_PosMethod_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PosMethod_enum2value_1, /* N => "tag"; sorted by N */ + 10, /* Number of elements in the maps */ + 11, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_PosMethod_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_PosMethod = { + "PosMethod", + "PosMethod", + PosMethod_free, + PosMethod_print, + PosMethod_constraint, + PosMethod_decode_ber, + PosMethod_encode_der, + PosMethod_decode_xer, + PosMethod_encode_xer, + PosMethod_decode_uper, + PosMethod_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PosMethod_tags_1, + sizeof(asn_DEF_PosMethod_tags_1) + /sizeof(asn_DEF_PosMethod_tags_1[0]), /* 1 */ + asn_DEF_PosMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_PosMethod_tags_1) + /sizeof(asn_DEF_PosMethod_tags_1[0]), /* 1 */ + &asn_PER_type_PosMethod_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_PosMethod_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PosMethod.h b/src/core/libs/supl/asn-supl/PosMethod.h new file mode 100644 index 000000000..89d77b330 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosMethod.h @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _PosMethod_H_ +#define _PosMethod_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PosMethod { + PosMethod_agpsSETassisted = 0, + PosMethod_agpsSETbased = 1, + PosMethod_agpsSETassistedpref = 2, + PosMethod_agpsSETbasedpref = 3, + PosMethod_autonomousGPS = 4, + PosMethod_aFLT = 5, + PosMethod_eCID = 6, + PosMethod_eOTD = 7, + PosMethod_oTDOA = 8, + PosMethod_noPosition = 9 + /* + * Enumeration is extensible + */ +} e_PosMethod; + +/* PosMethod */ +typedef ENUMERATED_t PosMethod_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PosMethod; +asn_struct_free_f PosMethod_free; +asn_struct_print_f PosMethod_print; +asn_constr_check_f PosMethod_constraint; +ber_type_decoder_f PosMethod_decode_ber; +der_type_encoder_f PosMethod_encode_der; +xer_type_decoder_f PosMethod_decode_xer; +xer_type_encoder_f PosMethod_encode_xer; +per_type_decoder_f PosMethod_decode_uper; +per_type_encoder_f PosMethod_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _PosMethod_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PosPayLoad.c b/src/core/libs/supl/asn-supl/PosPayLoad.c new file mode 100644 index 000000000..b12f05e74 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosPayLoad.c @@ -0,0 +1,173 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS" + * found in "../supl-pos.asn" + */ + +#include "PosPayLoad.h" + +static int +memb_tia801payload_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 8192)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_rrcPayload_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 8192)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_rrlpPayload_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 8192)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_tia801payload_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 13, 13, 1, 8192 } /* (SIZE(1..8192)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_rrcPayload_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 13, 13, 1, 8192 } /* (SIZE(1..8192)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_rrlpPayload_constr_4 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 13, 13, 1, 8192 } /* (SIZE(1..8192)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_type_PosPayLoad_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 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_PosPayLoad_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.tia801payload), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_tia801payload_constraint_1, + &asn_PER_memb_tia801payload_constr_2, + 0, + "tia801payload" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.rrcPayload), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_rrcPayload_constraint_1, + &asn_PER_memb_rrcPayload_constr_3, + 0, + "rrcPayload" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.rrlpPayload), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_rrlpPayload_constraint_1, + &asn_PER_memb_rrlpPayload_constr_4, + 0, + "rrlpPayload" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_PosPayLoad_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* tia801payload at 15 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* rrcPayload at 16 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rrlpPayload at 17 */ +}; +static asn_CHOICE_specifics_t asn_SPC_PosPayLoad_specs_1 = { + sizeof(struct PosPayLoad), + offsetof(struct PosPayLoad, _asn_ctx), + offsetof(struct PosPayLoad, present), + sizeof(((struct PosPayLoad *)0)->present), + asn_MAP_PosPayLoad_tag2el_1, + 3, /* Count of tags in the map */ + 0, + 3 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_PosPayLoad = { + "PosPayLoad", + "PosPayLoad", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_PosPayLoad_constr_1, + asn_MBR_PosPayLoad_1, + 3, /* Elements count */ + &asn_SPC_PosPayLoad_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PosPayLoad.h b/src/core/libs/supl/asn-supl/PosPayLoad.h new file mode 100644 index 000000000..c72c012e7 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosPayLoad.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS" + * found in "../supl-pos.asn" + */ + +#ifndef _PosPayLoad_H_ +#define _PosPayLoad_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PosPayLoad_PR { + PosPayLoad_PR_NOTHING, /* No components present */ + PosPayLoad_PR_tia801payload, + PosPayLoad_PR_rrcPayload, + PosPayLoad_PR_rrlpPayload, + /* Extensions may appear below */ + +} PosPayLoad_PR; + +/* PosPayLoad */ +typedef struct PosPayLoad { + PosPayLoad_PR present; + union PosPayLoad_u { + OCTET_STRING_t tia801payload; + OCTET_STRING_t rrcPayload; + OCTET_STRING_t rrlpPayload; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PosPayLoad_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PosPayLoad; + +#ifdef __cplusplus +} +#endif + +#endif /* _PosPayLoad_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PosProtocol.c b/src/core/libs/supl/asn-supl/PosProtocol.c new file mode 100644 index 000000000..10b8600fd --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosProtocol.c @@ -0,0 +1,79 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#include "PosProtocol.h" + +static asn_TYPE_member_t asn_MBR_PosProtocol_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PosProtocol, tia801), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "tia801" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosProtocol, rrlp), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rrlp" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosProtocol, rrc), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "rrc" + }, +}; +static ber_tlv_tag_t asn_DEF_PosProtocol_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PosProtocol_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* tia801 at 35 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* rrlp at 36 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rrc at 37 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PosProtocol_specs_1 = { + sizeof(struct PosProtocol), + offsetof(struct PosProtocol, _asn_ctx), + asn_MAP_PosProtocol_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PosProtocol = { + "PosProtocol", + "PosProtocol", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PosProtocol_tags_1, + sizeof(asn_DEF_PosProtocol_tags_1) + /sizeof(asn_DEF_PosProtocol_tags_1[0]), /* 1 */ + asn_DEF_PosProtocol_tags_1, /* Same as above */ + sizeof(asn_DEF_PosProtocol_tags_1) + /sizeof(asn_DEF_PosProtocol_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PosProtocol_1, + 3, /* Elements count */ + &asn_SPC_PosProtocol_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PosProtocol.h b/src/core/libs/supl/asn-supl/PosProtocol.h new file mode 100644 index 000000000..d22e9cf41 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosProtocol.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#ifndef _PosProtocol_H_ +#define _PosProtocol_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PosProtocol */ +typedef struct PosProtocol { + BOOLEAN_t tia801; + BOOLEAN_t rrlp; + BOOLEAN_t rrc; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PosProtocol_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PosProtocol; + +#ifdef __cplusplus +} +#endif + +#endif /* _PosProtocol_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PosTechnology.c b/src/core/libs/supl/asn-supl/PosTechnology.c new file mode 100644 index 000000000..677bee513 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosTechnology.c @@ -0,0 +1,119 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#include "PosTechnology.h" + +static asn_TYPE_member_t asn_MBR_PosTechnology_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, agpsSETassisted), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "agpsSETassisted" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, agpsSETBased), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "agpsSETBased" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, autonomousGPS), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "autonomousGPS" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, aFLT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "aFLT" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, eCID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "eCID" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, eOTD), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "eOTD" + }, + { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, oTDOA), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "oTDOA" + }, +}; +static ber_tlv_tag_t asn_DEF_PosTechnology_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PosTechnology_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* agpsSETassisted at 22 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* agpsSETBased at 23 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* autonomousGPS at 24 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* aFLT at 25 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* eCID at 26 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* eOTD at 27 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* oTDOA at 28 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PosTechnology_specs_1 = { + sizeof(struct PosTechnology), + offsetof(struct PosTechnology, _asn_ctx), + asn_MAP_PosTechnology_tag2el_1, + 7, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 6, /* Start extensions */ + 8 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PosTechnology = { + "PosTechnology", + "PosTechnology", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PosTechnology_tags_1, + sizeof(asn_DEF_PosTechnology_tags_1) + /sizeof(asn_DEF_PosTechnology_tags_1[0]), /* 1 */ + asn_DEF_PosTechnology_tags_1, /* Same as above */ + sizeof(asn_DEF_PosTechnology_tags_1) + /sizeof(asn_DEF_PosTechnology_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PosTechnology_1, + 7, /* Elements count */ + &asn_SPC_PosTechnology_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PosTechnology.h b/src/core/libs/supl/asn-supl/PosTechnology.h new file mode 100644 index 000000000..70f2700f2 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PosTechnology.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#ifndef _PosTechnology_H_ +#define _PosTechnology_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PosTechnology */ +typedef struct PosTechnology { + BOOLEAN_t agpsSETassisted; + BOOLEAN_t agpsSETBased; + BOOLEAN_t autonomousGPS; + BOOLEAN_t aFLT; + BOOLEAN_t eCID; + BOOLEAN_t eOTD; + BOOLEAN_t oTDOA; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PosTechnology_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PosTechnology; + +#ifdef __cplusplus +} +#endif + +#endif /* _PosTechnology_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Position.c b/src/core/libs/supl/asn-supl/Position.c new file mode 100644 index 000000000..a679d7293 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Position.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Position.h" + +static asn_TYPE_member_t asn_MBR_Position_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Position, timestamp), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTCTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "timestamp" + }, + { ATF_NOFLAGS, 0, offsetof(struct Position, positionEstimate), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionEstimate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "positionEstimate" + }, + { ATF_POINTER, 1, offsetof(struct Position, velocity), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_Velocity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "velocity" + }, +}; +static int asn_MAP_Position_oms_1[] = { 2 }; +static ber_tlv_tag_t asn_DEF_Position_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Position_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* timestamp at 67 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* positionEstimate at 68 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* velocity at 69 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Position_specs_1 = { + sizeof(struct Position), + offsetof(struct Position, _asn_ctx), + asn_MAP_Position_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Position_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Position = { + "Position", + "Position", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Position_tags_1, + sizeof(asn_DEF_Position_tags_1) + /sizeof(asn_DEF_Position_tags_1[0]), /* 1 */ + asn_DEF_Position_tags_1, /* Same as above */ + sizeof(asn_DEF_Position_tags_1) + /sizeof(asn_DEF_Position_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Position_1, + 3, /* Elements count */ + &asn_SPC_Position_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Position.h b/src/core/libs/supl/asn-supl/Position.h new file mode 100644 index 000000000..a56fb2eb4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Position.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Position_H_ +#define _Position_H_ + + +#include + +/* Including external dependencies */ +#include +#include "PositionEstimate.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Velocity; + +/* Position */ +typedef struct Position { + UTCTime_t timestamp; + PositionEstimate_t positionEstimate; + struct Velocity *velocity /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Position_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Position; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Velocity.h" + +#endif /* _Position_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PositionEstimate.c b/src/core/libs/supl/asn-supl/PositionEstimate.c new file mode 100644 index 000000000..4b7367af2 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PositionEstimate.c @@ -0,0 +1,503 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "PositionEstimate.h" + +static int +latitudeSign_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +latitudeSign_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +static void +latitudeSign_2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + latitudeSign_2_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +latitudeSign_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +latitudeSign_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +latitudeSign_2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +latitudeSign_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +latitudeSign_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static asn_dec_rval_t +latitudeSign_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +static asn_enc_rval_t +latitudeSign_2_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + latitudeSign_2_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static int +memb_uncertaintySemiMajor_constraint_7(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_uncertaintySemiMinor_constraint_7(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_orientationMajorAxis_constraint_7(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 180)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_latitude_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_longitude_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= -8388608 && value <= 8388607)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_confidence_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 100)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_type_latitudeSign_constr_2 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_uncertaintySemiMajor_constr_8 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_uncertaintySemiMinor_constr_9 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_orientationMajorAxis_constr_10 = { + { APC_CONSTRAINED, 8, 8, 0, 180 } /* (0..180) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_latitude_constr_5 = { + { APC_CONSTRAINED, 23, -1, 0, 8388607 } /* (0..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_longitude_constr_6 = { + { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_confidence_constr_11 = { + { APC_CONSTRAINED, 7, 7, 0, 100 } /* (0..100) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_latitudeSign_value2enum_2[] = { + { 0, 5, "north" }, + { 1, 5, "south" } +}; +static unsigned int asn_MAP_latitudeSign_enum2value_2[] = { + 0, /* north(0) */ + 1 /* south(1) */ +}; +static asn_INTEGER_specifics_t asn_SPC_latitudeSign_specs_2 = { + asn_MAP_latitudeSign_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_latitudeSign_enum2value_2, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_latitudeSign_tags_2[] = { + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_latitudeSign_2 = { + "latitudeSign", + "latitudeSign", + latitudeSign_2_free, + latitudeSign_2_print, + latitudeSign_2_constraint, + latitudeSign_2_decode_ber, + latitudeSign_2_encode_der, + latitudeSign_2_decode_xer, + latitudeSign_2_encode_xer, + latitudeSign_2_decode_uper, + latitudeSign_2_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_latitudeSign_tags_2, + sizeof(asn_DEF_latitudeSign_tags_2) + /sizeof(asn_DEF_latitudeSign_tags_2[0]) - 1, /* 1 */ + asn_DEF_latitudeSign_tags_2, /* Same as above */ + sizeof(asn_DEF_latitudeSign_tags_2) + /sizeof(asn_DEF_latitudeSign_tags_2[0]), /* 2 */ + &asn_PER_type_latitudeSign_constr_2, + 0, 0, /* Defined elsewhere */ + &asn_SPC_latitudeSign_specs_2 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_uncertainty_7[] = { + { ATF_NOFLAGS, 0, offsetof(struct uncertainty, uncertaintySemiMajor), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_uncertaintySemiMajor_constraint_7, + &asn_PER_memb_uncertaintySemiMajor_constr_8, + 0, + "uncertaintySemiMajor" + }, + { ATF_NOFLAGS, 0, offsetof(struct uncertainty, uncertaintySemiMinor), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_uncertaintySemiMinor_constraint_7, + &asn_PER_memb_uncertaintySemiMinor_constr_9, + 0, + "uncertaintySemiMinor" + }, + { ATF_NOFLAGS, 0, offsetof(struct uncertainty, orientationMajorAxis), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_orientationMajorAxis_constraint_7, + &asn_PER_memb_orientationMajorAxis_constr_10, + 0, + "orientationMajorAxis" + }, +}; +static ber_tlv_tag_t asn_DEF_uncertainty_tags_7[] = { + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_uncertainty_tag2el_7[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uncertaintySemiMajor at 77 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uncertaintySemiMinor at 78 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* orientationMajorAxis at 79 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_uncertainty_specs_7 = { + sizeof(struct uncertainty), + offsetof(struct uncertainty, _asn_ctx), + asn_MAP_uncertainty_tag2el_7, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_uncertainty_7 = { + "uncertainty", + "uncertainty", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_uncertainty_tags_7, + sizeof(asn_DEF_uncertainty_tags_7) + /sizeof(asn_DEF_uncertainty_tags_7[0]) - 1, /* 1 */ + asn_DEF_uncertainty_tags_7, /* Same as above */ + sizeof(asn_DEF_uncertainty_tags_7) + /sizeof(asn_DEF_uncertainty_tags_7[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_uncertainty_7, + 3, /* Elements count */ + &asn_SPC_uncertainty_specs_7 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_PositionEstimate_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, latitudeSign), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_latitudeSign_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "latitudeSign" + }, + { ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, latitude), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_latitude_constraint_1, + &asn_PER_memb_latitude_constr_5, + 0, + "latitude" + }, + { ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, longitude), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_longitude_constraint_1, + &asn_PER_memb_longitude_constr_6, + 0, + "longitude" + }, + { ATF_POINTER, 3, offsetof(struct PositionEstimate, uncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + 0, + &asn_DEF_uncertainty_7, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "uncertainty" + }, + { ATF_POINTER, 2, offsetof(struct PositionEstimate, confidence), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_confidence_constraint_1, + &asn_PER_memb_confidence_constr_11, + 0, + "confidence" + }, + { ATF_POINTER, 1, offsetof(struct PositionEstimate, altitudeInfo), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_AltitudeInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "altitudeInfo" + }, +}; +static int asn_MAP_PositionEstimate_oms_1[] = { 3, 4, 5 }; +static ber_tlv_tag_t asn_DEF_PositionEstimate_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PositionEstimate_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* latitudeSign at 73 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* latitude at 74 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* longitude at 75 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* uncertainty at 77 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* confidence at 81 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* altitudeInfo at 82 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PositionEstimate_specs_1 = { + sizeof(struct PositionEstimate), + offsetof(struct PositionEstimate, _asn_ctx), + asn_MAP_PositionEstimate_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_PositionEstimate_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PositionEstimate = { + "PositionEstimate", + "PositionEstimate", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PositionEstimate_tags_1, + sizeof(asn_DEF_PositionEstimate_tags_1) + /sizeof(asn_DEF_PositionEstimate_tags_1[0]), /* 1 */ + asn_DEF_PositionEstimate_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionEstimate_tags_1) + /sizeof(asn_DEF_PositionEstimate_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PositionEstimate_1, + 6, /* Elements count */ + &asn_SPC_PositionEstimate_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PositionEstimate.h b/src/core/libs/supl/asn-supl/PositionEstimate.h new file mode 100644 index 000000000..d3faa7619 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PositionEstimate.h @@ -0,0 +1,67 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _PositionEstimate_H_ +#define _PositionEstimate_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum latitudeSign { + latitudeSign_north = 0, + latitudeSign_south = 1 +} e_latitudeSign; + +/* Forward declarations */ +struct AltitudeInfo; + +/* PositionEstimate */ +typedef struct PositionEstimate { + ENUMERATED_t latitudeSign; + long latitude; + long longitude; + struct uncertainty { + long uncertaintySemiMajor; + long uncertaintySemiMinor; + long orientationMajorAxis; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } *uncertainty; + long *confidence /* OPTIONAL */; + struct AltitudeInfo *altitudeInfo /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PositionEstimate_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_latitudeSign_2; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_PositionEstimate; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "AltitudeInfo.h" + +#endif /* _PositionEstimate_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PrefMethod.c b/src/core/libs/supl/asn-supl/PrefMethod.c new file mode 100644 index 000000000..3949a64ec --- /dev/null +++ b/src/core/libs/supl/asn-supl/PrefMethod.c @@ -0,0 +1,147 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#include "PrefMethod.h" + +int +PrefMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +PrefMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +PrefMethod_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + PrefMethod_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +PrefMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +PrefMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +PrefMethod_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +PrefMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +PrefMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +PrefMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +PrefMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PrefMethod_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_PrefMethod_constr_1 = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_PrefMethod_value2enum_1[] = { + { 0, 24, "agpsSETassistedPreferred" }, + { 1, 21, "agpsSETBasedPreferred" }, + { 2, 12, "noPreference" } +}; +static unsigned int asn_MAP_PrefMethod_enum2value_1[] = { + 1, /* agpsSETBasedPreferred(1) */ + 0, /* agpsSETassistedPreferred(0) */ + 2 /* noPreference(2) */ +}; +static asn_INTEGER_specifics_t asn_SPC_PrefMethod_specs_1 = { + asn_MAP_PrefMethod_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PrefMethod_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_PrefMethod_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_PrefMethod = { + "PrefMethod", + "PrefMethod", + PrefMethod_free, + PrefMethod_print, + PrefMethod_constraint, + PrefMethod_decode_ber, + PrefMethod_encode_der, + PrefMethod_decode_xer, + PrefMethod_encode_xer, + PrefMethod_decode_uper, + PrefMethod_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PrefMethod_tags_1, + sizeof(asn_DEF_PrefMethod_tags_1) + /sizeof(asn_DEF_PrefMethod_tags_1[0]), /* 1 */ + asn_DEF_PrefMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_PrefMethod_tags_1) + /sizeof(asn_DEF_PrefMethod_tags_1[0]), /* 1 */ + &asn_PER_type_PrefMethod_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_PrefMethod_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PrefMethod.h b/src/core/libs/supl/asn-supl/PrefMethod.h new file mode 100644 index 000000000..af3786945 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PrefMethod.h @@ -0,0 +1,47 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#ifndef _PrefMethod_H_ +#define _PrefMethod_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum PrefMethod { + PrefMethod_agpsSETassistedPreferred = 0, + PrefMethod_agpsSETBasedPreferred = 1, + PrefMethod_noPreference = 2 +} e_PrefMethod; + +/* PrefMethod */ +typedef ENUMERATED_t PrefMethod_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PrefMethod; +asn_struct_free_f PrefMethod_free; +asn_struct_print_f PrefMethod_print; +asn_constr_check_f PrefMethod_constraint; +ber_type_decoder_f PrefMethod_decode_ber; +der_type_encoder_f PrefMethod_encode_der; +xer_type_decoder_f PrefMethod_decode_xer; +xer_type_encoder_f PrefMethod_encode_xer; +per_type_decoder_f PrefMethod_decode_uper; +per_type_encoder_f PrefMethod_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _PrefMethod_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c new file mode 100644 index 000000000..ea2ce5877 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "PrimaryCCPCH-RSCP.h" + +int +PrimaryCCPCH_RSCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +PrimaryCCPCH_RSCP_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +PrimaryCCPCH_RSCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +PrimaryCCPCH_RSCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +PrimaryCCPCH_RSCP_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +PrimaryCCPCH_RSCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +PrimaryCCPCH_RSCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +PrimaryCCPCH_RSCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +PrimaryCCPCH_RSCP_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_PrimaryCCPCH_RSCP_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_PrimaryCCPCH_RSCP_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_PrimaryCCPCH_RSCP = { + "PrimaryCCPCH-RSCP", + "PrimaryCCPCH-RSCP", + PrimaryCCPCH_RSCP_free, + PrimaryCCPCH_RSCP_print, + PrimaryCCPCH_RSCP_constraint, + PrimaryCCPCH_RSCP_decode_ber, + PrimaryCCPCH_RSCP_encode_der, + PrimaryCCPCH_RSCP_decode_xer, + PrimaryCCPCH_RSCP_encode_xer, + PrimaryCCPCH_RSCP_decode_uper, + PrimaryCCPCH_RSCP_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PrimaryCCPCH_RSCP_tags_1, + sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1) + /sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1[0]), /* 1 */ + asn_DEF_PrimaryCCPCH_RSCP_tags_1, /* Same as above */ + sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1) + /sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1[0]), /* 1 */ + &asn_PER_type_PrimaryCCPCH_RSCP_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h new file mode 100644 index 000000000..be672bc37 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _PrimaryCCPCH_RSCP_H_ +#define _PrimaryCCPCH_RSCP_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PrimaryCCPCH-RSCP */ +typedef long PrimaryCCPCH_RSCP_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PrimaryCCPCH_RSCP; +asn_struct_free_f PrimaryCCPCH_RSCP_free; +asn_struct_print_f PrimaryCCPCH_RSCP_print; +asn_constr_check_f PrimaryCCPCH_RSCP_constraint; +ber_type_decoder_f PrimaryCCPCH_RSCP_decode_ber; +der_type_encoder_f PrimaryCCPCH_RSCP_encode_der; +xer_type_decoder_f PrimaryCCPCH_RSCP_decode_xer; +xer_type_encoder_f PrimaryCCPCH_RSCP_encode_xer; +per_type_decoder_f PrimaryCCPCH_RSCP_decode_uper; +per_type_encoder_f PrimaryCCPCH_RSCP_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _PrimaryCCPCH_RSCP_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c new file mode 100644 index 000000000..62efe3f10 --- /dev/null +++ b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c @@ -0,0 +1,89 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "PrimaryCPICH-Info.h" + +static int +memb_primaryScramblingCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_primaryScramblingCode_constr_2 = { + { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_PrimaryCPICH_Info_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct PrimaryCPICH_Info, primaryScramblingCode), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_primaryScramblingCode_constraint_1, + &asn_PER_memb_primaryScramblingCode_constr_2, + 0, + "primaryScramblingCode" + }, +}; +static ber_tlv_tag_t asn_DEF_PrimaryCPICH_Info_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_PrimaryCPICH_Info_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* primaryScramblingCode at 186 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_PrimaryCPICH_Info_specs_1 = { + sizeof(struct PrimaryCPICH_Info), + offsetof(struct PrimaryCPICH_Info, _asn_ctx), + asn_MAP_PrimaryCPICH_Info_tag2el_1, + 1, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_PrimaryCPICH_Info = { + "PrimaryCPICH-Info", + "PrimaryCPICH-Info", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_PrimaryCPICH_Info_tags_1, + sizeof(asn_DEF_PrimaryCPICH_Info_tags_1) + /sizeof(asn_DEF_PrimaryCPICH_Info_tags_1[0]), /* 1 */ + asn_DEF_PrimaryCPICH_Info_tags_1, /* Same as above */ + sizeof(asn_DEF_PrimaryCPICH_Info_tags_1) + /sizeof(asn_DEF_PrimaryCPICH_Info_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_PrimaryCPICH_Info_1, + 1, /* Elements count */ + &asn_SPC_PrimaryCPICH_Info_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h new file mode 100644 index 000000000..79aeef11d --- /dev/null +++ b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h @@ -0,0 +1,37 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _PrimaryCPICH_Info_H_ +#define _PrimaryCPICH_Info_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* PrimaryCPICH-Info */ +typedef struct PrimaryCPICH_Info { + long primaryScramblingCode; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} PrimaryCPICH_Info_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_PrimaryCPICH_Info; + +#ifdef __cplusplus +} +#endif + +#endif /* _PrimaryCPICH_Info_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/QoP.c b/src/core/libs/supl/asn-supl/QoP.c new file mode 100644 index 000000000..5591c9f49 --- /dev/null +++ b/src/core/libs/supl/asn-supl/QoP.c @@ -0,0 +1,211 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "QoP.h" + +static int +memb_horacc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_veracc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_maxLocAge_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_delay_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 7)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_horacc_constr_2 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_veracc_constr_3 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_maxLocAge_constr_4 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_delay_constr_5 = { + { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_QoP_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct QoP, horacc), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_horacc_constraint_1, + &asn_PER_memb_horacc_constr_2, + 0, + "horacc" + }, + { ATF_POINTER, 3, offsetof(struct QoP, veracc), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_veracc_constraint_1, + &asn_PER_memb_veracc_constr_3, + 0, + "veracc" + }, + { ATF_POINTER, 2, offsetof(struct QoP, maxLocAge), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_maxLocAge_constraint_1, + &asn_PER_memb_maxLocAge_constr_4, + 0, + "maxLocAge" + }, + { ATF_POINTER, 1, offsetof(struct QoP, delay), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_delay_constraint_1, + &asn_PER_memb_delay_constr_5, + 0, + "delay" + }, +}; +static int asn_MAP_QoP_oms_1[] = { 1, 2, 3 }; +static ber_tlv_tag_t asn_DEF_QoP_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_QoP_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* horacc at 219 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* veracc at 220 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* maxLocAge at 221 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* delay at 222 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_QoP_specs_1 = { + sizeof(struct QoP), + offsetof(struct QoP, _asn_ctx), + asn_MAP_QoP_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_QoP_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 3, /* Start extensions */ + 5 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_QoP = { + "QoP", + "QoP", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_QoP_tags_1, + sizeof(asn_DEF_QoP_tags_1) + /sizeof(asn_DEF_QoP_tags_1[0]), /* 1 */ + asn_DEF_QoP_tags_1, /* Same as above */ + sizeof(asn_DEF_QoP_tags_1) + /sizeof(asn_DEF_QoP_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_QoP_1, + 4, /* Elements count */ + &asn_SPC_QoP_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/QoP.h b/src/core/libs/supl/asn-supl/QoP.h new file mode 100644 index 000000000..3ebcfdcb4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/QoP.h @@ -0,0 +1,44 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _QoP_H_ +#define _QoP_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* QoP */ +typedef struct QoP { + long horacc; + long *veracc /* OPTIONAL */; + long *maxLocAge /* OPTIONAL */; + long *delay /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} QoP_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_QoP; + +#ifdef __cplusplus +} +#endif + +#endif /* _QoP_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/RequestedAssistData.c b/src/core/libs/supl/asn-supl/RequestedAssistData.c new file mode 100644 index 000000000..359fd49fd --- /dev/null +++ b/src/core/libs/supl/asn-supl/RequestedAssistData.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#include "RequestedAssistData.h" + +static asn_TYPE_member_t asn_MBR_RequestedAssistData_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, almanacRequested), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "almanacRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, utcModelRequested), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "utcModelRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, ionosphericModelRequested), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ionosphericModelRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, dgpsCorrectionsRequested), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "dgpsCorrectionsRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, referenceLocationRequested), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceLocationRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, referenceTimeRequested), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "referenceTimeRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, acquisitionAssistanceRequested), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "acquisitionAssistanceRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, realTimeIntegrityRequested), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "realTimeIntegrityRequested" + }, + { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, navigationModelRequested), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "navigationModelRequested" + }, + { ATF_POINTER, 1, offsetof(struct RequestedAssistData, navigationModelData), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_XNavigationModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "navigationModelData" + }, +}; +static int asn_MAP_RequestedAssistData_oms_1[] = { 9 }; +static ber_tlv_tag_t asn_DEF_RequestedAssistData_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_RequestedAssistData_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* almanacRequested at 24 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* utcModelRequested at 25 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ionosphericModelRequested at 26 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* dgpsCorrectionsRequested at 27 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* referenceLocationRequested at 28 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* referenceTimeRequested at 29 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* acquisitionAssistanceRequested at 30 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* realTimeIntegrityRequested at 31 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* navigationModelRequested at 32 */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* navigationModelData at 33 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_RequestedAssistData_specs_1 = { + sizeof(struct RequestedAssistData), + offsetof(struct RequestedAssistData, _asn_ctx), + asn_MAP_RequestedAssistData_tag2el_1, + 10, /* Count of tags in the map */ + asn_MAP_RequestedAssistData_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 9, /* Start extensions */ + 11 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_RequestedAssistData = { + "RequestedAssistData", + "RequestedAssistData", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_RequestedAssistData_tags_1, + sizeof(asn_DEF_RequestedAssistData_tags_1) + /sizeof(asn_DEF_RequestedAssistData_tags_1[0]), /* 1 */ + asn_DEF_RequestedAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_RequestedAssistData_tags_1) + /sizeof(asn_DEF_RequestedAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_RequestedAssistData_1, + 10, /* Elements count */ + &asn_SPC_RequestedAssistData_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/RequestedAssistData.h b/src/core/libs/supl/asn-supl/RequestedAssistData.h new file mode 100644 index 000000000..4e4dfac2f --- /dev/null +++ b/src/core/libs/supl/asn-supl/RequestedAssistData.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#ifndef _RequestedAssistData_H_ +#define _RequestedAssistData_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct XNavigationModel; + +/* RequestedAssistData */ +typedef struct RequestedAssistData { + BOOLEAN_t almanacRequested; + BOOLEAN_t utcModelRequested; + BOOLEAN_t ionosphericModelRequested; + BOOLEAN_t dgpsCorrectionsRequested; + BOOLEAN_t referenceLocationRequested; + BOOLEAN_t referenceTimeRequested; + BOOLEAN_t acquisitionAssistanceRequested; + BOOLEAN_t realTimeIntegrityRequested; + BOOLEAN_t navigationModelRequested; + struct XNavigationModel *navigationModelData /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} RequestedAssistData_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_RequestedAssistData; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "XNavigationModel.h" + +#endif /* _RequestedAssistData_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SETAuthKey.c b/src/core/libs/supl/asn-supl/SETAuthKey.c new file mode 100644 index 000000000..75b01ca3b --- /dev/null +++ b/src/core/libs/supl/asn-supl/SETAuthKey.c @@ -0,0 +1,142 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-RESPONSE" + * found in "../supl-response.asn" + */ + +#include "SETAuthKey.h" + +static int +memb_shortKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 128)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_longKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 256)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_shortKey_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 128, 128 } /* (SIZE(128..128)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_longKey_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 256, 256 } /* (SIZE(256..256)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_type_SETAuthKey_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SETAuthKey_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.shortKey), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_shortKey_constraint_1, + &asn_PER_memb_shortKey_constr_2, + 0, + "shortKey" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.longKey), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_longKey_constraint_1, + &asn_PER_memb_longKey_constr_3, + 0, + "longKey" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_SETAuthKey_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* shortKey at 17 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* longKey at 18 */ +}; +static asn_CHOICE_specifics_t asn_SPC_SETAuthKey_specs_1 = { + sizeof(struct SETAuthKey), + offsetof(struct SETAuthKey, _asn_ctx), + offsetof(struct SETAuthKey, present), + sizeof(((struct SETAuthKey *)0)->present), + asn_MAP_SETAuthKey_tag2el_1, + 2, /* Count of tags in the map */ + 0, + 2 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_SETAuthKey = { + "SETAuthKey", + "SETAuthKey", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_SETAuthKey_constr_1, + asn_MBR_SETAuthKey_1, + 2, /* Elements count */ + &asn_SPC_SETAuthKey_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SETAuthKey.h b/src/core/libs/supl/asn-supl/SETAuthKey.h new file mode 100644 index 000000000..29f123269 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SETAuthKey.h @@ -0,0 +1,54 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-RESPONSE" + * found in "../supl-response.asn" + */ + +#ifndef _SETAuthKey_H_ +#define _SETAuthKey_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SETAuthKey_PR { + SETAuthKey_PR_NOTHING, /* No components present */ + SETAuthKey_PR_shortKey, + SETAuthKey_PR_longKey, + /* Extensions may appear below */ + +} SETAuthKey_PR; + +/* SETAuthKey */ +typedef struct SETAuthKey { + SETAuthKey_PR present; + union SETAuthKey_u { + BIT_STRING_t shortKey; + BIT_STRING_t longKey; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SETAuthKey_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SETAuthKey; + +#ifdef __cplusplus +} +#endif + +#endif /* _SETAuthKey_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SETCapabilities.c b/src/core/libs/supl/asn-supl/SETCapabilities.c new file mode 100644 index 000000000..e5648f504 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SETCapabilities.c @@ -0,0 +1,79 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#include "SETCapabilities.h" + +static asn_TYPE_member_t asn_MBR_SETCapabilities_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, posTechnology), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosTechnology, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posTechnology" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, prefMethod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PrefMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "prefMethod" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, posProtocol), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosProtocol, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posProtocol" + }, +}; +static ber_tlv_tag_t asn_DEF_SETCapabilities_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SETCapabilities_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posTechnology at 16 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* prefMethod at 17 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* posProtocol at 18 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SETCapabilities_specs_1 = { + sizeof(struct SETCapabilities), + offsetof(struct SETCapabilities, _asn_ctx), + asn_MAP_SETCapabilities_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SETCapabilities = { + "SETCapabilities", + "SETCapabilities", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SETCapabilities_tags_1, + sizeof(asn_DEF_SETCapabilities_tags_1) + /sizeof(asn_DEF_SETCapabilities_tags_1[0]), /* 1 */ + asn_DEF_SETCapabilities_tags_1, /* Same as above */ + sizeof(asn_DEF_SETCapabilities_tags_1) + /sizeof(asn_DEF_SETCapabilities_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SETCapabilities_1, + 3, /* Elements count */ + &asn_SPC_SETCapabilities_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SETCapabilities.h b/src/core/libs/supl/asn-supl/SETCapabilities.h new file mode 100644 index 000000000..84f0e8a00 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SETCapabilities.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#ifndef _SETCapabilities_H_ +#define _SETCapabilities_H_ + + +#include + +/* Including external dependencies */ +#include "PosTechnology.h" +#include "PrefMethod.h" +#include "PosProtocol.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SETCapabilities */ +typedef struct SETCapabilities { + PosTechnology_t posTechnology; + PrefMethod_t prefMethod; + PosProtocol_t posProtocol; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SETCapabilities_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SETCapabilities; + +#ifdef __cplusplus +} +#endif + +#endif /* _SETCapabilities_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SETId.c b/src/core/libs/supl/asn-supl/SETId.c new file mode 100644 index 000000000..6da7efdf5 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SETId.c @@ -0,0 +1,284 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "SETId.h" + +static int check_permitted_alphabet_6(const void *sptr) { + /* The underlying type is IA5String */ + const IA5String_t *st = (const IA5String_t *)sptr; + const uint8_t *ch = st->buf; + const uint8_t *end = ch + st->size; + + for(; ch < end; ch++) { + uint8_t cv = *ch; + if(!(cv <= 127)) return -1; + } + return 0; +} + +static int +memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 34)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 8)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const IA5String_t *st = (const IA5String_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size >= 1 && size <= 1000) + && !check_permitted_alphabet_6(st)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_msisdn_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_mdn_constr_3 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_min_constr_4 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 34, 34 } /* (SIZE(34..34)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_imsi_constr_5 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_nai_constr_6 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_CONSTRAINED, 10, 10, 1, 1000 } /* (SIZE(1..1000)) */, + 0, 0 /* No PER character map necessary */ +}; +static asn_per_constraints_t asn_PER_type_SETId_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5 } /* (0..5,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SETId_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SETId, choice.msisdn), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_msisdn_constraint_1, + &asn_PER_memb_msisdn_constr_2, + 0, + "msisdn" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETId, choice.mdn), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_mdn_constraint_1, + &asn_PER_memb_mdn_constr_3, + 0, + "mdn" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETId, choice.min), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, + memb_min_constraint_1, + &asn_PER_memb_min_constr_4, + 0, + "min" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETId, choice.imsi), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_imsi_constraint_1, + &asn_PER_memb_imsi_constr_5, + 0, + "imsi" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETId, choice.nai), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_IA5String, + memb_nai_constraint_1, + &asn_PER_memb_nai_constr_6, + 0, + "nai" + }, + { ATF_NOFLAGS, 0, offsetof(struct SETId, choice.iPAddress), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_IPAddress, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iPAddress" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_SETId_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msisdn at 22 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* mdn at 23 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* min at 24 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* imsi at 25 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* nai at 26 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* iPAddress at 27 */ +}; +static asn_CHOICE_specifics_t asn_SPC_SETId_specs_1 = { + sizeof(struct SETId), + offsetof(struct SETId, _asn_ctx), + offsetof(struct SETId, present), + sizeof(((struct SETId *)0)->present), + asn_MAP_SETId_tag2el_1, + 6, /* Count of tags in the map */ + 0, + 6 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_SETId = { + "SETId", + "SETId", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_SETId_constr_1, + asn_MBR_SETId_1, + 6, /* Elements count */ + &asn_SPC_SETId_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SETId.h b/src/core/libs/supl/asn-supl/SETId.h new file mode 100644 index 000000000..096777f75 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SETId.h @@ -0,0 +1,65 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _SETId_H_ +#define _SETId_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include "IPAddress.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SETId_PR { + SETId_PR_NOTHING, /* No components present */ + SETId_PR_msisdn, + SETId_PR_mdn, + SETId_PR_min, + SETId_PR_imsi, + SETId_PR_nai, + SETId_PR_iPAddress, + /* Extensions may appear below */ + +} SETId_PR; + +/* SETId */ +typedef struct SETId { + SETId_PR present; + union SETId_u { + OCTET_STRING_t msisdn; + OCTET_STRING_t mdn; + BIT_STRING_t min; + OCTET_STRING_t imsi; + IA5String_t nai; + IPAddress_t iPAddress; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SETId_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SETId; + +#ifdef __cplusplus +} +#endif + +#endif /* _SETId_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SLPAddress.c b/src/core/libs/supl/asn-supl/SLPAddress.c new file mode 100644 index 000000000..d123057c7 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SLPAddress.c @@ -0,0 +1,70 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "SLPAddress.h" + +static asn_per_constraints_t asn_PER_type_SLPAddress_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SLPAddress_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SLPAddress, choice.iPAddress), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_IPAddress, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "iPAddress" + }, + { ATF_NOFLAGS, 0, offsetof(struct SLPAddress, choice.fQDN), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FQDN, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "fQDN" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_SLPAddress_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* iPAddress at 44 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* fQDN at 45 */ +}; +static asn_CHOICE_specifics_t asn_SPC_SLPAddress_specs_1 = { + sizeof(struct SLPAddress), + offsetof(struct SLPAddress, _asn_ctx), + offsetof(struct SLPAddress, present), + sizeof(((struct SLPAddress *)0)->present), + asn_MAP_SLPAddress_tag2el_1, + 2, /* Count of tags in the map */ + 0, + 2 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_SLPAddress = { + "SLPAddress", + "SLPAddress", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_SLPAddress_constr_1, + asn_MBR_SLPAddress_1, + 2, /* Elements count */ + &asn_SPC_SLPAddress_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SLPAddress.h b/src/core/libs/supl/asn-supl/SLPAddress.h new file mode 100644 index 000000000..fba1f13d9 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SLPAddress.h @@ -0,0 +1,55 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _SLPAddress_H_ +#define _SLPAddress_H_ + + +#include + +/* Including external dependencies */ +#include "IPAddress.h" +#include "FQDN.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SLPAddress_PR { + SLPAddress_PR_NOTHING, /* No components present */ + SLPAddress_PR_iPAddress, + SLPAddress_PR_fQDN, + /* Extensions may appear below */ + +} SLPAddress_PR; + +/* SLPAddress */ +typedef struct SLPAddress { + SLPAddress_PR present; + union SLPAddress_u { + IPAddress_t iPAddress; + FQDN_t fQDN; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SLPAddress_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SLPAddress; + +#ifdef __cplusplus +} +#endif + +#endif /* _SLPAddress_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SLPMode.c b/src/core/libs/supl/asn-supl/SLPMode.c new file mode 100644 index 000000000..f01e1f89a --- /dev/null +++ b/src/core/libs/supl/asn-supl/SLPMode.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "SLPMode.h" + +int +SLPMode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +SLPMode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +SLPMode_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + SLPMode_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +SLPMode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +SLPMode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +SLPMode_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +SLPMode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +SLPMode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +SLPMode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +SLPMode_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SLPMode_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_SLPMode_constr_1 = { + { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_SLPMode_value2enum_1[] = { + { 0, 5, "proxy" }, + { 1, 8, "nonProxy" } +}; +static unsigned int asn_MAP_SLPMode_enum2value_1[] = { + 1, /* nonProxy(1) */ + 0 /* proxy(0) */ +}; +static asn_INTEGER_specifics_t asn_SPC_SLPMode_specs_1 = { + asn_MAP_SLPMode_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_SLPMode_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_SLPMode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_SLPMode = { + "SLPMode", + "SLPMode", + SLPMode_free, + SLPMode_print, + SLPMode_constraint, + SLPMode_decode_ber, + SLPMode_encode_der, + SLPMode_decode_xer, + SLPMode_encode_xer, + SLPMode_decode_uper, + SLPMode_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SLPMode_tags_1, + sizeof(asn_DEF_SLPMode_tags_1) + /sizeof(asn_DEF_SLPMode_tags_1[0]), /* 1 */ + asn_DEF_SLPMode_tags_1, /* Same as above */ + sizeof(asn_DEF_SLPMode_tags_1) + /sizeof(asn_DEF_SLPMode_tags_1[0]), /* 1 */ + &asn_PER_type_SLPMode_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_SLPMode_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SLPMode.h b/src/core/libs/supl/asn-supl/SLPMode.h new file mode 100644 index 000000000..3aec2cac0 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SLPMode.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _SLPMode_H_ +#define _SLPMode_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum SLPMode { + SLPMode_proxy = 0, + SLPMode_nonProxy = 1 +} e_SLPMode; + +/* SLPMode */ +typedef ENUMERATED_t SLPMode_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SLPMode; +asn_struct_free_f SLPMode_free; +asn_struct_print_f SLPMode_print; +asn_constr_check_f SLPMode_constraint; +ber_type_decoder_f SLPMode_decode_ber; +der_type_encoder_f SLPMode_encode_der; +xer_type_decoder_f SLPMode_decode_xer; +xer_type_encoder_f SLPMode_encode_xer; +per_type_decoder_f SLPMode_decode_uper; +per_type_encoder_f SLPMode_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _SLPMode_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SUPLEND.c b/src/core/libs/supl/asn-supl/SUPLEND.c new file mode 100644 index 000000000..9f2d5e247 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLEND.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-END" + * found in "../supl-end.asn" + */ + +#include "SUPLEND.h" + +static asn_TYPE_member_t asn_MBR_SUPLEND_1[] = { + { ATF_POINTER, 3, offsetof(struct SUPLEND, position), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Position, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_POINTER, 2, offsetof(struct SUPLEND, statusCode), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_StatusCode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "statusCode" + }, + { ATF_POINTER, 1, offsetof(struct SUPLEND, ver), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ver, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ver" + }, +}; +static int asn_MAP_SUPLEND_oms_1[] = { 0, 1, 2 }; +static ber_tlv_tag_t asn_DEF_SUPLEND_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SUPLEND_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* position at 10 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* statusCode at 11 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ver at 12 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SUPLEND_specs_1 = { + sizeof(struct SUPLEND), + offsetof(struct SUPLEND, _asn_ctx), + asn_MAP_SUPLEND_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_SUPLEND_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SUPLEND = { + "SUPLEND", + "SUPLEND", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SUPLEND_tags_1, + sizeof(asn_DEF_SUPLEND_tags_1) + /sizeof(asn_DEF_SUPLEND_tags_1[0]), /* 1 */ + asn_DEF_SUPLEND_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLEND_tags_1) + /sizeof(asn_DEF_SUPLEND_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SUPLEND_1, + 3, /* Elements count */ + &asn_SPC_SUPLEND_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SUPLEND.h b/src/core/libs/supl/asn-supl/SUPLEND.h new file mode 100644 index 000000000..2c75dbc21 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLEND.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-END" + * found in "../supl-end.asn" + */ + +#ifndef _SUPLEND_H_ +#define _SUPLEND_H_ + + +#include + +/* Including external dependencies */ +#include "StatusCode.h" +#include "Ver.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Position; + +/* SUPLEND */ +typedef struct SUPLEND { + struct Position *position /* OPTIONAL */; + StatusCode_t *statusCode /* OPTIONAL */; + Ver_t *ver /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SUPLEND_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SUPLEND; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Position.h" + +#endif /* _SUPLEND_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SUPLINIT.c b/src/core/libs/supl/asn-supl/SUPLINIT.c new file mode 100644 index 000000000..28f0f7ca8 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLINIT.c @@ -0,0 +1,121 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#include "SUPLINIT.h" + +static asn_TYPE_member_t asn_MBR_SUPLINIT_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SUPLINIT, posMethod), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posMethod" + }, + { ATF_POINTER, 3, offsetof(struct SUPLINIT, notification), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Notification, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "notification" + }, + { ATF_POINTER, 2, offsetof(struct SUPLINIT, sLPAddress), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_SLPAddress, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sLPAddress" + }, + { ATF_POINTER, 1, offsetof(struct SUPLINIT, qoP), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_QoP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "qoP" + }, + { ATF_NOFLAGS, 0, offsetof(struct SUPLINIT, sLPMode), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SLPMode, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sLPMode" + }, + { ATF_POINTER, 2, offsetof(struct SUPLINIT, mAC), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MAC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "mAC" + }, + { ATF_POINTER, 1, offsetof(struct SUPLINIT, keyIdentity), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_KeyIdentity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "keyIdentity" + }, +}; +static int asn_MAP_SUPLINIT_oms_1[] = { 1, 2, 3, 5, 6 }; +static ber_tlv_tag_t asn_DEF_SUPLINIT_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SUPLINIT_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posMethod at 10 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* notification at 11 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sLPAddress at 12 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* qoP at 13 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sLPMode at 14 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* mAC at 15 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* keyIdentity at 16 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SUPLINIT_specs_1 = { + sizeof(struct SUPLINIT), + offsetof(struct SUPLINIT, _asn_ctx), + asn_MAP_SUPLINIT_tag2el_1, + 7, /* Count of tags in the map */ + asn_MAP_SUPLINIT_oms_1, /* Optional members */ + 5, 0, /* Root/Additions */ + 6, /* Start extensions */ + 8 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SUPLINIT = { + "SUPLINIT", + "SUPLINIT", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SUPLINIT_tags_1, + sizeof(asn_DEF_SUPLINIT_tags_1) + /sizeof(asn_DEF_SUPLINIT_tags_1[0]), /* 1 */ + asn_DEF_SUPLINIT_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLINIT_tags_1) + /sizeof(asn_DEF_SUPLINIT_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SUPLINIT_1, + 7, /* Elements count */ + &asn_SPC_SUPLINIT_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SUPLINIT.h b/src/core/libs/supl/asn-supl/SUPLINIT.h new file mode 100644 index 000000000..af290986f --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLINIT.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-INIT" + * found in "../supl-init.asn" + */ + +#ifndef _SUPLINIT_H_ +#define _SUPLINIT_H_ + + +#include + +/* Including external dependencies */ +#include "PosMethod.h" +#include "SLPMode.h" +#include "MAC.h" +#include "KeyIdentity.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Notification; +struct SLPAddress; +struct QoP; + +/* SUPLINIT */ +typedef struct SUPLINIT { + PosMethod_t posMethod; + struct Notification *notification /* OPTIONAL */; + struct SLPAddress *sLPAddress /* OPTIONAL */; + struct QoP *qoP /* OPTIONAL */; + SLPMode_t sLPMode; + MAC_t *mAC /* OPTIONAL */; + KeyIdentity_t *keyIdentity /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SUPLINIT_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SUPLINIT; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Notification.h" +#include "SLPAddress.h" +#include "QoP.h" + +#endif /* _SUPLINIT_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SUPLPOS.c b/src/core/libs/supl/asn-supl/SUPLPOS.c new file mode 100644 index 000000000..52e5dc465 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLPOS.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS" + * found in "../supl-pos.asn" + */ + +#include "SUPLPOS.h" + +static asn_TYPE_member_t asn_MBR_SUPLPOS_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SUPLPOS, posPayLoad), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_PosPayLoad, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posPayLoad" + }, + { ATF_POINTER, 1, offsetof(struct SUPLPOS, velocity), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_Velocity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "velocity" + }, +}; +static int asn_MAP_SUPLPOS_oms_1[] = { 1 }; +static ber_tlv_tag_t asn_DEF_SUPLPOS_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SUPLPOS_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posPayLoad at 10 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* velocity at 11 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SUPLPOS_specs_1 = { + sizeof(struct SUPLPOS), + offsetof(struct SUPLPOS, _asn_ctx), + asn_MAP_SUPLPOS_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_SUPLPOS_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SUPLPOS = { + "SUPLPOS", + "SUPLPOS", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SUPLPOS_tags_1, + sizeof(asn_DEF_SUPLPOS_tags_1) + /sizeof(asn_DEF_SUPLPOS_tags_1[0]), /* 1 */ + asn_DEF_SUPLPOS_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLPOS_tags_1) + /sizeof(asn_DEF_SUPLPOS_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SUPLPOS_1, + 2, /* Elements count */ + &asn_SPC_SUPLPOS_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SUPLPOS.h b/src/core/libs/supl/asn-supl/SUPLPOS.h new file mode 100644 index 000000000..7285b26cf --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLPOS.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS" + * found in "../supl-pos.asn" + */ + +#ifndef _SUPLPOS_H_ +#define _SUPLPOS_H_ + + +#include + +/* Including external dependencies */ +#include "PosPayLoad.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct Velocity; + +/* SUPLPOS */ +typedef struct SUPLPOS { + PosPayLoad_t posPayLoad; + struct Velocity *velocity /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SUPLPOS_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SUPLPOS; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "Velocity.h" + +#endif /* _SUPLPOS_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SUPLPOSINIT.c b/src/core/libs/supl/asn-supl/SUPLPOSINIT.c new file mode 100644 index 000000000..bfebd9a55 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLPOSINIT.c @@ -0,0 +1,111 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#include "SUPLPOSINIT.h" + +static asn_TYPE_member_t asn_MBR_SUPLPOSINIT_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SUPLPOSINIT, sETCapabilities), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SETCapabilities, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sETCapabilities" + }, + { ATF_POINTER, 1, offsetof(struct SUPLPOSINIT, requestedAssistData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequestedAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "requestedAssistData" + }, + { ATF_NOFLAGS, 0, offsetof(struct SUPLPOSINIT, locationId), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "locationId" + }, + { ATF_POINTER, 3, offsetof(struct SUPLPOSINIT, position), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Position, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "position" + }, + { ATF_POINTER, 2, offsetof(struct SUPLPOSINIT, sUPLPOS), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLPOS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sUPLPOS" + }, + { ATF_POINTER, 1, offsetof(struct SUPLPOSINIT, ver), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ver, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "ver" + }, +}; +static int asn_MAP_SUPLPOSINIT_oms_1[] = { 1, 3, 4, 5 }; +static ber_tlv_tag_t asn_DEF_SUPLPOSINIT_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SUPLPOSINIT_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sETCapabilities at 15 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* requestedAssistData at 16 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* locationId at 17 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* position at 18 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sUPLPOS at 19 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* ver at 20 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SUPLPOSINIT_specs_1 = { + sizeof(struct SUPLPOSINIT), + offsetof(struct SUPLPOSINIT, _asn_ctx), + asn_MAP_SUPLPOSINIT_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_SUPLPOSINIT_oms_1, /* Optional members */ + 4, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SUPLPOSINIT = { + "SUPLPOSINIT", + "SUPLPOSINIT", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SUPLPOSINIT_tags_1, + sizeof(asn_DEF_SUPLPOSINIT_tags_1) + /sizeof(asn_DEF_SUPLPOSINIT_tags_1[0]), /* 1 */ + asn_DEF_SUPLPOSINIT_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLPOSINIT_tags_1) + /sizeof(asn_DEF_SUPLPOSINIT_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SUPLPOSINIT_1, + 6, /* Elements count */ + &asn_SPC_SUPLPOSINIT_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SUPLPOSINIT.h b/src/core/libs/supl/asn-supl/SUPLPOSINIT.h new file mode 100644 index 000000000..740f7b5b4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLPOSINIT.h @@ -0,0 +1,58 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#ifndef _SUPLPOSINIT_H_ +#define _SUPLPOSINIT_H_ + + +#include + +/* Including external dependencies */ +#include "SETCapabilities.h" +#include "LocationId.h" +#include "Ver.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct RequestedAssistData; +struct Position; +struct SUPLPOS; + +/* SUPLPOSINIT */ +typedef struct SUPLPOSINIT { + SETCapabilities_t sETCapabilities; + struct RequestedAssistData *requestedAssistData /* OPTIONAL */; + LocationId_t locationId; + struct Position *position /* OPTIONAL */; + struct SUPLPOS *sUPLPOS /* OPTIONAL */; + Ver_t *ver /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SUPLPOSINIT_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SUPLPOSINIT; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "RequestedAssistData.h" +#include "Position.h" +#include "SUPLPOS.h" + +#endif /* _SUPLPOSINIT_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SUPLRESPONSE.c b/src/core/libs/supl/asn-supl/SUPLRESPONSE.c new file mode 100644 index 000000000..eef657673 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLRESPONSE.c @@ -0,0 +1,91 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-RESPONSE" + * found in "../supl-response.asn" + */ + +#include "SUPLRESPONSE.h" + +static asn_TYPE_member_t asn_MBR_SUPLRESPONSE_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SUPLRESPONSE, posMethod), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "posMethod" + }, + { ATF_POINTER, 3, offsetof(struct SUPLRESPONSE, sLPAddress), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_SLPAddress, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sLPAddress" + }, + { ATF_POINTER, 2, offsetof(struct SUPLRESPONSE, sETAuthKey), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_SETAuthKey, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sETAuthKey" + }, + { ATF_POINTER, 1, offsetof(struct SUPLRESPONSE, keyIdentity4), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_KeyIdentity4, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "keyIdentity4" + }, +}; +static int asn_MAP_SUPLRESPONSE_oms_1[] = { 1, 2, 3 }; +static ber_tlv_tag_t asn_DEF_SUPLRESPONSE_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SUPLRESPONSE_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posMethod at 10 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sLPAddress at 11 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sETAuthKey at 12 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* keyIdentity4 at 13 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SUPLRESPONSE_specs_1 = { + sizeof(struct SUPLRESPONSE), + offsetof(struct SUPLRESPONSE, _asn_ctx), + asn_MAP_SUPLRESPONSE_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_SUPLRESPONSE_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 3, /* Start extensions */ + 5 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SUPLRESPONSE = { + "SUPLRESPONSE", + "SUPLRESPONSE", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SUPLRESPONSE_tags_1, + sizeof(asn_DEF_SUPLRESPONSE_tags_1) + /sizeof(asn_DEF_SUPLRESPONSE_tags_1[0]), /* 1 */ + asn_DEF_SUPLRESPONSE_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLRESPONSE_tags_1) + /sizeof(asn_DEF_SUPLRESPONSE_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SUPLRESPONSE_1, + 4, /* Elements count */ + &asn_SPC_SUPLRESPONSE_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SUPLRESPONSE.h b/src/core/libs/supl/asn-supl/SUPLRESPONSE.h new file mode 100644 index 000000000..698cd32b4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLRESPONSE.h @@ -0,0 +1,53 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-RESPONSE" + * found in "../supl-response.asn" + */ + +#ifndef _SUPLRESPONSE_H_ +#define _SUPLRESPONSE_H_ + + +#include + +/* Including external dependencies */ +#include "PosMethod.h" +#include "KeyIdentity4.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SLPAddress; +struct SETAuthKey; + +/* SUPLRESPONSE */ +typedef struct SUPLRESPONSE { + PosMethod_t posMethod; + struct SLPAddress *sLPAddress /* OPTIONAL */; + struct SETAuthKey *sETAuthKey /* OPTIONAL */; + KeyIdentity4_t *keyIdentity4 /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SUPLRESPONSE_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SUPLRESPONSE; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SLPAddress.h" +#include "SETAuthKey.h" + +#endif /* _SUPLRESPONSE_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SUPLSTART.c b/src/core/libs/supl/asn-supl/SUPLSTART.c new file mode 100644 index 000000000..c60d6e263 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLSTART.c @@ -0,0 +1,81 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#include "SUPLSTART.h" + +static asn_TYPE_member_t asn_MBR_SUPLSTART_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SUPLSTART, sETCapabilities), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SETCapabilities, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sETCapabilities" + }, + { ATF_NOFLAGS, 0, offsetof(struct SUPLSTART, locationId), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "locationId" + }, + { ATF_POINTER, 1, offsetof(struct SUPLSTART, qoP), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_QoP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "qoP" + }, +}; +static int asn_MAP_SUPLSTART_oms_1[] = { 2 }; +static ber_tlv_tag_t asn_DEF_SUPLSTART_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SUPLSTART_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sETCapabilities at 10 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* locationId at 11 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* qoP at 12 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SUPLSTART_specs_1 = { + sizeof(struct SUPLSTART), + offsetof(struct SUPLSTART, _asn_ctx), + asn_MAP_SUPLSTART_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_SUPLSTART_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SUPLSTART = { + "SUPLSTART", + "SUPLSTART", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SUPLSTART_tags_1, + sizeof(asn_DEF_SUPLSTART_tags_1) + /sizeof(asn_DEF_SUPLSTART_tags_1[0]), /* 1 */ + asn_DEF_SUPLSTART_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLSTART_tags_1) + /sizeof(asn_DEF_SUPLSTART_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SUPLSTART_1, + 3, /* Elements count */ + &asn_SPC_SUPLSTART_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SUPLSTART.h b/src/core/libs/supl/asn-supl/SUPLSTART.h new file mode 100644 index 000000000..b1061bf3c --- /dev/null +++ b/src/core/libs/supl/asn-supl/SUPLSTART.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-START" + * found in "../supl-start.asn" + */ + +#ifndef _SUPLSTART_H_ +#define _SUPLSTART_H_ + + +#include + +/* Including external dependencies */ +#include "SETCapabilities.h" +#include "LocationId.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct QoP; + +/* SUPLSTART */ +typedef struct SUPLSTART { + SETCapabilities_t sETCapabilities; + LocationId_t locationId; + struct QoP *qoP /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SUPLSTART_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SUPLSTART; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "QoP.h" + +#endif /* _SUPLSTART_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SatelliteInfo.c b/src/core/libs/supl/asn-supl/SatelliteInfo.c new file mode 100644 index 000000000..b32a55b86 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SatelliteInfo.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#include "SatelliteInfo.h" + +static asn_per_constraints_t asn_PER_type_SatelliteInfo_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 5, 5, 1, 31 } /* (SIZE(1..31)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SatelliteInfo_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SatelliteInfoElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_SatelliteInfo_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_SatelliteInfo_specs_1 = { + sizeof(struct SatelliteInfo), + offsetof(struct SatelliteInfo, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_SatelliteInfo = { + "SatelliteInfo", + "SatelliteInfo", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SatelliteInfo_tags_1, + sizeof(asn_DEF_SatelliteInfo_tags_1) + /sizeof(asn_DEF_SatelliteInfo_tags_1[0]), /* 1 */ + asn_DEF_SatelliteInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_SatelliteInfo_tags_1) + /sizeof(asn_DEF_SatelliteInfo_tags_1[0]), /* 1 */ + &asn_PER_type_SatelliteInfo_constr_1, + asn_MBR_SatelliteInfo_1, + 1, /* Single element */ + &asn_SPC_SatelliteInfo_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SatelliteInfo.h b/src/core/libs/supl/asn-supl/SatelliteInfo.h new file mode 100644 index 000000000..ff36af47a --- /dev/null +++ b/src/core/libs/supl/asn-supl/SatelliteInfo.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#ifndef _SatelliteInfo_H_ +#define _SatelliteInfo_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SatelliteInfoElement; + +/* SatelliteInfo */ +typedef struct SatelliteInfo { + A_SEQUENCE_OF(struct SatelliteInfoElement) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SatelliteInfo_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SatelliteInfo; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SatelliteInfoElement.h" + +#endif /* _SatelliteInfo_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SatelliteInfoElement.c b/src/core/libs/supl/asn-supl/SatelliteInfoElement.c new file mode 100644 index 000000000..0590d6e3b --- /dev/null +++ b/src/core/libs/supl/asn-supl/SatelliteInfoElement.c @@ -0,0 +1,129 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#include "SatelliteInfoElement.h" + +static int +memb_satId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 63)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_iODE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_satId_constr_2 = { + { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_iODE_constr_3 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SatelliteInfoElement_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SatelliteInfoElement, satId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_satId_constraint_1, + &asn_PER_memb_satId_constr_2, + 0, + "satId" + }, + { ATF_NOFLAGS, 0, offsetof(struct SatelliteInfoElement, iODE), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_iODE_constraint_1, + &asn_PER_memb_iODE_constr_3, + 0, + "iODE" + }, +}; +static ber_tlv_tag_t asn_DEF_SatelliteInfoElement_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SatelliteInfoElement_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satId at 50 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iODE at 51 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SatelliteInfoElement_specs_1 = { + sizeof(struct SatelliteInfoElement), + offsetof(struct SatelliteInfoElement, _asn_ctx), + asn_MAP_SatelliteInfoElement_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SatelliteInfoElement = { + "SatelliteInfoElement", + "SatelliteInfoElement", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SatelliteInfoElement_tags_1, + sizeof(asn_DEF_SatelliteInfoElement_tags_1) + /sizeof(asn_DEF_SatelliteInfoElement_tags_1[0]), /* 1 */ + asn_DEF_SatelliteInfoElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SatelliteInfoElement_tags_1) + /sizeof(asn_DEF_SatelliteInfoElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SatelliteInfoElement_1, + 2, /* Elements count */ + &asn_SPC_SatelliteInfoElement_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SatelliteInfoElement.h b/src/core/libs/supl/asn-supl/SatelliteInfoElement.h new file mode 100644 index 000000000..6b2cc69ee --- /dev/null +++ b/src/core/libs/supl/asn-supl/SatelliteInfoElement.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#ifndef _SatelliteInfoElement_H_ +#define _SatelliteInfoElement_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SatelliteInfoElement */ +typedef struct SatelliteInfoElement { + long satId; + long iODE; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SatelliteInfoElement_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SatelliteInfoElement; + +#ifdef __cplusplus +} +#endif + +#endif /* _SatelliteInfoElement_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SessionID.c b/src/core/libs/supl/asn-supl/SessionID.c new file mode 100644 index 000000000..7a1b75ad8 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SessionID.c @@ -0,0 +1,71 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "SessionID.h" + +static asn_TYPE_member_t asn_MBR_SessionID_1[] = { + { ATF_POINTER, 2, offsetof(struct SessionID, setSessionID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SetSessionID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "setSessionID" + }, + { ATF_POINTER, 1, offsetof(struct SessionID, slpSessionID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SlpSessionID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "slpSessionID" + }, +}; +static int asn_MAP_SessionID_oms_1[] = { 0, 1 }; +static ber_tlv_tag_t asn_DEF_SessionID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SessionID_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* setSessionID at 15 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* slpSessionID at 16 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SessionID_specs_1 = { + sizeof(struct SessionID), + offsetof(struct SessionID, _asn_ctx), + asn_MAP_SessionID_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_SessionID_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SessionID = { + "SessionID", + "SessionID", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SessionID_tags_1, + sizeof(asn_DEF_SessionID_tags_1) + /sizeof(asn_DEF_SessionID_tags_1[0]), /* 1 */ + asn_DEF_SessionID_tags_1, /* Same as above */ + sizeof(asn_DEF_SessionID_tags_1) + /sizeof(asn_DEF_SessionID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SessionID_1, + 2, /* Elements count */ + &asn_SPC_SessionID_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SessionID.h b/src/core/libs/supl/asn-supl/SessionID.h new file mode 100644 index 000000000..c56f8ac07 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SessionID.h @@ -0,0 +1,45 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _SessionID_H_ +#define _SessionID_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SetSessionID; +struct SlpSessionID; + +/* SessionID */ +typedef struct SessionID { + struct SetSessionID *setSessionID /* OPTIONAL */; + struct SlpSessionID *slpSessionID /* OPTIONAL */; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SessionID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SessionID; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SetSessionID.h" +#include "SlpSessionID.h" + +#endif /* _SessionID_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SetSessionID.c b/src/core/libs/supl/asn-supl/SetSessionID.c new file mode 100644 index 000000000..5adf6d09e --- /dev/null +++ b/src/core/libs/supl/asn-supl/SetSessionID.c @@ -0,0 +1,99 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "SetSessionID.h" + +static int +memb_sessionId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_sessionId_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SetSessionID_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SetSessionID, sessionId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_sessionId_constraint_1, + &asn_PER_memb_sessionId_constr_2, + 0, + "sessionId" + }, + { ATF_NOFLAGS, 0, offsetof(struct SetSessionID, setId), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_SETId, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "setId" + }, +}; +static ber_tlv_tag_t asn_DEF_SetSessionID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SetSessionID_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sessionId at 18 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setId at 19 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SetSessionID_specs_1 = { + sizeof(struct SetSessionID), + offsetof(struct SetSessionID, _asn_ctx), + asn_MAP_SetSessionID_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SetSessionID = { + "SetSessionID", + "SetSessionID", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SetSessionID_tags_1, + sizeof(asn_DEF_SetSessionID_tags_1) + /sizeof(asn_DEF_SetSessionID_tags_1[0]), /* 1 */ + asn_DEF_SetSessionID_tags_1, /* Same as above */ + sizeof(asn_DEF_SetSessionID_tags_1) + /sizeof(asn_DEF_SetSessionID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SetSessionID_1, + 2, /* Elements count */ + &asn_SPC_SetSessionID_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SetSessionID.h b/src/core/libs/supl/asn-supl/SetSessionID.h new file mode 100644 index 000000000..6e9cc352f --- /dev/null +++ b/src/core/libs/supl/asn-supl/SetSessionID.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _SetSessionID_H_ +#define _SetSessionID_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SETId.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SetSessionID */ +typedef struct SetSessionID { + long sessionId; + SETId_t setId; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SetSessionID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SetSessionID; + +#ifdef __cplusplus +} +#endif + +#endif /* _SetSessionID_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/SlpSessionID.c b/src/core/libs/supl/asn-supl/SlpSessionID.c new file mode 100644 index 000000000..173724cd6 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SlpSessionID.c @@ -0,0 +1,100 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "SlpSessionID.h" + +static int +memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = st->size; + + if((size == 4)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_sessionID_constr_2 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, sessionID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + memb_sessionID_constraint_1, + &asn_PER_memb_sessionID_constr_2, + 0, + "sessionID" + }, + { ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, slpId), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_SLPAddress, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "slpId" + }, +}; +static ber_tlv_tag_t asn_DEF_SlpSessionID_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_SlpSessionID_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sessionID at 37 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* slpId at 38 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_SlpSessionID_specs_1 = { + sizeof(struct SlpSessionID), + offsetof(struct SlpSessionID, _asn_ctx), + asn_MAP_SlpSessionID_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_SlpSessionID = { + "SlpSessionID", + "SlpSessionID", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_SlpSessionID_tags_1, + sizeof(asn_DEF_SlpSessionID_tags_1) + /sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ + asn_DEF_SlpSessionID_tags_1, /* Same as above */ + sizeof(asn_DEF_SlpSessionID_tags_1) + /sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_SlpSessionID_1, + 2, /* Elements count */ + &asn_SPC_SlpSessionID_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/SlpSessionID.h b/src/core/libs/supl/asn-supl/SlpSessionID.h new file mode 100644 index 000000000..2e1df8300 --- /dev/null +++ b/src/core/libs/supl/asn-supl/SlpSessionID.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _SlpSessionID_H_ +#define _SlpSessionID_H_ + + +#include + +/* Including external dependencies */ +#include +#include "SLPAddress.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SlpSessionID */ +typedef struct SlpSessionID { + OCTET_STRING_t sessionID; + SLPAddress_t slpId; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SlpSessionID_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SlpSessionID; + +#ifdef __cplusplus +} +#endif + +#endif /* _SlpSessionID_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Status.c b/src/core/libs/supl/asn-supl/Status.c new file mode 100644 index 000000000..5637fd918 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Status.c @@ -0,0 +1,149 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Status.h" + +int +Status_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +Status_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +Status_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Status_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Status_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Status_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Status_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Status_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Status_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Status_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Status_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Status_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Status_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Status_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +Status_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Status_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +Status_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Status_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_Status_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_Status_value2enum_1[] = { + { 0, 5, "stale" }, + { 1, 7, "current" }, + { 2, 7, "unknown" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_Status_enum2value_1[] = { + 1, /* current(1) */ + 0, /* stale(0) */ + 2 /* unknown(2) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_Status_specs_1 = { + asn_MAP_Status_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Status_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 4, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_Status_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Status = { + "Status", + "Status", + Status_free, + Status_print, + Status_constraint, + Status_decode_ber, + Status_encode_der, + Status_decode_xer, + Status_encode_xer, + Status_decode_uper, + Status_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Status_tags_1, + sizeof(asn_DEF_Status_tags_1) + /sizeof(asn_DEF_Status_tags_1[0]), /* 1 */ + asn_DEF_Status_tags_1, /* Same as above */ + sizeof(asn_DEF_Status_tags_1) + /sizeof(asn_DEF_Status_tags_1[0]), /* 1 */ + &asn_PER_type_Status_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_Status_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Status.h b/src/core/libs/supl/asn-supl/Status.h new file mode 100644 index 000000000..7107531ab --- /dev/null +++ b/src/core/libs/supl/asn-supl/Status.h @@ -0,0 +1,50 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Status_H_ +#define _Status_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum Status { + Status_stale = 0, + Status_current = 1, + Status_unknown = 2 + /* + * Enumeration is extensible + */ +} e_Status; + +/* Status */ +typedef ENUMERATED_t Status_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Status; +asn_struct_free_f Status_free; +asn_struct_print_f Status_print; +asn_constr_check_f Status_constraint; +ber_type_decoder_f Status_decode_ber; +der_type_encoder_f Status_encode_der; +xer_type_decoder_f Status_decode_xer; +xer_type_encoder_f Status_encode_xer; +per_type_decoder_f Status_decode_uper; +per_type_encoder_f Status_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Status_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/StatusCode.c b/src/core/libs/supl/asn-supl/StatusCode.c new file mode 100644 index 000000000..3edb52a21 --- /dev/null +++ b/src/core/libs/supl/asn-supl/StatusCode.c @@ -0,0 +1,183 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "StatusCode.h" + +int +StatusCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_ENUMERATED.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using ENUMERATED, + * so here we adjust the DEF accordingly. + */ +static void +StatusCode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_ENUMERATED.per_constraints; + td->elements = asn_DEF_ENUMERATED.elements; + td->elements_count = asn_DEF_ENUMERATED.elements_count; + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ +} + +void +StatusCode_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + StatusCode_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +StatusCode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +StatusCode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +StatusCode_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +StatusCode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +StatusCode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +StatusCode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +StatusCode_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + StatusCode_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_StatusCode_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 5, 5, 0, 19 } /* (0..19,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_INTEGER_enum_map_t asn_MAP_StatusCode_value2enum_1[] = { + { 0, 11, "unspecified" }, + { 1, 13, "systemFailure" }, + { 2, 17, "unexpectedMessage" }, + { 3, 13, "protocolError" }, + { 4, 11, "dataMissing" }, + { 5, 19, "unexpectedDataValue" }, + { 6, 16, "posMethodFailure" }, + { 7, 17, "posMethodMismatch" }, + { 8, 19, "posProtocolMismatch" }, + { 9, 21, "targetSETnotReachable" }, + { 10, 19, "versionNotSupported" }, + { 11, 16, "resourceShortage" }, + { 12, 16, "invalidSessionId" }, + { 13, 24, "nonProxyModeNotSupported" }, + { 14, 21, "proxyModeNotSupported" }, + { 15, 23, "positioningNotPermitted" }, + { 16, 14, "authNetFailure" }, + { 17, 19, "authSuplinitFailure" }, + { 100, 19, "consentDeniedByUser" }, + { 101, 20, "consentGrantedByUser" } + /* This list is extensible */ +}; +static unsigned int asn_MAP_StatusCode_enum2value_1[] = { + 16, /* authNetFailure(16) */ + 17, /* authSuplinitFailure(17) */ + 18, /* consentDeniedByUser(100) */ + 19, /* consentGrantedByUser(101) */ + 4, /* dataMissing(4) */ + 12, /* invalidSessionId(12) */ + 13, /* nonProxyModeNotSupported(13) */ + 6, /* posMethodFailure(6) */ + 7, /* posMethodMismatch(7) */ + 8, /* posProtocolMismatch(8) */ + 15, /* positioningNotPermitted(15) */ + 3, /* protocolError(3) */ + 14, /* proxyModeNotSupported(14) */ + 11, /* resourceShortage(11) */ + 1, /* systemFailure(1) */ + 9, /* targetSETnotReachable(9) */ + 5, /* unexpectedDataValue(5) */ + 2, /* unexpectedMessage(2) */ + 0, /* unspecified(0) */ + 10 /* versionNotSupported(10) */ + /* This list is extensible */ +}; +static asn_INTEGER_specifics_t asn_SPC_StatusCode_specs_1 = { + asn_MAP_StatusCode_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_StatusCode_enum2value_1, /* N => "tag"; sorted by N */ + 20, /* Number of elements in the maps */ + 21, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_StatusCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_StatusCode = { + "StatusCode", + "StatusCode", + StatusCode_free, + StatusCode_print, + StatusCode_constraint, + StatusCode_decode_ber, + StatusCode_encode_der, + StatusCode_decode_xer, + StatusCode_encode_xer, + StatusCode_decode_uper, + StatusCode_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_StatusCode_tags_1, + sizeof(asn_DEF_StatusCode_tags_1) + /sizeof(asn_DEF_StatusCode_tags_1[0]), /* 1 */ + asn_DEF_StatusCode_tags_1, /* Same as above */ + sizeof(asn_DEF_StatusCode_tags_1) + /sizeof(asn_DEF_StatusCode_tags_1[0]), /* 1 */ + &asn_PER_type_StatusCode_constr_1, + 0, 0, /* Defined elsewhere */ + &asn_SPC_StatusCode_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/StatusCode.h b/src/core/libs/supl/asn-supl/StatusCode.h new file mode 100644 index 000000000..35b52a379 --- /dev/null +++ b/src/core/libs/supl/asn-supl/StatusCode.h @@ -0,0 +1,67 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _StatusCode_H_ +#define _StatusCode_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum StatusCode { + StatusCode_unspecified = 0, + StatusCode_systemFailure = 1, + StatusCode_unexpectedMessage = 2, + StatusCode_protocolError = 3, + StatusCode_dataMissing = 4, + StatusCode_unexpectedDataValue = 5, + StatusCode_posMethodFailure = 6, + StatusCode_posMethodMismatch = 7, + StatusCode_posProtocolMismatch = 8, + StatusCode_targetSETnotReachable = 9, + StatusCode_versionNotSupported = 10, + StatusCode_resourceShortage = 11, + StatusCode_invalidSessionId = 12, + StatusCode_nonProxyModeNotSupported = 13, + StatusCode_proxyModeNotSupported = 14, + StatusCode_positioningNotPermitted = 15, + StatusCode_authNetFailure = 16, + StatusCode_authSuplinitFailure = 17, + StatusCode_consentDeniedByUser = 100, + StatusCode_consentGrantedByUser = 101 + /* + * Enumeration is extensible + */ +} e_StatusCode; + +/* StatusCode */ +typedef ENUMERATED_t StatusCode_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_StatusCode; +asn_struct_free_f StatusCode_free; +asn_struct_print_f StatusCode_print; +asn_constr_check_f StatusCode_constraint; +ber_type_decoder_f StatusCode_decode_ber; +der_type_encoder_f StatusCode_encode_der; +xer_type_decoder_f StatusCode_decode_xer; +xer_type_encoder_f StatusCode_encode_xer; +per_type_decoder_f StatusCode_decode_uper; +per_type_encoder_f StatusCode_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _StatusCode_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/TGSN.c b/src/core/libs/supl/asn-supl/TGSN.c new file mode 100644 index 000000000..2da645c36 --- /dev/null +++ b/src/core/libs/supl/asn-supl/TGSN.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "TGSN.h" + +int +TGSN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 14)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TGSN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TGSN_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TGSN_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TGSN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TGSN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TGSN_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TGSN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TGSN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TGSN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TGSN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TGSN_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TGSN_constr_1 = { + { APC_CONSTRAINED, 4, 4, 0, 14 } /* (0..14) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TGSN_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TGSN = { + "TGSN", + "TGSN", + TGSN_free, + TGSN_print, + TGSN_constraint, + TGSN_decode_ber, + TGSN_encode_der, + TGSN_decode_xer, + TGSN_encode_xer, + TGSN_decode_uper, + TGSN_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TGSN_tags_1, + sizeof(asn_DEF_TGSN_tags_1) + /sizeof(asn_DEF_TGSN_tags_1[0]), /* 1 */ + asn_DEF_TGSN_tags_1, /* Same as above */ + sizeof(asn_DEF_TGSN_tags_1) + /sizeof(asn_DEF_TGSN_tags_1[0]), /* 1 */ + &asn_PER_type_TGSN_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/TGSN.h b/src/core/libs/supl/asn-supl/TGSN.h new file mode 100644 index 000000000..3aa40dc25 --- /dev/null +++ b/src/core/libs/supl/asn-supl/TGSN.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _TGSN_H_ +#define _TGSN_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TGSN */ +typedef long TGSN_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TGSN; +asn_struct_free_f TGSN_free; +asn_struct_print_f TGSN_print; +asn_constr_check_f TGSN_constraint; +ber_type_decoder_f TGSN_decode_ber; +der_type_encoder_f TGSN_encode_der; +xer_type_decoder_f TGSN_decode_xer; +xer_type_encoder_f TGSN_encode_xer; +per_type_decoder_f TGSN_decode_uper; +per_type_encoder_f TGSN_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TGSN_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP-List.c b/src/core/libs/supl/asn-supl/TimeslotISCP-List.c new file mode 100644 index 000000000..cd5e6bd0f --- /dev/null +++ b/src/core/libs/supl/asn-supl/TimeslotISCP-List.c @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "TimeslotISCP-List.h" + +static asn_per_constraints_t asn_PER_type_TimeslotISCP_List_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 4, 4, 1, 14 } /* (SIZE(1..14)) */, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_TimeslotISCP_List_1[] = { + { ATF_POINTER, 0, 0, + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_TimeslotISCP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "" + }, +}; +static ber_tlv_tag_t asn_DEF_TimeslotISCP_List_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_SET_OF_specifics_t asn_SPC_TimeslotISCP_List_specs_1 = { + sizeof(struct TimeslotISCP_List), + offsetof(struct TimeslotISCP_List, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ +}; +asn_TYPE_descriptor_t asn_DEF_TimeslotISCP_List = { + "TimeslotISCP-List", + "TimeslotISCP-List", + SEQUENCE_OF_free, + SEQUENCE_OF_print, + SEQUENCE_OF_constraint, + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, + SEQUENCE_OF_decode_uper, + SEQUENCE_OF_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TimeslotISCP_List_tags_1, + sizeof(asn_DEF_TimeslotISCP_List_tags_1) + /sizeof(asn_DEF_TimeslotISCP_List_tags_1[0]), /* 1 */ + asn_DEF_TimeslotISCP_List_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeslotISCP_List_tags_1) + /sizeof(asn_DEF_TimeslotISCP_List_tags_1[0]), /* 1 */ + &asn_PER_type_TimeslotISCP_List_constr_1, + asn_MBR_TimeslotISCP_List_1, + 1, /* Single element */ + &asn_SPC_TimeslotISCP_List_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP-List.h b/src/core/libs/supl/asn-supl/TimeslotISCP-List.h new file mode 100644 index 000000000..8333e73ae --- /dev/null +++ b/src/core/libs/supl/asn-supl/TimeslotISCP-List.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _TimeslotISCP_List_H_ +#define _TimeslotISCP_List_H_ + + +#include + +/* Including external dependencies */ +#include "TimeslotISCP.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TimeslotISCP-List */ +typedef struct TimeslotISCP_List { + A_SEQUENCE_OF(TimeslotISCP_t) list; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} TimeslotISCP_List_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TimeslotISCP_List; + +#ifdef __cplusplus +} +#endif + +#endif /* _TimeslotISCP_List_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP.c b/src/core/libs/supl/asn-supl/TimeslotISCP.c new file mode 100644 index 000000000..d0a155752 --- /dev/null +++ b/src/core/libs/supl/asn-supl/TimeslotISCP.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "TimeslotISCP.h" + +int +TimeslotISCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +TimeslotISCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +TimeslotISCP_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +TimeslotISCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +TimeslotISCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +TimeslotISCP_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +TimeslotISCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +TimeslotISCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +TimeslotISCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +TimeslotISCP_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + TimeslotISCP_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_TimeslotISCP_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_TimeslotISCP_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_TimeslotISCP = { + "TimeslotISCP", + "TimeslotISCP", + TimeslotISCP_free, + TimeslotISCP_print, + TimeslotISCP_constraint, + TimeslotISCP_decode_ber, + TimeslotISCP_encode_der, + TimeslotISCP_decode_xer, + TimeslotISCP_encode_xer, + TimeslotISCP_decode_uper, + TimeslotISCP_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_TimeslotISCP_tags_1, + sizeof(asn_DEF_TimeslotISCP_tags_1) + /sizeof(asn_DEF_TimeslotISCP_tags_1[0]), /* 1 */ + asn_DEF_TimeslotISCP_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeslotISCP_tags_1) + /sizeof(asn_DEF_TimeslotISCP_tags_1[0]), /* 1 */ + &asn_PER_type_TimeslotISCP_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP.h b/src/core/libs/supl/asn-supl/TimeslotISCP.h new file mode 100644 index 000000000..27ec36634 --- /dev/null +++ b/src/core/libs/supl/asn-supl/TimeslotISCP.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _TimeslotISCP_H_ +#define _TimeslotISCP_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* TimeslotISCP */ +typedef long TimeslotISCP_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_TimeslotISCP; +asn_struct_free_f TimeslotISCP_free; +asn_struct_print_f TimeslotISCP_print; +asn_constr_check_f TimeslotISCP_constraint; +ber_type_decoder_f TimeslotISCP_decode_ber; +der_type_encoder_f TimeslotISCP_encode_der; +xer_type_decoder_f TimeslotISCP_decode_xer; +xer_type_encoder_f TimeslotISCP_encode_xer; +per_type_decoder_f TimeslotISCP_decode_uper; +per_type_encoder_f TimeslotISCP_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _TimeslotISCP_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/UARFCN.c b/src/core/libs/supl/asn-supl/UARFCN.c new file mode 100644 index 000000000..5a703b7ce --- /dev/null +++ b/src/core/libs/supl/asn-supl/UARFCN.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "UARFCN.h" + +int +UARFCN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 16383)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +UARFCN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +UARFCN_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + UARFCN_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +UARFCN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +UARFCN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +UARFCN_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +UARFCN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +UARFCN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +UARFCN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +UARFCN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + UARFCN_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_UARFCN_constr_1 = { + { APC_CONSTRAINED, 14, 14, 0, 16383 } /* (0..16383) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_UARFCN_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_UARFCN = { + "UARFCN", + "UARFCN", + UARFCN_free, + UARFCN_print, + UARFCN_constraint, + UARFCN_decode_ber, + UARFCN_encode_der, + UARFCN_decode_xer, + UARFCN_encode_xer, + UARFCN_decode_uper, + UARFCN_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UARFCN_tags_1, + sizeof(asn_DEF_UARFCN_tags_1) + /sizeof(asn_DEF_UARFCN_tags_1[0]), /* 1 */ + asn_DEF_UARFCN_tags_1, /* Same as above */ + sizeof(asn_DEF_UARFCN_tags_1) + /sizeof(asn_DEF_UARFCN_tags_1[0]), /* 1 */ + &asn_PER_type_UARFCN_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/UARFCN.h b/src/core/libs/supl/asn-supl/UARFCN.h new file mode 100644 index 000000000..3ece4c30d --- /dev/null +++ b/src/core/libs/supl/asn-supl/UARFCN.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _UARFCN_H_ +#define _UARFCN_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UARFCN */ +typedef long UARFCN_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UARFCN; +asn_struct_free_f UARFCN_free; +asn_struct_print_f UARFCN_print; +asn_constr_check_f UARFCN_constraint; +ber_type_decoder_f UARFCN_decode_ber; +der_type_encoder_f UARFCN_encode_der; +xer_type_decoder_f UARFCN_decode_xer; +xer_type_encoder_f UARFCN_encode_xer; +per_type_decoder_f UARFCN_decode_uper; +per_type_encoder_f UARFCN_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _UARFCN_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/ULP-PDU.c b/src/core/libs/supl/asn-supl/ULP-PDU.c new file mode 100644 index 000000000..75ac7fab2 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ULP-PDU.c @@ -0,0 +1,119 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP" + * found in "../supl-ulp.asn" + */ + +#include "ULP-PDU.h" + +static int +memb_length_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_length_constr_2 = { + { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_ULP_PDU_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, length), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_length_constraint_1, + &asn_PER_memb_length_constr_2, + 0, + "length" + }, + { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, version), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Version, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "version" + }, + { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, sessionID), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SessionID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "sessionID" + }, + { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, message), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + +1, /* EXPLICIT tag at current level */ + &asn_DEF_UlpMessage, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "message" + }, +}; +static ber_tlv_tag_t asn_DEF_ULP_PDU_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_ULP_PDU_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* length at 31 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* version at 32 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sessionID at 33 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* message at 34 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ULP_PDU_specs_1 = { + sizeof(struct ULP_PDU), + offsetof(struct ULP_PDU, _asn_ctx), + asn_MAP_ULP_PDU_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_ULP_PDU = { + "ULP-PDU", + "ULP-PDU", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ULP_PDU_tags_1, + sizeof(asn_DEF_ULP_PDU_tags_1) + /sizeof(asn_DEF_ULP_PDU_tags_1[0]), /* 1 */ + asn_DEF_ULP_PDU_tags_1, /* Same as above */ + sizeof(asn_DEF_ULP_PDU_tags_1) + /sizeof(asn_DEF_ULP_PDU_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ULP_PDU_1, + 4, /* Elements count */ + &asn_SPC_ULP_PDU_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/ULP-PDU.h b/src/core/libs/supl/asn-supl/ULP-PDU.h new file mode 100644 index 000000000..c90eb6287 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ULP-PDU.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP" + * found in "../supl-ulp.asn" + */ + +#ifndef _ULP_PDU_H_ +#define _ULP_PDU_H_ + + +#include + +/* Including external dependencies */ +#include +#include "Version.h" +#include "SessionID.h" +#include "UlpMessage.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ULP-PDU */ +typedef struct ULP_PDU { + long length; + Version_t version; + SessionID_t sessionID; + UlpMessage_t message; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ULP_PDU_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ULP_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* _ULP_PDU_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/UTCTime.c b/src/core/libs/supl/asn-supl/UTCTime.c new file mode 100644 index 000000000..0abe1db74 --- /dev/null +++ b/src/core/libs/supl/asn-supl/UTCTime.c @@ -0,0 +1,179 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include + +#ifdef __CYGWIN__ +#include "/usr/include/time.h" +#else +#include +#endif /* __CYGWIN__ */ + +#ifndef __ASN_INTERNAL_TEST_MODE__ + +/* + * UTCTime basic type description. + */ +static ber_tlv_tag_t asn_DEF_UTCTime_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (23 << 2)), /* [UNIVERSAL 23] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +static asn_per_constraints_t asn_DEF_UTCTime_constraints = { + { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_UTCTime = { + "UTCTime", + "UTCTime", + OCTET_STRING_free, + UTCTime_print, + UTCTime_constraint, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_xer_utf8, + UTCTime_encode_xer, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UTCTime_tags, + sizeof(asn_DEF_UTCTime_tags) + / sizeof(asn_DEF_UTCTime_tags[0]) - 2, + asn_DEF_UTCTime_tags, + sizeof(asn_DEF_UTCTime_tags) + / sizeof(asn_DEF_UTCTime_tags[0]), + &asn_DEF_UTCTime_constraints, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +#endif /* __ASN_INTERNAL_TEST_MODE__ */ + +/* + * Check that the time looks like the time. + */ +int +UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const UTCTime_t *st = (const UTCTime_t *)sptr; + time_t tloc; + + errno = EPERM; /* Just an unlikely error code */ + tloc = asn_UT2time(st, 0, 0); + if(tloc == -1 && errno != EPERM) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: Invalid time format: %s (%s:%d)", + td->name, strerror(errno), __FILE__, __LINE__); + return -1; + } + + return 0; +} + +#ifndef __ASN_INTERNAL_TEST_MODE__ + +asn_enc_rval_t +UTCTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + + if(flags & XER_F_CANONICAL) { + asn_enc_rval_t rv; + UTCTime_t *ut; + struct tm tm; + + errno = EPERM; + if(asn_UT2time((UTCTime_t *)sptr, &tm, 1) == -1 + && errno != EPERM) + _ASN_ENCODE_FAILED; + + /* Fractions are not allowed in UTCTime */ + ut = asn_time2GT(0, 0, 1); + if(!ut) _ASN_ENCODE_FAILED; + + rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, + cb, app_key); + OCTET_STRING_free(&asn_DEF_UTCTime, ut, 0); + return rv; + } else { + return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, + cb, app_key); + } +} + +#endif /* __ASN_INTERNAL_TEST_MODE__ */ + +int +UTCTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + const UTCTime_t *st = (const UTCTime_t *)sptr; + + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ + + if(st && st->buf) { + char buf[32]; + struct tm tm; + int ret; + + errno = EPERM; + if(asn_UT2time(st, &tm, 1) == -1 && errno != EPERM) + return (cb("", 11, app_key) < 0) ? -1 : 0; + + ret = snprintf(buf, sizeof(buf), + "%04d-%02d-%02d %02d:%02d:%02d (GMT)", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + assert(ret > 0 && ret < (int)sizeof(buf)); + return (cb(buf, ret, app_key) < 0) ? -1 : 0; + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +time_t +asn_UT2time(const UTCTime_t *st, struct tm *_tm, int as_gmt) { + char buf[24]; /* "AAMMJJhhmmss+hhmm" + cushion */ + GeneralizedTime_t gt; + + if(!st || !st->buf + || st->size < 11 || st->size >= ((int)sizeof(buf) - 2)) { + errno = EINVAL; + return -1; + } + + gt.buf = (unsigned char *)buf; + gt.size = st->size + 2; + memcpy(gt.buf + 2, st->buf, st->size); + if(st->buf[0] > 0x35) { + /* 19xx */ + gt.buf[0] = 0x31; + gt.buf[1] = 0x39; + } else { + /* 20xx */ + gt.buf[0] = 0x32; + gt.buf[1] = 0x30; + } + + return asn_GT2time(>, _tm, as_gmt); +} + +UTCTime_t * +asn_time2UT(UTCTime_t *opt_ut, const struct tm *tm, int force_gmt) { + GeneralizedTime_t *gt = (GeneralizedTime_t *)opt_ut; + + gt = asn_time2GT(gt, tm, force_gmt); + if(gt == 0) return 0; + + assert(gt->size >= 2); + gt->size -= 2; + memmove(gt->buf, gt->buf + 2, gt->size + 1); + + return (UTCTime_t *)gt; +} + diff --git a/src/core/libs/supl/asn-supl/UTCTime.h b/src/core/libs/supl/asn-supl/UTCTime.h new file mode 100644 index 000000000..8035b3456 --- /dev/null +++ b/src/core/libs/supl/asn-supl/UTCTime.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _UTCTime_H_ +#define _UTCTime_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t UTCTime_t; /* Implemented via OCTET STRING */ + +extern asn_TYPE_descriptor_t asn_DEF_UTCTime; + +asn_struct_print_f UTCTime_print; +asn_constr_check_f UTCTime_constraint; +xer_type_encoder_f UTCTime_encode_xer; + +/*********************** + * Some handy helpers. * + ***********************/ + +struct tm; /* */ + +/* See asn_GT2time() in GeneralizedTime.h */ +time_t asn_UT2time(const UTCTime_t *, struct tm *_optional_tm4fill, int as_gmt); + +/* See asn_time2GT() in GeneralizedTime.h */ +UTCTime_t *asn_time2UT(UTCTime_t *__opt_ut, const struct tm *, int force_gmt); + +#ifdef __cplusplus +} +#endif + +#endif /* _UTCTime_H_ */ diff --git a/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c new file mode 100644 index 000000000..77b24d619 --- /dev/null +++ b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c @@ -0,0 +1,145 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "UTRA-CarrierRSSI.h" + +int +UTRA_CarrierRSSI_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 127)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeInteger.per_constraints; + td->elements = asn_DEF_NativeInteger.elements; + td->elements_count = asn_DEF_NativeInteger.elements_count; + td->specifics = asn_DEF_NativeInteger.specifics; +} + +void +UTRA_CarrierRSSI_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +UTRA_CarrierRSSI_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +UTRA_CarrierRSSI_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +UTRA_CarrierRSSI_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +UTRA_CarrierRSSI_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +UTRA_CarrierRSSI_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +UTRA_CarrierRSSI_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +UTRA_CarrierRSSI_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_UTRA_CarrierRSSI_constr_1 = { + { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_UTRA_CarrierRSSI_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_UTRA_CarrierRSSI = { + "UTRA-CarrierRSSI", + "UTRA-CarrierRSSI", + UTRA_CarrierRSSI_free, + UTRA_CarrierRSSI_print, + UTRA_CarrierRSSI_constraint, + UTRA_CarrierRSSI_decode_ber, + UTRA_CarrierRSSI_encode_der, + UTRA_CarrierRSSI_decode_xer, + UTRA_CarrierRSSI_encode_xer, + UTRA_CarrierRSSI_decode_uper, + UTRA_CarrierRSSI_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_UTRA_CarrierRSSI_tags_1, + sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1) + /sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1[0]), /* 1 */ + asn_DEF_UTRA_CarrierRSSI_tags_1, /* Same as above */ + sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1) + /sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1[0]), /* 1 */ + &asn_PER_type_UTRA_CarrierRSSI_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h new file mode 100644 index 000000000..23b1bcb6f --- /dev/null +++ b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _UTRA_CarrierRSSI_H_ +#define _UTRA_CarrierRSSI_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* UTRA-CarrierRSSI */ +typedef long UTRA_CarrierRSSI_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UTRA_CarrierRSSI; +asn_struct_free_f UTRA_CarrierRSSI_free; +asn_struct_print_f UTRA_CarrierRSSI_print; +asn_constr_check_f UTRA_CarrierRSSI_constraint; +ber_type_decoder_f UTRA_CarrierRSSI_decode_ber; +der_type_encoder_f UTRA_CarrierRSSI_encode_der; +xer_type_decoder_f UTRA_CarrierRSSI_decode_xer; +xer_type_encoder_f UTRA_CarrierRSSI_encode_xer; +per_type_decoder_f UTRA_CarrierRSSI_decode_uper; +per_type_encoder_f UTRA_CarrierRSSI_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _UTRA_CarrierRSSI_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/UlpMessage.c b/src/core/libs/supl/asn-supl/UlpMessage.c new file mode 100644 index 000000000..d27e05d04 --- /dev/null +++ b/src/core/libs/supl/asn-supl/UlpMessage.c @@ -0,0 +1,130 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP" + * found in "../supl-ulp.asn" + */ + +#include "UlpMessage.h" + +static asn_per_constraints_t asn_PER_type_UlpMessage_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 7 } /* (0..7,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_UlpMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLINIT), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLINIT, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msSUPLINIT" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLSTART), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLSTART, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msSUPLSTART" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLRESPONSE), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLRESPONSE, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msSUPLRESPONSE" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLPOSINIT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLPOSINIT, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msSUPLPOSINIT" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLPOS), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLPOS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msSUPLPOS" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLEND), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLEND, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msSUPLEND" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msDUMMY2), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_DUMMY, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msDUMMY2" + }, + { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msDUMMY3), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_DUMMY, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "msDUMMY3" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_UlpMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msSUPLINIT at 37 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msSUPLSTART at 38 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msSUPLRESPONSE at 39 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* msSUPLPOSINIT at 40 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* msSUPLPOS at 41 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* msSUPLEND at 42 */ + { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* msDUMMY2 at 44 */ + { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* msDUMMY3 at 46 */ +}; +static asn_CHOICE_specifics_t asn_SPC_UlpMessage_specs_1 = { + sizeof(struct UlpMessage), + offsetof(struct UlpMessage, _asn_ctx), + offsetof(struct UlpMessage, present), + sizeof(((struct UlpMessage *)0)->present), + asn_MAP_UlpMessage_tag2el_1, + 8, /* Count of tags in the map */ + 0, + 8 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_UlpMessage = { + "UlpMessage", + "UlpMessage", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_UlpMessage_constr_1, + asn_MBR_UlpMessage_1, + 8, /* Elements count */ + &asn_SPC_UlpMessage_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/UlpMessage.h b/src/core/libs/supl/asn-supl/UlpMessage.h new file mode 100644 index 000000000..8447dd73c --- /dev/null +++ b/src/core/libs/supl/asn-supl/UlpMessage.h @@ -0,0 +1,72 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP" + * found in "../supl-ulp.asn" + */ + +#ifndef _UlpMessage_H_ +#define _UlpMessage_H_ + + +#include + +/* Including external dependencies */ +#include "SUPLINIT.h" +#include "SUPLSTART.h" +#include "SUPLRESPONSE.h" +#include "SUPLPOSINIT.h" +#include "SUPLPOS.h" +#include "SUPLEND.h" +#include "DUMMY.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum UlpMessage_PR { + UlpMessage_PR_NOTHING, /* No components present */ + UlpMessage_PR_msSUPLINIT, + UlpMessage_PR_msSUPLSTART, + UlpMessage_PR_msSUPLRESPONSE, + UlpMessage_PR_msSUPLPOSINIT, + UlpMessage_PR_msSUPLPOS, + UlpMessage_PR_msSUPLEND, + UlpMessage_PR_msDUMMY2, + UlpMessage_PR_msDUMMY3, + /* Extensions may appear below */ + +} UlpMessage_PR; + +/* UlpMessage */ +typedef struct UlpMessage { + UlpMessage_PR present; + union UlpMessage_u { + SUPLINIT_t msSUPLINIT; + SUPLSTART_t msSUPLSTART; + SUPLRESPONSE_t msSUPLRESPONSE; + SUPLPOSINIT_t msSUPLPOSINIT; + SUPLPOS_t msSUPLPOS; + SUPLEND_t msSUPLEND; + DUMMY_t msDUMMY2; + DUMMY_t msDUMMY3; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} UlpMessage_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_UlpMessage; + +#ifdef __cplusplus +} +#endif + +#endif /* _UlpMessage_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Velocity.c b/src/core/libs/supl/asn-supl/Velocity.c new file mode 100644 index 000000000..67e4e4c66 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Velocity.c @@ -0,0 +1,90 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Velocity.h" + +static asn_per_constraints_t asn_PER_type_Velocity_constr_1 = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 3 } /* (0..3,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Velocity_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horvel), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horvel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "horvel" + }, + { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horandvervel), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horandvervel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "horandvervel" + }, + { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horveluncert), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horveluncert, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "horveluncert" + }, + { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horandveruncert), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horandveruncert, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "horandveruncert" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_Velocity_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* horvel at 226 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* horandvervel at 227 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* horveluncert at 228 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* horandveruncert at 229 */ +}; +static asn_CHOICE_specifics_t asn_SPC_Velocity_specs_1 = { + sizeof(struct Velocity), + offsetof(struct Velocity, _asn_ctx), + offsetof(struct Velocity, present), + sizeof(((struct Velocity *)0)->present), + asn_MAP_Velocity_tag2el_1, + 4, /* Count of tags in the map */ + 0, + 4 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_Velocity = { + "Velocity", + "Velocity", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &asn_PER_type_Velocity_constr_1, + asn_MBR_Velocity_1, + 4, /* Elements count */ + &asn_SPC_Velocity_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Velocity.h b/src/core/libs/supl/asn-supl/Velocity.h new file mode 100644 index 000000000..b4620dcc4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Velocity.h @@ -0,0 +1,61 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Velocity_H_ +#define _Velocity_H_ + + +#include + +/* Including external dependencies */ +#include "Horvel.h" +#include "Horandvervel.h" +#include "Horveluncert.h" +#include "Horandveruncert.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum Velocity_PR { + Velocity_PR_NOTHING, /* No components present */ + Velocity_PR_horvel, + Velocity_PR_horandvervel, + Velocity_PR_horveluncert, + Velocity_PR_horandveruncert, + /* Extensions may appear below */ + +} Velocity_PR; + +/* Velocity */ +typedef struct Velocity { + Velocity_PR present; + union Velocity_u { + Horvel_t horvel; + Horandvervel_t horandvervel; + Horveluncert_t horveluncert; + Horandveruncert_t horandveruncert; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Velocity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Velocity; + +#ifdef __cplusplus +} +#endif + +#endif /* _Velocity_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Ver.c b/src/core/libs/supl/asn-supl/Ver.c new file mode 100644 index 000000000..664fb9517 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Ver.c @@ -0,0 +1,151 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Ver.h" + +int +Ver_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if(st->size > 0) { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } else { + size = 0; + } + + if((size == 64)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static void +Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_BIT_STRING.per_constraints; + td->elements = asn_DEF_BIT_STRING.elements; + td->elements_count = asn_DEF_BIT_STRING.elements_count; + td->specifics = asn_DEF_BIT_STRING.specifics; +} + +void +Ver_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + Ver_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +Ver_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + Ver_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +Ver_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + Ver_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +Ver_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + Ver_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +Ver_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + Ver_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +Ver_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + Ver_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +asn_dec_rval_t +Ver_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Ver_1_inherit_TYPE_descriptor(td); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + +asn_enc_rval_t +Ver_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Ver_1_inherit_TYPE_descriptor(td); + return td->uper_encoder(td, constraints, structure, per_out); +} + +static asn_per_constraints_t asn_PER_type_Ver_constr_1 = { + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + { APC_CONSTRAINED, 0, 0, 64, 64 } /* (SIZE(64..64)) */, + 0, 0 /* No PER value map */ +}; +static ber_tlv_tag_t asn_DEF_Ver_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_Ver = { + "Ver", + "Ver", + Ver_free, + Ver_print, + Ver_constraint, + Ver_decode_ber, + Ver_encode_der, + Ver_decode_xer, + Ver_encode_xer, + Ver_decode_uper, + Ver_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Ver_tags_1, + sizeof(asn_DEF_Ver_tags_1) + /sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */ + asn_DEF_Ver_tags_1, /* Same as above */ + sizeof(asn_DEF_Ver_tags_1) + /sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */ + &asn_PER_type_Ver_constr_1, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/core/libs/supl/asn-supl/Ver.h b/src/core/libs/supl/asn-supl/Ver.h new file mode 100644 index 000000000..81c4fb55a --- /dev/null +++ b/src/core/libs/supl/asn-supl/Ver.h @@ -0,0 +1,40 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Ver_H_ +#define _Ver_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Ver */ +typedef BIT_STRING_t Ver_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Ver; +asn_struct_free_f Ver_free; +asn_struct_print_f Ver_print; +asn_constr_check_f Ver_constraint; +ber_type_decoder_f Ver_decode_ber; +der_type_encoder_f Ver_encode_der; +xer_type_decoder_f Ver_decode_xer; +xer_type_encoder_f Ver_encode_xer; +per_type_decoder_f Ver_decode_uper; +per_type_encoder_f Ver_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _Ver_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/Version.c b/src/core/libs/supl/asn-supl/Version.c new file mode 100644 index 000000000..3f5d9b753 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Version.c @@ -0,0 +1,169 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "Version.h" + +static int +memb_maj_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_servind_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 255)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_maj_constr_2 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_min_constr_3 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_servind_constr_4 = { + { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_Version_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct Version, maj), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_maj_constraint_1, + &asn_PER_memb_maj_constr_2, + 0, + "maj" + }, + { ATF_NOFLAGS, 0, offsetof(struct Version, min), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_min_constraint_1, + &asn_PER_memb_min_constr_3, + 0, + "min" + }, + { ATF_NOFLAGS, 0, offsetof(struct Version, servind), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_servind_constraint_1, + &asn_PER_memb_servind_constr_4, + 0, + "servind" + }, +}; +static ber_tlv_tag_t asn_DEF_Version_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_Version_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* maj at 10 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* min at 11 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* servind at 12 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_Version_specs_1 = { + sizeof(struct Version), + offsetof(struct Version, _asn_ctx), + asn_MAP_Version_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_Version = { + "Version", + "Version", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_Version_tags_1, + sizeof(asn_DEF_Version_tags_1) + /sizeof(asn_DEF_Version_tags_1[0]), /* 1 */ + asn_DEF_Version_tags_1, /* Same as above */ + sizeof(asn_DEF_Version_tags_1) + /sizeof(asn_DEF_Version_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_Version_1, + 3, /* Elements count */ + &asn_SPC_Version_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/Version.h b/src/core/libs/supl/asn-supl/Version.h new file mode 100644 index 000000000..e0576ce24 --- /dev/null +++ b/src/core/libs/supl/asn-supl/Version.h @@ -0,0 +1,39 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _Version_H_ +#define _Version_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Version */ +typedef struct Version { + long maj; + long min; + long servind; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} Version_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_Version; + +#ifdef __cplusplus +} +#endif + +#endif /* _Version_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/VisibleString.c b/src/core/libs/supl/asn-supl/VisibleString.c new file mode 100644 index 000000000..3487b6f93 --- /dev/null +++ b/src/core/libs/supl/asn-supl/VisibleString.c @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 2003, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +/* + * VisibleString basic type description. + */ +static ber_tlv_tag_t asn_DEF_VisibleString_tags[] = { + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ +}; +static asn_per_constraints_t asn_DEF_VisibleString_constraints = { + { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ + { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ + 0, 0 +}; +asn_TYPE_descriptor_t asn_DEF_VisibleString = { + "VisibleString", + "VisibleString", + OCTET_STRING_free, + OCTET_STRING_print_utf8, /* ASCII subset */ + VisibleString_constraint, + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, + OCTET_STRING_decode_xer_utf8, + OCTET_STRING_encode_xer_utf8, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_VisibleString_tags, + sizeof(asn_DEF_VisibleString_tags) + / sizeof(asn_DEF_VisibleString_tags[0]) - 1, + asn_DEF_VisibleString_tags, + sizeof(asn_DEF_VisibleString_tags) + / sizeof(asn_DEF_VisibleString_tags[0]), + &asn_DEF_VisibleString_constraints, + 0, 0, /* No members */ + 0 /* No specifics */ +}; + +int +VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const VisibleString_t *st = (const VisibleString_t *)sptr; + + if(st && st->buf) { + uint8_t *buf = st->buf; + uint8_t *end = buf + st->size; + + /* + * Check the alphabet of the VisibleString. + * ISO646, ISOReg#6 + * The alphabet is a subset of ASCII between the space + * and "~" (tilde). + */ + for(; buf < end; buf++) { + if(*buf < 0x20 || *buf > 0x7e) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value byte %ld (%d) " + "not in VisibleString alphabet (%s:%d)", + td->name, + (long)((buf - st->buf) + 1), + *buf, + __FILE__, __LINE__); + return -1; + } + } + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + return 0; +} diff --git a/src/core/libs/supl/asn-supl/VisibleString.h b/src/core/libs/supl/asn-supl/VisibleString.h new file mode 100644 index 000000000..20ba8cc50 --- /dev/null +++ b/src/core/libs/supl/asn-supl/VisibleString.h @@ -0,0 +1,24 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _VisibleString_H_ +#define _VisibleString_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OCTET_STRING_t VisibleString_t; /* Implemented via OCTET STRING */ + +extern asn_TYPE_descriptor_t asn_DEF_VisibleString; + +asn_constr_check_f VisibleString_constraint; + +#ifdef __cplusplus +} +#endif + +#endif /* _VisibleString_H_ */ diff --git a/src/core/libs/supl/asn-supl/WcdmaCellInformation.c b/src/core/libs/supl/asn-supl/WcdmaCellInformation.c new file mode 100644 index 000000000..d4561099c --- /dev/null +++ b/src/core/libs/supl/asn-supl/WcdmaCellInformation.c @@ -0,0 +1,231 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#include "WcdmaCellInformation.h" + +static int +memb_refMCC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refMNC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 999)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_refUC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 268435455)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_primaryScramblingCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 511)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_refMCC_constr_2 = { + { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refMNC_constr_3 = { + { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_refUC_constr_4 = { + { APC_CONSTRAINED, 28, -1, 0, 268435455 } /* (0..268435455) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_primaryScramblingCode_constr_6 = { + { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_WcdmaCellInformation_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refMCC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refMCC_constraint_1, + &asn_PER_memb_refMCC_constr_2, + 0, + "refMCC" + }, + { ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refMNC), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refMNC_constraint_1, + &asn_PER_memb_refMNC_constr_3, + 0, + "refMNC" + }, + { ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refUC), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_refUC_constraint_1, + &asn_PER_memb_refUC_constr_4, + 0, + "refUC" + }, + { ATF_POINTER, 3, offsetof(struct WcdmaCellInformation, frequencyInfo), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "frequencyInfo" + }, + { ATF_POINTER, 2, offsetof(struct WcdmaCellInformation, primaryScramblingCode), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_primaryScramblingCode_constraint_1, + &asn_PER_memb_primaryScramblingCode_constr_6, + 0, + "primaryScramblingCode" + }, + { ATF_POINTER, 1, offsetof(struct WcdmaCellInformation, measuredResultsList), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_MeasuredResultsList, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "measuredResultsList" + }, +}; +static int asn_MAP_WcdmaCellInformation_oms_1[] = { 3, 4, 5 }; +static ber_tlv_tag_t asn_DEF_WcdmaCellInformation_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_WcdmaCellInformation_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refMCC at 112 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refMNC at 113 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* refUC at 114 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* frequencyInfo at 115 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* primaryScramblingCode at 116 */ + { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* measuredResultsList at 117 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_WcdmaCellInformation_specs_1 = { + sizeof(struct WcdmaCellInformation), + offsetof(struct WcdmaCellInformation, _asn_ctx), + asn_MAP_WcdmaCellInformation_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_WcdmaCellInformation_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_WcdmaCellInformation = { + "WcdmaCellInformation", + "WcdmaCellInformation", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_WcdmaCellInformation_tags_1, + sizeof(asn_DEF_WcdmaCellInformation_tags_1) + /sizeof(asn_DEF_WcdmaCellInformation_tags_1[0]), /* 1 */ + asn_DEF_WcdmaCellInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_WcdmaCellInformation_tags_1) + /sizeof(asn_DEF_WcdmaCellInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_WcdmaCellInformation_1, + 6, /* Elements count */ + &asn_SPC_WcdmaCellInformation_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/WcdmaCellInformation.h b/src/core/libs/supl/asn-supl/WcdmaCellInformation.h new file mode 100644 index 000000000..8136982f7 --- /dev/null +++ b/src/core/libs/supl/asn-supl/WcdmaCellInformation.h @@ -0,0 +1,54 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "ULP-Components" + * found in "../supl-common.asn" + */ + +#ifndef _WcdmaCellInformation_H_ +#define _WcdmaCellInformation_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct FrequencyInfo; +struct MeasuredResultsList; + +/* WcdmaCellInformation */ +typedef struct WcdmaCellInformation { + long refMCC; + long refMNC; + long refUC; + struct FrequencyInfo *frequencyInfo /* OPTIONAL */; + long *primaryScramblingCode /* OPTIONAL */; + struct MeasuredResultsList *measuredResultsList /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} WcdmaCellInformation_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_WcdmaCellInformation; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "FrequencyInfo.h" +#include "MeasuredResultsList.h" + +#endif /* _WcdmaCellInformation_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/XNavigationModel.c b/src/core/libs/supl/asn-supl/XNavigationModel.c new file mode 100644 index 000000000..4440f2557 --- /dev/null +++ b/src/core/libs/supl/asn-supl/XNavigationModel.c @@ -0,0 +1,221 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#include "XNavigationModel.h" + +static int +memb_gpsWeek_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 1023)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_gpsToe_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 167)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_nSAT_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 31)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_toeLimit_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 10)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_per_constraints_t asn_PER_memb_gpsWeek_constr_2 = { + { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_gpsToe_constr_3 = { + { APC_CONSTRAINED, 8, 8, 0, 167 } /* (0..167) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_nSAT_constr_4 = { + { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_per_constraints_t asn_PER_memb_toeLimit_constr_5 = { + { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +static asn_TYPE_member_t asn_MBR_XNavigationModel_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, gpsWeek), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gpsWeek_constraint_1, + &asn_PER_memb_gpsWeek_constr_2, + 0, + "gpsWeek" + }, + { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, gpsToe), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_gpsToe_constraint_1, + &asn_PER_memb_gpsToe_constr_3, + 0, + "gpsToe" + }, + { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, nSAT), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_nSAT_constraint_1, + &asn_PER_memb_nSAT_constr_4, + 0, + "nSAT" + }, + { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, toeLimit), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, + memb_toeLimit_constraint_1, + &asn_PER_memb_toeLimit_constr_5, + 0, + "toeLimit" + }, + { ATF_POINTER, 1, offsetof(struct XNavigationModel, satInfo), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, + "satInfo" + }, +}; +static int asn_MAP_XNavigationModel_oms_1[] = { 4 }; +static ber_tlv_tag_t asn_DEF_XNavigationModel_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_XNavigationModel_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsWeek at 38 */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsToe at 39 */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* nSAT at 40 */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* toeLimit at 41 */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* satInfo at 42 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_XNavigationModel_specs_1 = { + sizeof(struct XNavigationModel), + offsetof(struct XNavigationModel, _asn_ctx), + asn_MAP_XNavigationModel_tag2el_1, + 5, /* Count of tags in the map */ + asn_MAP_XNavigationModel_oms_1, /* Optional members */ + 1, 0, /* Root/Additions */ + 4, /* Start extensions */ + 6 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_XNavigationModel = { + "XNavigationModel", + "XNavigationModel", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_XNavigationModel_tags_1, + sizeof(asn_DEF_XNavigationModel_tags_1) + /sizeof(asn_DEF_XNavigationModel_tags_1[0]), /* 1 */ + asn_DEF_XNavigationModel_tags_1, /* Same as above */ + sizeof(asn_DEF_XNavigationModel_tags_1) + /sizeof(asn_DEF_XNavigationModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_XNavigationModel_1, + 5, /* Elements count */ + &asn_SPC_XNavigationModel_specs_1 /* Additional specs */ +}; + diff --git a/src/core/libs/supl/asn-supl/XNavigationModel.h b/src/core/libs/supl/asn-supl/XNavigationModel.h new file mode 100644 index 000000000..0fa410743 --- /dev/null +++ b/src/core/libs/supl/asn-supl/XNavigationModel.h @@ -0,0 +1,51 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "SUPL-POS-INIT" + * found in "../supl-posinit.asn" + */ + +#ifndef _XNavigationModel_H_ +#define _XNavigationModel_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct SatelliteInfo; + +/* XNavigationModel */ +typedef struct XNavigationModel { + long gpsWeek; + long gpsToe; + long nSAT; + long toeLimit; + struct SatelliteInfo *satInfo /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} XNavigationModel_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_XNavigationModel; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include "SatelliteInfo.h" + +#endif /* _XNavigationModel_H_ */ +#include diff --git a/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c new file mode 100644 index 000000000..ec952fc99 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +typedef A_SEQUENCE_OF(void) asn_sequence; + +void +asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) { + asn_sequence *as = (asn_sequence *)asn_sequence_of_x; + + if(as) { + void *ptr; + int n; + + if(number < 0 || number >= as->count) + return; /* Nothing to delete */ + + if(_do_free && as->free) { + ptr = as->array[number]; + } else { + ptr = 0; + } + + /* + * Shift all elements to the left to hide the gap. + */ + --as->count; + for(n = number; n < as->count; n++) + as->array[n] = as->array[n+1]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if(ptr) as->free(ptr); + } +} + diff --git a/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h new file mode 100644 index 000000000..e678f0347 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_SEQUENCE_OF_H +#define ASN_SEQUENCE_OF_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SEQUENCE OF is the same as SET OF with a tiny difference: + * the delete operation preserves the initial order of elements + * and thus MAY operate in non-constant time. + */ +#define A_SEQUENCE_OF(type) A_SET_OF(type) + +#define ASN_SEQUENCE_ADD(headptr, ptr) \ + asn_sequence_add((headptr), (ptr)) + +/*********************************************** + * Implementation of the SEQUENCE OF structure. + */ + +#define asn_sequence_add asn_set_add +#define asn_sequence_empty asn_set_empty + +/* + * Delete the element from the set by its number (base 0). + * This is NOT a constant-time operation. + * The order of elements is preserved. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ +void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); + +/* + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ +typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; +#define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) +#define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_SEQUENCE_OF_H */ diff --git a/src/core/libs/supl/asn-supl/asn_SET_OF.c b/src/core/libs/supl/asn-supl/asn_SET_OF.c new file mode 100644 index 000000000..944f2cb8a --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_SET_OF.c @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Add another element into the set. + */ +int +asn_set_add(void *asn_set_of_x, void *ptr) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as == 0 || ptr == 0) { + errno = EINVAL; /* Invalid arguments */ + return -1; + } + + /* + * Make sure there's enough space to insert an element. + */ + if(as->count == as->size) { + int _newsize = as->size ? (as->size << 1) : 4; + void *_new_arr; + _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); + if(_new_arr) { + as->array = (void **)_new_arr; + as->size = _newsize; + } else { + /* ENOMEM */ + return -1; + } + } + + as->array[as->count++] = ptr; + + return 0; +} + +void +asn_set_del(void *asn_set_of_x, int number, int _do_free) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as) { + void *ptr; + if(number < 0 || number >= as->count) + return; + + if(_do_free && as->free) { + ptr = as->array[number]; + } else { + ptr = 0; + } + + as->array[number] = as->array[--as->count]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if(ptr) as->free(ptr); + } +} + +/* + * Free the contents of the set, do not free the set itself. + */ +void +asn_set_empty(void *asn_set_of_x) { + asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); + + if(as) { + if(as->array) { + if(as->free) { + while(as->count--) + as->free(as->array[as->count]); + } + FREEMEM(as->array); + as->array = 0; + } + as->count = 0; + as->size = 0; + } + +} + diff --git a/src/core/libs/supl/asn-supl/asn_SET_OF.h b/src/core/libs/supl/asn-supl/asn_SET_OF.h new file mode 100644 index 000000000..7edf14b51 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_SET_OF.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_SET_OF_H +#define ASN_SET_OF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define A_SET_OF(type) \ + struct { \ + type **array; \ + int count; /* Meaningful size */ \ + int size; /* Allocated size */ \ + void (*free)(type *); \ + } + +#define ASN_SET_ADD(headptr, ptr) \ + asn_set_add((headptr), (ptr)) + +/******************************************* + * Implementation of the SET OF structure. + */ + +/* + * Add another structure into the set by its pointer. + * RETURN VALUES: + * 0 for success and -1/errno for failure. + */ +int asn_set_add(void *asn_set_of_x, void *ptr); + +/* + * Delete the element from the set by its number (base 0). + * This is a constant-time operation. The order of elements before the + * deleted ones is guaranteed, the order of elements after the deleted + * one is NOT guaranteed. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ +void asn_set_del(void *asn_set_of_x, int number, int _do_free); + +/* + * Empty the contents of the set. Will free the elements, if (*free) is given. + * Will NOT free the set itself. + */ +void asn_set_empty(void *asn_set_of_x); + +/* + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ +typedef A_SET_OF(void) asn_anonymous_set_; +#define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) +#define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_SET_OF_H */ diff --git a/src/core/libs/supl/asn-supl/asn_application.h b/src/core/libs/supl/asn-supl/asn_application.h new file mode 100644 index 000000000..f40cd86ad --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_application.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Application-level ASN.1 callbacks. + */ +#ifndef _ASN_APPLICATION_H_ +#define _ASN_APPLICATION_H_ + +#include "asn_system.h" /* for platform-dependent types */ +#include "asn_codecs.h" /* for ASN.1 codecs specifics */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Generic type of an application-defined callback to return various + * types of data to the application. + * EXPECTED RETURN VALUES: + * -1: Failed to consume bytes. Abort the mission. + * Non-negative return values indicate success, and ignored. + */ +typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, + void *application_specific_key); + +/* + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ +typedef void (asn_app_constraint_failed_f)(void *application_specific_key, + struct asn_TYPE_descriptor_s *type_descriptor_which_failed, + const void *structure_which_failed_ptr, + const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); + +#ifdef __cplusplus +} +#endif + +#include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ + +#endif /* _ASN_APPLICATION_H_ */ diff --git a/src/core/libs/supl/asn-supl/asn_codecs.h b/src/core/libs/supl/asn-supl/asn_codecs.h new file mode 100644 index 000000000..4a251d940 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_codecs.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ASN_CODECS_H_ +#define _ASN_CODECS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * This structure defines a set of parameters that may be passed + * to every ASN.1 encoder or decoder function. + * WARNING: if max_stack_size member is set, and you are calling the + * function pointers of the asn_TYPE_descriptor_t directly, + * this structure must be ALLOCATED ON THE STACK! + * If you can't always satisfy this requirement, use ber_decode(), + * xer_decode() and uper_decode() functions instead. + */ +typedef struct asn_codec_ctx_s { + /* + * Limit the decoder routines to use no (much) more stack than a given + * number of bytes. Most of decoders are stack-based, and this + * would protect against stack overflows if the number of nested + * encodings is high. + * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, + * and are safe from this kind of overflow. + * A value from getrlimit(RLIMIT_STACK) may be used to initialize + * this variable. Be careful in multithreaded environments, as the + * stack size is rather limited. + */ + size_t max_stack_size; /* 0 disables stack bounds checking */ +} asn_codec_ctx_t; + +/* + * Type of the return value of the encoding functions (der_encode, xer_encode). + */ +typedef struct asn_enc_rval_s { + /* + * Number of bytes encoded. + * -1 indicates failure to encode the structure. + * In this case, the members below this one are meaningful. + */ + ssize_t encoded; + + /* + * Members meaningful when (encoded == -1), for post mortem analysis. + */ + + /* Type which cannot be encoded */ + struct asn_TYPE_descriptor_s *failed_type; + + /* Pointer to the structure of that type */ + void *structure_ptr; +} asn_enc_rval_t; +#define _ASN_ENCODE_FAILED do { \ + asn_enc_rval_t tmp_error; \ + tmp_error.encoded = -1; \ + tmp_error.failed_type = td; \ + tmp_error.structure_ptr = sptr; \ + ASN_DEBUG("Failed to encode element %s", td->name); \ + return tmp_error; \ +} while(0) +#define _ASN_ENCODED_OK(rval) do { \ + rval.structure_ptr = 0; \ + rval.failed_type = 0; \ + return rval; \ +} while(0) + +/* + * Type of the return value of the decoding functions (ber_decode, xer_decode) + * + * Please note that the number of consumed bytes is ALWAYS meaningful, + * even if code==RC_FAIL. This is to indicate the number of successfully + * decoded bytes, hence providing a possibility to fail with more diagnostics + * (i.e., print the offending remainder of the buffer). + */ +enum asn_dec_rval_code_e { + RC_OK, /* Decoded successfully */ + RC_WMORE, /* More data expected, call again */ + RC_FAIL /* Failure to decode data */ +}; +typedef struct asn_dec_rval_s { + enum asn_dec_rval_code_e code; /* Result code */ + size_t consumed; /* Number of bytes consumed */ +} asn_dec_rval_t; +#define _ASN_DECODE_FAILED do { \ + asn_dec_rval_t tmp_error; \ + tmp_error.code = RC_FAIL; \ + tmp_error.consumed = 0; \ + ASN_DEBUG("Failed to decode element %s", td->name); \ + return tmp_error; \ +} while(0) +#define _ASN_DECODE_STARVED do { \ + asn_dec_rval_t tmp_error; \ + tmp_error.code = RC_WMORE; \ + tmp_error.consumed = 0; \ + return tmp_error; \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN_CODECS_H_ */ diff --git a/src/core/libs/supl/asn-supl/asn_codecs_prim.c b/src/core/libs/supl/asn-supl/asn_codecs_prim.c new file mode 100644 index 000000000..4e5c63937 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_codecs_prim.c @@ -0,0 +1,295 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Decode an always-primitive type. + */ +asn_dec_rval_t +ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const void *buf_ptr, size_t size, int tag_mode) { + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr; + asn_dec_rval_t rval; + ber_tlv_len_t length; + + /* + * If the structure is not there, allocate it. + */ + if(st == NULL) { + st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); + if(st == NULL) _ASN_DECODE_FAILED; + *sptr = (void *)st; + } + + ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", + td->name, tag_mode); + + /* + * Check tags and extract value length. + */ + 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("%s length is %d bytes", td->name, (int)length); + + /* + * Make sure we have this 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; + } + + st->size = (int)length; + /* The following better be optimized away. */ + if(sizeof(st->size) != sizeof(length) + && (ber_tlv_len_t)st->size != length) { + st->size = 0; + _ASN_DECODE_FAILED; + } + + st->buf = (uint8_t *)MALLOC(length + 1); + if(!st->buf) { + st->size = 0; + _ASN_DECODE_FAILED; + } + + memcpy(st->buf, buf_ptr, length); + st->buf[length] = '\0'; /* Just in case */ + + rval.code = RC_OK; + rval.consumed += length; + + ASN_DEBUG("Took %ld/%ld bytes to encode %s", + (long)rval.consumed, + (long)length, td->name); + + return rval; +} + +/* + * Encode an always-primitive type using DER. + */ +asn_enc_rval_t +der_encode_primitive(asn_TYPE_descriptor_t *td, 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__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; + + ASN_DEBUG("%s %s as a primitive type (tm=%d)", + cb?"Encoding":"Estimating", td->name, tag_mode); + + erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, + cb, app_key); + ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded); + if(erval.encoded == -1) { + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + + if(cb && st->buf) { + if(cb(st->buf, st->size, app_key) < 0) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } else { + assert(st->buf || st->size == 0); + } + + erval.encoded += st->size; + _ASN_ENCODED_OK(erval); +} + +void +ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, + int contents_only) { + ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; + + if(!td || !sptr) + return; + + ASN_DEBUG("Freeing %s as a primitive type", td->name); + + if(st->buf) + FREEMEM(st->buf); + + if(!contents_only) + FREEMEM(st); +} + + +/* + * Local internal type passed around as an argument. + */ +struct xdp_arg_s { + asn_TYPE_descriptor_t *type_descriptor; + void *struct_key; + xer_primitive_body_decoder_f *prim_body_decoder; + int decoded_something; + int want_more; +}; + + +static int +xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) { + struct xdp_arg_s *arg = (struct xdp_arg_s *)key; + enum xer_pbd_rval bret; + + if(arg->decoded_something) { + if(xer_is_whitespace(chunk_buf, chunk_size)) + return 0; /* Skip it. */ + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } + + bret = arg->prim_body_decoder(arg->type_descriptor, + arg->struct_key, chunk_buf, chunk_size); + switch(bret) { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return 0; + } + + return -1; +} + +static ssize_t +xer_decode__body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) { + struct xdp_arg_s *arg = (struct xdp_arg_s *)key; + enum xer_pbd_rval bret; + + if(arg->decoded_something) { + if(xer_is_whitespace(chunk_buf, chunk_size)) + return chunk_size; + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } + + if(!have_more) { + /* + * If we've received something like "1", we can't really + * tell whether it is really `1` or `123`, until we know + * that there is no more data coming. + * The have_more argument will be set to 1 once something + * like this is available to the caller of this callback: + * "1want_more = 1; + return -1; + } + + bret = arg->prim_body_decoder(arg->type_descriptor, + arg->struct_key, chunk_buf, chunk_size); + switch(bret) { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return chunk_size; + } + + return -1; +} + + +asn_dec_rval_t +xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, + size_t struct_size, + const char *opt_mname, + const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder +) { + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + asn_struct_ctx_t s_ctx; + struct xdp_arg_s s_arg; + asn_dec_rval_t rc; + + /* + * Create the structure if does not exist. + */ + if(!*sptr) { + *sptr = CALLOC(1, struct_size); + if(!*sptr) _ASN_DECODE_FAILED; + } + + memset(&s_ctx, 0, sizeof(s_ctx)); + s_arg.type_descriptor = td; + s_arg.struct_key = *sptr; + s_arg.prim_body_decoder = prim_body_decoder; + s_arg.decoded_something = 0; + s_arg.want_more = 0; + + rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, + xml_tag, buf_ptr, size, + xer_decode__unexpected_tag, xer_decode__body); + switch(rc.code) { + case RC_OK: + if(!s_arg.decoded_something) { + char ch; + ASN_DEBUG("Primitive body is not recognized, " + "supplying empty one"); + /* + * Decoding opportunity has come and gone. + * Where's the result? + * Try to feed with empty body, see if it eats it. + */ + if(prim_body_decoder(s_arg.type_descriptor, + s_arg.struct_key, &ch, 0) + != XPBD_BODY_CONSUMED) { + /* + * This decoder does not like empty stuff. + */ + _ASN_DECODE_FAILED; + } + } + break; + case RC_WMORE: + /* + * Redo the whole thing later. + * We don't have a context to save intermediate parsing state. + */ + rc.consumed = 0; + break; + case RC_FAIL: + rc.consumed = 0; + if(s_arg.want_more) + rc.code = RC_WMORE; + else + _ASN_DECODE_FAILED; + break; + } + return rc; +} + diff --git a/src/core/libs/supl/asn-supl/asn_codecs_prim.h b/src/core/libs/supl/asn-supl/asn_codecs_prim.h new file mode 100644 index 000000000..0f683fdd0 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_codecs_prim.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_CODECS_PRIM_H +#define ASN_CODECS_PRIM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ASN__PRIMITIVE_TYPE_s { + uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ + int size; /* Size of the buffer */ +} ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ + +asn_struct_free_f ASN__PRIMITIVE_TYPE_free; +ber_type_decoder_f ber_decode_primitive; +der_type_encoder_f der_encode_primitive; + +/* + * A callback specification for the xer_decode_primitive() function below. + */ +enum xer_pbd_rval { + XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ + XPBD_DECODER_LIMIT, /* Hit some decoder limitation or deficiency */ + XPBD_BROKEN_ENCODING, /* Encoding of a primitive body is broken */ + XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ + XPBD_BODY_CONSUMED /* Body is recognized and consumed */ +}; +typedef enum xer_pbd_rval (xer_primitive_body_decoder_f) + (asn_TYPE_descriptor_t *td, void *struct_ptr, + const void *chunk_buf, size_t chunk_size); + +/* + * Specific function to decode simple primitive types. + * Also see xer_decode_general() in xer_decoder.h + */ +asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, size_t struct_size, + const char *opt_mname, + const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder +); + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_CODECS_PRIM_H */ diff --git a/src/core/libs/supl/asn-supl/asn_internal.h b/src/core/libs/supl/asn-supl/asn_internal.h new file mode 100644 index 000000000..249d7ef64 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_internal.h @@ -0,0 +1,119 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Declarations internally useful for the ASN.1 support code. + */ +#ifndef _ASN_INTERNAL_H_ +#define _ASN_INTERNAL_H_ + +#include "asn_application.h" /* Application-visible API */ + +#ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */ +#include /* for assert() macro */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Environment version might be used to avoid running with the old library */ +#define ASN1C_ENVIRONMENT_VERSION 922 /* Compile-time version */ +int get_asn1c_environment_version(void); /* Run-time version */ + +#define CALLOC(nmemb, size) calloc(nmemb, size) +#define MALLOC(size) malloc(size) +#define REALLOC(oldptr, size) realloc(oldptr, size) +#define FREEMEM(ptr) free(ptr) + +/* + * A macro for debugging the ASN.1 internals. + * You may enable or override it. + */ +#ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */ +#if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */ +#ifdef __GNUC__ +#ifdef ASN_THREAD_SAFE +#define asn_debug_indent 0 +#else /* !ASN_THREAD_SAFE */ +int asn_debug_indent; +#endif /* ASN_THREAD_SAFE */ +#define ASN_DEBUG(fmt, args...) do { \ + int adi = asn_debug_indent; \ + while(adi--) fprintf(stderr, " "); \ + fprintf(stderr, fmt, ##args); \ + fprintf(stderr, " (%s:%d)\n", \ + __FILE__, __LINE__); \ + } while(0) +#else /* !__GNUC__ */ +void ASN_DEBUG_f(const char *fmt, ...); +#define ASN_DEBUG ASN_DEBUG_f +#endif /* __GNUC__ */ +#else /* EMIT_ASN_DEBUG != 1 */ +static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } +#endif /* EMIT_ASN_DEBUG */ +#endif /* ASN_DEBUG */ + +/* + * Invoke the application-supplied callback and fail, if something is wrong. + */ +#define __ASN_E_cbc(buf, size) (cb((buf), (size), app_key) < 0) +#define _ASN_E_CALLBACK(foo) do { \ + if(foo) goto cb_failed; \ + } while(0) +#define _ASN_CALLBACK(buf, size) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) +#define _ASN_CALLBACK2(buf1, size1, buf2, size2) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2)) +#define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) \ + || __ASN_E_cbc(buf2, size2) \ + || __ASN_E_cbc(buf3, size3)) + +#define _i_ASN_TEXT_INDENT(nl, level) do { \ + int __level = (level); \ + int __nl = ((nl) != 0); \ + int __i; \ + if(__nl) _ASN_CALLBACK("\n", 1); \ + if(__level < 0) __level = 0; \ + for(__i = 0; __i < __level; __i++) \ + _ASN_CALLBACK(" ", 4); \ + er.encoded += __nl + 4 * __level; \ +} while(0) + +#define _i_INDENT(nl) do { \ + int __i; \ + if((nl) && cb("\n", 1, app_key) < 0) return -1; \ + for(__i = 0; __i < ilevel; __i++) \ + if(cb(" ", 4, app_key) < 0) return -1; \ +} while(0) + +/* + * Check stack against overflow, if limit is set. + */ +#define _ASN_DEFAULT_STACK_MAX (30000) +static inline int +_ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) { + if(ctx && ctx->max_stack_size) { + + /* ctx MUST be allocated on the stack */ + ptrdiff_t usedstack = ((char *)ctx - (char *)&ctx); + if(usedstack > 0) usedstack = -usedstack; /* grows up! */ + + /* double negative required to avoid int wrap-around */ + if(usedstack < -(ptrdiff_t)ctx->max_stack_size) { + ASN_DEBUG("Stack limit %ld reached", + (long)ctx->max_stack_size); + return -1; + } + } + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN_INTERNAL_H_ */ diff --git a/src/core/libs/supl/asn-supl/asn_system.h b/src/core/libs/supl/asn-supl/asn_system.h new file mode 100644 index 000000000..0a9b092c3 --- /dev/null +++ b/src/core/libs/supl/asn-supl/asn_system.h @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2003, 2004, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * Miscellaneous system-dependent types. + */ +#ifndef _ASN_SYSTEM_H_ +#define _ASN_SYSTEM_H_ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include /* For snprintf(3) */ +#include /* For *alloc(3) */ +#include /* For memcpy(3) */ +#include /* For size_t */ +#include /* For LONG_MAX */ +#include /* For va_start */ +#include /* for offsetof and ptrdiff_t */ + +#ifdef WIN32 + +#include +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ +#define sys_ntohl(l) ((((l) << 24) & 0xff000000) \ + | (((l) << 16) & 0xff0000) \ + | (((l) << 8) & 0xff00) \ + | ((l) & 0xff)) + +#ifdef _MSC_VER /* MSVS.Net */ +#ifndef __cplusplus +#define inline __inline +#endif +#ifndef ASSUMESTDTYPES /* Standard types have been defined elsewhere */ +#define ssize_t SSIZE_T +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif /* ASSUMESTDTYPES */ +#define WIN32_LEAN_AND_MEAN +#include +#include +#define isnan _isnan +#define finite _finite +#define copysign _copysign +#define ilogb _logb +#else /* !_MSC_VER */ +#include +#endif /* _MSC_VER */ + +#else /* !WIN32 */ + +#if defined(__vxworks) +#include +#else /* !defined(__vxworks) */ + +#include /* C99 specifies this file */ +/* + * 1. Earlier FreeBSD version didn't have , + * but was present. + * 2. Sun Solaris requires for alloca(3), + * but does not have . + */ +#if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_)) +#if defined(sun) +#include /* For alloca(3) */ +#include /* for finite(3) */ +#elif defined(__hpux) +#ifdef __GNUC__ +#include /* For alloca(3) */ +#else /* !__GNUC__ */ +#define inline +#endif /* __GNUC__ */ +#else +#include /* SUSv2+ and C99 specify this file, for uintXX_t */ +#endif /* defined(sun) */ +#endif + +#include /* for ntohl() */ +#define sys_ntohl(foo) ntohl(foo) + +#endif /* defined(__vxworks) */ + +#endif /* WIN32 */ + +#if __GNUC__ >= 3 +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#endif +#ifndef GCC_NOTUSED +#define GCC_NOTUSED __attribute__((unused)) +#endif +#else +#ifndef GCC_PRINTFLIKE +#define GCC_PRINTFLIKE(fmt,var) /* nothing */ +#endif +#ifndef GCC_NOTUSED +#define GCC_NOTUSED +#endif +#endif + +/* Figure out if thread safety is requested */ +#if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT)) +#define ASN_THREAD_SAFE +#endif /* Thread safety */ + +#ifndef offsetof /* If not defined by */ +#define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0)) +#endif /* offsetof */ + +#ifndef MIN /* Suitable for comparing primitive types (integers) */ +#if defined(__GNUC__) +#define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \ + ((_a)<(_b)?(_a):(_b)); }) +#else /* !__GNUC__ */ +#define MIN(a,b) ((a)<(b)?(a):(b)) /* Unsafe variant */ +#endif /* __GNUC__ */ +#endif /* MIN */ + +#endif /* _ASN_SYSTEM_H_ */ diff --git a/src/core/libs/supl/asn-supl/ber_decoder.c b/src/core/libs/supl/asn-supl/ber_decoder.c new file mode 100644 index 000000000..601f66c0b --- /dev/null +++ b/src/core/libs/supl/asn-supl/ber_decoder.c @@ -0,0 +1,283 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) +#undef RETURN +#define RETURN(_code) do { \ + asn_dec_rval_t rval; \ + rval.code = _code; \ + if(opt_ctx) opt_ctx->step = step; /* Save context */ \ + if(_code == RC_OK || opt_ctx) \ + rval.consumed = consumed_myself; \ + else \ + rval.consumed = 0; /* Context-free */ \ + return rval; \ + } while(0) + +/* + * The BER decoder of any type. + */ +asn_dec_rval_t +ber_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, const void *ptr, size_t size) { + asn_codec_ctx_t s_codec_ctx; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* + * Invoke type-specific decoder. + */ + return type_descriptor->ber_decoder(opt_codec_ctx, type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + ptr, size, /* Buffer and its size */ + 0 /* Default tag mode is 0 */ + ); +} + +/* + * Check the set of >> tags matches the definition. + */ +asn_dec_rval_t +ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, + const void *ptr, size_t size, int tag_mode, int last_tag_form, + ber_tlv_len_t *last_length, int *opt_tlv_form) { + ssize_t consumed_myself = 0; + ssize_t tag_len; + ssize_t len_len; + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_len_t limit_len = -1; + int expect_00_terminators = 0; + int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ + int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ + int tagno; + + /* + * Make sure we didn't exceed the maximum stack size. + */ + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + RETURN(RC_FAIL); + + /* + * So what does all this implicit skip stuff mean? + * Imagine two types, + * A ::= [5] IMPLICIT T + * B ::= [2] EXPLICIT T + * Where T is defined as + * T ::= [4] IMPLICIT SEQUENCE { ... } + * + * Let's say, we are starting to decode type A, given the + * following TLV stream: <5> <0>. What does this mean? + * It means that the type A contains type T which is, + * in turn, empty. + * Remember though, that we are still in A. We cannot + * just pass control to the type T decoder. Why? Because + * the type T decoder expects <4> <0>, not <5> <0>. + * So, we must make sure we are going to receive <5> while + * still in A, then pass control to the T decoder, indicating + * that the tag <4> was implicitly skipped. The decoder of T + * hence will be prepared to treat <4> as valid tag, and decode + * it appropriately. + */ + + tagno = step /* Continuing where left previously */ + + (tag_mode==1?-1:0) + ; + ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)", + td->name, (long)size, tag_mode, step, tagno); + /* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */ + + if(tag_mode == 0 && tagno == td->tags_count) { + /* + * This must be the _untagged_ ANY type, + * which outermost tag isn't known in advance. + * Fetch the tag and length separately. + */ + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + switch(tag_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + len_len = ber_fetch_length(tlv_constr, + (const char *)ptr + tag_len, size - tag_len, &tlv_len); + switch(len_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + ASN_DEBUG("Advancing %ld in ANY case", + (long)(tag_len + len_len)); + ADVANCE(tag_len + len_len); + } else { + assert(tagno < td->tags_count); /* At least one loop */ + } + for((void)tagno; tagno < td->tags_count; tagno++, step++) { + + /* + * Fetch and process T from TLV. + */ + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + ASN_DEBUG("Fetching tag from {%p,%ld}: " + "len %ld, step %d, tagno %d got %s", + ptr, (long)size, + (long)tag_len, step, tagno, + ber_tlv_tag_string(tlv_tag)); + switch(tag_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + + /* + * If {I}, don't check anything. + * If {I,B,C}, check B and C unless we're at I. + */ + if(tag_mode != 0 && step == 0) { + /* + * We don't expect tag to match here. + * It's just because we don't know how the tag + * is supposed to look like. + */ + } else { + assert(tagno >= 0); /* Guaranteed by the code above */ + if(tlv_tag != td->tags[tagno]) { + /* + * Unexpected tag. Too bad. + */ + ASN_DEBUG("Expected: %s, " + "expectation failed (tn=%d, tm=%d)", + ber_tlv_tag_string(td->tags[tagno]), + tagno, tag_mode + ); + RETURN(RC_FAIL); + } + } + + /* + * Attention: if there are more tags expected, + * ensure that the current tag is presented + * in constructed form (it contains other tags!). + * If this one is the last one, check that the tag form + * matches the one given in descriptor. + */ + if(tagno < (td->tags_count - 1)) { + if(tlv_constr == 0) { + ASN_DEBUG("tlv_constr = %d, expfail", + tlv_constr); + RETURN(RC_FAIL); + } + } else { + if(last_tag_form != tlv_constr + && last_tag_form != -1) { + ASN_DEBUG("last_tag_form %d != %d", + last_tag_form, tlv_constr); + RETURN(RC_FAIL); + } + } + + /* + * Fetch and process L from TLV. + */ + len_len = ber_fetch_length(tlv_constr, + (const char *)ptr + tag_len, size - tag_len, &tlv_len); + ASN_DEBUG("Fetchinig len = %ld", (long)len_len); + switch(len_len) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + } + + /* + * FIXME + * As of today, the chain of tags + * must either contain several indefinite length TLVs, + * or several definite length ones. + * No mixing is allowed. + */ + if(tlv_len == -1) { + /* + * Indefinite length. + */ + if(limit_len == -1) { + expect_00_terminators++; + } else { + ASN_DEBUG("Unexpected indefinite length " + "in a chain of definite lengths"); + RETURN(RC_FAIL); + } + ADVANCE(tag_len + len_len); + continue; + } else { + if(expect_00_terminators) { + ASN_DEBUG("Unexpected definite length " + "in a chain of indefinite lengths"); + RETURN(RC_FAIL); + } + } + + /* + * Check that multiple TLVs specify ever decreasing length, + * which is consistent. + */ + if(limit_len == -1) { + limit_len = tlv_len + tag_len + len_len; + if(limit_len < 0) { + /* Too great tlv_len value? */ + RETURN(RC_FAIL); + } + } else if(limit_len != tlv_len + tag_len + len_len) { + /* + * Inner TLV specifies length which is inconsistent + * with the outer TLV's length value. + */ + ASN_DEBUG("Outer TLV is %ld and inner is %ld", + (long)limit_len, (long)tlv_len); + RETURN(RC_FAIL); + } + + ADVANCE(tag_len + len_len); + + limit_len -= (tag_len + len_len); + if((ssize_t)size > limit_len) { + /* + * Make sure that we won't consume more bytes + * from the parent frame than the inferred limit. + */ + size = limit_len; + } + } + + if(opt_tlv_form) + *opt_tlv_form = tlv_constr; + if(expect_00_terminators) + *last_length = -expect_00_terminators; + else + *last_length = tlv_len; + + RETURN(RC_OK); +} diff --git a/src/core/libs/supl/asn-supl/ber_decoder.h b/src/core/libs/supl/asn-supl/ber_decoder.h new file mode 100644 index 000000000..9fe2e895d --- /dev/null +++ b/src/core/libs/supl/asn-supl/ber_decoder.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_DECODER_H_ +#define _BER_DECODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ +struct asn_codec_ctx_s; /* Forward declaration */ + +/* + * The BER decoder of any type. + * This function may be invoked directly from the application. + * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). + */ +asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of that buffer */ + ); + +/* + * Type of generic function which decodes the byte stream into the structure. + */ +typedef asn_dec_rval_t (ber_type_decoder_f)( + struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, const void *buf_ptr, size_t size, + int tag_mode); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Check that all tags correspond to the type definition (as given in head). + * On return, last_length would contain either a non-negative length of the + * value part of the last TLV, or the negative number of expected + * "end of content" sequences. The number may only be negative if the + * head->last_tag_form is non-zero. + */ +asn_dec_rval_t ber_check_tags( + struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ + struct asn_TYPE_descriptor_s *type_descriptor, + asn_struct_ctx_t *opt_ctx, /* saved decoding context */ + const void *ptr, size_t size, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {-1,0:1}: any, primitive, constr */ + ber_tlv_len_t *last_length, + int *opt_tlv_form /* optional tag form */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_DECODER_H_ */ diff --git a/src/core/libs/supl/asn-supl/ber_tlv_length.c b/src/core/libs/supl/asn-supl/ber_tlv_length.c new file mode 100644 index 000000000..b87e75e04 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ber_tlv_length.c @@ -0,0 +1,178 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +ssize_t +ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r) { + const uint8_t *buf = (const uint8_t *)bufptr; + unsigned oct; + + if(size == 0) + return 0; /* Want more */ + + oct = *(const uint8_t *)buf; + if((oct & 0x80) == 0) { + /* + * Short definite length. + */ + *len_r = oct; /* & 0x7F */ + return 1; + } else { + ber_tlv_len_t len; + size_t skipped; + + if(_is_constructed && oct == 0x80) { + *len_r = -1; /* Indefinite length */ + return 1; + } + + if(oct == 0xff) { + /* Reserved in standard for future use. */ + return -1; + } + + oct &= 0x7F; /* Leave only the 7 LS bits */ + for(len = 0, buf++, skipped = 1; + oct && (++skipped <= size); buf++, oct--) { + + len = (len << 8) | *buf; + if(len < 0 + || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) { + /* + * Too large length value. + */ + return -1; + } + } + + if(oct == 0) { + ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; + /* + * Here length may be very close or equal to 2G. + * However, the arithmetics used in some decoders + * may add some (small) quantities to the length, + * to check the resulting value against some limits. + * This may result in integer wrap-around, which + * we try to avoid by checking it earlier here. + */ + if(lenplusepsilon < 0) { + /* Too large length value */ + return -1; + } + + *len_r = len; + return skipped; + } + + return 0; /* Want more */ + } + +} + +ssize_t +ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, + int _is_constructed, const void *ptr, size_t size) { + ber_tlv_len_t vlen; /* Length of V in TLV */ + ssize_t tl; /* Length of L in TLV */ + ssize_t ll; /* Length of L in TLV */ + size_t skip; + + /* + * Make sure we didn't exceed the maximum stack size. + */ + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + return -1; + + /* + * Determine the size of L in TLV. + */ + ll = ber_fetch_length(_is_constructed, ptr, size, &vlen); + if(ll <= 0) return ll; + + /* + * Definite length. + */ + if(vlen >= 0) { + skip = ll + vlen; + if(skip > size) + return 0; /* Want more */ + return skip; + } + + /* + * Indefinite length! + */ + ASN_DEBUG("Skipping indefinite length"); + for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) { + ber_tlv_tag_t tag; + + /* Fetch the tag */ + tl = ber_fetch_tag(ptr, size, &tag); + if(tl <= 0) return tl; + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + ((const char *)ptr) + tl, size - tl); + if(ll <= 0) return ll; + + skip += tl + ll; + + /* + * This may be the end of the indefinite length structure, + * two consecutive 0 octets. + * Check if it is true. + */ + if(((const uint8_t *)ptr)[0] == 0 + && ((const uint8_t *)ptr)[1] == 0) + return skip; + + ptr = ((const char *)ptr) + tl + ll; + size -= tl + ll; + } + + /* UNREACHABLE */ +} + +size_t +der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) { + size_t required_size; /* Size of len encoding */ + uint8_t *buf = (uint8_t *)bufp; + uint8_t *end; + size_t i; + + if(len <= 127) { + /* Encoded in 1 octet */ + if(size) *buf = (uint8_t)len; + return 1; + } + + /* + * Compute the size of the subsequent bytes. + */ + for(required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) { + if(len >> i) + required_size++; + else + break; + } + + if(size <= required_size) + return required_size + 1; + + *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ + + /* + * Produce the len encoding, space permitting. + */ + end = buf + required_size; + for(i -= 8; buf < end; i -= 8, buf++) + *buf = (uint8_t)(len >> i); + + return required_size + 1; +} + diff --git a/src/core/libs/supl/asn-supl/ber_tlv_length.h b/src/core/libs/supl/asn-supl/ber_tlv_length.h new file mode 100644 index 000000000..349680224 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ber_tlv_length.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_TLV_LENGTH_H_ +#define _BER_TLV_LENGTH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ssize_t ber_tlv_len_t; + +/* + * This function tries to fetch the length of the BER TLV value and place it + * in *len_r. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering length. + * >0: Number of bytes used from bufptr. + * On return with >0, len_r is constrained as -1..MAX, where -1 mean + * that the value is of indefinite length. + */ +ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r); + +/* + * This function expects bufptr to be positioned over L in TLV. + * It returns number of bytes occupied by L and V together, suitable + * for skipping. The function properly handles indefinite length. + * RETURN VALUES: + * Standard {-1,0,>0} convention. + */ +ssize_t ber_skip_length( + struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ + int _is_constructed, const void *bufptr, size_t size); + +/* + * This function serializes the length (L from TLV) in DER format. + * It always returns number of bytes necessary to represent the length, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ +size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_TLV_LENGTH_H_ */ diff --git a/src/core/libs/supl/asn-supl/ber_tlv_tag.c b/src/core/libs/supl/asn-supl/ber_tlv_tag.c new file mode 100644 index 000000000..42708760e --- /dev/null +++ b/src/core/libs/supl/asn-supl/ber_tlv_tag.c @@ -0,0 +1,144 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +ssize_t +ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { + ber_tlv_tag_t val; + ber_tlv_tag_t tclass; + size_t skipped; + + if(size == 0) + return 0; + + val = *(const uint8_t *)ptr; + tclass = (val >> 6); + if((val &= 0x1F) != 0x1F) { + /* + * Simple form: everything encoded in a single octet. + * Tag Class is encoded using two least significant bits. + */ + *tag_r = (val << 2) | tclass; + return 1; + } + + /* + * Each octet contains 7 bits of useful information. + * The MSB is 0 if it is the last octet of the tag. + */ + for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; + skipped <= size; + ptr = ((const char *)ptr) + 1, skipped++) { + unsigned int oct = *(const uint8_t *)ptr; + if(oct & 0x80) { + val = (val << 7) | (oct & 0x7F); + /* + * Make sure there are at least 9 bits spare + * at the MS side of a value. + */ + if(val >> ((8 * sizeof(val)) - 9)) { + /* + * We would not be able to accomodate + * any more tag bits. + */ + return -1; + } + } else { + val = (val << 7) | oct; + *tag_r = (val << 2) | tclass; + return skipped; + } + } + + return 0; /* Want more */ +} + + +ssize_t +ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) { + char buf[sizeof("[APPLICATION ]") + 32]; + ssize_t ret; + + ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf)); + if(ret >= (ssize_t)sizeof(buf) || ret < 2) { + errno = EPERM; + return -1; + } + + return fwrite(buf, 1, ret, f); +} + +ssize_t +ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) { + char *type = 0; + int ret; + + switch(tag & 0x3) { + case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break; + case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break; + case ASN_TAG_CLASS_CONTEXT: type = ""; break; + case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break; + } + + ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2); + if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ + + return ret; +} + +char * +ber_tlv_tag_string(ber_tlv_tag_t tag) { + static char buf[sizeof("[APPLICATION ]") + 32]; + + (void)ber_tlv_tag_snprint(tag, buf, sizeof(buf)); + + return buf; +} + + +size_t +ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { + int tclass = BER_TAG_CLASS(tag); + ber_tlv_tag_t tval = BER_TAG_VALUE(tag); + uint8_t *buf = (uint8_t *)bufp; + uint8_t *end; + size_t required_size; + size_t i; + + if(tval <= 30) { + /* Encoded in 1 octet */ + if(size) buf[0] = (tclass << 6) | tval; + return 1; + } else if(size) { + *buf++ = (tclass << 6) | 0x1F; + size--; + } + + /* + * Compute the size of the subsequent bytes. + */ + for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) { + if(tval >> i) + required_size++; + else + break; + } + + if(size < required_size) + return required_size + 1; + + /* + * Fill in the buffer, space permitting. + */ + end = buf + required_size - 1; + for(i -= 7; buf < end; i -= 7, buf++) + *buf = 0x80 | ((tval >> i) & 0x7F); + *buf = (tval & 0x7F); /* Last octet without high bit */ + + return required_size + 1; +} + diff --git a/src/core/libs/supl/asn-supl/ber_tlv_tag.h b/src/core/libs/supl/asn-supl/ber_tlv_tag.h new file mode 100644 index 000000000..60e866861 --- /dev/null +++ b/src/core/libs/supl/asn-supl/ber_tlv_tag.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _BER_TLV_TAG_H_ +#define _BER_TLV_TAG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum asn_tag_class { + ASN_TAG_CLASS_UNIVERSAL = 0, /* 0b00 */ + ASN_TAG_CLASS_APPLICATION = 1, /* 0b01 */ + ASN_TAG_CLASS_CONTEXT = 2, /* 0b10 */ + ASN_TAG_CLASS_PRIVATE = 3 /* 0b11 */ +}; +typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */ + +/* + * Tag class is encoded together with tag value for optimization purposes. + */ +#define BER_TAG_CLASS(tag) ((tag) & 0x3) +#define BER_TAG_VALUE(tag) ((tag) >> 2) +#define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr)&0x20)?1:0) + +#define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) + +/* + * Several functions for printing the TAG in the canonical form + * (i.e. "[PRIVATE 0]"). + * Return values correspond to their libc counterparts (if any). + */ +ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen); +ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *); +char *ber_tlv_tag_string(ber_tlv_tag_t tag); + + +/* + * This function tries to fetch the tag from the input stream. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering tag. + * >0: Number of bytes used from bufptr. tag_r will contain the tag. + */ +ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); + +/* + * This function serializes the tag (T from TLV) in BER format. + * It always returns number of bytes necessary to represent the tag, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ +size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _BER_TLV_TAG_H_ */ diff --git a/src/core/libs/supl/asn-supl/constr_CHOICE.c b/src/core/libs/supl/asn-supl/constr_CHOICE.c new file mode 100644 index 000000000..a9eb71941 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_CHOICE.c @@ -0,0 +1,1110 @@ +/* + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * See the definitions. + */ +static int _fetch_present_idx(const void *struct_ptr, int off, int size); +static void _set_present_idx(void *sptr, int offset, int size, int pres); + +/* + * Tags are canonically sorted in the tag to member table. + */ +static int +_search4tag(const void *ap, const void *bp) { + const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; + const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; + + int a_class = BER_TAG_CLASS(a->el_tag); + int b_class = BER_TAG_CLASS(b->el_tag); + + if(a_class == b_class) { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + + if(a_value == b_value) + return 0; + else if(a_value < b_value) + return -1; + else + return 1; + } else if(a_class < b_class) { + return -1; + } else { + return 1; + } +} + +/* + * The decoder of the CHOICE type. + */ +asn_dec_rval_t +CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + ssize_t tag_len; /* Length of TLV's T */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + ASN_DEBUG("Decoding %s as CHOICE", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + if(tag_mode || td->tags_count) { + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, -1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) { + /* ?Substracted below! */ + ctx->left += rval.consumed; + } + ADVANCE(rval.consumed); + } else { + ctx->left = -1; + } + + NEXT_PHASE(ctx); + + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); + + /* Fall through */ + case 1: + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + do { + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + + key.el_tag = tlv_tag; + t2m = (asn_TYPE_tag2member_t *)bsearch(&key, + specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _search4tag); + if(t2m) { + /* + * Found the element corresponding to the tag. + */ + NEXT_PHASE(ctx); + ctx->step = t2m->el_no; + break; + } else if(specs->ext_start == -1) { + ASN_DEBUG("Unexpected tag %s " + "in non-extensible CHOICE %s", + ber_tlv_tag_string(tlv_tag), td->name); + RETURN(RC_FAIL); + } else { + /* Skip this tag */ + ssize_t skip; + + ASN_DEBUG("Skipping unknown tag %s", + ber_tlv_tag_string(tlv_tag)); + + skip = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + + switch(skip) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + RETURN(RC_OK); + } + } while(0); + + case 2: + /* + * PHASE 2. + * Read in the element. + */ + do { + asn_TYPE_member_t *elm;/* CHOICE's element */ + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &elements[ctx->step]; + + /* + * Compute the position of the member inside a structure, + * and also a type of containment (it may be contained + * as pointer or using inline inclusion). + */ + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + /* Set presence to be able to free it properly at any time */ + _set_present_idx(st, specs->pres_offset, + specs->pres_size, ctx->step + 1); + /* + * Invoke the member fetch routine according to member's type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + memb_ptr2, ptr, LEFT, elm->tag_mode); + switch(rval.code) { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + RETURN(RC_FAIL); + case RC_FAIL: /* Fatal error */ + RETURN(rval.code); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } while(0); + + NEXT_PHASE(ctx); + + /* Fall through */ + case 3: + ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", + td->name, (long)ctx->left, (long)size, + tag_mode, td->tags_count); + + if(ctx->left > 0) { + /* + * The type must be fully decoded + * by the CHOICE member-specific decoder. + */ + RETURN(RC_FAIL); + } + + if(ctx->left == -1 + && !(tag_mode || td->tags_count)) { + /* + * This is an untagged CHOICE. + * It doesn't contain nothing + * except for the member itself, including all its tags. + * The decoding is completed. + */ + NEXT_PHASE(ctx); + break; + } + + /* + * Read in the "end of data chunks"'s. + */ + while(ctx->left < 0) { + ssize_t tl; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tl) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + /* + * Expected <0><0>... + */ + if(((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + continue; + } + } else { + ASN_DEBUG("Unexpected continuation in %s", + td->name); + RETURN(RC_FAIL); + } + + /* UNREACHABLE */ + } + + NEXT_PHASE(ctx); + case 4: + /* No meaningful work here */ + break; + } + + RETURN(RC_OK); +} + +asn_enc_rval_t +CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE element */ + asn_enc_rval_t erval; + void *memb_ptr; + size_t computed_size = 0; + int present; + + if(!sptr) _ASN_ENCODE_FAILED; + + ASN_DEBUG("%s %s as CHOICE", + cb?"Encoding":"Estimating", td->name); + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) { + if(present == 0 && td->elements_count == 0) { + /* The CHOICE is empty?! */ + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + _ASN_ENCODE_FAILED; + } + + /* + * Seek over the present member of the structure. + */ + elm = &td->elements[present-1]; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(memb_ptr == 0) { + if(elm->optional) { + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + /* Mandatory element absent */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + /* + * If the CHOICE itself is tagged EXPLICIT: + * T ::= [2] EXPLICIT CHOICE { ... } + * Then emit the appropriate tags. + */ + if(tag_mode == 1 || td->tags_count) { + /* + * For this, we need to pre-compute the member. + */ + ssize_t ret; + + /* Encode member with its tag */ + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, 0, 0); + if(erval.encoded == -1) + return erval; + + /* Encode CHOICE with parent or my own tag */ + ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, + cb, app_key); + if(ret == -1) + _ASN_ENCODE_FAILED; + computed_size += ret; + } + + /* + * Encode the single underlying member. + */ + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, cb, app_key); + if(erval.encoded == -1) + return erval; + + ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", + (long)erval.encoded, (long)computed_size); + + erval.encoded += computed_size; + + return erval; +} + +ber_tlv_tag_t +CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + assert(tag_mode == 0); (void)tag_mode; + assert(tag == 0); (void)tag; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); + + if(present > 0 || present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *) + ((const char *)ptr + elm->memb_offset); + } else { + memb_ptr = (const void *) + ((const char *)ptr + elm->memb_offset); + } + + return asn_TYPE_outmost_tag(elm->type, memb_ptr, + elm->tag_mode, elm->tag); + } else { + return (ber_tlv_tag_t)-1; + } +} + +int +CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + return 0; + _ASN_CTFAIL(app_key, td, sptr, + "%s: mandatory CHOICE element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + if(elm->memb_constraints) { + return elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + } else { + int ret = elm->type->check_constraints(elm->type, + memb_ptr, ctfailcb, app_key); + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + return ret; + } + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: no CHOICE element given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value of a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + if(ctx->phase == 0 && !*xml_tag) + ctx->phase = 1; /* Skip the outer tag checking phase */ + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + * Phase 3: Only waiting for closing tag. + * Phase 4: Skipping unknown extensions. + * Phase 5: PHASED OUT + */ + for(edx = ctx->step; ctx->phase <= 4;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + + /* + * Go inside the member. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &td->elements[edx]; + + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Start/Continue decoding the inner member */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, + elm->type, memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", + elm->type->name, tmprval.code); + if(tmprval.code != RC_OK) + RETURN(tmprval.code); + assert(_fetch_present_idx(st, + specs->pres_offset, specs->pres_size) == 0); + /* Record what we've got */ + _set_present_idx(st, + specs->pres_offset, specs->pres_size, edx + 1); + ctx->phase = 3; + /* Fall through */ + } + + /* No need to wait for closing tag; special mode. */ + if(ctx->phase == 3 && !*xml_tag) { + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", + ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', + ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', + ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', + ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', + xml_tag, tcv); + + /* Skip the extensions section */ + if(ctx->phase == 4) { + ASN_DEBUG("skip_unknown(%d, %ld)", + tcv, (long)ctx->left); + switch(xer_skip_unknown(tcv, &ctx->left)) { + case -1: + ctx->phase = 5; + RETURN(RC_FAIL); + continue; + case 1: + ctx->phase = 3; + /* Fall through */ + case 0: + XER_ADVANCE(ch_size); + continue; + case 2: + ctx->phase = 3; + break; + } + } + + switch(tcv) { + case XCT_BOTH: + break; /* No CHOICE? */ + case XCT_CLOSING: + if(ctx->phase != 3) + break; + XER_ADVANCE(ch_size); + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + if(ctx->phase != 1) + break; /* Really unexpected */ + + /* + * Search which inner member corresponds to this tag. + */ + for(edx = 0; edx < td->elements_count; edx++) { + elm = &td->elements[edx]; + tcv = xer_check_tag(buf_ptr,ch_size,elm->name); + switch(tcv) { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + edx = td->elements_count; + break; /* Phase out */ + } + break; + } + if(edx != td->elements_count) + continue; + + /* It is expected extension */ + if(specs->ext_start != -1) { + ASN_DEBUG("Got anticipated extension"); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if(tcv & XCT_CLOSING) { + /* Found without body */ + ctx->phase = 3; /* Terminating */ + } else { + ctx->left = 1; + ctx->phase = 4; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" + " (ph=%d, tag=%s)", + ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', + ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', + ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', + ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', + td->name, ctx->phase, xml_tag); + break; + } + + ctx->phase = 5; /* Phase out, just in case */ + RETURN(RC_FAIL); +} + + +asn_enc_rval_t +CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs=(asn_CHOICE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int present; + + if(!sptr) + _ASN_ENCODE_FAILED; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + + if(present <= 0 || present > td->elements_count) { + _ASN_ENCODE_FAILED; + } else { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[present-1]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) _ASN_ENCODE_FAILED; + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + er.encoded = 0; + + if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + + er.encoded += 5 + (2 * mlen) + tmper.encoded; + } + + if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +asn_dec_rval_t +CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_dec_rval_t rv; + asn_per_constraint_t *ct; + asn_TYPE_member_t *elm; /* CHOICE's element */ + void *memb_ptr; + void **memb_ptr2; + void *st = *sptr; + int value; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + _ASN_DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) _ASN_DECODE_FAILED; + } + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + value = per_get_few_bits(pd, 1); + if(value < 0) _ASN_DECODE_STARVED; + if(value) ct = 0; /* Not restricted */ + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) _ASN_DECODE_STARVED; + ASN_DEBUG("CHOICE %s got index %d in range %d", + td->name, value, ct->range_bits); + if(value > ct->upper_bound) + _ASN_DECODE_FAILED; + } else { + if(specs->ext_start == -1) + _ASN_DECODE_FAILED; + value = uper_get_nsnnwn(pd); + if(value < 0) _ASN_DECODE_STARVED; + value += specs->ext_start; + if(value >= td->elements_count) + _ASN_DECODE_FAILED; + } + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + value = specs->canonical_order[value]; + + /* Set presence to be able to free it later */ + _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); + + elm = &td->elements[value]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); + + if(ct && ct->range_bits >= 0) { + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } else { + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } + + if(rv.code != RC_OK) + ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", + elm->name, td->name, rv.code); + return rv; +} + +asn_enc_rval_t +CHOICE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_per_constraint_t *ct; + void *memb_ptr; + int present; + + if(!sptr) _ASN_ENCODE_FAILED; + + ASN_DEBUG("Encoding %s as CHOICE", td->name); + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized properly, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) + _ASN_ENCODE_FAILED; + else + present--; + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + present = specs->canonical_order[present]; + + ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); + + if(ct && ct->range_bits >= 0) { + if(present < ct->lower_bound + || present > ct->upper_bound) { + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, 1, 1)) + _ASN_ENCODE_FAILED; + } else { + _ASN_ENCODE_FAILED; + } + ct = 0; + } + } + if(ct && ct->flags & APC_EXTENSIBLE) + if(per_put_few_bits(po, 0, 1)) + _ASN_ENCODE_FAILED; + + elm = &td->elements[present]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) _ASN_ENCODE_FAILED; + } else { + memb_ptr = (char *)sptr + elm->memb_offset; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, present, ct->range_bits)) + _ASN_ENCODE_FAILED; + + return elm->type->uper_encoder(elm->type, elm->per_constraints, + memb_ptr, po); + } else { + asn_enc_rval_t rval; + if(specs->ext_start == -1) + _ASN_ENCODE_FAILED; + if(uper_put_nsnnwn(po, present - specs->ext_start)) + _ASN_ENCODE_FAILED; + if(uper_open_type_put(elm->type, elm->per_constraints, + memb_ptr, po)) + _ASN_ENCODE_FAILED; + rval.encoded = 0; + _ASN_ENCODED_OK(rval); + } +} + + +int +CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + + /* + * Print that element. + */ + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Print member's name and stuff */ + if(0) { + if(cb(elm->name, strlen(elm->name), app_key) < 0 + || cb(": ", 2, app_key) < 0) + return -1; + } + + return elm->type->print_struct(elm->type, memb_ptr, ilevel, + cb, app_key); + } else { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } +} + +void +CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + int present; + + if(!td || !ptr) + return; + + ASN_DEBUG("Freeing %s as CHOICE", td->name); + + /* + * Figure out which CHOICE element is encoded. + */ + present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); + + /* + * Free that element. + */ + if(present > 0 && present <= td->elements_count) { + asn_TYPE_member_t *elm = &td->elements[present-1]; + void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)ptr + elm->memb_offset); + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } else { + memb_ptr = (void *)((char *)ptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } + } + + if(!contents_only) { + FREEMEM(ptr); + } +} + + +/* + * The following functions functions offer protection against -fshort-enums, + * compatible with little- and big-endian machines. + * If assertion is triggered, either disable -fshort-enums, or add an entry + * here with the ->pres_size of your target stracture. + * Unless the target structure is packed, the ".present" member + * is guaranteed to be aligned properly. ASN.1 compiler itself does not + * produce packed code. + */ +static int +_fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { + const void *present_ptr; + int present; + + present_ptr = ((const char *)struct_ptr) + pres_offset; + + switch(pres_size) { + case sizeof(int): present = *(const int *)present_ptr; break; + case sizeof(short): present = *(const short *)present_ptr; break; + case sizeof(char): present = *(const char *)present_ptr; break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + return 0; /* If not aborted, pass back safe value */ + } + + return present; +} + +static void +_set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { + void *present_ptr; + present_ptr = ((char *)struct_ptr) + pres_offset; + + switch(pres_size) { + case sizeof(int): *(int *)present_ptr = present; break; + case sizeof(short): *(short *)present_ptr = present; break; + case sizeof(char): *(char *)present_ptr = present; break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + } +} diff --git a/src/core/libs/supl/asn-supl/constr_CHOICE.h b/src/core/libs/supl/asn-supl/constr_CHOICE.h new file mode 100644 index 000000000..83404e6d4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_CHOICE.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_CHOICE_H_ +#define _CONSTR_CHOICE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct asn_CHOICE_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_codec_ctx_t member */ + int pres_offset; /* Identifier of the present member */ + int pres_size; /* Size of the identifier (enum) */ + + /* + * Tags to members mapping table. + */ + asn_TYPE_tag2member_t *tag2el; + int tag2el_count; + + /* Canonical ordering of CHOICE elements, for PER */ + int *canonical_order; + + /* + * Extensions-related stuff. + */ + int ext_start; /* First member of extensions, or -1 */ +} asn_CHOICE_specifics_t; + +/* + * A set specialized functions dealing with the CHOICE type. + */ +asn_struct_free_f CHOICE_free; +asn_struct_print_f CHOICE_print; +asn_constr_check_f CHOICE_constraint; +ber_type_decoder_f CHOICE_decode_ber; +der_type_encoder_f CHOICE_encode_der; +xer_type_decoder_f CHOICE_decode_xer; +xer_type_encoder_f CHOICE_encode_xer; +per_type_decoder_f CHOICE_decode_uper; +per_type_encoder_f CHOICE_encode_uper; +asn_outmost_tag_f CHOICE_outmost_tag; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_CHOICE_H_ */ diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c new file mode 100644 index 000000000..db3c92581 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c @@ -0,0 +1,1423 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) +#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * Check whether we are inside the extensions group. + */ +#define IN_EXTENSION_GROUP(specs, memb_idx) \ + ( ((memb_idx) > (specs)->ext_after) \ + &&((memb_idx) < (specs)->ext_before)) + + +/* + * Tags are canonically sorted in the tag2element map. + */ +static int +_t2e_cmp(const void *ap, const void *bp) { + const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; + const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; + + int a_class = BER_TAG_CLASS(a->el_tag); + int b_class = BER_TAG_CLASS(b->el_tag); + + if(a_class == b_class) { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + + if(a_value == b_value) { + if(a->el_no > b->el_no) + return 1; + /* + * Important: we do not check + * for a->el_no <= b->el_no! + */ + return 0; + } else if(a_value < b_value) + return -1; + else + return 1; + } else if(a_class < b_class) { + return -1; + } else { + return 1; + } +} + + +/* + * The decoder of the SEQUENCE type. + */ +asn_dec_rval_t +SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* SEQUENCE element's index */ + + ASN_DEBUG("Decoding %s as SEQUENCE", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) + ctx->left += rval.consumed; /* ?Substracted below! */ + ADVANCE(rval.consumed); + + NEXT_PHASE(ctx); + + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); + + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next member from the list of + * this structure's elements. + * (ctx->step) stores the member being processed + * between invocations and the microphase {0,1} of parsing + * that member: + * step = ( * 2 + ). + */ + for(edx = (ctx->step >> 1); edx < td->elements_count; + edx++, ctx->step = (ctx->step & ~1) + 2) { + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + ssize_t tag_len; /* Length of TLV's T */ + int opt_edx_end; /* Next non-optional element */ + int use_bsearch; + int n; + + if(ctx->step & 1) + goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + ASN_DEBUG("In %s SEQUENCE left %d, edx=%d flags=%d" + " opt=%d ec=%d", + td->name, (int)ctx->left, edx, + elements[edx].flags, elements[edx].optional, + td->elements_count); + + if(ctx->left == 0 /* No more stuff is expected */ + && ( + /* Explicit OPTIONAL specification reaches the end */ + (edx + elements[edx].optional + == td->elements_count) + || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before > td->elements_count) + ) + ) { + ASN_DEBUG("End of SEQUENCE %s", td->name); + /* + * Found the legitimate end of the structure. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("Current tag in %s SEQUENCE for element %d " + "(%s) is %s encoded in %d bytes, of frame %ld", + td->name, edx, elements[edx].name, + ber_tlv_tag_string(tlv_tag), (int)tag_len, (long)LEFT); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + ASN_DEBUG("edx = %d, opt = %d, ec=%d", + edx, elements[edx].optional, + td->elements_count); + if((edx + elements[edx].optional + == td->elements_count) + || (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before + > td->elements_count)) { + /* + * Yeah, baby! Found the terminator + * of the indefinite length structure. + */ + /* + * Proceed to the canonical + * finalization function. + * No advancing is necessary. + */ + goto phase3; + } + } + } + + /* + * Find the next available type with this tag. + */ + use_bsearch = 0; + opt_edx_end = edx + elements[edx].optional + 1; + if(opt_edx_end > td->elements_count) + opt_edx_end = td->elements_count; /* Cap */ + else if(opt_edx_end - edx > 8) { + /* Limit the scope of linear search... */ + opt_edx_end = edx + 8; + use_bsearch = 1; + /* ... and resort to bsearch() */ + } + for(n = edx; n < opt_edx_end; n++) { + if(BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) { + /* + * Found element corresponding to the tag + * being looked at. + * Reposition over the right element. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } else if(elements[n].flags & ATF_OPEN_TYPE) { + /* + * This is the ANY type, which may bear + * any flag whatsoever. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } else if(elements[n].tag == (ber_tlv_tag_t)-1) { + use_bsearch = 1; + break; + } + } + if(use_bsearch) { + /* + * Resort to a binary search over + * sorted array of tags. + */ + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + key.el_tag = tlv_tag; + key.el_no = edx; + t2m = (asn_TYPE_tag2member_t *)bsearch(&key, + specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _t2e_cmp); + if(t2m) { + asn_TYPE_tag2member_t *best = 0; + asn_TYPE_tag2member_t *t2m_f, *t2m_l; + int edx_max = edx + elements[edx].optional; + /* + * Rewind to the first element with that tag, + * `cause bsearch() does not guarantee order. + */ + t2m_f = t2m + t2m->toff_first; + t2m_l = t2m + t2m->toff_last; + for(t2m = t2m_f; t2m <= t2m_l; t2m++) { + if(t2m->el_no > edx_max) break; + if(t2m->el_no < edx) continue; + best = t2m; + } + if(best) { + edx = best->el_no; + ctx->step = 1 + 2 * edx; + goto microphase2; + } + } + n = opt_edx_end; + } + if(n == opt_edx_end) { + /* + * If tag is unknown, it may be either + * an unknown (thus, incorrect) tag, + * or an extension (...), + * or an end of the indefinite-length structure. + */ + if(!IN_EXTENSION_GROUP(specs, + edx + elements[edx].optional)) { + ASN_DEBUG("Unexpected tag %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + ASN_DEBUG("Expected tag %s (%s)%s", + ber_tlv_tag_string(elements[edx].tag), + elements[edx].name, + elements[edx].optional + ?" or alternatives":""); + RETURN(RC_FAIL); + } else { + /* Skip this tag */ + ssize_t skip; + edx += elements[edx].optional; + + ASN_DEBUG("Skipping unexpected %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + skip = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + ASN_DEBUG("Skip length %d in %s", + (int)skip, td->name); + switch(skip) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + ctx->step -= 2; + edx--; + continue; /* Try again with the next tag */ + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); + + /* + * Compute the position of the member inside a structure, + * and also a type of containment (it may be contained + * as pointer or using inline inclusion). + */ + if(elements[edx].flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); + } else { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elements[edx].memb_offset; + memb_ptr2 = &memb_ptr; + } + /* + * Invoke the member fetch routine according to member's type + */ + rval = elements[edx].type->ber_decoder(opt_codec_ctx, + elements[edx].type, + memb_ptr2, ptr, LEFT, + elements[edx].tag_mode); + ASN_DEBUG("In %s SEQUENCE decoded %d %s of %d " + "in %d bytes rval.code %d, size=%d", + td->name, edx, elements[edx].type->name, + (int)LEFT, (int)rval.consumed, rval.code, (int)size); + switch(rval.code) { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + ASN_DEBUG("Size violation (c->l=%ld <= s=%ld)", + (long)ctx->left, (long)size); + /* Fall through */ + case RC_FAIL: /* Fatal error */ + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all structure members) */ + + phase3: + ctx->phase = 3; + case 3: /* 00 and other tags expected */ + case 4: /* only 00's expected */ + + ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", + td->name, (long)ctx->left, (long)size); + + /* + * Skip everything until the end of the SEQUENCE. + */ + while(ctx->left) { + ssize_t tl, ll; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tl) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + /* + * If expected <0><0>... + */ + if(ctx->left < 0 + && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + ctx->phase = 4; + continue; + } + } + + if(!IN_EXTENSION_GROUP(specs, td->elements_count) + || ctx->phase == 4) { + ASN_DEBUG("Unexpected continuation " + "of a non-extensible type " + "%s (SEQUENCE): %s", + td->name, + ber_tlv_tag_string(tlv_tag)); + RETURN(RC_FAIL); + } + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tl, LEFT - tl); + switch(ll) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + ADVANCE(tl + ll); + } + + PHASE_OUT(ctx); + } + + RETURN(RC_OK); +} + + +/* + * The DER encoder of the SEQUENCE type. + */ +asn_enc_rval_t +SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, + 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; + ssize_t ret; + int edx; + + ASN_DEBUG("%s %s as SEQUENCE", + cb?"Encoding":"Estimating", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + erval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, + 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + ASN_DEBUG("Member %d %s estimated %ld bytes", + edx, elm->name, (long)erval.encoded); + } + + /* + * Encode the TLV for the sequence itself. + */ + ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + ASN_DEBUG("Wrote tags: %ld (+%ld)", (long)ret, (long)computed_size); + if(ret == -1) + _ASN_ENCODE_FAILED; + erval.encoded = computed_size + ret; + + if(!cb) _ASN_ENCODED_OK(erval); + + /* + * Encode all members. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmperval; + void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) continue; + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + tmperval = elm->type->der_encoder(elm->type, memb_ptr, + elm->tag_mode, elm->tag, + cb, app_key); + if(tmperval.encoded == -1) + return tmperval; + computed_size -= tmperval.encoded; + ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", + edx, elm->name, td->name, (long)tmperval.encoded); + } + + if(computed_size != 0) + /* + * Encoded size is not equal to the computed size. + */ + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(erval); +} + + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_TYPE_member_t *elements = td->elements; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * ... and parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ + int edx_end; + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + * Phase 3: Skipping unknown extensions. + * Phase 4: PHASED OUT + */ + for(edx = ctx->step; ctx->phase <= 3;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + int n; + + /* + * Go inside the inner member of a sequence. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &td->elements[edx]; + + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Invoke the inner type decoder, m.b. multiple times */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, + elm->type, memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + if(tmprval.code != RC_OK) + RETURN(tmprval.code); + ctx->phase = 1; /* Back to body processing */ + ctx->step = ++edx; + ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", + ctx->phase, ctx->step); + /* Fall through */ + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, + &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", + tcv, ctx->phase, xml_tag); + + /* Skip the extensions section */ + if(ctx->phase == 3) { + switch(xer_skip_unknown(tcv, &ctx->left)) { + case -1: + ctx->phase = 4; + RETURN(RC_FAIL); + case 0: + XER_ADVANCE(ch_size); + continue; + case 1: + XER_ADVANCE(ch_size); + ctx->phase = 1; + continue; + case 2: + ctx->phase = 1; + break; + } + } + + switch(tcv) { + case XCT_CLOSING: + if(ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if(ctx->phase == 0) { + if(edx >= td->elements_count + || + /* Explicit OPTIONAL specs reaches the end */ + (edx + elements[edx].optional + == td->elements_count) + || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) + && specs->ext_before + > td->elements_count) + ) { + XER_ADVANCE(ch_size); + ctx->phase = 4; /* Phase out */ + RETURN(RC_OK); + } else { + ASN_DEBUG("Premature end of XER SEQUENCE"); + RETURN(RC_FAIL); + } + } + /* Fall through */ + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", + tcv, ctx->phase, edx); + if(ctx->phase != 1) { + break; /* Really unexpected */ + } + + if(edx < td->elements_count) { + /* + * Search which member corresponds to this tag. + */ + edx_end = edx + elements[edx].optional + 1; + if(edx_end > td->elements_count) + edx_end = td->elements_count; + for(n = edx; n < edx_end; n++) { + elm = &td->elements[n]; + tcv = xer_check_tag(buf_ptr, + ch_size, elm->name); + switch(tcv) { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx = n; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + n = edx_end; + break; /* Phase out */ + } + break; + } + if(n != edx_end) + continue; + } else { + ASN_DEBUG("Out of defined members: %d/%d", + edx, td->elements_count); + } + + /* It is expected extension */ + if(IN_EXTENSION_GROUP(specs, + edx + (edx < td->elements_count + ? elements[edx].optional : 0))) { + ASN_DEBUG("Got anticipated extension at %d", + edx); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if(tcv & XCT_CLOSING) { + /* Found without body */ + } else { + ctx->left = 1; + ctx->phase = 3; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", + size>0?((const char *)buf_ptr)[0]:'.', + size>1?((const char *)buf_ptr)[1]:'.', + size>2?((const char *)buf_ptr)[2]:'.', + size>3?((const char *)buf_ptr)[3]:'.', + size>4?((const char *)buf_ptr)[4]:'.', + size>5?((const char *)buf_ptr)[5]:'.'); + break; + } + + ctx->phase = 4; /* "Phase out" on hard failure */ + RETURN(RC_FAIL); +} + +asn_enc_rval_t +SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er; + int xcan = (flags & XER_F_CANONICAL); + int edx; + + if(!sptr) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + for(edx = 0; edx < td->elements_count; edx++) { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + /* Print the member itself */ + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + er.encoded += 5 + (2 * mlen) + tmper.encoded; + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +int +SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + int edx; + int ret; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* Dump preamble */ + if(cb(td->name, strlen(td->name), app_key) < 0 + || cb(" ::= {", 6, app_key) < 0) + return -1; + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) continue; + /* Print line */ + /* Fall through */ + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Indentation */ + _i_INDENT(1); + + /* Print the member's name and stuff */ + if(cb(elm->name, strlen(elm->name), app_key) < 0 + || cb(": ", 2, app_key) < 0) + return -1; + + /* Print the member itself */ + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, + cb, app_key); + if(ret) return ret; + } + + ilevel--; + _i_INDENT(1); + + return (cb("}", 1, app_key) < 0) ? -1 : 0; +} + +void +SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { + int edx; + + if(!td || !sptr) + return; + + ASN_DEBUG("Freeing %s as SEQUENCE", td->name); + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } + } + + if(!contents_only) { + FREEMEM(sptr); + } +} + +int +SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + int edx; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + /* + * Iterate over structure members and check their validity. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; + + if(elm->flags & ATF_POINTER) { + memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(elm->optional) + continue; + _ASN_CTFAIL(app_key, td, sptr, + "%s: mandatory element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } else { + memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + } + + if(elm->memb_constraints) { + int ret = elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if(ret) return ret; + } else { + int ret = elm->type->check_constraints(elm->type, + memb_ptr, ctfailcb, app_key); + if(ret) return ret; + /* + * Cannot inherit it earlier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + } + } + + return 0; +} + +asn_dec_rval_t +SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + void *st = *sptr; /* Target structure. */ + int extpresent; /* Extension additions are present */ + uint8_t *opres; /* Presence of optional root members */ + asn_per_data_t opmd; + asn_dec_rval_t rv; + int edx; + + (void)constraints; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + _ASN_DECODE_FAILED; + + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) _ASN_DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as SEQUENCE (UPER)", td->name); + + /* Handle extensions */ + if(specs->ext_before >= 0) { + extpresent = per_get_few_bits(pd, 1); + if(extpresent < 0) _ASN_DECODE_STARVED; + } else { + extpresent = 0; + } + + /* Prepare a place and read-in the presence bitmap */ + memset(&opmd, 0, sizeof(opmd)); + if(specs->roms_count) { + opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); + if(!opres) _ASN_DECODE_FAILED; + /* Get the presence map */ + if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { + FREEMEM(opres); + _ASN_DECODE_STARVED; + } + opmd.buffer = opres; + opmd.nbits = specs->roms_count; + ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", + td->name, specs->roms_count, *opres); + } else { + opres = 0; + } + + /* + * Get the sequence ROOT elements. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Deal with optionality */ + if(elm->optional) { + int present = per_get_few_bits(&opmd, 1); + ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", + td->name, elm->name, present, + (int)opmd.nboff, (int)opmd.nbits); + if(present == 0) { + /* This element is not present */ + if(elm->default_value) { + /* Fill-in DEFAULT */ + if(elm->default_value(1, memb_ptr2)) { + FREEMEM(opres); + _ASN_DECODE_FAILED; + } + ASN_DEBUG("Filled-in default"); + } + /* The member is just not present */ + continue; + } + /* Fall through */ + } + + /* Fetch the member from the stream */ + ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + ASN_DEBUG("Failed decode %s in %s", + elm->name, td->name); + FREEMEM(opres); + return rv; + } + } + + /* Optionality map is not needed anymore */ + FREEMEM(opres); + + /* + * Deal with extensions. + */ + if(extpresent) { + ssize_t bmlength; + uint8_t *epres; /* Presence of extension members */ + asn_per_data_t epmd; + + bmlength = uper_get_nslength(pd); + if(bmlength < 0) _ASN_DECODE_STARVED; + + ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); + + epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); + if(!epres) _ASN_DECODE_STARVED; + + /* Get the extensions map */ + if(per_get_many_bits(pd, epres, 0, bmlength)) + _ASN_DECODE_STARVED; + + memset(&epmd, 0, sizeof(epmd)); + epmd.buffer = epres; + epmd.nbits = bmlength; + ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", + td->name, bmlength, *epres); + + /* Go over extensions and read them in */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%d is not extension", edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (void *)((char *)st + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + present = per_get_few_bits(&epmd, 1); + if(present <= 0) { + if(present < 0) break; /* No more extensions */ + continue; + } + + ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + FREEMEM(epres); + return rv; + } + } + + /* Skip over overflow extensions which aren't present + * in this system's version of the protocol */ + for(;;) { + ASN_DEBUG("Getting overflow extensions"); + switch(per_get_few_bits(&epmd, 1)) { + case -1: break; + case 0: continue; + default: + if(uper_open_type_skip(opt_codec_ctx, pd)) { + FREEMEM(epres); + _ASN_DECODE_STARVED; + } + } + break; + } + + FREEMEM(epres); + } + + /* Fill DEFAULT members in extensions */ + for(edx = specs->roms_count; edx < specs->roms_count + + specs->aoms_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void **memb_ptr2; /* Pointer to member pointer */ + + if(!elm->default_value) continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + if(*memb_ptr2) continue; + } else { + continue; /* Extensions are all optionals */ + } + + /* Set default value */ + if(elm->default_value(1, memb_ptr2)) { + _ASN_DECODE_FAILED; + } + } + + rv.consumed = 0; + rv.code = RC_OK; + return rv; +} + +static int +SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, + asn_per_outp_t *po1, asn_per_outp_t *po2) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + int exts_present = 0; + int exts_count = 0; + int edx; + + if(specs->ext_before < 0) + return 0; + + /* Find out which extensions are present */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + ASN_DEBUG("checking %s (@%d) present => %d", + elm->type->name, edx, present); + exts_count++; + exts_present += present; + + /* Encode as presence marker */ + if(po1 && per_put_few_bits(po1, present, 1)) + return -1; + /* Encode as open type field */ + if(po2 && present && uper_open_type_put(elm->type, + elm->per_constraints, *memb_ptr2, po2)) + return -1; + + } + + return exts_present ? exts_count : 0; +} + +asn_enc_rval_t +SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int n_extensions; + int edx; + int i; + + (void)constraints; + + if(!sptr) + _ASN_ENCODE_FAILED; + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE (UPER)", td->name); + + + /* + * X.691#18.1 Whether structure is extensible + * and whether to encode extensions + */ + if(specs->ext_before >= 0) { + n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + per_put_few_bits(po, n_extensions ? 1 : 0, 1); + } else { + n_extensions = 0; /* There are no extensions to encode */ + } + + /* Encode a presence bitmap */ + for(i = 0; i < specs->roms_count; i++) { + asn_TYPE_member_t *elm; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + edx = specs->oms[i]; + elm = &td->elements[edx]; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + /* Eliminate default values */ + if(present && elm->default_value + && elm->default_value(0, memb_ptr2) == 1) + present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", + td->name, elm->name, present ? "present" : "absent"); + if(per_put_few_bits(po, present, 1)) + _ASN_ENCODE_FAILED; + } + + /* + * Encode the sequence ROOT elements. + */ + ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); + for(edx = 0; edx < ((specs->ext_after < 0) + ? td->elements_count : specs->ext_before - 1); edx++) { + + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + ASN_DEBUG("About to encode %s", elm->type->name); + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if(!*memb_ptr2) { + ASN_DEBUG("Element %s %d not present", + elm->name, edx); + if(elm->optional) + continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + /* Eliminate default values */ + if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) + continue; + + ASN_DEBUG("Encoding %s->%s", td->name, elm->name); + er = elm->type->uper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if(er.encoded == -1) + return er; + } + + /* No extensions to encode */ + if(!n_extensions) _ASN_ENCODED_OK(er); + + ASN_DEBUG("Length of %d bit-map", n_extensions); + /* #18.8. Write down the presence bit-map length. */ + if(uper_put_nslength(po, n_extensions)) + _ASN_ENCODE_FAILED; + + ASN_DEBUG("Bit-map of %d elements", n_extensions); + /* #18.7. Encoding the extensions presence bit-map. */ + /* TODO: act upon NOTE in #18.7 for canonical PER */ + if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + _ASN_ENCODE_FAILED; + + ASN_DEBUG("Writing %d extensions", n_extensions); + /* #18.9. Encode extensions as open type fields. */ + if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + _ASN_ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} + diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE.h b/src/core/libs/supl/asn-supl/constr_SEQUENCE.h new file mode 100644 index 000000000..5f589d5c1 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SEQUENCE_H_ +#define _CONSTR_SEQUENCE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct asn_SEQUENCE_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + /* + * Tags to members mapping table (sorted). + */ + asn_TYPE_tag2member_t *tag2el; + int tag2el_count; + + /* + * Optional members of the extensions root (roms) or additions (aoms). + * Meaningful for PER. + */ + int *oms; /* Optional MemberS */ + int roms_count; /* Root optional members count */ + int aoms_count; /* Additions optional members count */ + + /* + * Description of an extensions group. + */ + int ext_after; /* Extensions start after this member */ + int ext_before; /* Extensions stop before this member */ +} asn_SEQUENCE_specifics_t; + + +/* + * A set specialized functions dealing with the SEQUENCE type. + */ +asn_struct_free_f SEQUENCE_free; +asn_struct_print_f SEQUENCE_print; +asn_constr_check_f SEQUENCE_constraint; +ber_type_decoder_f SEQUENCE_decode_ber; +der_type_encoder_f SEQUENCE_encode_der; +xer_type_decoder_f SEQUENCE_decode_xer; +xer_type_encoder_f SEQUENCE_encode_xer; +per_type_decoder_f SEQUENCE_decode_uper; +per_type_encoder_f SEQUENCE_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SEQUENCE_H_ */ diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c b/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c new file mode 100644 index 000000000..aa101176d --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c @@ -0,0 +1,208 @@ +/*- + * Copyright (c) 2003, 2004, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * The DER encoder of the SEQUENCE OF type. + */ +asn_enc_rval_t +SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr); + size_t computed_size = 0; + ssize_t encoding_size = 0; + asn_enc_rval_t erval; + int edx; + + ASN_DEBUG("Estimating size of SEQUENCE OF %s", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, + 0, elm->tag, + 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + } + + /* + * Encode the TLV for the sequence itself. + */ + encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, + cb, app_key); + if(encoding_size == -1) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + computed_size += encoding_size; + if(!cb) { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } + + ASN_DEBUG("Encoding members of SEQUENCE OF %s", td->name); + + /* + * Encode all members. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, + 0, elm->tag, + cb, app_key); + if(erval.encoded == -1) + return erval; + encoding_size += erval.encoded; + } + + if(computed_size != (size_t)encoding_size) { + /* + * Encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } else { + erval.encoded = computed_size; + erval.structure_ptr = 0; + erval.failed_type = 0; + } + + return erval; +} + +asn_enc_rval_t +SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, 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_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr); + const char *mname = specs->as_XMLValueList + ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + unsigned int mlen = mname ? strlen(mname) : 0; + int xcan = (flags & XER_F_CANONICAL); + int i; + + if(!sptr) _ASN_ENCODE_FAILED; + + er.encoded = 0; + + for(i = 0; i < list->count; i++) { + asn_enc_rval_t tmper; + void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + if(mname) { + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + } + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + 1, flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + if(tmper.encoded == 0 && specs->as_XMLValueList) { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel + 1); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if(mname) { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +asn_enc_rval_t +SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_anonymous_sequence_ *list; + asn_per_constraint_t *ct; + asn_enc_rval_t er; + asn_TYPE_member_t *elm = td->elements; + int seq; + + if(!sptr) _ASN_ENCODE_FAILED; + list = _A_SEQUENCE_FROM_VOID(sptr); + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count); + + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->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; + } + + for(seq = -1; seq < list->count;) { + ssize_t mayEncode; + if(seq < 0) seq = 0; + if(ct && ct->effective_bits >= 0) { + mayEncode = list->count; + } else { + mayEncode = uper_put_length(po, list->count - seq); + if(mayEncode < 0) _ASN_ENCODE_FAILED; + } + + while(mayEncode--) { + void *memb_ptr = list->array[seq++]; + if(!memb_ptr) _ASN_ENCODE_FAILED; + er = elm->type->uper_encoder(elm->type, + elm->per_constraints, memb_ptr, po); + if(er.encoded == -1) + _ASN_ENCODE_FAILED; + } + } + + _ASN_ENCODED_OK(er); +} + diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.h b/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.h new file mode 100644 index 000000000..e2272f326 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SEQUENCE_OF_H_ +#define _CONSTR_SEQUENCE_OF_H_ + +#include +#include /* Implemented using SET OF */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A set specialized functions dealing with the SEQUENCE OF type. + * Generally implemented using SET OF. + */ +#define SEQUENCE_OF_free SET_OF_free +#define SEQUENCE_OF_print SET_OF_print +#define SEQUENCE_OF_constraint SET_OF_constraint +#define SEQUENCE_OF_decode_ber SET_OF_decode_ber +#define SEQUENCE_OF_decode_xer SET_OF_decode_xer +#define SEQUENCE_OF_decode_uper SET_OF_decode_uper +der_type_encoder_f SEQUENCE_OF_encode_der; +xer_type_encoder_f SEQUENCE_OF_encode_xer; +per_type_encoder_f SEQUENCE_OF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SET_OF_H_ */ diff --git a/src/core/libs/supl/asn-supl/constr_SET_OF.c b/src/core/libs/supl/asn-supl/constr_SET_OF.c new file mode 100644 index 000000000..11eac57a2 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_SET_OF.c @@ -0,0 +1,953 @@ +/*- + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Number of bytes left for this structure. + * (ctx->left) indicates the number of bytes _transferred_ for the structure. + * (size) contains the number of bytes in the buffer passed. + */ +#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) + +/* + * If the subprocessor function returns with an indication that it wants + * more data, it may well be a fatal decoding problem, because the + * size is constrained by the 's L, even if the buffer size allows + * reading more data. + * For example, consider the buffer containing the following TLVs: + * ... + * The TLV length clearly indicates that one byte is expected in V, but + * if the V processor returns with "want more data" even if the buffer + * contains way more data than the V processor have seen. + */ +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) + +/* + * This macro "eats" the part of the buffer which is definitely "consumed", + * i.e. was correctly converted into local representation or rightfully skipped. + */ +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num;\ + size -= num; \ + if(ctx->left >= 0) \ + ctx->left -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Switch to the next phase of parsing. + */ +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) do { \ + ctx->phase++; \ + ctx->step = 0; \ + } while(0) +#define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) + +/* + * Return a standardized complex structure. + */ +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself;\ + return rval; \ + } while(0) + +/* + * The decoder of the SET OF type. + */ +asn_dec_rval_t +SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *ptr, size_t size, int tag_mode) { + /* + * Bring closer parts of structure description. + */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + + /* + * Parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ + + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + ASN_DEBUG("Decoding %s as SET OF", td->name); + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) { + RETURN(RC_FAIL); + } + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Start to parse where left previously + */ + switch(ctx->phase) { + case 0: + /* + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. + */ + + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if(rval.code != RC_OK) { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if(ctx->left >= 0) + ctx->left += rval.consumed; /* ?Substracted below! */ + ADVANCE(rval.consumed); + + ASN_DEBUG("Structure consumes %ld bytes, " + "buffer %ld", (long)ctx->left, (long)size); + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next item. + */ + for(;; ctx->step = 0) { + ssize_t tag_len; /* Length of TLV's T */ + + if(ctx->step & 1) + goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + + if(ctx->left == 0) { + ASN_DEBUG("End of SET OF %s", td->name); + /* + * No more things to decode. + * Exit out of here. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch(tag_len) { + case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: RETURN(RC_FAIL); + } + + if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { + if(LEFT < 2) { + if(SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } else if(((const uint8_t *)ptr)[1] == 0) { + /* + * Found the terminator of the + * indefinite length structure. + */ + break; + } + } + + /* Outmost tag may be unknown and cannot be fetched/compared */ + if(elm->tag != (ber_tlv_tag_t)-1) { + if(BER_TAGS_EQUAL(tlv_tag, elm->tag)) { + /* + * The new list member of expected type has arrived. + */ + } else { + ASN_DEBUG("Unexpected tag %s fixed SET OF %s", + ber_tlv_tag_string(tlv_tag), td->name); + ASN_DEBUG("%s SET OF has tag %s", + td->name, ber_tlv_tag_string(elm->tag)); + RETURN(RC_FAIL); + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + + /* + * Invoke the member fetch routine according to member's type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, + elm->type, &ctx->ptr, ptr, LEFT, 0); + ASN_DEBUG("In %s SET OF %s code %d consumed %d", + td->name, elm->type->name, + rval.code, (int)rval.consumed); + switch(rval.code) { + case RC_OK: + { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if(ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + else + ctx->ptr = 0; + } + break; + case RC_WMORE: /* More data expected */ + if(!SIZE_VIOLATION) { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + /* Fall through */ + case RC_FAIL: /* Fatal error */ + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all list members) */ + + NEXT_PHASE(ctx); + case 2: + /* + * Read in all "end of content" TLVs. + */ + while(ctx->left < 0) { + if(LEFT < 2) { + if(LEFT > 0 && ((const char *)ptr)[0] != 0) { + /* Unexpected tag */ + RETURN(RC_FAIL); + } else { + RETURN(RC_WMORE); + } + } + if(((const char *)ptr)[0] == 0 + && ((const char *)ptr)[1] == 0) { + ADVANCE(2); + ctx->left++; + } else { + RETURN(RC_FAIL); + } + } + + PHASE_OUT(ctx); + } + + RETURN(RC_OK); +} + +/* + * Internally visible buffer holding a single encoded element. + */ +struct _el_buffer { + uint8_t *buf; + size_t length; + size_t size; +}; +/* Append bytes to the above structure */ +static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) { + struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr; + + if(el_buf->length + size > el_buf->size) + return -1; + + memcpy(el_buf->buf + el_buf->length, buffer, size); + + el_buf->length += size; + return 0; +} +static int _el_buf_cmp(const void *ap, const void *bp) { + const struct _el_buffer *a = (const struct _el_buffer *)ap; + const struct _el_buffer *b = (const struct _el_buffer *)bp; + int ret; + size_t common_len; + + if(a->length < b->length) + common_len = a->length; + else + common_len = b->length; + + ret = memcmp(a->buf, b->buf, common_len); + if(ret == 0) { + if(a->length < b->length) + ret = -1; + else if(a->length > b->length) + ret = 1; + } + + return ret; +} + +/* + * The DER encoder of the SET OF type. + */ +asn_enc_rval_t +SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_TYPE_descriptor_t *elm_type = elm->type; + der_type_encoder_f *der_encoder = elm_type->der_encoder; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + size_t computed_size = 0; + ssize_t encoding_size = 0; + struct _el_buffer *encoded_els; + ssize_t eels_count = 0; + size_t max_encoded_len = 1; + asn_enc_rval_t erval; + int ret; + int edx; + + ASN_DEBUG("Estimating size for SET OF %s", td->name); + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + if(!memb_ptr) continue; + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); + if(erval.encoded == -1) + return erval; + computed_size += erval.encoded; + + /* Compute maximum encoding's size */ + if(max_encoded_len < (size_t)erval.encoded) + max_encoded_len = erval.encoded; + } + + /* + * Encode the TLV for the sequence itself. + */ + encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, + cb, app_key); + if(encoding_size == -1) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + computed_size += encoding_size; + + if(!cb || list->count == 0) { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } + + /* + * DER mandates dynamic sorting of the SET OF elements + * according to their encodings. Build an array of the + * encoded elements. + */ + encoded_els = (struct _el_buffer *)MALLOC( + list->count * sizeof(encoded_els[0])); + if(encoded_els == NULL) { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + ASN_DEBUG("Encoding members of %s SET OF", td->name); + + /* + * Encode all members. + */ + for(edx = 0; edx < list->count; edx++) { + void *memb_ptr = list->array[edx]; + struct _el_buffer *encoded_el = &encoded_els[eels_count]; + + if(!memb_ptr) continue; + + /* + * Prepare space for encoding. + */ + encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); + if(encoded_el->buf) { + encoded_el->length = 0; + encoded_el->size = max_encoded_len; + } else { + for(edx--; edx >= 0; edx--) + FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + /* + * Encode the member into the prepared space. + */ + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, + _el_addbytes, encoded_el); + if(erval.encoded == -1) { + for(; edx >= 0; edx--) + FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + return erval; + } + encoding_size += erval.encoded; + eels_count++; + } + + /* + * Sort the encoded elements according to their encoding. + */ + qsort(encoded_els, eels_count, sizeof(encoded_els[0]), _el_buf_cmp); + + /* + * Report encoded elements to the application. + * Dispose of temporary sorted members table. + */ + ret = 0; + for(edx = 0; edx < eels_count; edx++) { + struct _el_buffer *encoded_el = &encoded_els[edx]; + /* Report encoded chunks to the application */ + if(ret == 0 + && cb(encoded_el->buf, encoded_el->length, app_key) < 0) + ret = -1; + FREEMEM(encoded_el->buf); + } + FREEMEM(encoded_els); + + if(ret || computed_size != (size_t)encoding_size) { + /* + * Standard callback failed, or + * encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } else { + erval.encoded = computed_size; + } + + _ASN_ENCODED_OK(erval); +} + +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) do { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num;\ + size -= num; \ + consumed_myself += num; \ + } while(0) + +/* + * Decode the XER (XML) data. + */ +asn_dec_rval_t +SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const char *opt_mname, + const void *buf_ptr, size_t size) { + /* + * Bring closer parts of structure description. + */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *element = td->elements; + const char *elm_tag; + const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; + + /* + * ... and parts of the structure being constructed. + */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ + + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + + /* + * Create the target structure if it is not present already. + */ + if(st == 0) { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if(st == 0) RETURN(RC_FAIL); + } + + /* Which tag is expected for the downstream */ + if(specs->as_XMLValueList) { + elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; + } else { + elm_tag = (*element->name) + ? element->name : element->type->xml_tag; + } + + /* + * Restore parsing context. + */ + ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + * Phase 2: Processing inner type. + */ + for(; ctx->phase <= 2;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + + /* + * Go inside the inner member of a set. + */ + if(ctx->phase == 2) { + asn_dec_rval_t tmprval; + + /* Invoke the inner type decoder, m.b. multiple times */ + ASN_DEBUG("XER/SET OF element [%s]", elm_tag); + tmprval = element->type->xer_decoder(opt_codec_ctx, + element->type, &ctx->ptr, elm_tag, + buf_ptr, size); + if(tmprval.code == RC_OK) { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if(ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + ctx->ptr = 0; + XER_ADVANCE(tmprval.consumed); + } else { + XER_ADVANCE(tmprval.consumed); + RETURN(tmprval.code); + } + ctx->phase = 1; /* Back to body processing */ + ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); + /* Fall through */ + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, + buf_ptr, size, &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", + tcv, ctx->phase, xml_tag); + switch(tcv) { + case XCT_CLOSING: + if(ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if(ctx->phase == 0) { + /* No more things to decode */ + XER_ADVANCE(ch_size); + ctx->phase = 3; /* Phase out */ + RETURN(RC_OK); + } + /* Fall through */ + case XCT_OPENING: + if(ctx->phase == 0) { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); + if(ctx->phase == 1) { + /* + * Process a single possible member. + */ + ctx->phase = 2; + continue; + } + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SET OF"); + break; + } + + ctx->phase = 3; /* "Phase out" on hard failure */ + RETURN(RC_FAIL); +} + + + +typedef struct xer_tmp_enc_s { + void *buffer; + size_t offset; + size_t size; +} xer_tmp_enc_t; +static int +SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { + xer_tmp_enc_t *t = (xer_tmp_enc_t *)key; + if(t->offset + size >= t->size) { + size_t newsize = (t->size << 2) + size; + void *p = REALLOC(t->buffer, newsize); + if(!p) return -1; + t->buffer = p; + t->size = newsize; + } + memcpy((char *)t->buffer + t->offset, buffer, size); + t->offset += size; + return 0; +} +static int +SET_OF_xer_order(const void *aptr, const void *bptr) { + const xer_tmp_enc_t *a = (const xer_tmp_enc_t *)aptr; + const xer_tmp_enc_t *b = (const xer_tmp_enc_t *)bptr; + size_t minlen = a->offset; + int ret; + if(b->offset < minlen) minlen = b->offset; + /* Well-formed UTF-8 has this nice lexicographical property... */ + ret = memcmp(a->buffer, b->buffer, minlen); + if(ret != 0) return ret; + if(a->offset == b->offset) + return 0; + if(a->offset == minlen) + return -1; + return 1; +} + + +asn_enc_rval_t +SET_OF_encode_xer(asn_TYPE_descriptor_t *td, 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_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr); + const char *mname = specs->as_XMLValueList + ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + size_t mlen = mname ? strlen(mname) : 0; + int xcan = (flags & XER_F_CANONICAL); + xer_tmp_enc_t *encs = 0; + size_t encs_count = 0; + void *original_app_key = app_key; + asn_app_consume_bytes_f *original_cb = cb; + int i; + + if(!sptr) _ASN_ENCODE_FAILED; + + if(xcan) { + encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); + if(!encs) _ASN_ENCODE_FAILED; + cb = SET_OF_encode_xer_callback; + } + + er.encoded = 0; + + for(i = 0; i < list->count; i++) { + asn_enc_rval_t tmper; + + void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + if(encs) { + memset(&encs[encs_count], 0, sizeof(encs[0])); + app_key = &encs[encs_count]; + encs_count++; + } + + if(mname) { + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + } + + if(!xcan && specs->as_XMLValueList == 1) + _i_ASN_TEXT_INDENT(1, ilevel + 1); + tmper = elm->type->xer_encoder(elm->type, memb_ptr, + ilevel + (specs->as_XMLValueList != 2), + flags, cb, app_key); + if(tmper.encoded == -1) { + td = tmper.failed_type; + sptr = tmper.structure_ptr; + goto cb_failed; + } + if(tmper.encoded == 0 && specs->as_XMLValueList) { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if(mname) { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; + } + + if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + if(encs) { + xer_tmp_enc_t *enc = encs; + xer_tmp_enc_t *end = encs + encs_count; + ssize_t control_size = 0; + + cb = original_cb; + app_key = original_app_key; + qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); + + for(; enc < end; enc++) { + _ASN_CALLBACK(enc->buffer, enc->offset); + FREEMEM(enc->buffer); + enc->buffer = 0; + control_size += enc->offset; + } + assert(control_size == er.encoded); + } + + goto cleanup; +cb_failed: + er.encoded = -1; + er.failed_type = td; + er.structure_ptr = sptr; +cleanup: + if(encs) { + while(encs_count-- > 0) { + if(encs[encs_count].buffer) + FREEMEM(encs[encs_count].buffer); + } + FREEMEM(encs); + } + _ASN_ENCODED_OK(er); +} + +int +SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); + int ret; + int i; + + if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + + /* Dump preamble */ + if(cb(td->name, strlen(td->name), app_key) < 0 + || cb(" ::= {", 6, app_key) < 0) + return -1; + + for(i = 0; i < list->count; i++) { + const void *memb_ptr = list->array[i]; + if(!memb_ptr) continue; + + _i_INDENT(1); + + ret = elm->type->print_struct(elm->type, memb_ptr, + ilevel + 1, cb, app_key); + if(ret) return ret; + } + + ilevel--; + _i_INDENT(1); + + return (cb("}", 1, app_key) < 0) ? -1 : 0; +} + +void +SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { + if(td && ptr) { + asn_SET_OF_specifics_t *specs; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + asn_struct_ctx_t *ctx; /* Decoder context */ + int i; + + /* + * Could not use set_of_empty() because of (*free) + * incompatibility. + */ + for(i = 0; i < list->count; i++) { + void *memb_ptr = list->array[i]; + if(memb_ptr) + ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + list->count = 0; /* No meaningful elements left */ + + asn_set_empty(list); /* Remove (list->array) */ + + specs = (asn_SET_OF_specifics_t *)td->specifics; + ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); + if(ctx->ptr) { + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + } + + if(!contents_only) { + FREEMEM(ptr); + } + } +} + +int +SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + asn_TYPE_member_t *elm = td->elements; + asn_constr_check_f *constr; + const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); + int i; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + constr = elm->memb_constraints; + if(!constr) constr = elm->type->check_constraints; + + /* + * Iterate over the members of an array. + * Validate each in turn, until one fails. + */ + for(i = 0; i < list->count; i++) { + const void *memb_ptr = list->array[i]; + int ret; + + if(!memb_ptr) continue; + + ret = constr(elm->type, memb_ptr, ctfailcb, app_key); + if(ret) return ret; + } + + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + if(!elm->memb_constraints) + elm->memb_constraints = elm->type->check_constraints; + + return 0; +} + +asn_dec_rval_t +SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + void *st = *sptr; + asn_anonymous_set_ *list; + asn_per_constraint_t *ct; + int repeat = 0; + ssize_t nelems; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + _ASN_DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) _ASN_DECODE_FAILED; + } + list = _A_SET_FROM_VOID(st); + + /* Figure out which constraints to use */ + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->per_constraints->size; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int value = per_get_few_bits(pd, 1); + if(value < 0) _ASN_DECODE_STARVED; + if(value) ct = 0; /* Not restricted! */ + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ + nelems = per_get_few_bits(pd, ct->effective_bits); + ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", + (long)nelems, ct->lower_bound, td->name); + if(nelems < 0) _ASN_DECODE_STARVED; + nelems += ct->lower_bound; + } else { + nelems = -1; + } + + do { + int i; + if(nelems < 0) { + nelems = uper_get_length(pd, + ct ? ct->effective_bits : -1, &repeat); + ASN_DEBUG("Got to decode %d elements (eff %d)", + (int)nelems, (int)ct ? ct->effective_bits : -1); + if(nelems < 0) _ASN_DECODE_STARVED; + } + + for(i = 0; i < nelems; i++) { + void *ptr = 0; + ASN_DEBUG("SET OF %s decoding", elm->type->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, &ptr, pd); + ASN_DEBUG("%s SET OF %s decoded %d, %p", + td->name, elm->type->name, rv.code, ptr); + if(rv.code == RC_OK) { + if(ASN_SET_ADD(list, ptr) == 0) + continue; + ASN_DEBUG("Failed to add element into %s", + td->name); + /* Fall through */ + rv.code = RC_FAIL; + } else { + ASN_DEBUG("Failed decoding %s of %s (SET OF)", + elm->type->name, td->name); + } + if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); + return rv; + } + + nelems = -1; /* Allow uper_get_length() */ + } while(repeat); + + ASN_DEBUG("Decoded %s as SET OF", td->name); + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + diff --git a/src/core/libs/supl/asn-supl/constr_SET_OF.h b/src/core/libs/supl/asn-supl/constr_SET_OF.h new file mode 100644 index 000000000..bcd096629 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_SET_OF.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2003 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _CONSTR_SET_OF_H_ +#define _CONSTR_SET_OF_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct asn_SET_OF_specifics_s { + /* + * Target structure description. + */ + int struct_size; /* Size of the target structure. */ + int ctx_offset; /* Offset of the asn_struct_ctx_t member */ + + /* XER-specific stuff */ + int as_XMLValueList; /* The member type must be encoded like this */ +} asn_SET_OF_specifics_t; + +/* + * A set specialized functions dealing with the SET OF type. + */ +asn_struct_free_f SET_OF_free; +asn_struct_print_f SET_OF_print; +asn_constr_check_f SET_OF_constraint; +ber_type_decoder_f SET_OF_decode_ber; +der_type_encoder_f SET_OF_encode_der; +xer_type_decoder_f SET_OF_decode_xer; +xer_type_encoder_f SET_OF_encode_xer; +per_type_decoder_f SET_OF_decode_uper; +per_type_encoder_f SET_OF_encode_uper; + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_SET_OF_H_ */ diff --git a/src/core/libs/supl/asn-supl/constr_TYPE.c b/src/core/libs/supl/asn-supl/constr_TYPE.c new file mode 100644 index 000000000..4bc88d44f --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_TYPE.c @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * Version of the ASN.1 infrastructure shipped with compiler. + */ +int get_asn1c_environment_version() { return ASN1C_ENVIRONMENT_VERSION; } + +static asn_app_consume_bytes_f _print2fp; + +/* + * Return the outmost tag of the type. + */ +ber_tlv_tag_t +asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag) { + + if(tag_mode) + return tag; + + if(type_descriptor->tags_count) + return type_descriptor->tags[0]; + + return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0); +} + +/* + * Print the target language's structure in human readable form. + */ +int +asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) { + if(!stream) stream = stdout; + if(!td || !struct_ptr) { + errno = EINVAL; + return -1; + } + + /* Invoke type-specific printer */ + if(td->print_struct(td, struct_ptr, 1, _print2fp, stream)) + return -1; + + /* Terminate the output */ + if(_print2fp("\n", 1, stream)) + return -1; + + return fflush(stream); +} + +/* Dump the data into the specified stdio stream */ +static int +_print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + + +/* + * Some compilers do not support variable args macros. + * This function is a replacement of ASN_DEBUG() macro. + */ +void ASN_DEBUG_f(const char *fmt, ...); +void ASN_DEBUG_f(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} diff --git a/src/core/libs/supl/asn-supl/constr_TYPE.h b/src/core/libs/supl/asn-supl/constr_TYPE.h new file mode 100644 index 000000000..95507c809 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constr_TYPE.h @@ -0,0 +1,180 @@ +/*- + * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +/* + * This file contains the declaration structure called "ASN.1 Type Definition", + * which holds all information necessary for encoding and decoding routines. + * This structure even contains pointer to these encoding and decoding routines + * for each defined ASN.1 type. + */ +#ifndef _CONSTR_TYPE_H_ +#define _CONSTR_TYPE_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ +struct asn_TYPE_member_s; /* Forward declaration */ + +/* + * This type provides the context information for various ASN.1 routines, + * primarily ones doing decoding. A member _asn_ctx of this type must be + * included into certain target language's structures, such as compound types. + */ +typedef struct asn_struct_ctx_s { + short phase; /* Decoding phase */ + short step; /* Elementary step of a phase */ + int context; /* Other context information */ + void *ptr; /* Decoder-specific stuff (stack elements) */ + ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */ +} asn_struct_ctx_t; + +#include /* Basic Encoding Rules decoder */ +#include /* Distinguished Encoding Rules encoder */ +#include /* Decoder of XER (XML, text) */ +#include /* Encoder into XER (XML, text) */ +#include /* Packet Encoding Rules decoder */ +#include /* Packet Encoding Rules encoder */ +#include /* Subtype constraints support */ + +/* + * Free the structure according to its specification. + * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) + * will not be freed. (It may be useful in case the structure is allocated + * statically or arranged on the stack, yet its elements are allocated + * dynamically.) + */ +typedef void (asn_struct_free_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, int free_contents_only); +#define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF),ptr,0) +#define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ + (asn_DEF).free_struct(&(asn_DEF),ptr,1) + +/* + * Print the structure according to its specification. + */ +typedef int (asn_struct_print_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, + int level, /* Indentation level */ + asn_app_consume_bytes_f *callback, void *app_key); + +/* + * Return the outmost tag of the type. + * If the type is untagged CHOICE, the dynamic operation is performed. + * NOTE: This function pointer type is only useful internally. + * Do not use it in your application. + */ +typedef ber_tlv_tag_t (asn_outmost_tag_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); +/* The instance of the above function type; used internally. */ +asn_outmost_tag_f asn_TYPE_outmost_tag; + + +/* + * The definitive description of the destination language's structure. + */ +typedef struct asn_TYPE_descriptor_s { + char *name; /* A name of the ASN.1 type. "" in some cases. */ + char *xml_tag; /* Name used in XML tag */ + + /* + * Generalized functions for dealing with the specific type. + * May be directly invoked by applications. + */ + asn_struct_free_f *free_struct; /* Free the structure */ + asn_struct_print_f *print_struct; /* Human readable output */ + asn_constr_check_f *check_constraints; /* Constraints validator */ + ber_type_decoder_f *ber_decoder; /* Generic BER decoder */ + der_type_encoder_f *der_encoder; /* Canonical DER encoder */ + xer_type_decoder_f *xer_decoder; /* Generic XER decoder */ + xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */ + per_type_decoder_f *uper_decoder; /* Unaligned PER decoder */ + per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ + + /*********************************************************************** + * Internally useful members. Not to be used by applications directly. * + **********************************************************************/ + + /* + * Tags that are expected to occur. + */ + asn_outmost_tag_f *outmost_tag; /* */ + ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ + int tags_count; /* Number of tags which are expected */ + ber_tlv_tag_t *all_tags;/* Every tag for BER/containment */ + int all_tags_count; /* Number of tags */ + + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + + /* + * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). + */ + struct asn_TYPE_member_s *elements; + int elements_count; + + /* + * Additional information describing the type, used by appropriate + * functions above. + */ + void *specifics; +} asn_TYPE_descriptor_t; + +/* + * This type describes an element of the constructed type, + * i.e. SEQUENCE, SET, CHOICE, etc. + */ + enum asn_TYPE_flags_e { + ATF_NOFLAGS, + ATF_POINTER = 0x01, /* Represented by the pointer */ + ATF_OPEN_TYPE = 0x02 /* ANY type, without meaningful tag */ + }; +typedef struct asn_TYPE_member_s { + enum asn_TYPE_flags_e flags; /* Element's presentation flags */ + int optional; /* Following optional members, including current */ + int memb_offset; /* Offset of the element */ + ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ + int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_constr_check_f *memb_constraints; /* Constraints validator */ + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + int (*default_value)(int setval, void **sptr); /* DEFAULT */ + char *name; /* ASN.1 identifier of the element */ +} asn_TYPE_member_t; + +/* + * BER tag to element number mapping. + */ +typedef struct asn_TYPE_tag2member_s { + ber_tlv_tag_t el_tag; /* Outmost tag of the member */ + int 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, relatvie */ +} asn_TYPE_tag2member_t; + +/* + * This function is a wrapper around (td)->print_struct, which prints out + * the contents of the target language's structure (struct_ptr) into the + * file pointer (stream) in human readable form. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem dumping the structure. + * (See also xer_fprint() in xer_encoder.h) + */ +int asn_fprint(FILE *stream, /* Destination stream descriptor */ + asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ + const void *struct_ptr); /* Structure to be printed */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CONSTR_TYPE_H_ */ diff --git a/src/core/libs/supl/asn-supl/constraints.c b/src/core/libs/supl/asn-supl/constraints.c new file mode 100644 index 000000000..1bdda73e5 --- /dev/null +++ b/src/core/libs/supl/asn-supl/constraints.c @@ -0,0 +1,93 @@ +#include "asn_internal.h" +#include "constraints.h" + +int +asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { + + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ + + /* Nothing to check */ + return 0; +} + +int +asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { + + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ + + /* Unknown how to check */ + return 0; +} + +struct errbufDesc { + asn_TYPE_descriptor_t *failed_type; + const void *failed_struct_ptr; + char *errbuf; + size_t errlen; +}; + +static void +_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { + struct errbufDesc *arg = key; + va_list ap; + ssize_t vlen; + ssize_t maxlen; + + arg->failed_type = td; + arg->failed_struct_ptr = sptr; + + maxlen = arg->errlen; + if(maxlen <= 0) + return; + + va_start(ap, fmt); + vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); + va_end(ap); + if(vlen >= maxlen) { + arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ + arg->errlen = maxlen - 1; /* Not counting termination */ + return; + } else if(vlen >= 0) { + arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ + arg->errlen = vlen; /* Not counting termination */ + } else { + /* + * The libc on this system is broken. + */ + vlen = sizeof("") - 1; + maxlen--; + arg->errlen = vlen < maxlen ? vlen : maxlen; + memcpy(arg->errbuf, "", arg->errlen); + arg->errbuf[arg->errlen] = 0; + } + + return; +} + +int +asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, char *errbuf, size_t *errlen) { + struct errbufDesc arg; + int ret; + + arg.failed_type = 0; + arg.failed_struct_ptr = 0; + arg.errbuf = errbuf; + arg.errlen = errlen ? *errlen : 0; + + ret = type_descriptor->check_constraints(type_descriptor, + struct_ptr, _asn_i_ctfailcb, &arg); + if(ret == -1 && errlen) + *errlen = arg.errlen; + + return ret; +} + diff --git a/src/core/libs/supl/asn-supl/constraints.h b/src/core/libs/supl/asn-supl/constraints.h new file mode 100644 index 000000000..5032345ee --- /dev/null +++ b/src/core/libs/supl/asn-supl/constraints.h @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _ASN1_CONSTRAINTS_VALIDATOR_H_ +#define _ASN1_CONSTRAINTS_VALIDATOR_H_ + +#include /* Platform-dependent types */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Validate the structure according to the ASN.1 constraints. + * If errbuf and errlen are given, they shall be pointing to the appropriate + * buffer space and its length before calling this function. Alternatively, + * they could be passed as NULL's. If constraints validation fails, + * errlen will contain the actual number of bytes taken from the errbuf + * to encode an error message (properly 0-terminated). + * + * RETURN VALUES: + * This function returns 0 in case all ASN.1 constraints are met + * and -1 if one or more constraints were failed. + */ +int +asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, /* Target language's structure */ + char *errbuf, /* Returned error description */ + size_t *errlen /* Length of the error description */ + ); + + +/* + * Generic type for constraint checking callback, + * associated with every type descriptor. + */ +typedef int (asn_constr_check_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *optional_callback, /* Log the error */ + void *optional_app_key /* Opaque key passed to a callback */ + ); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ +asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ + +/* + * Invoke the callback with a complete error message. + */ +#define _ASN_CTFAIL if(ctfailcb) ctfailcb + +#ifdef __cplusplus +} +#endif + +#endif /* _ASN1_CONSTRAINTS_VALIDATOR_H_ */ diff --git a/src/core/libs/supl/asn-supl/der_encoder.c b/src/core/libs/supl/asn-supl/der_encoder.c new file mode 100644 index 000000000..6c859e1b0 --- /dev/null +++ b/src/core/libs/supl/asn-supl/der_encoder.c @@ -0,0 +1,199 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, int constructed); + +/* + * The DER encoder of any type. + */ +asn_enc_rval_t +der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, + asn_app_consume_bytes_f *consume_bytes, void *app_key) { + + ASN_DEBUG("DER encoder invoked for %s", + type_descriptor->name); + + /* + * Invoke type-specific encoder. + */ + return type_descriptor->der_encoder(type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + 0, 0, + consume_bytes, app_key); +} + +/* + * Argument type and callback necessary for der_encode_to_buffer(). + */ +typedef struct enc_to_buf_arg { + void *buffer; + size_t left; +} enc_to_buf_arg; +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { + enc_to_buf_arg *arg = (enc_to_buf_arg *)key; + + if(arg->left < size) + return -1; /* Data exceeds the available buffer size */ + + memcpy(arg->buffer, buffer, size); + arg->buffer = ((char *)arg->buffer) + size; + arg->left -= size; + + return 0; +} + +/* + * A variant of the der_encode() which encodes the data into the provided buffer + */ +asn_enc_rval_t +der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, + void *buffer, size_t buffer_size) { + enc_to_buf_arg arg; + asn_enc_rval_t ec; + + arg.buffer = buffer; + arg.left = buffer_size; + + ec = type_descriptor->der_encoder(type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + 0, 0, encode_to_buffer_cb, &arg); + if(ec.encoded != -1) { + assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); + /* Return the encoded contents size */ + } + return ec; +} + + +/* + * Write out leading TL[v] sequence according to the type definition. + */ +ssize_t +der_write_tags(asn_TYPE_descriptor_t *sd, + size_t struct_length, + int tag_mode, int last_tag_form, + ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ + asn_app_consume_bytes_f *cb, + void *app_key) { + ber_tlv_tag_t *tags; /* Copy of tags stream */ + int tags_count; /* Number of tags */ + size_t overall_length; + ssize_t *lens; + int i; + + ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", + sd->name, tag_mode, sd->tags_count, + ber_tlv_tag_string(tag), + tag_mode + ?(sd->tags_count+1 + -((tag_mode == -1) && sd->tags_count)) + :sd->tags_count + ); + + if(tag_mode) { + /* + * Instead of doing shaman dance like we do in ber_check_tags(), + * allocate a small array on the stack + * and initialize it appropriately. + */ + int stag_offset; + tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t)); + if(!tags) { /* Can fail on !x86 */ + errno = ENOMEM; + return -1; + } + tags_count = sd->tags_count + + 1 /* EXPLICIT or IMPLICIT tag is given */ + - ((tag_mode == -1) && sd->tags_count); + /* Copy tags over */ + tags[0] = tag; + stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); + for(i = 1; i < tags_count; i++) + tags[i] = sd->tags[i + stag_offset]; + } else { + tags = sd->tags; + tags_count = sd->tags_count; + } + + /* No tags to write */ + if(tags_count == 0) + return 0; + + lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); + if(!lens) { + errno = ENOMEM; + return -1; + } + + /* + * Array of tags is initialized. + * Now, compute the size of the TLV pairs, from right to left. + */ + overall_length = struct_length; + for(i = tags_count - 1; i >= 0; --i) { + lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); + if(lens[i] == -1) return -1; + overall_length += lens[i]; + lens[i] = overall_length - lens[i]; + } + + if(!cb) return overall_length - struct_length; + + ASN_DEBUG("%s %s TL sequence (%d elements)", + cb?"Encoding":"Estimating", sd->name, tags_count); + + /* + * Encode the TL sequence for real. + */ + for(i = 0; i < tags_count; i++) { + ssize_t len; + int _constr; + + /* Check if this tag happens to be constructed */ + _constr = (last_tag_form || i < (tags_count - 1)); + + len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); + if(len == -1) return -1; + } + + return overall_length - struct_length; +} + +static ssize_t +der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, + int constructed) { + uint8_t buf[32]; + size_t size = 0; + int buf_size = cb?sizeof(buf):0; + ssize_t tmp; + + /* Serialize tag (T from TLV) into possibly zero-length buffer */ + tmp = ber_tlv_tag_serialize(tag, buf, buf_size); + if(tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; + size += tmp; + + /* Serialize length (L from TLV) into possibly zero-length buffer */ + tmp = der_tlv_length_serialize(len, buf+size, buf_size?buf_size-size:0); + if(tmp == -1) return -1; + size += tmp; + + if(size > sizeof(buf)) + return -1; + + /* + * If callback is specified, invoke it, and check its return value. + */ + if(cb) { + if(constructed) *buf |= 0x20; + if(cb(buf, size, app_key) < 0) + return -1; + } + + return size; +} diff --git a/src/core/libs/supl/asn-supl/der_encoder.h b/src/core/libs/supl/asn-supl/der_encoder.h new file mode 100644 index 000000000..61431c6db --- /dev/null +++ b/src/core/libs/supl/asn-supl/der_encoder.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _DER_ENCODER_H_ +#define _DER_ENCODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * The DER encoder of any type. May be invoked by the application. + * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). + */ +asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ + ); + +/* A variant of der_encode() which encodes data into the pre-allocated buffer */ +asn_enc_rval_t der_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (maximum) */ + ); + +/* + * Type of the generic DER encoder. + */ +typedef asn_enc_rval_t (der_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ + ); + + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Write out leading TL[v] sequence according to the type definition. + */ +ssize_t der_write_tags( + struct asn_TYPE_descriptor_s *type_descriptor, + size_t struct_length, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {0,!0}: prim, constructed */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _DER_ENCODER_H_ */ diff --git a/src/core/libs/supl/asn-supl/per_decoder.c b/src/core/libs/supl/asn-supl/per_decoder.c new file mode 100644 index 000000000..2b3d2e298 --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_decoder.c @@ -0,0 +1,93 @@ +#include +#include +#include + +/* + * Decode a "Production of a complete encoding", X.691#10.1. + * The complete encoding contains at least one byte, and is an integral + * multiple of 8 bytes. + */ +asn_dec_rval_t +uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { + asn_dec_rval_t rval; + + rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); + if(rval.consumed) { + /* + * We've always given 8-aligned data, + * so convert bits to integral bytes. + */ + rval.consumed += 7; + rval.consumed >>= 3; + } else if(rval.code == RC_OK) { + if(size) { + if(((uint8_t *)buffer)[0] == 0) { + rval.consumed = 1; /* 1 byte */ + } else { + ASN_DEBUG("Expecting single zeroed byte"); + rval.code = RC_FAIL; + } + } else { + /* Must contain at least 8 bits. */ + rval.code = RC_WMORE; + } + } + + return rval; +} + +asn_dec_rval_t +uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { + asn_codec_ctx_t s_codec_ctx; + asn_dec_rval_t rval; + asn_per_data_t pd; + + if(skip_bits < 0 || skip_bits > 7 + || unused_bits < 0 || unused_bits > 7 + || (unused_bits > 0 && !size)) + _ASN_DECODE_FAILED; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* Fill in the position indicator */ + memset(&pd, 0, sizeof(pd)); + pd.buffer = (const uint8_t *)buffer; + pd.nboff = skip_bits; + pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ + if(pd.nboff > pd.nbits) + _ASN_DECODE_FAILED; + + /* + * Invoke type-specific decoder. + */ + if(!td->uper_decoder) + _ASN_DECODE_FAILED; /* PER is not compiled in */ + rval = td->uper_decoder(opt_codec_ctx, td, 0, sptr, &pd); + if(rval.code == RC_OK) { + /* Return the number of consumed bits */ + rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + + pd.nboff - skip_bits; + ASN_DEBUG("PER decoding consumed %d, counted %d", + rval.consumed, pd.moved); + assert(rval.consumed == pd.moved); + } else { + /* PER codec is not a restartable */ + rval.consumed = 0; + } + return rval; +} + diff --git a/src/core/libs/supl/asn-supl/per_decoder.h b/src/core/libs/supl/asn-supl/per_decoder.h new file mode 100644 index 000000000..8397a545f --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_decoder.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2005, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_DECODER_H_ +#define _PER_DECODER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. + * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. + */ +asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); + +/* + * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. + * WARNING: This call returns the number of BITS read from the stream. Beware. + */ +asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size, /* Size of data buffer */ + int skip_bits, /* Number of unused leading bits, 0..7 */ + int unused_bits /* Number of unused tailing bits, 0..7 */ + ); + + +/* + * Type of the type-specific PER decoder function. + */ +typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void **struct_ptr, + asn_per_data_t *per_data + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_DECODER_H_ */ diff --git a/src/core/libs/supl/asn-supl/per_encoder.c b/src/core/libs/supl/asn-supl/per_encoder.c new file mode 100644 index 000000000..f4bace060 --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_encoder.c @@ -0,0 +1,151 @@ +#include +#include +#include + +static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); + +asn_enc_rval_t +uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + return uper_encode_internal(td, 0, sptr, cb, app_key); +} + +/* + * Argument type and callback necessary for uper_encode_to_buffer(). + */ +typedef struct enc_to_buf_arg { + void *buffer; + size_t left; +} enc_to_buf_arg; +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { + enc_to_buf_arg *arg = (enc_to_buf_arg *)key; + + if(arg->left < size) + return -1; /* Data exceeds the available buffer size */ + + memcpy(arg->buffer, buffer, size); + arg->buffer = ((char *)arg->buffer) + size; + arg->left -= size; + + return 0; +} + +asn_enc_rval_t +uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { + enc_to_buf_arg key; + + key.buffer = buffer; + key.left = buffer_size; + + if(td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); + + return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); +} + +typedef struct enc_dyn_arg { + void *buffer; + size_t length; + size_t allocated; +} enc_dyn_arg; +static int +encode_dyn_cb(const void *buffer, size_t size, void *key) { + enc_dyn_arg *arg = key; + if(arg->length + size >= arg->allocated) { + void *p; + arg->allocated = arg->allocated ? (arg->allocated << 2) : size; + p = REALLOC(arg->buffer, arg->allocated); + if(!p) { + FREEMEM(arg->buffer); + memset(arg, 0, sizeof(*arg)); + return -1; + } + arg->buffer = p; + } + memcpy(((char *)arg->buffer) + arg->length, buffer, size); + arg->length += size; + return 0; +} +ssize_t +uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { + asn_enc_rval_t er; + enc_dyn_arg key; + + memset(&key, 0, sizeof(key)); + + er = uper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); + switch(er.encoded) { + case -1: + FREEMEM(key.buffer); + return -1; + case 0: + FREEMEM(key.buffer); + key.buffer = MALLOC(1); + if(key.buffer) { + *(char *)key.buffer = '\0'; + *buffer_r = key.buffer; + return 1; + } else { + return -1; + } + default: + *buffer_r = key.buffer; + ASN_DEBUG("Complete encoded in %d bits", er.encoded); + return ((er.encoded + 7) >> 3); + } +} + +/* + * Internally useful functions. + */ + +/* Flush partially filled buffer */ +static int +_uper_encode_flush_outp(asn_per_outp_t *po) { + uint8_t *buf; + + if(po->nboff == 0 && po->buffer == po->tmpspace) + return 0; + + buf = po->buffer + (po->nboff >> 3); + /* Make sure we account for the last, partially filled */ + if(po->nboff & 0x07) { + buf[0] &= 0xff << (8 - (po->nboff & 0x07)); + buf++; + } + + return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); +} + +static asn_enc_rval_t +uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + asn_per_outp_t po; + asn_enc_rval_t er; + + /* + * Invoke type-specific encoder. + */ + if(!td || !td->uper_encoder) + _ASN_ENCODE_FAILED; /* PER is not compiled in */ + + po.buffer = po.tmpspace; + po.nboff = 0; + po.nbits = 8 * sizeof(po.tmpspace); + po.outper = cb; + po.op_key = app_key; + po.flushed_bytes = 0; + + er = td->uper_encoder(td, constraints, sptr, &po); + if(er.encoded != -1) { + size_t bits_to_flush; + + bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; + + /* Set number of bits encoded to a firm value */ + er.encoded = (po.flushed_bytes << 3) + bits_to_flush; + + if(_uper_encode_flush_outp(&po)) + _ASN_ENCODE_FAILED; + } + + return er; +} + diff --git a/src/core/libs/supl/asn-supl/per_encoder.h b/src/core/libs/supl/asn-supl/per_encoder.h new file mode 100644 index 000000000..95a6506e4 --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_encoder.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2006, 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_ENCODER_H_ +#define _PER_ENCODER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. Use the following formula to convert to bytes: + * bytes = ((.encoded + 7) / 8) + */ +asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ + void *app_key /* Arbitrary callback argument */ +); + +/* + * A variant of uper_encode() which encodes data into the existing buffer + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. + */ +asn_enc_rval_t uper_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (max) */ +); + +/* + * A variant of uper_encode_to_buffer() which allocates buffer itself. + * Returns the number of bytes in the buffer or -1 in case of failure. + * WARNING: This function produces a "Production of the complete encoding", + * with length of at least one octet. Contrast this to precise bit-packing + * encoding of uper_encode() and uper_encode_to_buffer(). + */ +ssize_t uper_encode_to_new_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void *struct_ptr, /* Structure to be encoded */ + void **buffer_r /* Buffer allocated and returned */ +); + +/* + * Type of the generic PER encoder function. + */ +typedef asn_enc_rval_t (per_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + asn_per_constraints_t *constraints, + void *struct_ptr, + asn_per_outp_t *per_output +); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_ENCODER_H_ */ diff --git a/src/core/libs/supl/asn-supl/per_opentype.c b/src/core/libs/supl/asn-supl/per_opentype.c new file mode 100644 index 000000000..c749c8c6c --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_opentype.c @@ -0,0 +1,373 @@ +/* + * Copyright (c) 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include +#include + +typedef struct uper_ugot_key { + asn_per_data_t oldpd; /* Old per data source */ + size_t unclaimed; + size_t ot_moved; /* Number of bits moved by OT processing */ + int repeat; +} uper_ugot_key; + +static int uper_ugot_refill(asn_per_data_t *pd); +static int per_skip_bits(asn_per_data_t *pd, int skip_nbits); +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + +int asn_debug_indent; + +/* + * Encode an "open type field". + * #10.1, #10.2 + */ +int +uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + void *buf; + void *bptr; + ssize_t size; + size_t toGo; + + ASN_DEBUG("Open type put %s ...", td->name); + + size = uper_encode_to_new_buffer(td, constraints, sptr, &buf); + if(size <= 0) return -1; + + for(bptr = buf, toGo = size; toGo;) { + ssize_t maySave = uper_put_length(po, toGo); + if(maySave < 0) break; + if(per_put_many_bits(po, bptr, maySave * 8)) break; + bptr = (char *)bptr + maySave; + toGo -= maySave; + } + + FREEMEM(buf); + if(toGo) return -1; + + ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", + td->name, size); + + return 0; +} + +static asn_dec_rval_t +uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + ssize_t chunk_bytes; + int repeat; + uint8_t *buf = 0; + size_t bufLen = 0; + size_t bufSize = 0; + asn_per_data_t spd; + size_t padding; + + _ASN_STACK_OVERFLOW_CHECK(ctx); + + ASN_DEBUG("Getting open type %s...", td->name); + + do { + chunk_bytes = uper_get_length(pd, -1, &repeat); + if(chunk_bytes < 0) { + FREEMEM(buf); + _ASN_DECODE_STARVED; + } + if(bufLen + chunk_bytes > bufSize) { + void *ptr; + bufSize = chunk_bytes + (bufSize << 2); + ptr = REALLOC(buf, bufSize); + if(!ptr) { + FREEMEM(buf); + _ASN_DECODE_FAILED; + } + buf = ptr; + } + if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { + FREEMEM(buf); + _ASN_DECODE_STARVED; + } + bufLen += chunk_bytes; + } while(repeat); + + ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, + bufLen); + + memset(&spd, 0, sizeof(spd)); + spd.buffer = buf; + spd.nbits = bufLen << 3; + + asn_debug_indent += 4; + rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); + asn_debug_indent -= 4; + + if(rv.code == RC_OK) { + /* Check padding validity */ + padding = spd.nbits - spd.nboff; + if(padding < 8 && per_get_few_bits(&spd, padding) == 0) { + /* Everything is cool */ + FREEMEM(buf); + return rv; + } + FREEMEM(buf); + if(padding >= 8) { + ASN_DEBUG("Too large padding %d in open type", padding); + _ASN_DECODE_FAILED; + } else { + ASN_DEBUG("Non-zero padding"); + _ASN_DECODE_FAILED; + } + } else { + FREEMEM(buf); + /* rv.code could be RC_WMORE, nonsense in this context */ + rv.code = RC_FAIL; /* Noone would give us more */ + } + + return rv; +} + +static asn_dec_rval_t GCC_NOTUSED +uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + uper_ugot_key arg; + asn_dec_rval_t rv; + ssize_t padding; + + _ASN_STACK_OVERFLOW_CHECK(ctx); + + ASN_DEBUG("Getting open type %s from %s", td->name, + per_data_string(pd)); + arg.oldpd = *pd; + arg.unclaimed = 0; + arg.ot_moved = 0; + arg.repeat = 1; + pd->refill = uper_ugot_refill; + pd->refill_key = &arg; + pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */ + pd->moved = 0; /* This now counts the open type size in bits */ + + asn_debug_indent += 4; + rv = td->uper_decoder(ctx, td, constraints, sptr, pd); + asn_debug_indent -= 4; + +#define UPDRESTOREPD do { \ + /* buffer and nboff are valid, preserve them. */ \ + pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ + pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ + pd->refill = arg.oldpd.refill; \ + pd->refill_key = arg.oldpd.refill_key; \ + } while(0) + + if(rv.code != RC_OK) { + UPDRESTOREPD; + return rv; + } + + ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d" + , td->name, + per_data_string(pd), + per_data_string(&arg.oldpd), + arg.unclaimed, arg.repeat); + + padding = pd->moved % 8; + if(padding) { + int32_t pvalue; + if(padding > 7) { + ASN_DEBUG("Too large padding %d in open type", + padding); + rv.code = RC_FAIL; + UPDRESTOREPD; + return rv; + } + padding = 8 - padding; + ASN_DEBUG("Getting padding of %d bits", padding); + pvalue = per_get_few_bits(pd, padding); + switch(pvalue) { + case -1: + ASN_DEBUG("Padding skip failed"); + UPDRESTOREPD; + _ASN_DECODE_STARVED; + case 0: break; + default: + ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", + padding, (int)pvalue); + UPDRESTOREPD; + _ASN_DECODE_FAILED; + } + } + if(pd->nboff != pd->nbits) { + ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, + per_data_string(pd), per_data_string(&arg.oldpd)); + if(1) { + UPDRESTOREPD; + _ASN_DECODE_FAILED; + } else { + arg.unclaimed += pd->nbits - pd->nboff; + } + } + + /* Adjust pd back so it points to original data */ + UPDRESTOREPD; + + /* Skip data not consumed by the decoder */ + if(arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed); + if(arg.unclaimed) { + switch(per_skip_bits(pd, arg.unclaimed)) { + case -1: + ASN_DEBUG("Claim of %d failed", arg.unclaimed); + _ASN_DECODE_STARVED; + case 0: + ASN_DEBUG("Got claim of %d", arg.unclaimed); + break; + default: + /* Padding must be blank */ + ASN_DEBUG("Non-blank unconsumed padding"); + _ASN_DECODE_FAILED; + } + arg.unclaimed = 0; + } + + if(arg.repeat) { + ASN_DEBUG("Not consumed the whole thing"); + rv.code = RC_FAIL; + return rv; + } + + return rv; +} + + +asn_dec_rval_t +uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + return uper_open_type_get_simple(ctx, td, constraints, + sptr, pd); + +} + +int +uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) { + asn_TYPE_descriptor_t s_td; + asn_dec_rval_t rv; + + s_td.name = ""; + s_td.uper_decoder = uper_sot_suck; + + rv = uper_open_type_get(ctx, &s_td, 0, 0, pd); + if(rv.code != RC_OK) + return -1; + else + return 0; +} + +/* + * Internal functions. + */ + +static asn_dec_rval_t +uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)ctx; + (void)td; + (void)constraints; + (void)sptr; + + while(per_get_few_bits(pd, 24) >= 0); + + rv.code = RC_OK; + rv.consumed = pd->moved; + + return rv; +} + +static int +uper_ugot_refill(asn_per_data_t *pd) { + uper_ugot_key *arg = pd->refill_key; + ssize_t next_chunk_bytes, next_chunk_bits; + ssize_t avail; + + asn_per_data_t *oldpd = &arg->oldpd; + + ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", + pd->moved, oldpd->moved); + + /* Advance our position to where pd is */ + oldpd->buffer = pd->buffer; + oldpd->nboff = pd->nboff; + oldpd->nbits -= pd->moved - arg->ot_moved; + oldpd->moved += pd->moved - arg->ot_moved; + arg->ot_moved = pd->moved; + + if(arg->unclaimed) { + /* Refill the container */ + if(per_get_few_bits(oldpd, 1)) + return -1; + if(oldpd->nboff == 0) { + assert(0); + return -1; + } + pd->buffer = oldpd->buffer; + pd->nboff = oldpd->nboff - 1; + pd->nbits = oldpd->nbits; + ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved); + return 0; + } + + if(!arg->repeat) { + ASN_DEBUG("Want more but refill doesn't have it"); + return -1; + } + + next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); + ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", + next_chunk_bytes, oldpd->moved, arg->repeat); + if(next_chunk_bytes < 0) return -1; + if(next_chunk_bytes == 0) { + pd->refill = 0; /* No more refills, naturally */ + assert(!arg->repeat); /* Implementation guarantee */ + } + next_chunk_bits = next_chunk_bytes << 3; + avail = oldpd->nbits - oldpd->nboff; + if(avail >= next_chunk_bits) { + pd->nbits = oldpd->nboff + next_chunk_bits; + arg->unclaimed = 0; + ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", + next_chunk_bits, oldpd->moved, + oldpd->nboff, oldpd->nbits, + oldpd->nbits - oldpd->nboff); + } else { + pd->nbits = oldpd->nbits; + arg->unclaimed = next_chunk_bits - avail; + ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); + } + pd->buffer = oldpd->buffer; + pd->nboff = oldpd->nboff; + ASN_DEBUG("Refilled pd%s old%s", + per_data_string(pd), per_data_string(oldpd)); + return 0; +} + +static int +per_skip_bits(asn_per_data_t *pd, int skip_nbits) { + int hasNonZeroBits = 0; + while(skip_nbits > 0) { + int skip; + if(skip_nbits < skip) + skip = skip_nbits; + else + skip = 24; + skip_nbits -= skip; + + switch(per_get_few_bits(pd, skip)) { + case -1: return -1; /* Starving */ + case 0: continue; /* Skipped empty space */ + default: hasNonZeroBits = 1; continue; + } + } + return hasNonZeroBits; +} diff --git a/src/core/libs/supl/asn-supl/per_opentype.h b/src/core/libs/supl/asn-supl/per_opentype.h new file mode 100644 index 000000000..facfaa637 --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_opentype.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2007 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_OPENTYPE_H_ +#define _PER_OPENTYPE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + +int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); + +int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_OPENTYPE_H_ */ diff --git a/src/core/libs/supl/asn-supl/per_support.c b/src/core/libs/supl/asn-supl/per_support.c new file mode 100644 index 000000000..e8299c730 --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_support.c @@ -0,0 +1,425 @@ +/* + * Copyright (c) 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +char * +per_data_string(asn_per_data_t *pd) { + static char buf[2][32]; + static int n; + n = (n+1) % 2; + snprintf(buf[n], sizeof(buf), + "{m=%d span %+d[%d..%d] (%d)}", + pd->moved, + (((int)pd->buffer) & 0xf), + pd->nboff, pd->nbits, + pd->nbits - pd->nboff); + return buf[n]; +} + +void +per_get_undo(asn_per_data_t *pd, int nbits) { + if((ssize_t)pd->nboff < nbits) { + assert((ssize_t)pd->nboff < nbits); + } else { + pd->nboff -= nbits; + pd->moved -= nbits; + } +} + +/* + * Extract a small number of bits (<= 31) from the specified PER data pointer. + */ +int32_t +per_get_few_bits(asn_per_data_t *pd, int nbits) { + size_t off; /* Next after last bit offset */ + ssize_t nleft; /* Number of bits left in this stream */ + uint32_t accum; + const uint8_t *buf; + + if(nbits < 0) + return -1; + + nleft = pd->nbits - pd->nboff; + if(nbits > nleft) { + int32_t tailv, vhead; + if(!pd->refill || nbits > 31) return -1; + /* Accumulate unused bytes before refill */ + ASN_DEBUG("Obtain the rest %d bits (want %d)", nleft, nbits); + tailv = per_get_few_bits(pd, nleft); + if(tailv < 0) return -1; + /* Refill (replace pd contents with new data) */ + if(pd->refill(pd)) + return -1; + nbits -= nleft; + vhead = per_get_few_bits(pd, nbits); + /* Combine the rest of previous pd with the head of new one */ + tailv = (tailv << nbits) | vhead; /* Could == -1 */ + return tailv; + } + + /* + * Normalize position indicator. + */ + if(pd->nboff >= 8) { + pd->buffer += (pd->nboff >> 3); + pd->nbits -= (pd->nboff & ~0x07); + pd->nboff &= 0x07; + } + pd->moved += nbits; + pd->nboff += nbits; + off = pd->nboff; + buf = pd->buffer; + + /* + * Extract specified number of bits. + */ + if(off <= 8) + accum = nbits ? (buf[0]) >> (8 - off) : 0; + else if(off <= 16) + accum = ((buf[0] << 8) + buf[1]) >> (16 - off); + else if(off <= 24) + accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); + else if(off <= 31) + accum = ((buf[0] << 24) + (buf[1] << 16) + + (buf[2] << 8) + (buf[3])) >> (32 - off); + else if(nbits <= 31) { + asn_per_data_t tpd = *pd; + /* Here are we with our 31-bits limit plus 1..7 bits offset. */ + per_get_undo(&tpd, nbits); + /* The number of available bits in the stream allow + * for the following operations to take place without + * invoking the ->refill() function */ + accum = per_get_few_bits(&tpd, nbits - 24) << 24; + accum |= per_get_few_bits(&tpd, 24); + } else { + per_get_undo(pd, nbits); + return -1; + } + + accum &= (((uint32_t)1 << nbits) - 1); + + ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+d[%d..%d]:%02x (%d) => 0x%x]", + nbits, nleft, + pd->moved, + (((int)pd->buffer) & 0xf), + pd->nboff, pd->nbits, + pd->buffer[0], + pd->nbits - pd->nboff, + (int)accum); + + return accum; +} + +/* + * Extract a large number of bits from the specified PER data pointer. + */ +int +per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { + int32_t value; + + if(alright && (nbits & 7)) { + /* Perform right alignment of a first few bits */ + value = per_get_few_bits(pd, nbits & 0x07); + if(value < 0) return -1; + *dst++ = value; /* value is already right-aligned */ + nbits &= ~7; + } + + while(nbits) { + if(nbits >= 24) { + value = per_get_few_bits(pd, 24); + if(value < 0) return -1; + *(dst++) = value >> 16; + *(dst++) = value >> 8; + *(dst++) = value; + nbits -= 24; + } else { + value = per_get_few_bits(pd, nbits); + if(value < 0) return -1; + if(nbits & 7) { /* implies left alignment */ + value <<= 8 - (nbits & 7), + nbits += 8 - (nbits & 7); + if(nbits > 24) + *dst++ = value >> 24; + } + if(nbits > 16) + *dst++ = value >> 16; + if(nbits > 8) + *dst++ = value >> 8; + *dst++ = value; + break; + } + } + + return 0; +} + +/* + * Get the length "n" from the stream. + */ +ssize_t +uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { + ssize_t value; + + *repeat = 0; + + if(ebits >= 0) return per_get_few_bits(pd, ebits); + + value = per_get_few_bits(pd, 8); + if(value < 0) return -1; + if((value & 128) == 0) /* #10.9.3.6 */ + return (value & 0x7F); + if((value & 64) == 0) { /* #10.9.3.7 */ + value = ((value & 63) << 8) | per_get_few_bits(pd, 8); + if(value < 0) return -1; + return value; + } + value &= 63; /* this is "m" from X.691, #10.9.3.8 */ + if(value < 1 || value > 4) + return -1; + *repeat = 1; + return (16384 * value); +} + +/* + * Get the normally small length "n". + * This procedure used to decode length of extensions bit-maps + * for SET and SEQUENCE types. + */ +ssize_t +uper_get_nslength(asn_per_data_t *pd) { + ssize_t length; + + ASN_DEBUG("Getting normally small length"); + + if(per_get_few_bits(pd, 1) == 0) { + length = per_get_few_bits(pd, 6) + 1; + if(length <= 0) return -1; + ASN_DEBUG("l=%d", length); + return length; + } else { + int repeat; + length = uper_get_length(pd, -1, &repeat); + if(length >= 0 && !repeat) return length; + return -1; /* Error, or do not support >16K extensions */ + } +} + +/* + * Get the normally small non-negative whole number. + * X.691, #10.6 + */ +ssize_t +uper_get_nsnnwn(asn_per_data_t *pd) { + ssize_t value; + + 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; +} + +/* + * Put the normally small non-negative whole number. + * X.691, #10.6 + */ +int +uper_put_nsnnwn(asn_per_outp_t *po, int n) { + int bytes; + + 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); +} + + +/* + * Put a small number of bits (<= 31). + */ +int +per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { + size_t off; /* Next after last bit offset */ + size_t omsk; /* Existing last byte meaningful bits mask */ + uint8_t *buf; + + if(obits <= 0 || obits >= 32) return obits ? -1 : 0; + + ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", + obits, (int)bits, po->buffer, po->nboff); + + /* + * Normalize position indicator. + */ + if(po->nboff >= 8) { + po->buffer += (po->nboff >> 3); + po->nbits -= (po->nboff & ~0x07); + po->nboff &= 0x07; + } + + /* + * Flush whole-bytes output, if necessary. + */ + if(po->nboff + obits > po->nbits) { + int complete_bytes = (po->buffer - po->tmpspace); + ASN_DEBUG("[PER output %d complete + %d]", + complete_bytes, po->flushed_bytes); + if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + return -1; + if(po->nboff) + po->tmpspace[0] = po->buffer[0]; + po->buffer = po->tmpspace; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; + } + + /* + * Now, due to sizeof(tmpspace), we are guaranteed large enough space. + */ + buf = po->buffer; + omsk = ~((1 << (8 - po->nboff)) - 1); + off = (po->nboff += obits); + + /* Clear data of debris before meaningful bits */ + bits &= (((uint32_t)1 << obits) - 1); + + ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, + (int)bits, (int)bits, + po->nboff - obits, off, buf[0], omsk&0xff, buf[0] & omsk); + + if(off <= 8) /* Completely within 1 byte */ + bits <<= (8 - off), + buf[0] = (buf[0] & omsk) | bits; + else if(off <= 16) + bits <<= (16 - off), + buf[0] = (buf[0] & omsk) | (bits >> 8), + buf[1] = bits; + else if(off <= 24) + bits <<= (24 - off), + buf[0] = (buf[0] & omsk) | (bits >> 16), + buf[1] = bits >> 8, + buf[2] = bits; + else if(off <= 31) + bits <<= (32 - off), + buf[0] = (buf[0] & omsk) | (bits >> 24), + buf[1] = bits >> 16, + buf[2] = bits >> 8, + buf[3] = bits; + else { + ASN_DEBUG("->[PER out split %d]", obits); + per_put_few_bits(po, bits >> 8, 24); + per_put_few_bits(po, bits, obits - 24); + ASN_DEBUG("<-[PER out split %d]", obits); + } + + ASN_DEBUG("[PER out %u/%x => %02x buf+%d]", + (int)bits, (int)bits, buf[0], po->buffer - po->tmpspace); + + return 0; +} + + +/* + * Output a large number of bits. + */ +int +per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { + + while(nbits) { + uint32_t value; + + if(nbits >= 24) { + value = (src[0] << 16) | (src[1] << 8) | src[2]; + src += 3; + nbits -= 24; + if(per_put_few_bits(po, value, 24)) + return -1; + } else { + value = src[0]; + if(nbits > 8) + value = (value << 8) | src[1]; + if(nbits > 16) + value = (value << 8) | src[2]; + if(nbits & 0x07) + value >>= (8 - (nbits & 0x07)); + if(per_put_few_bits(po, value, nbits)) + return -1; + break; + } + } + + return 0; +} + +/* + * Put the length "n" (or part of it) into the stream. + */ +ssize_t +uper_put_length(asn_per_outp_t *po, size_t length) { + + if(length <= 127) /* #10.9.3.6 */ + return per_put_few_bits(po, length, 8) + ? -1 : (ssize_t)length; + else if(length < 16384) /* #10.9.3.7 */ + return per_put_few_bits(po, length|0x8000, 16) + ? -1 : (ssize_t)length; + + length >>= 14; + if(length > 4) length = 4; + + return per_put_few_bits(po, 0xC0 | length, 8) + ? -1 : (ssize_t)(length << 14); +} + + +/* + * Put the normally small length "n" into the stream. + * This procedure used to encode length of extensions bit-maps + * for SET and SEQUENCE types. + */ +int +uper_put_nslength(asn_per_outp_t *po, size_t length) { + + if(length <= 64) { + /* #10.9.3.4 */ + if(length == 0) return -1; + return per_put_few_bits(po, length-1, 7) ? -1 : 0; + } else { + if(uper_put_length(po, length) != (ssize_t)length) { + /* This might happen in case of >16K extensions */ + return -1; + } + } + + return 0; +} + diff --git a/src/core/libs/supl/asn-supl/per_support.h b/src/core/libs/supl/asn-supl/per_support.h new file mode 100644 index 000000000..7cb1a0ca3 --- /dev/null +++ b/src/core/libs/supl/asn-supl/per_support.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2005, 2006, 2007 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _PER_SUPPORT_H_ +#define _PER_SUPPORT_H_ + +#include /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Pre-computed PER constraints. + */ +typedef struct asn_per_constraint_s { + enum asn_per_constraint_flags { + APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ + APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ + APC_CONSTRAINED = 0x2, /* Fully constrained */ + APC_EXTENSIBLE = 0x4 /* May have extension */ + } 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 */ +} asn_per_constraint_t; +typedef struct asn_per_constraints_s { + asn_per_constraint_t value; + asn_per_constraint_t size; + int (*value2code)(unsigned int value); + int (*code2value)(unsigned int code); +} asn_per_constraints_t; + +/* + * This structure describes a position inside an incoming PER bit stream. + */ +typedef struct asn_per_data_s { + const uint8_t *buffer; /* Pointer to the octet stream */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits in the stream */ + size_t moved; /* Number of bits moved through this bit stream */ + int (*refill)(struct asn_per_data_s *); + void *refill_key; +} asn_per_data_t; + +/* + * Extract a small number of bits (<= 31) from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ +int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); + +/* Undo the immediately preceeding "get_few_bits" operation */ +void per_get_undo(asn_per_data_t *per_data, int get_nbits); + +/* + * Extract a large number of bits from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ +int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, + int get_nbits); + +/* + * Get the length "n" from the Unaligned PER stream. + */ +ssize_t uper_get_length(asn_per_data_t *pd, + int effective_bound_bits, + int *repeat); + +/* + * Get the normally small length "n". + */ +ssize_t uper_get_nslength(asn_per_data_t *pd); + +/* + * Get the normally small non-negative whole number. + */ +ssize_t uper_get_nsnnwn(asn_per_data_t *pd); + +/* Non-thread-safe debugging function, don't use it */ +char *per_data_string(asn_per_data_t *pd); + +/* + * This structure supports forming PER output. + */ +typedef struct asn_per_outp_s { + uint8_t *buffer; /* Pointer into the (tmpspace) */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits left in (tmpspace) */ + uint8_t tmpspace[32]; /* Preliminary storage to hold data */ + int (*outper)(const void *data, size_t size, void *op_key); + void *op_key; /* Key for (outper) data callback */ + size_t flushed_bytes; /* Bytes already flushed through (outper) */ +} asn_per_outp_t; + +/* Output a small number of bits (<= 31) */ +int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); + +/* Output a large number of bits */ +int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); + +/* + * Put the length "n" to the Unaligned PER stream. + * This function returns the number of units which may be flushed + * in the next units saving iteration. + */ +ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); + +/* + * Put the normally small length "n" to the Unaligned PER stream. + * Returns 0 or -1. + */ +int uper_put_nslength(asn_per_outp_t *po, size_t length); + +/* + * Put the normally small non-negative whole number. + */ +int uper_put_nsnnwn(asn_per_outp_t *po, int n); + +#ifdef __cplusplus +} +#endif + +#endif /* _PER_SUPPORT_H_ */ diff --git a/src/core/libs/supl/asn-supl/xer_decoder.c b/src/core/libs/supl/asn-supl/xer_decoder.c new file mode 100644 index 000000000..161dc78ce --- /dev/null +++ b/src/core/libs/supl/asn-supl/xer_decoder.c @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2004, 2005 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include /* XER/XML parsing support */ + + +/* + * Decode the XER encoding of a given type. + */ +asn_dec_rval_t +xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **struct_ptr, const void *buffer, size_t size) { + asn_codec_ctx_t s_codec_ctx; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* + * Invoke type-specific decoder. + */ + return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size); +} + + + +struct xer__cb_arg { + pxml_chunk_type_e chunk_type; + size_t chunk_size; + const void *chunk_buf; + int callback_not_invoked; +}; + +static int +xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key) { + struct xer__cb_arg *arg = (struct xer__cb_arg *)key; + arg->chunk_type = type; + arg->chunk_size = _chunk_size; + arg->chunk_buf = _chunk_data; + arg->callback_not_invoked = 0; + return -1; /* Terminate the XML parsing */ +} + +/* + * Fetch the next token from the XER/XML stream. + */ +ssize_t +xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type) { + struct xer__cb_arg arg; + int new_stateContext = *stateContext; + ssize_t ret; + + arg.callback_not_invoked = 1; + ret = pxml_parse(&new_stateContext, buffer, size, xer__token_cb, &arg); + if(ret < 0) return -1; + if(arg.callback_not_invoked) { + assert(ret == 0); /* No data was consumed */ + return 0; /* Try again with more data */ + } else { + assert(arg.chunk_size); + assert(arg.chunk_buf == buffer); + } + + /* + * Translate the XML chunk types into more convenient ones. + */ + switch(arg.chunk_type) { + case PXML_TEXT: + *ch_type = PXER_TEXT; + break; + case PXML_TAG: return 0; /* Want more */ + case PXML_TAG_END: + *ch_type = PXER_TAG; + break; + case PXML_COMMENT: + case PXML_COMMENT_END: + *ch_type = PXER_COMMENT; + break; + } + + *stateContext = new_stateContext; + return arg.chunk_size; +} + +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define RANGLE 0x3e /* '>' */ + +xer_check_tag_e +xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { + const char *buf = (const char *)buf_ptr; + const char *end; + xer_check_tag_e ct = XCT_OPENING; + + if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) { + if(size >= 2) + ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); + return XCT_BROKEN; + } + + /* + * Determine the tag class. + */ + if(buf[1] == CSLASH) { + buf += 2; /* advance past "" */ + ct = XCT_CLOSING; + if(size > 0 && buf[size-1] == CSLASH) + return XCT_BROKEN; /* */ + } else { + buf++; /* advance past "<" */ + size -= 2; /* strip "<" and ">" */ + if(size > 0 && buf[size-1] == CSLASH) { + ct = XCT_BOTH; + size--; /* One more, for "/" */ + } + } + + /* Sometimes we don't care about the tag */ + if(!need_tag || !*need_tag) + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + + /* + * Determine the tag name. + */ + for(end = buf + size; buf < end; buf++, need_tag++) { + int b = *buf, n = *need_tag; + if(b != n) { + if(n == 0) { + switch(b) { + case 0x09: case 0x0a: case 0x0c: case 0x0d: + case 0x20: + /* "": whitespace is normal */ + return ct; + } + } + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + } + if(b == 0) + return XCT_BROKEN; /* Embedded 0 in buf?! */ + } + if(*need_tag) + return (xer_check_tag_e)(XCT__UNK__MASK | ct); + + return ct; +} + + +#undef ADVANCE +#define ADVANCE(num_bytes) do { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } while(0) + +#undef RETURN +#define RETURN(_code) do { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + if(rval.code != RC_OK) \ + ASN_DEBUG("Failed with %d", rval.code); \ + return rval; \ + } while(0) + +#define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ + ssize_t converted_size = body_receiver \ + (struct_key, chunk_buf, chunk_size, \ + (size_t)chunk_size < size); \ + if(converted_size == -1) RETURN(RC_FAIL); \ + if(converted_size == 0 \ + && size == (size_t)chunk_size) \ + RETURN(RC_WMORE); \ + chunk_size = converted_size; \ + } while(0) +#define XER_GOT_EMPTY() do { \ + if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ + RETURN(RC_FAIL); \ + } while(0) + +/* + * Generalized function for decoding the primitive values. + */ +asn_dec_rval_t +xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, + const char *xml_tag, /* Expected XML tag */ + const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_key, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_key, const void *chunk_buf, size_t chunk_size, + int have_more) + ) { + + asn_dec_rval_t rval; + ssize_t consumed_myself = 0; + + (void)opt_codec_ctx; + + /* + * Phases of XER/XML processing: + * Phase 0: Check that the opening tag matches our expectations. + * Phase 1: Processing body and reacting on closing tag. + */ + if(ctx->phase > 1) RETURN(RC_FAIL); + for(;;) { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, + &ch_type); + switch(ch_size) { + case -1: RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch(ch_type) { + case PXER_COMMENT: /* Got XML comment */ + ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TEXT: + if(ctx->phase == 0) { + /* + * We have to ignore whitespace here, + * but in order to be forward compatible + * with EXTENDED-XER (EMBED-VALUES, #25) + * any text is just ignored here. + */ + } else { + XER_GOT_BODY(buf_ptr, ch_size, size); + } + ADVANCE(ch_size); + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + assert(ch_type == PXER_TAG && size); + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + /* + * Phase 0: + * Expecting the opening tag + * for the type being processed. + * Phase 1: + * Waiting for the closing XML tag. + */ + switch(tcv) { + case XCT_BOTH: + if(ctx->phase) break; + /* Finished decoding of an empty element */ + XER_GOT_EMPTY(); + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if(ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + case XCT_CLOSING: + if(!ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_UNKNOWN_BO: + /* + * Certain tags in the body may be expected. + */ + if(opt_unexpected_tag_decoder + && opt_unexpected_tag_decoder(struct_key, + buf_ptr, ch_size) >= 0) { + /* Tag's processed fine */ + ADVANCE(ch_size); + if(!ctx->phase) { + /* We are not expecting + * the closing tag anymore. */ + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + } + continue; + } + /* Fall through */ + default: + break; /* Unexpected tag */ + } + + ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); + break; /* Dark and mysterious things have just happened */ + } + + RETURN(RC_FAIL); +} + + +int +xer_is_whitespace(const void *chunk_buf, size_t chunk_size) { + const char *p = (const char *)chunk_buf; + const char *pend = p + chunk_size; + + for(; p < pend; p++) { + switch(*p) { + /* X.693, #8.1.4 + * HORISONTAL TAB (9) + * LINE FEED (10) + * CARRIAGE RETURN (13) + * SPACE (32) + */ + case 0x09: case 0x0a: case 0x0d: case 0x20: + break; + default: + return 0; + } + } + return 1; /* All whitespace */ +} + +/* + * This is a vastly simplified, non-validating XML tree skipper. + */ +int +xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) { + assert(*depth > 0); + switch(tcv) { + case XCT_BOTH: + case XCT_UNKNOWN_BO: + /* These negate each other. */ + return 0; + case XCT_OPENING: + case XCT_UNKNOWN_OP: + ++(*depth); + return 0; + case XCT_CLOSING: + case XCT_UNKNOWN_CL: + if(--(*depth) == 0) + return (tcv == XCT_CLOSING) ? 2 : 1; + return 0; + default: + return -1; + } +} diff --git a/src/core/libs/supl/asn-supl/xer_decoder.h b/src/core/libs/supl/asn-supl/xer_decoder.h new file mode 100644 index 000000000..cf0d846fe --- /dev/null +++ b/src/core/libs/supl/asn-supl/xer_decoder.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_DECODER_H_ +#define _XER_DECODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* + * The XER decoder of any ASN.1 type. May be invoked by the application. + */ +asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); + +/* + * Type of the type-specific XER decoder function. + */ +typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, + void **struct_ptr, + const char *opt_mname, /* Member name */ + const void *buf_ptr, size_t size + ); + +/******************************* + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ + +/* + * Generalized function for decoding the primitive values. + * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 + * and others. This function should not be used by applications, as its API + * is subject to changes. + */ +asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, /* Treated as opaque pointer */ + const char *xml_tag, /* Expected XML tag name */ + const void *buf_ptr, size_t size, + int (*opt_unexpected_tag_decoder) + (void *struct_key, const void *chunk_buf, size_t chunk_size), + ssize_t (*body_receiver) + (void *struct_key, const void *chunk_buf, size_t chunk_size, + int have_more) + ); + + +/* + * Fetch the next XER (XML) token from the stream. + * The function returns the number of bytes occupied by the chunk type, + * returned in the _ch_type. The _ch_type is only set (and valid) when + * the return value is greater than 0. + */ + typedef enum pxer_chunk_type { + PXER_TAG, /* Complete XER tag */ + PXER_TEXT, /* Plain text between XER tags */ + PXER_COMMENT /* A comment, may be part of */ + } pxer_chunk_type_e; +ssize_t xer_next_token(int *stateContext, + const void *buffer, size_t size, pxer_chunk_type_e *_ch_type); + +/* + * This function checks the buffer against the tag name is expected to occur. + */ + typedef enum xer_check_tag { + XCT_BROKEN = 0, /* The tag is broken */ + XCT_OPENING = 1, /* This is the tag */ + XCT_CLOSING = 2, /* This is the tag */ + XCT_BOTH = 3, /* This is the tag */ + XCT__UNK__MASK = 4, /* Mask of everything unexpected */ + XCT_UNKNOWN_OP = 5, /* Unexpected tag */ + XCT_UNKNOWN_CL = 6, /* Unexpected tag */ + XCT_UNKNOWN_BO = 7 /* Unexpected tag */ + } xer_check_tag_e; +xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, + const char *need_tag); + +/* + * Check whether this buffer consists of entirely XER whitespace characters. + * RETURN VALUES: + * 1: Whitespace or empty string + * 0: Non-whitespace + */ +int xer_is_whitespace(const void *chunk_buf, size_t chunk_size); + +/* + * Skip the series of anticipated extensions. + */ +int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_DECODER_H_ */ diff --git a/src/core/libs/supl/asn-supl/xer_encoder.c b/src/core/libs/supl/asn-supl/xer_encoder.c new file mode 100644 index 000000000..aa7cf040a --- /dev/null +++ b/src/core/libs/supl/asn-supl/xer_encoder.c @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +/* + * The XER encoder of any type. May be invoked by the application. + */ +asn_enc_rval_t +xer_encode(asn_TYPE_descriptor_t *td, void *sptr, + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *cb, void *app_key) { + asn_enc_rval_t er, tmper; + const char *mname; + size_t mlen; + int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2; + + if(!td || !sptr) goto cb_failed; + + mname = td->xml_tag; + mlen = strlen(mname); + + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key); + if(tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("\n", xcan); + + er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded; + + _ASN_ENCODED_OK(er); +cb_failed: + _ASN_ENCODE_FAILED; +} + +/* + * This is a helper function for xer_fprint, which directs all incoming data + * into the provided file descriptor. + */ +static int +xer__print2fp(const void *buffer, size_t size, void *app_key) { + FILE *stream = (FILE *)app_key; + + if(fwrite(buffer, 1, size, stream) != size) + return -1; + + return 0; +} + +int +xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) { + asn_enc_rval_t er; + + if(!stream) stream = stdout; + if(!td || !sptr) + return -1; + + er = xer_encode(td, sptr, XER_F_BASIC, xer__print2fp, stream); + if(er.encoded == -1) + return -1; + + return fflush(stream); +} diff --git a/src/core/libs/supl/asn-supl/xer_encoder.h b/src/core/libs/supl/asn-supl/xer_encoder.h new file mode 100644 index 000000000..055e73c0c --- /dev/null +++ b/src/core/libs/supl/asn-supl/xer_encoder.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_ENCODER_H_ +#define _XER_ENCODER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct asn_TYPE_descriptor_s; /* Forward declaration */ + +/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ +enum xer_encoder_flags_e { + /* Mode of encoding */ + XER_F_BASIC = 0x01, /* BASIC-XER (pretty-printing) */ + XER_F_CANONICAL = 0x02 /* Canonical XER (strict rules) */ +}; + +/* + * The XER encoder of any type. May be invoked by the application. + */ +asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ + ); + +/* + * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) + * output into the chosen file pointer. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem printing the structure. + * WARNING: No sensible errno value is returned. + */ +int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); + +/* + * Type of the generic XER encoder. + */ +typedef asn_enc_rval_t (xer_type_encoder_f)( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + int ilevel, /* Level of indentation */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ + void *app_key /* Arbitrary callback argument */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_ENCODER_H_ */ diff --git a/src/core/libs/supl/asn-supl/xer_support.c b/src/core/libs/supl/asn-supl/xer_support.c new file mode 100644 index 000000000..9e34e6923 --- /dev/null +++ b/src/core/libs/supl/asn-supl/xer_support.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. + * Copyright (c) 2003, 2004, 2005 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include + +/* Parser states */ +typedef enum { + ST_TEXT, + ST_TAG_START, + ST_TAG_BODY, + ST_TAG_QUOTE_WAIT, + ST_TAG_QUOTED_STRING, + ST_TAG_UNQUOTED_STRING, + ST_COMMENT_WAIT_DASH1, /* ""[0] */ + ST_COMMENT_CLO_RT /* "-->"[1] */ +} pstate_e; + +static pxml_chunk_type_e final_chunk_type[] = { + PXML_TEXT, + PXML_TAG_END, + PXML_COMMENT_END, + PXML_TAG_END, + PXML_COMMENT_END, +}; + + +static int +_charclass[256] = { + 0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0, + 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, + 2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */ + 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */ + 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */ + 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */ + 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */ +}; +#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) +#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) +#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) + +/* Aliases for characters, ASCII/UTF-8 */ +#define EXCLAM 0x21 /* '!' */ +#define CQUOTE 0x22 /* '"' */ +#define CDASH 0x2d /* '-' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define CEQUAL 0x3d /* '=' */ +#define RANGLE 0x3e /* '>' */ +#define CQUEST 0x3f /* '?' */ + +/* Invoke token callback */ +#define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ + int _ret; \ + pstate_e ns = _ns; \ + ssize_t _sz = (p - chunk_start) + _current_too; \ + if (!_sz) { \ + /* Shortcut */ \ + state = _ns; \ + break; \ + } \ + _ret = cb(type, chunk_start, _sz, key); \ + if(_ret < _sz) { \ + if(_current_too && _ret == -1) \ + state = ns; \ + goto finish; \ + } \ + chunk_start = p + _current_too; \ + state = ns; \ + } while(0) + +#define TOKEN_CB(_type, _ns, _current_too) \ + TOKEN_CB_CALL(_type, _ns, _current_too, 0) + +#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ + TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1) + +/* + * Parser itself + */ +ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) { + pstate_e state = (pstate_e)*stateContext; + const char *chunk_start = (const char *)xmlbuf; + const char *p = chunk_start; + const char *end = p + size; + + for(; p < end; p++) { + int C = *(const unsigned char *)p; + switch(state) { + case ST_TEXT: + /* + * Initial state: we're in the middle of some text, + * or just have started. + */ + if (C == LANGLE) + /* We're now in the tag, probably */ + TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); + break; + case ST_TAG_START: + if (ALPHA(C) || (C == CSLASH)) + state = ST_TAG_BODY; + else if (C == EXCLAM) + state = ST_COMMENT_WAIT_DASH1; + else + /* + * Not characters and not whitespace. + * Must be something like "3 < 4". + */ + TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */ + break; + case ST_TAG_BODY: + switch(C) { + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + case LANGLE: + /* + * The previous tag wasn't completed, but still + * recognized as valid. (Mozilla-compatible) + */ + TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); + break; + case CEQUAL: + state = ST_TAG_QUOTE_WAIT; + break; + } + break; + case ST_TAG_QUOTE_WAIT: + /* + * State after the equal sign ("=") in the tag. + */ + switch(C) { + case CQUOTE: + state = ST_TAG_QUOTED_STRING; + break; + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + default: + if(!WHITESPACE(C)) + /* Unquoted string value */ + state = ST_TAG_UNQUOTED_STRING; + } + break; + case ST_TAG_QUOTED_STRING: + /* + * Tag attribute's string value in quotes. + */ + if(C == CQUOTE) { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_TAG_UNQUOTED_STRING: + if(C == RANGLE) { + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + } else if(WHITESPACE(C)) { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH1: + if(C == CDASH) { + state = ST_COMMENT_WAIT_DASH2; + } else { + /* Some ordinary tag. */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH2: + if(C == CDASH) { + /* Seen "<--" */ + state = ST_COMMENT; + } else { + /* Some ordinary tag */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT: + if(C == CDASH) { + state = ST_COMMENT_CLO_DASH2; + } + break; + case ST_COMMENT_CLO_DASH2: + if(C == CDASH) { + state = ST_COMMENT_CLO_RT; + } else { + /* This is not an end of a comment */ + state = ST_COMMENT; + } + break; + case ST_COMMENT_CLO_RT: + if(C == RANGLE) { + TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); + } else if(C == CDASH) { + /* Maintain current state, still waiting for '>' */ + } else { + state = ST_COMMENT; + } + break; + } /* switch(*ptr) */ + } /* for() */ + + /* + * Flush the partially processed chunk, state permitting. + */ + if(p - chunk_start) { + switch (state) { + case ST_COMMENT: + TOKEN_CB(PXML_COMMENT, state, 0); + break; + case ST_TEXT: + TOKEN_CB(PXML_TEXT, state, 0); + break; + default: break; /* a no-op */ + } + } + +finish: + *stateContext = (int)state; + return chunk_start - (const char *)xmlbuf; +} + diff --git a/src/core/libs/supl/asn-supl/xer_support.h b/src/core/libs/supl/asn-supl/xer_support.h new file mode 100644 index 000000000..8b01944ab --- /dev/null +++ b/src/core/libs/supl/asn-supl/xer_support.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. + * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef _XER_SUPPORT_H_ +#define _XER_SUPPORT_H_ + +#include /* Platform-specific types */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Types of data transferred to the application. + */ +typedef enum { + PXML_TEXT, /* Plain text between XML tags. */ + PXML_TAG, /* A tag, starting with '<'. */ + PXML_COMMENT, /* An XML comment, including "". */ + /* + * The following chunk types are reported if the chunk + * terminates the specified XML element. + */ + PXML_TAG_END, /* Tag ended */ + PXML_COMMENT_END /* Comment ended */ +} pxml_chunk_type_e; + +/* + * Callback function that is called by the parser when parsed data is + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the text + * data is the piece of buffer identified by _bufid (as supplied to + * pxml_feed() call) starting at offset _offset and of _size bytes size. + * The chunk is NOT '\0'-terminated. + */ +typedef int (pxml_callback_f)(pxml_chunk_type_e _type, + const void *_chunk_data, size_t _chunk_size, void *_key); + +/* + * 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. + * It will always be lesser than or equal to the specified _size. + * The next invocation of this function must account the difference. + */ +ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size, + pxml_callback_f *cb, void *_key); + +#ifdef __cplusplus +} +#endif + +#endif /* _XER_SUPPORT_H_ */ diff --git a/src/core/libs/supl/asn/rrlp-components.asn b/src/core/libs/supl/asn/rrlp-components.asn new file mode 100644 index 000000000..14ed9392a --- /dev/null +++ b/src/core/libs/supl/asn/rrlp-components.asn @@ -0,0 +1,1502 @@ +RRLP-Components +-- { RRLP-Components } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +--IMPORTS +-- Ext-GeographicalInformation , VelocityEstimate +--FROM +-- MAP-LCS-DataTypes { +-- ccitt identified-organization (4) etsi (0) mobileDomain (0) +-- gsm-Network (1) modules (3) map-LCS-DataTypes (25) version5 (5)} +-- +-- ExtensionContainer +--FROM MAP-ExtensionDataTypes { +-- ccitt identified-organization (4) etsi (0) mobileDomain (0) +-- gsm-Network (1) modules (3) map-ExtensionDataTypes (21) version4 (4)} +--; + +VelocityEstimate ::= INTEGER +ExtensionContainer ::= INTEGER + +-- Add here other ASN.1 definitions presented below +-- in chapters 4 and 5. + +-- add this definition to RRLP-Components module + +-- Measurement Position request component +MsrPosition-Req ::= SEQUENCE { + positionInstruct PositionInstruct, + referenceAssistData ReferenceAssistData OPTIONAL, + msrAssistData MsrAssistData OPTIONAL, + systemInfoAssistData SystemInfoAssistData OPTIONAL, + gps-AssistData GPS-AssistData OPTIONAL, + extensionContainer ExtensionContainer OPTIONAL, + ..., + -- Release 98 extension element +rel98-MsrPosition-Req-extension Rel98-MsrPosition-Req-Extension OPTIONAL, + -- Release 5 extension element +rel5-MsrPosition-Req-extension Rel5-MsrPosition-Req-Extension OPTIONAL + -- Release 7 extension element +-- rel7-MsrPosition-Req-extension Rel7-MsrPosition-Req-Extension OPTIONAL +} + + +-- add this defintion to RRLP-Components module + +-- Measurement Position response component +MsrPosition-Rsp ::= SEQUENCE { + multipleSets MultipleSets OPTIONAL, + referenceIdentity ReferenceIdentity OPTIONAL, + otd-MeasureInfo OTD-MeasureInfo OPTIONAL, + locationInfo LocationInfo OPTIONAL, + gps-MeasureInfo GPS-MeasureInfo OPTIONAL, + locationError LocationError OPTIONAL, + extensionContainer ExtensionContainer OPTIONAL, + ..., + -- Release extension here + rel-98-MsrPosition-Rsp-Extension + Rel-98-MsrPosition-Rsp-Extension OPTIONAL, + rel-5-MsrPosition-Rsp-Extension + Rel-5-MsrPosition-Rsp-Extension OPTIONAL + -- rel-5-MsrPosition-Rsp-Extension and other possible future extensions + -- are the only information elements that may be included in the 2nd + -- MsrPosition-Rsp component when RRLP pseudo-segmentation is +-- rel-7-MsrPosition-Rsp-Extension Rel-7-MsrPosition-Rsp-Extension OPTIONAL +} + + +-- add this defintion to RRLP-Components module + +-- Assistance Data component +AssistanceData ::= SEQUENCE { + referenceAssistData ReferenceAssistData OPTIONAL, + msrAssistData MsrAssistData OPTIONAL, + systemInfoAssistData SystemInfoAssistData OPTIONAL, + gps-AssistData GPS-AssistData OPTIONAL, + moreAssDataToBeSent MoreAssDataToBeSent OPTIONAL, -- If not present, interpret as only + -- Assistance Data component used to + -- deliver entire set of assistance + -- data. + extensionContainer ExtensionContainer OPTIONAL, + ..., + -- Release extension here + rel98-AssistanceData-Extension Rel98-AssistanceData-Extension OPTIONAL, + rel5-AssistanceData-Extension Rel5-AssistanceData-Extension OPTIONAL +-- rel7-AssistanceData-Extension Rel7-AssistanceData-Extension OPTIONAL +} + + +-- add this defintion to RRLP-Components module + +-- Protocol Error component +ProtocolError ::= SEQUENCE { + errorCause ErrorCodes, + extensionContainer ExtensionContainer OPTIONAL, + ..., + -- Release extensions here + rel-5-ProtocolError-Extension Rel-5-ProtocolError-Extension OPTIONAL +} + + +-- add these defintions to RRLP-Components module +-- Position instructions +PositionInstruct ::= SEQUENCE { + -- Method type + methodType MethodType, + positionMethod PositionMethod, + measureResponseTime MeasureResponseTime, + useMultipleSets UseMultipleSets, + environmentCharacter EnvironmentCharacter OPTIONAL +} + +-- +MethodType ::= CHOICE { + msAssisted AccuracyOpt, -- accuracy is optional + msBased Accuracy, -- accuracy is mandatory + msBasedPref Accuracy, -- accuracy is mandatory + msAssistedPref Accuracy -- accuracy is mandatory +} + +-- Accuracy of the location estimation +AccuracyOpt ::= SEQUENCE { + accuracy Accuracy OPTIONAL +} + +-- The values of this field are defined in 3GPP TS 23.032 (Uncertainty code) +Accuracy ::= INTEGER (0..127) + +-- Position Method +PositionMethod ::= ENUMERATED { + eotd (0), + gps (1), + gpsOrEOTD (2) +} + +-- Measurement request response time +MeasureResponseTime ::= INTEGER (0..7) + +-- useMultiple Sets, FFS! +UseMultipleSets ::= ENUMERATED { + multipleSets (0), -- multiple sets are allowed + oneSet (1) -- sending of multiple is not allowed +} + +-- Environment characterization +EnvironmentCharacter ::= ENUMERATED { + badArea (0), -- bad urban or suburban, heavy multipath and NLOS + notBadArea (1), -- light multipath and NLOS + mixedArea (2), -- not defined or mixed environment + ... +} + +-- E-OTD reference BTS for Assitance data IE +ReferenceAssistData ::= SEQUENCE { + bcchCarrier BCCHCarrier, -- BCCH carrier + bsic BSIC, -- BSIC + timeSlotScheme TimeSlotScheme, -- Timeslot scheme + btsPosition BTSPosition OPTIONAL +} + + +-- ellipsoid point and +-- ellipsoid point with altitude and uncertainty ellipsoid shapes are supported +BTSPosition ::= Ext-GeographicalInformation + +-- RF channel number of BCCH +BCCHCarrier ::= INTEGER (0..1023) + +-- Base station Identity Code +BSIC ::= INTEGER (0..63) + +-- Timeslot scheme +TimeSlotScheme ::= ENUMERATED { + equalLength (0), + variousLength (1) +} + +-- Time slot (modulo) +ModuloTimeSlot ::= INTEGER (0..3) + +-- E-OTD measurement assistance data IE +-- The total number of neighbors in this element (MsrAssistData) +-- and in SystemInfoAssistData element (presented neighbors +-- can be at a maximum 15!) +MsrAssistData ::= SEQUENCE { + msrAssistList SeqOfMsrAssistBTS +} +SeqOfMsrAssistBTS ::= SEQUENCE (SIZE(1..15)) OF MsrAssistBTS + +MsrAssistBTS ::= SEQUENCE { + bcchCarrier BCCHCarrier, -- BCCH carrier + bsic BSIC, -- BSIC + multiFrameOffset MultiFrameOffset, -- multiframe offset + timeSlotScheme TimeSlotScheme, -- Timeslot scheme + roughRTD RoughRTD, -- rough RTD value + + -- Location Calculation Assistance data is moved here + calcAssistanceBTS CalcAssistanceBTS OPTIONAL +} + +-- Multiframe offset +MultiFrameOffset ::= INTEGER (0..51) +-- The Multiframe Offset value 51 shall not be encoded by the transmitting entity and +-- shall be treated by the receiving entity as 0. + +-- Rough RTD value between one base station and reference BTS +RoughRTD ::= INTEGER (0..1250) +-- The RoughRTD value 1250 shall not be encoded by the transmitting entity and shall +-- be treated by the receiving entity as 0. + +-- E-OTD Measurement assistance data for system information List IE +-- The total number of base stations in this element (SystemInfoAssistData +-- presented neighbors) and in MsrAssistData element can be at a maximum 15. +SystemInfoAssistData ::= SEQUENCE { + systemInfoAssistList SeqOfSystemInfoAssistBTS +} +SeqOfSystemInfoAssistBTS::= SEQUENCE (SIZE(1..32)) OF SystemInfoAssistBTS + +-- whether n.th is present or not ? +SystemInfoAssistBTS ::= CHOICE { + notPresent NULL, + present AssistBTSData +} + +-- Actual assistance data for system information base station +AssistBTSData ::= SEQUENCE { + bsic BSIC, -- BSIC + multiFrameOffset MultiFrameOffset, -- multiframe offset + timeSlotScheme TimeSlotScheme, -- Timeslot scheme + roughRTD RoughRTD, -- rough RTD value + + -- Location Calculation Assistance data + calcAssistanceBTS CalcAssistanceBTS OPTIONAL +} + +-- E-OTD Location calculation assistance data, +-- CalcAssistanceBTS element is optional not subfields +CalcAssistanceBTS ::= SEQUENCE { + fineRTD FineRTD, -- fine RTD value between base stations + referenceWGS84 ReferenceWGS84 -- reference coordinates +} + +-- Coordinates of neighbour BTS, WGS-84 ellipsoid +ReferenceWGS84 ::= SEQUENCE { + relativeNorth RelDistance, -- relative distance (south negative) + relativeEast RelDistance, -- relative distance (west negative) + -- Relative Altitude is not always known + relativeAlt RelativeAlt OPTIONAL -- relative altitude +} + +-- Fine RTD value between this BTS and the reference BTS +FineRTD ::= INTEGER (0..255) + +-- Relative north/east distance +RelDistance ::= INTEGER (-200000..200000) + +-- Relative altitude +RelativeAlt ::= INTEGER (-4000..4000) + +-- Measure position response IEs +-- Reference Identity +-- Multiple sets +MultipleSets ::= SEQUENCE { + -- number of reference sets + nbrOfSets INTEGER (2..3), + + -- This field actually tells the number of reference BTSs + nbrOfReferenceBTSs INTEGER (1..3), + + -- This field is conditional and included optionally only if + -- nbrOfSets is 3 and number of reference BTSs is 2. + referenceRelation ReferenceRelation OPTIONAL +} + +-- Relation between refence BTSs and sets +ReferenceRelation ::= ENUMERATED { + secondBTSThirdSet (0), -- 1st BTS related to 1st and 2nd sets + secondBTSSecondSet (1), -- 1st BTS related to 1st and 3rd sets + firstBTSFirstSet (2) -- 1st BTS related to 1st set +} + +-- Reference BTS Identity, this element contains number of +-- BTSs told nbrOfReferenceBTSs field in Multiple sets element) +ReferenceIdentity ::= SEQUENCE { + -- Reference BTS list + refBTSList SeqOfReferenceIdentityType +} +SeqOfReferenceIdentityType ::= SEQUENCE (SIZE(1..3)) OF ReferenceIdentityType + +-- Cell identity +ReferenceIdentityType ::= CHOICE { + bsicAndCarrier BSICAndCarrier, -- BSIC and Carrier + ci CellID, -- Cell ID, LAC not needed + requestIndex RequestIndex, -- Index to Requested Neighbor List + systemInfoIndex SystemInfoIndex, -- Index to System info list, this type of ref. identity + -- shall not be used by the MS unless it has received + -- the SystemInfoAssistData from the SMLC for this cell. + ciAndLAC CellIDAndLAC -- CI and LAC +} + +BSICAndCarrier ::= SEQUENCE { + carrier BCCHCarrier, + bsic BSIC +} + +RequestIndex ::= INTEGER (1..16) + +SystemInfoIndex ::= INTEGER (1..32) + +CellIDAndLAC ::= SEQUENCE { + referenceLAC LAC, -- Location area code + referenceCI CellID -- Cell identity +} +CellID ::= INTEGER (0..65535) +LAC ::= INTEGER (0..65535) + +-- OTD-MeasureInfo +OTD-MeasureInfo ::= SEQUENCE { + -- Measurement info elements, OTD-MsrElement is repeated number of times + -- told in nbrOfReferenceBTSs in MultipleSets, default value is 1 + otdMsrFirstSets OTD-MsrElementFirst, + + -- if more than one sets are present this element is repeated + -- NumberOfSets - 1 (-1 = first set) + otdMsrRestSets SeqOfOTD-MsrElementRest OPTIONAL +} + +SeqOfOTD-MsrElementRest ::= SEQUENCE (SIZE(1..2)) OF OTD-MsrElementRest + +-- OTD measurent information for 1 set +OTD-MsrElementFirst ::= SEQUENCE { + refFrameNumber INTEGER (0..42431), -- Frame number modulo 42432 + referenceTimeSlot ModuloTimeSlot, + toaMeasurementsOfRef TOA-MeasurementsOfRef OPTIONAL, + stdResolution StdResolution, + taCorrection INTEGER (0..960) OPTIONAL, -- TA correction + + -- measured neighbors in OTD measurements + otd-FirstSetMsrs SeqOfOTD-FirstSetMsrs OPTIONAL +} +SeqOfOTD-FirstSetMsrs ::= SEQUENCE (SIZE(1..10)) OF OTD-FirstSetMsrs + +-- OTD measurent information 2 and 3 sets if exist +OTD-MsrElementRest ::= SEQUENCE { + refFrameNumber INTEGER (0..42431), -- Frame number modulo 42432 + referenceTimeSlot ModuloTimeSlot, + toaMeasurementsOfRef TOA-MeasurementsOfRef OPTIONAL, + stdResolution StdResolution, + taCorrection INTEGER (0..960) OPTIONAL, -- TA correction + + -- measured neighbors in OTD measurements + otd-MsrsOfOtherSets SeqOfOTD-MsrsOfOtherSets OPTIONAL +} +SeqOfOTD-MsrsOfOtherSets ::= SEQUENCE (SIZE(1..10)) OF OTD-MsrsOfOtherSets + +-- Standard deviation of the TOA measurements from the reference BTS +TOA-MeasurementsOfRef ::= SEQUENCE { + refQuality RefQuality, + numOfMeasurements NumOfMeasurements +} + +RefQuality ::= INTEGER (0..31) -- St Dev of TOA of reference as defined in annex +NumOfMeasurements ::= INTEGER (0..7) -- No. of measurements for RefQuality as defined in annex +StdResolution ::= INTEGER (0..3) -- Values of resolution are defined in annex + +OTD-FirstSetMsrs ::= OTD-MeasurementWithID + +-- Neighbour info in OTD measurements 0-10 times in TD measurement info +OTD-MsrsOfOtherSets ::= CHOICE { + identityNotPresent OTD-Measurement, + identityPresent OTD-MeasurementWithID +} + +-- For this OTD measurement identity is same as the identity of BTS +-- in the first set with same sequence number +OTD-Measurement ::= SEQUENCE { + nborTimeSlot ModuloTimeSlot, + eotdQuality EOTDQuality, + otdValue OTDValue +} + +-- This measurement contains the BTS identity and measurement +OTD-MeasurementWithID ::=SEQUENCE { + neighborIdentity NeighborIdentity, + nborTimeSlot ModuloTimeSlot, + eotdQuality EOTDQuality, + otdValue OTDValue +} + +EOTDQuality ::= SEQUENCE { + nbrOfMeasurements INTEGER (0..7), + stdOfEOTD INTEGER (0..31) +} + +NeighborIdentity ::= CHOICE { + bsicAndCarrier BSICAndCarrier, -- BSIC and Carrier + ci CellID, -- Cell ID, LAC not needed + multiFrameCarrier MultiFrameCarrier, -- MultiFrameOffest and BSIC + requestIndex RequestIndex, -- Index to Requested Neighbor List + systemInfoIndex SystemInfoIndex, -- Index to System info list, this type of neighbour + -- identity shall not be used by the MS unless it has + -- received the SystemInfoAssistData from the SMLC for + -- this cell. + ciAndLAC CellIDAndLAC -- CI and LAC +} + +-- Multiframe and carrier +MultiFrameCarrier ::= SEQUENCE { + bcchCarrier BCCHCarrier, + multiFrameOffset MultiFrameOffset +} + +-- OTD measurement value for neighbour +OTDValue ::= INTEGER (0..39999) + +-- Location information IE +LocationInfo ::= SEQUENCE { + refFrame INTEGER (0..65535), -- Reference Frame number + -- If refFrame is within (42432..65535), it shall be ignored by the receiver + -- in that case the MS should provide GPS TOW if available + gpsTOW INTEGER (0..14399999) OPTIONAL, -- GPS TOW + fixType FixType, + -- Note that applicable range for refFrame is 0 - 42431 + -- Possible shapes carried in posEstimate are + -- ellipsoid point, + -- ellipsoid point with uncertainty circle + -- ellipsoid point with uncertainty ellipse + -- ellipsoid point with altitude and uncertainty ellipsoid + posEstimate Ext-GeographicalInformation +} + +FixType ::= INTEGER { + twoDFix (0), + threeDFix (1) +} (0..1) + +-- GPS-Measurement information +GPS-MeasureInfo ::= SEQUENCE { + -- Measurement info elements + -- user has to make sure that in this element is number of elements + -- defined in reference BTS identity + gpsMsrSetList SeqOfGPS-MsrSetElement +} +SeqOfGPS-MsrSetElement ::= SEQUENCE (SIZE(1..3)) OF GPS-MsrSetElement + +-- OTD measurent information 1-3 times in message +GPS-MsrSetElement ::= SEQUENCE { + refFrame INTEGER (0..65535) OPTIONAL, -- Reference Frame number + gpsTOW GPSTOW24b, -- GPS TOW + -- Note that applicable range for refFrame is 0 - 42431 + +--N_SAT can be read from number of elements of gps-msrList + + gps-msrList SeqOfGPS-MsrElement +} + +-- 24 bit presentation for GPSTOW +GPSTOW24b ::= INTEGER (0..14399999) + +-- measured elements in measurement parameters field +SeqOfGPS-MsrElement ::= SEQUENCE (SIZE(1..16)) OF GPS-MsrElement + +GPS-MsrElement ::= SEQUENCE { + satelliteID SatelliteID, -- Satellite identifier + cNo INTEGER (0..63), -- carrier noise ratio + doppler INTEGER (-32768..32767), -- doppler, mulltiply by 0.2 + wholeChips INTEGER (0..1022), -- whole value of the code phase measurement + fracChips INTEGER (0..1024), -- fractional value of the code phase measurement + -- a value of 1024 shall not be encoded by the sender + -- the receiver shall consider a value of 1024 to be + -- invalid data + mpathIndic MpathIndic, -- multipath indicator + pseuRangeRMSErr INTEGER (0..63) -- index +} + +-- Multipath indicator +MpathIndic ::= ENUMERATED { + notMeasured (0), + low (1), + medium (2), + high (3) +} + +-- Location error IE +LocationError ::= SEQUENCE { + locErrorReason LocErrorReason, + additionalAssistanceData AdditionalAssistanceData OPTIONAL, + ... +} + +LocErrorReason ::= ENUMERATED { + unDefined (0), + notEnoughBTSs (1), + notEnoughSats (2), + eotdLocCalAssDataMissing (3), + eotdAssDataMissing (4), + gpsLocCalAssDataMissing (5), + gpsAssDataMissing (6), + methodNotSupported (7), + notProcessed (8), + refBTSForGPSNotServingBTS (9), + refBTSForEOTDNotServingBTS (10), + ..., + notEnoughGANSSSats (11), + ganssAssDataMissing (12), + refBTSForGANSSNotServingBTS (13) +} + + + +-- exception handling: +-- an unrecognized value shall be treated the same as value 0 + + +-- defines additional assistance data needed for any new location attempt +-- MS shall retain any assistance data already received +AdditionalAssistanceData ::= SEQUENCE { + gpsAssistanceData GPSAssistanceData OPTIONAL, + extensionContainer ExtensionContainer OPTIONAL, + ..., + ganssAssistanceData GANSSAssistanceData OPTIONAL +} + +GPSAssistanceData ::= OCTET STRING (SIZE (1..maxGPSAssistanceData)) +-- GPSAssistanceData has identical structure and encoding to octets 3 to n of the +-- GPS Assistance Data IE in 3GPP TS 49.031 + +maxGPSAssistanceData INTEGER ::= 40 + +GANSSAssistanceData ::= OCTET STRING (SIZE (1..maxGANSSAssistanceData)) +-- GANSSAssistanceData has identical structure and encoding to octets 3 to n of the +-- GANSS Assistance Data IE in 3GPP TS 49.031 + +maxGANSSAssistanceData INTEGER ::= 40 + + +-- Protocol Error Causes +ErrorCodes ::= ENUMERATED { + unDefined (0), +missingComponet (1), +incorrectData (2), +missingIEorComponentElement (3), +messageTooShort (4), +unknowReferenceNumber (5), +... +} + +-- exception handling: +-- an unrecognized value shall be treated the same as value 0 + +-- GPS assistance data IE +GPS-AssistData ::= SEQUENCE { + controlHeader ControlHeader +} + +-- More Assistance Data To Be Sent IE +-- More Assistance Data Components On the Way indication for delivery of an entire set of assistance +-- data in multiple Assistance Data components. + +MoreAssDataToBeSent ::= ENUMERATED { + noMoreMessages (0), -- This is the only or last Assistance Data message used to deliver + -- the entire set of assistance data. + moreMessagesOnTheWay (1) -- The SMLC will send more Assistance Data messages or a final RRLP + -- Measure Position Request message to deliver the + -- the entire set of assistance data. +} + +-- Control header of the GPS assistance data +ControlHeader ::= SEQUENCE { + + -- Field type Present information + referenceTime ReferenceTime OPTIONAL, + refLocation RefLocation OPTIONAL, + dgpsCorrections DGPSCorrections OPTIONAL, + navigationModel NavigationModel OPTIONAL, + ionosphericModel IonosphericModel OPTIONAL, + utcModel UTCModel OPTIONAL, + almanac Almanac OPTIONAL, + acquisAssist AcquisAssist OPTIONAL, + realTimeIntegrity SeqOf-BadSatelliteSet OPTIONAL +} + +ReferenceTime ::= SEQUENCE { + gpsTime GPSTime, + gsmTime GSMTime OPTIONAL, + gpsTowAssist GPSTOWAssist OPTIONAL +} + + +-- GPS Time includes week number and time-of-week (TOW) +GPSTime ::= SEQUENCE { + gpsTOW23b GPSTOW23b, + gpsWeek GPSWeek +} + +-- GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation +GPSTOW23b ::= INTEGER (0..7559999) + +-- GPS week number +GPSWeek ::= INTEGER (0..1023) + +-- GPSTOWAssist consists of TLM message, Anti-spoof flag, Alert flag, and 2 reserved bits in TLM Word +-- for each visible satellite. +-- N_SAT can be read from number of elements in GPSTOWAssist +GPSTOWAssist ::= SEQUENCE (SIZE(1..12)) OF GPSTOWAssistElement + +GPSTOWAssistElement ::= SEQUENCE { + satelliteID SatelliteID, + tlmWord TLMWord, + antiSpoof AntiSpoofFlag, + alert AlertFlag, + tlmRsvdBits TLMReservedBits +} + +-- TLM Word, 14 bits +TLMWord ::= INTEGER (0..16383) + +-- Anti-Spoof flag +AntiSpoofFlag ::= INTEGER (0..1) + +-- Alert flag +AlertFlag ::= INTEGER (0..1) + +-- Reserved bits in TLM word, MSB occurs earlier in TLM Word transmitted by satellite +TLMReservedBits ::= INTEGER (0..3) + +GSMTime ::= SEQUENCE { + bcchCarrier BCCHCarrier, -- BCCH carrier + bsic BSIC, -- BSIC + frameNumber FrameNumber, + timeSlot TimeSlot, + bitNumber BitNumber +} + +-- Frame number +FrameNumber ::= INTEGER (0..2097151) + +-- Time slot number +TimeSlot ::= INTEGER (0..7) + +-- Bit number +BitNumber ::= INTEGER (0..156) + + +-- Reference Location IE +RefLocation ::= SEQUENCE { + threeDLocation Ext-GeographicalInformation +} + +-- DGPS Corrections IE +DGPSCorrections ::= SEQUENCE { + + gpsTOW INTEGER (0..604799), -- DGPS reference time + status INTEGER (0..7), + -- N_SAT can be read from number of elements of satList + satList SeqOfSatElement +} +SeqOfSatElement ::= SEQUENCE (SIZE (1..16)) OF SatElement + +-- number of correction for satellites +SatElement ::= SEQUENCE { + satelliteID SatelliteID, + +--- Sequence number for ephemeris + iode INTEGER (0..239), + -- User Differential Range Error + udre INTEGER (0..3), + + -- Pseudo Range Correction, range is + -- -655.04 - +655.04, + pseudoRangeCor INTEGER (-2047..2047), + + -- Pseudo Range Rate Correction, range is + -- -4.064 - +4.064, + rangeRateCor INTEGER (-127..127), + +-- Delta Pseudo Range Correction 2 + deltaPseudoRangeCor2 INTEGER (-127..127), -- This IE shall be ignored by the receiver and + -- set to zero by the sender + -- Delta Pseudo Range Correction 2 + deltaRangeRateCor2 INTEGER (-7..7), -- This IE shall be ignored by the receiver and + -- set to zero by the sender + -- Delta Pseudo Range Correction 3 + deltaPseudoRangeCor3 INTEGER (-127..127), -- This IE shall be ignored by the receiver and + -- set to zero by the sender + -- Delta Pseudo Range Correction 3 + deltaRangeRateCor3 INTEGER (-7..7) -- This IE shall be ignored by the receiver and + -- set to zero by the sender +} + +SatelliteID ::= INTEGER (0..63) -- identifies satellite +-- Navigation Model IE +NavigationModel ::= SEQUENCE { + navModelList SeqOfNavModelElement +} + +-- navigation model satellite list +SeqOfNavModelElement ::= SEQUENCE (SIZE(1..16)) OF NavModelElement + +NavModelElement ::= SEQUENCE { + satelliteID SatelliteID, + satStatus SatStatus -- satellite status +} + +-- the Status of the navigation model +SatStatus ::= CHOICE { + -- New satellite, new Navigation Model + newSatelliteAndModelUC UncompressedEphemeris, + + -- Existing satellite, Existing Navigation Model + oldSatelliteAndModel NULL, + + -- Existing satellite, new Navigation Model + newNaviModelUC UncompressedEphemeris, + ... +} + +-- Uncompressed satellite emhemeris and clock corrections +UncompressedEphemeris ::= SEQUENCE { + ephemCodeOnL2 INTEGER (0..3), + ephemURA INTEGER (0..15), + ephemSVhealth INTEGER (0..63), + ephemIODC INTEGER (0..1023), + ephemL2Pflag INTEGER (0..1), + ephemSF1Rsvd EphemerisSubframe1Reserved, + ephemTgd INTEGER (-128..127), + ephemToc INTEGER (0..37799), + ephemAF2 INTEGER (-128..127), + ephemAF1 INTEGER (-32768..32767), + ephemAF0 INTEGER (-2097152..2097151), + ephemCrs INTEGER (-32768..32767), + ephemDeltaN INTEGER (-32768..32767), + ephemM0 INTEGER (-2147483648..2147483647), + ephemCuc INTEGER (-32768..32767), + ephemE INTEGER (0..4294967295), + ephemCus INTEGER (-32768..32767), + ephemAPowerHalf INTEGER (0..4294967295), + ephemToe INTEGER (0..37799), + ephemFitFlag INTEGER (0..1), + ephemAODA INTEGER (0..31), + ephemCic INTEGER (-32768..32767), + ephemOmegaA0 INTEGER (-2147483648..2147483647), + ephemCis INTEGER (-32768..32767), + ephemI0 INTEGER (-2147483648..2147483647), + ephemCrc INTEGER (-32768..32767), + ephemW INTEGER (-2147483648..2147483647), + ephemOmegaADot INTEGER (-8388608..8388607), + ephemIDot INTEGER (-8192..8191) +} + +-- Reserved bits in subframe 1 of navigation message +EphemerisSubframe1Reserved ::= SEQUENCE { + reserved1 INTEGER (0..8388607), -- 23-bit field + reserved2 INTEGER (0..16777215), -- 24-bit field + reserved3 INTEGER (0..16777215), -- 24-bit field + reserved4 INTEGER (0..65535) -- 16-bit field +} + +-- Ionospheric Model IE +IonosphericModel ::= SEQUENCE { + alfa0 INTEGER (-128..127), + alfa1 INTEGER (-128..127), + alfa2 INTEGER (-128..127), + alfa3 INTEGER (-128..127), + beta0 INTEGER (-128..127), + beta1 INTEGER (-128..127), + beta2 INTEGER (-128..127), + beta3 INTEGER (-128..127) +} + +-- Universal Time Coordinate Model +UTCModel ::= SEQUENCE { + utcA1 INTEGER (-8388608..8388607), + utcA0 INTEGER (-2147483648..2147483647), + utcTot INTEGER (0..255), + utcWNt INTEGER (0..255), + utcDeltaTls INTEGER (-128..127), + utcWNlsf INTEGER (0..255), + utcDN INTEGER (-128..127), + utcDeltaTlsf INTEGER (-128..127) +} + +-- Almanac, Long term model +-- NOTE: These are parameters are subset of the ephemeris +-- NOTE: But with reduced resolution and accuracy +Almanac ::= SEQUENCE { + alamanacWNa INTEGER (0..255), -- Once per message + + -- navigation model satellite list. + -- The size of almanacList is actually Nums_Sats_Total field + almanacList SeqOfAlmanacElement +} +SeqOfAlmanacElement ::= SEQUENCE (SIZE(1..64)) OF AlmanacElement + +-- Almanac info once per satellite +AlmanacElement ::= SEQUENCE { + satelliteID SatelliteID, + almanacE INTEGER (0..65535), + alamanacToa INTEGER (0..255), + almanacKsii INTEGER (-32768..32767), + almanacOmegaDot INTEGER (-32768..32767), + almanacSVhealth INTEGER (0..255), + almanacAPowerHalf INTEGER (0..16777215), + almanacOmega0 INTEGER (-8388608..8388607), + almanacW INTEGER (-8388608..8388607), + almanacM0 INTEGER (-8388608..8388607), + almanacAF0 INTEGER (-1024..1023), + almanacAF1 INTEGER (-1024..1023) +} + +-- Acquisition Assistance +AcquisAssist ::= SEQUENCE { + + -- Number of Satellites can be read from acquistList + timeRelation TimeRelation, + + -- Acquisition assistance list + -- The size of Number of Satellites is actually Number of Satellites field + acquisList SeqOfAcquisElement +} +SeqOfAcquisElement ::= SEQUENCE (SIZE(1..16)) OF AcquisElement + +-- the relationship between GPS time and air-interface timing +TimeRelation ::= SEQUENCE { + -- + gpsTOW GPSTOW23b, -- 23b presentation + gsmTime GSMTime OPTIONAL +} + +-- data occuring per number of satellites +AcquisElement ::= SEQUENCE { + svid SatelliteID, + + -- Doppler 0th order term, + -- -5120.0 - 5117.5 Hz (= -2048 - 2047 with 2.5 Hz resolution) + doppler0 INTEGER (-2048..2047), + addionalDoppler AddionalDopplerFields OPTIONAL, + codePhase INTEGER (0..1022), -- Code Phase + intCodePhase INTEGER (0..19), -- Integer Code Phase + gpsBitNumber INTEGER (0..3), -- GPS bit number + codePhaseSearchWindow INTEGER (0..15), -- Code Phase Search Window + addionalAngle AddionalAngleFields OPTIONAL +} + +AddionalDopplerFields ::= SEQUENCE { + -- Doppler 1st order term, -1.0 - +0.5 Hz/sec + -- (= -42 + (0 to 63) with 1/42 Hz/sec. resolution) + doppler1 INTEGER (0..63), + dopplerUncertainty INTEGER (0..7) + -- a sender shall not encode any DopplerUncertainty value in the range 5 to 7 + -- a receiver shall ignore any value between 5 and 7. +} + +AddionalAngleFields ::= SEQUENCE { + -- azimuth angle, 0 - 348.75 deg (= 0 - 31 with 11.25 deg resolution) + azimuth INTEGER (0..31), + -- elevation angle, 0 - 78.75 deg (= 0 - 7 with 11.25 deg resolution) + elevation INTEGER (0..7) +} + +-- Real-Time Integrity +-- number of bad satellites can be read from this element +SeqOf-BadSatelliteSet ::= SEQUENCE (SIZE(1..16)) OF SatelliteID + +-- Extension Elements + +-- Release 98 Extensions here +Rel98-MsrPosition-Req-Extension ::= SEQUENCE { + rel98-Ext-ExpOTD Rel98-Ext-ExpOTD OPTIONAL, -- ExpectedOTD extension + ..., + gpsTimeAssistanceMeasurementRequest NULL OPTIONAL, + gpsReferenceTimeUncertainty GPSReferenceTimeUncertainty OPTIONAL + +-- Further R98 extensions here +} +Rel98-AssistanceData-Extension ::= SEQUENCE { + rel98-Ext-ExpOTD Rel98-Ext-ExpOTD OPTIONAL, -- ExpectedOTD extension + ..., + gpsTimeAssistanceMeasurementRequest NULL OPTIONAL, + gpsReferenceTimeUncertainty GPSReferenceTimeUncertainty OPTIONAL + +-- Further R98 extensions here +} + +-- Release 98 ExpOTD extension +Rel98-Ext-ExpOTD ::= SEQUENCE { +-- If MsrAssistBTS is included in message, msrAssistData-R98-ExpOTD shall be included. + msrAssistData-R98-ExpOTD MsrAssistData-R98-ExpOTD OPTIONAL, + +-- If SystemInfoAssistaData is included in message, systemInfoAssistData-R98-ExpOTD shall be +-- included. + systemInfoAssistData-R98-ExpOTD SystemInfoAssistData-R98-ExpOTD OPTIONAL +} + +-- MsrAssistData R98 extension +MsrAssistData-R98-ExpOTD ::= SEQUENCE { + msrAssistList-R98-ExpOTD SeqOfMsrAssistBTS-R98-ExpOTD +} + +-- Indexes in SeqOfMsrAssistBTS-R98-ExpOTD refer to SeqOfMsrAssistBTS +-- If the index exceeds the SegOfMsrAssistBTS range or if there is other +-- inconsistencies between the BTS indices, the MS shall apply protocol +-- error cause incorrectData +SeqOfMsrAssistBTS-R98-ExpOTD ::= SEQUENCE (SIZE(1..15)) OF MsrAssistBTS-R98-ExpOTD + +-- This element completes MsrAssistBTS IE +MsrAssistBTS-R98-ExpOTD ::= SEQUENCE { + expectedOTD ExpectedOTD, + expOTDUncertainty ExpOTDUncertainty +} + +-- SystemInfoAssistData R98 extension +SystemInfoAssistData-R98-ExpOTD ::= SEQUENCE { + systemInfoAssistListR98-ExpOTD SeqOfSystemInfoAssistBTS-R98-ExpOTD +} + +-- SeqOfSystemInfoAssistBTS-R98-ExpOTD index refer to SeqOfSystemInfoAssistBTS +-- If the index exceeds the SegOfSystemInfoAssistBTS range or if there is other +-- inconsistencies between the BTS indices, the MS shall apply protocol +-- error cause incorrectData +SeqOfSystemInfoAssistBTS-R98-ExpOTD ::= SEQUENCE (SIZE(1..32)) OF SystemInfoAssistBTS-R98-ExpOTD + +-- whether n.th is present or not ? +SystemInfoAssistBTS-R98-ExpOTD ::= CHOICE { + notPresent NULL, + present AssistBTSData-R98-ExpOTD +} + +-- This element completes AssistBTSData IE +AssistBTSData-R98-ExpOTD ::= SEQUENCE { + expectedOTD ExpectedOTD, + expOTDuncertainty ExpOTDUncertainty -- Uncertainty of expected OTD +} + +-- Expected OTD value between nbor base station and reference BTS +-- at MS's current estimated location. +ExpectedOTD ::= INTEGER (0..1250) +-- The ExpectedOTD value 1250 shall not be encoded by the transmitting entity and +-- shall be treated by the receiving entity as 0. +-- Uncertainty of Exptected OTD in bits +ExpOTDUncertainty ::= INTEGER(0..7) + +-- Release 98 extensions + +GPSReferenceTimeUncertainty ::= INTEGER (0 .. 127) -- Coding according to Annex + +GPSTimeAssistanceMeasurements ::= SEQUENCE { + referenceFrameMSB INTEGER (0 .. 63), -- MSB of frame number + gpsTowSubms INTEGER (0 .. 9999) OPTIONAL, -- in units of 100ns, for MS based AGPS + deltaTow INTEGER (0 .. 127) OPTIONAL, -- for MS assisted AGPS + gpsReferenceTimeUncertainty GPSReferenceTimeUncertainty OPTIONAL +} + +Rel-98-MsrPosition-Rsp-Extension ::= SEQUENCE { + + -- First extension to Release 98 + rel-98-Ext-MeasureInfo SEQUENCE { + otd-MeasureInfo-R98-Ext OTD-MeasureInfo-R98-Ext OPTIONAL + }, + ..., + timeAssistanceMeasurements GPSTimeAssistanceMeasurements OPTIONAL + -- Further R98 extensions here +} + +-- This is an addition to OTD-MeasureInfo element defined in original message, +-- If OTD-MeasureInfo is absent, or if one or more OTD-MsrElementRest are present +-- OTD-MeasureInfo-R98-Ext shall be absent. +-- OTD-MeasureInfo-R98-Ext +OTD-MeasureInfo-R98-Ext ::= SEQUENCE { + -- Measurement info elements + otdMsrFirstSets-R98-Ext OTD-MsrElementFirst-R98-Ext +} + +-- OTD measurement information Ext for the first set only +OTD-MsrElementFirst-R98-Ext ::= SEQUENCE { + -- additional measured neighbors in OTD measurements + otd-FirstSetMsrs-R98-Ext SeqOfOTD-FirstSetMsrs-R98-Ext OPTIONAL +} +SeqOfOTD-FirstSetMsrs-R98-Ext ::= SEQUENCE (SIZE(1..5)) OF OTD-FirstSetMsrs + +Rel-5-MsrPosition-Rsp-Extension ::= SEQUENCE { + + extended-reference Extended-reference OPTIONAL, + -- The extended-reference shall be included by the MS if and only if previously + -- received from the SMLC in a Measure Position Request. When included, the value sent + -- by the MS shall equal the value received from the SMLC. + + -- extension to Release 5, for RRLP pseudo-segmentation here + otd-MeasureInfo-5-Ext OTD-MeasureInfo-5-Ext OPTIONAL, + ulPseudoSegInd UlPseudoSegInd OPTIONAL, -- Included when uplink RRLP + -- Pseudo-segmentation is used, not included when no uplink pseudo-segmentation is used + ... + -- Possibly more extensions for Release 5 here later +} + +Extended-reference ::= SEQUENCE { + smlc-code INTEGER (0..63), + transaction-ID INTEGER (0..262143) +} + +OTD-MeasureInfo-5-Ext ::= SeqOfOTD-MsrElementRest + -- if more than one measurement sets are present this element is repeated + -- NumberOfSets - 1 (-1 = first set) combined in OTD-MeasureInfo-5-Ext and + -- OTD-MeasureInfo (e.g. if NumberOfSets is 3, then one otdMsrRestSets may + -- be sent in OTD-MeasureInfo-5-Ext and one in OTD-MeasureInfo) + +-- First part of Uplink RRLP Pseudo-segmentation indication, possibly more may be defined +-- in the future for segmentation with more than two segments. +UlPseudoSegInd ::= ENUMERATED { + firstOfMany (0), + secondOfMany(1) +} + +Rel5-MsrPosition-Req-Extension ::= SEQUENCE { + extended-reference Extended-reference, + ... + -- Possibly more extensions for Release 5 here later +} + +Rel5-AssistanceData-Extension ::= SEQUENCE { + extended-reference Extended-reference, + ... + +-- Possibly more extensions for Release 5 here later +} + +Rel-5-ProtocolError-Extension::= SEQUENCE { + extended-reference Extended-reference OPTIONAL, + -- The extended-reference shall be included by the MS if and only if previously + -- received from the SMLC. + -- When included, the value sent by the MS shall equal the value received from the SMLC. + ... + + -- Possibly more extensions for Release 5 here later +} + + + + +-- Release 7 Extensions here + +Rel7-MsrPosition-Req-Extension ::= SEQUENCE { +velocityRequested NULL OPTIONAL, + ganssPositionMethod GANSSPositioningMethod OPTIONAL, + ganss-AssistData GANSS-AssistData OPTIONAL, + ganssCarrierPhaseMeasurementRequest NULL OPTIONAL, + ganssTODGSMTimeAssociationMeasurementRequest NULL OPTIONAL, +requiredResponseTime RequiredResponseTime OPTIONAL, + ... + -- Further Release 7 extentions here +} + +-- additional satellite systems may be added in future versions of the protocol +GANSSPositioningMethod ::= BIT STRING { + gps (0), + galileo (1)} (SIZE (2..16)) + +GANSS-AssistData ::= SEQUENCE { + ganss-controlHeader GANSS-ControlHeader +} + +GANSS-ControlHeader ::= SEQUENCE { + ganssCommonAssistData GANSSCommonAssistData OPTIONAL, + ganssGenericAssistDataList SeqOfGANSSGenericAssistDataElement OPTIONAL +} + +-- GANSS Common Assistance Data Elements +GANSSCommonAssistData ::= SEQUENCE { + ganssReferenceTime GANSSReferenceTime OPTIONAL, + ganssRefLocation GANSSRefLocation OPTIONAL, + ganssIonosphericModel GANSSIonosphericModel OPTIONAL, + ... +} + +-- List of GANSS Generic Assistance Data Elements, up to 8 GANSS +SeqOfGANSSGenericAssistDataElement ::= SEQUENCE (SIZE (1..8)) OF GANSSGenericAssistDataElement + +-- GANSS Generic Assistance Data Elements +GANSSGenericAssistDataElement ::= SEQUENCE { + ganssID INTEGER (0..7) OPTIONAL, -- Coding according to Annex + ganssTimeModel SeqOfGANSSTimeModel OPTIONAL, + ganssDiffCorrections GANSSDiffCorrections OPTIONAL, + ganssNavigationModel GANSSNavModel OPTIONAL, + ganssRealTimeIntegrity GANSSRealTimeIntegrity OPTIONAL, + ganssDataBitAssist GANSSDataBitAssist OPTIONAL, + ganssRefMeasurementAssist GANSSRefMeasurementAssist OPTIONAL, + ganssAlmanacModel GANSSAlmanacModel OPTIONAL, + ganssUTCModel GANSSUTCModel OPTIONAL, + ... +} + +-- GANSS COMMON ASSISTANCE DATA ELEMENTS + +-- GANSS Reference Time IE +GANSSReferenceTime ::= SEQUENCE { + ganssRefTimeInfo GANSSRefTimeInfo, + ganssTOD-GSMTimeAssociation GANSSTOD-GSMTimeAssociation OPTIONAL +} + +-- GANSS Reference Time includes GANSS TOD, GANSS Day, uncertainty +GANSSRefTimeInfo ::= SEQUENCE { + ganssDay INTEGER(0 .. 8191) OPTIONAL, + ganssTOD GANSSTOD, + ganssTODUncertainty GANSSTODUncertainty OPTIONAL, + ganssTimeID INTEGER (0 .. 7) OPTIONAL +} + +-- GANSS TOD integer seconds +GANSSTOD ::= INTEGER (0 .. 86399) + +-- GANSS TOD uncertainty +GANSSTODUncertainty ::= INTEGER (0 .. 127) -- Coding according to Annex + +-- GANSS TOD-GSM Time association +GANSSTOD-GSMTimeAssociation ::= SEQUENCE { + bcchCarrier BCCHCarrier, -- BCCH carrier + bsic BSIC, -- BSIC + frameNumber FrameNumber, + timeSlot TimeSlot, + bitNumber BitNumber, + frameDrift FrameDrift OPTIONAL +} + +-- Frame drift +FrameDrift ::= INTEGER(-64 .. 63) + +-- GANSS Reference Location IE +GANSSRefLocation ::= SEQUENCE { + threeDLocation Ext-GeographicalInformation +} + +-- GANSS Ionospheric Model IE +-- GANSS Ionospheric Model consists of NeQuick model parameters and storm flags + +GANSSIonosphericModel ::= SEQUENCE { + ganssIonoModel GANSSIonosphereModel, + ganssIonoStormFlags GANSSIonoStormFlags OPTIONAL, + ... +} + +-- GANSS ionosphere model. Coding according to Annex +GANSSIonosphereModel ::= SEQUENCE { + ai0 INTEGER (0 .. 4095), + ai1 INTEGER (0 .. 4095), + ai2 INTEGER (0 .. 4095) +} + +-- GANSS ionosphere storm flags +GANSSIonoStormFlags ::= SEQUENCE { + ionoStormFlag1 INTEGER (0 .. 1), + ionoStormFlag2 INTEGER (0 .. 1), + ionoStormFlag3 INTEGER (0 .. 1), + ionoStormFlag4 INTEGER (0 .. 1), + ionoStormFlag5 INTEGER (0 .. 1) +} + +-- GANSS GENERIC ASSISTANCE DATA ELEMENTS + +-- GANSS Time Model IE consists of time offset and first and second order parameters to relate GNSS +-- specific system time to selected time reference +-- SeqOf GANSSTimeModel ::= SEQUENCE (SIZE(1..7)) OF GANSSTimeModelElement +SeqOfGANSSTimeModel ::= SEQUENCE (SIZE(1..7)) OF GANSSTimeModelElement + +GANSSTimeModelElement ::= SEQUENCE { + ganssTimeModelRefTime INTEGER(0 .. 65535), + tA0 TA0, + tA1 TA1 OPTIONAL, + tA2 TA2 OPTIONAL, + gnssTOID INTEGER (0 .. 7), + weekNumber INTEGER (0 .. 8191) OPTIONAL +} + +-- GANSS time model parameter A0 +TA0 ::= INTEGER (-2147483648 .. 2147483647) + +-- GANSS time model parameter A1 +TA1 ::= INTEGER (-8388608 .. 8388607) + +-- GANSS time model parameter A2 +TA2 ::= INTEGER (-64 .. 63) + +-- DGANSS Corrections IE +GANSSDiffCorrections ::= SEQUENCE { + dganssRefTime INTEGER (0 .. 119), -- DGANSS reference time + + -- N_SGN_TYPE can be read from number of elements of sgnTypeList + sgnTypeList SeqOfSgnTypeElement +} + +SeqOfSgnTypeElement ::= SEQUENCE (SIZE (1..3)) OF SgnTypeElement -- max three signals per GNSS + +-- DGANSS signal type element, once per GNSS signal type included in DGANSS +SgnTypeElement ::= SEQUENCE { + ganssSignalID GANSSSignalID OPTIONAL, -- signal type identity + ganssStatusHealth INTEGER (0 .. 7), + -- N_SGN can be read from number of elements of dganssSgnList + dganssSgnList SeqOfDGANSSSgnElement +} + +GANSSSignalID ::= INTEGER (0 .. 3) -- Coding according to Annex +SeqOfDGANSSSgnElement ::= SEQUENCE (SIZE (1..16)) OF DGANSSSgnElement + +-- number of correction for signals +DGANSSSgnElement ::= SEQUENCE { + svID SVID, -- Satellite identity + +--- Sequence number for GANSS Navigation Model that matches the DGANSS correction set + iod INTEGER (0 .. 1023), + + -- User Differential Range Error + udre INTEGER (0..3), + + -- Pseudo Range Correction, range is + -- -655.04 - +655.04, + pseudoRangeCor INTEGER (-2047..2047), + + -- Pseudo Range Rate Correction, range is + -- -4.064 - +4.064, + rangeRateCor INTEGER (-127..127) +} + +SVID ::= INTEGER (0 .. 63) -- Coding according to Annex + +-- GANSS Navigation Model IE +GANSSNavModel ::= SEQUENCE { + nonBroadcastIndFlag INTEGER (0 .. 1), + toeMSB INTEGER (0 .. 31) OPTIONAL, -- 5 MSB of toe and toc + eMSB INTEGER (0 .. 127) OPTIONAL, + sqrtAMBS INTEGER (0 .. 63) OPTIONAL, + ganssSatelliteList SeqOfGANSSSatelliteElement +} + +SeqOfGANSSSatelliteElement ::= SEQUENCE (SIZE(1..32)) OF GANSSSatelliteElement + +GANSSSatelliteElement ::= SEQUENCE { + svID SVID, + svHealth INTEGER (-7 .. 13), -- Coding according to Annex + iod INTEGER (0 .. 1023), -- Coding according to Annex + ganssClockModel GANSSClockModel, + ganssOrbitModel GANSSOrbitModel, + ... +} + +-- GANSS orbit model for the GNSS satellite according to the choice +GANSSOrbitModel ::= CHOICE { + keplerianSet NavModel-KeplerianSet, + ... +} + +-- Navigation model in Keplerian parameters +NavModel-KeplerianSet ::= SEQUENCE { + keplerToeLSB INTEGER (0 .. 511), -- 9LSB are given in GANSSNavigationModel + keplerW INTEGER (-2147483648..2147483647), + keplerDeltaN INTEGER (-32768..32767), + keplerM0 INTEGER (-2147483648..2147483647), + keplerOmegaDot INTEGER (-8388608..8388607), + keplerELSB INTEGER (0..33554431), + keplerIDot INTEGER (-8192..8191), + keplerAPowerHalfLSB INTEGER (0.. 67108863), + keplerI0 INTEGER (-2147483648..2147483647), + keplerOmega0 INTEGER (-2147483648..2147483647), + keplerCrs INTEGER (-32768..32767), + keplerCis INTEGER (-32768..32767), + keplerCus INTEGER (-32768..32767), + keplerCrc INTEGER (-32768..32767), + keplerCic INTEGER (-32768..32767), + keplerCuc INTEGER (-32768..32767) +} + +-- GANSS clock model for the GNSS satellite according to the choice +GANSSClockModel ::= CHOICE { + standardClockModelList SeqOfStandardClockModelElement, + ... +} + +SeqOfStandardClockModelElement ::= SEQUENCE (SIZE(1..2)) OF StandardClockModelElement + +StandardClockModelElement ::= SEQUENCE { + stanClockTocLSB INTEGER (0 .. 511), -- 9LSB of time of clock + stanClockAF2 INTEGER (-2048 .. 2047), + stanClockAF1 INTEGER (-131072 .. 131071), + stanClockAF0 INTEGER (-134217728 .. 134217727), + stanClockTgd INTEGER (-512 .. 511) OPTIONAL, + stanModelID INTEGER (0 .. 1) OPTIONAL, + ... +} + +-- GANSS Real-Time Integrity IE +GANSSRealTimeIntegrity ::= SEQUENCE { + -- list of bad signals + -- NBS can be read from number of elements in SeqOf-BadSignalSet + ganssBadSignalList SeqOfBadSignalElement +} + +SeqOfBadSignalElement ::= SEQUENCE (SIZE(1..16)) OF BadSignalElement + +BadSignalElement ::= SEQUENCE { + badSVID SVID, -- Coding according to Annex + badSignalID INTEGER (0 .. 3) OPTIONAL -- Coding according to Annex +} + + +-- GANSS Data Bit Assistance IE +GANSSDataBitAssist ::= SEQUENCE { + ganssTOD INTEGER (0 .. 59), + svID SVID, + ganssDataTypeID INTEGER (0 .. 2), -- Coding according to Annex + -- list of navigation data bits + -- N_BIT can be read from number of elements in SeqOf-DataBits + ganssDataBits SeqOf-GANSSDataBits +} + +SeqOf-GANSSDataBits ::= SEQUENCE (SIZE(1 .. 1024)) OF GANSSDataBit +GANSSDataBit ::= INTEGER(0 .. 1) + +-- GANSS Reference Measurement Assistance IE +-- Code and Doppler assistance from the network. +GANSSRefMeasurementAssist ::= SEQUENCE { + ganssSignalID INTEGER (0 .. 3) OPTIONAL, -- Coding according to Annex + ganssRefMeasAssitList SeqOfGANSSRefMeasurementElement +} + +SeqOfGANSSRefMeasurementElement ::= SEQUENCE (SIZE(1 .. 16)) OF GANSSRefMeasurementElement + +GANSSRefMeasurementElement ::= SEQUENCE { + svID SVID, + -- Doppler 0th order term, + -- -1024 m/s to 1023.5 m/s with 0.5 m/s resolution) + doppler0 INTEGER (-2048 .. 2047), -- Coding according to Annex + additionalDoppler AdditionalDopplerFields OPTIONAL, + codePhase INTEGER (0 .. 1022), -- Code Phase in ms + intCodePhase INTEGER (0 .. 127), -- Integer Code Phase in ms + codePhaseSearchWindow INTEGER (0 .. 31), -- Code Phase Search Window, see Annex + additionalAngle AddionalAngleFields OPTIONAL, + ... +} + +AdditionalDopplerFields ::= SEQUENCE { + -- Doppler 1st order term, -0.2 - +0.1 m/s2 + doppler1 INTEGER (0..63), + dopplerUncertainty INTEGER (0..4) +} + +-- GANSS Almanac Model IE +GANSSAlmanacModel ::= SEQUENCE { + weekNumber INTEGER (0 .. 255), + svIDMask SVIDMASK, + toa INTEGER (0 .. 255) OPTIONAL, + ioda INTEGER (0 .. 3) OPTIONAL, + ganssAlmanacList SeqOfGANSSAlmanacElement +} + +-- SV ID Mask, LSB for ID 1 and MSB for ID 36 +SVIDMASK ::= BIT STRING (SIZE (1..36)) + +SeqOfGANSSAlmanacElement ::= SEQUENCE (SIZE(1 .. 36)) OF GANSSAlmanacElement + +-- GANSS Almanac Model +GANSSAlmanacElement ::= CHOICE { + keplerianAlmanacSet Almanac-KeplerianSet, + ... +} + +-- Almanac parameters according to Keplerian parameters +Almanac-KeplerianSet ::= SEQUENCE { + kepAlmanacE INTEGER (0 .. 2047), + kepAlmanacDeltaI INTEGER (-1024 .. 1023), + kepAlmanacOmegaDot INTEGER (-1024 .. 1023), + kepSVHealth INTEGER (0 .. 15), -- Coding according to Annex + kepAlmanacAPowerHalf INTEGER (-65536 .. 65535), + kepAlmanacOmega0 INTEGER (-32768 .. 32767), + kepAlmanacW INTEGER (-32768 .. 32767), + kepAlmanacM0 INTEGER (-32768 .. 32767), + kepAlmanacAF0 INTEGER (-8192 .. 8191), + kepAlmanacAF1 INTEGER (-1024..1023) +} + +-- GANSS Universal Time Coordinate Model +GANSSUTCModel ::= SEQUENCE { + ganssUtcA1 INTEGER (-8388608..8388607), + ganssUtcA0 INTEGER (-2147483648..2147483647), + ganssUtcTot INTEGER (0..255), + ganssUtcWNt INTEGER (0..255), + ganssUtcDeltaTls INTEGER (-128..127), + ganssUtcWNlsf INTEGER (0..255), + ganssUtcDN INTEGER (-128..127), + ganssUtcDeltaTlsf INTEGER (-128..127) +} + +--Required Measurement Request Response Time, range is 1 to 128 seconds. +RequiredResponseTime ::= INTEGER (1..128) + +Rel-7-MsrPosition-Rsp-Extension ::= SEQUENCE { + + velEstimate VelocityEstimate OPTIONAL, + -- Horizontal Velocity + -- Horizontal with Vertical Velocity + -- Horizontal Velocity with Uncertainty + -- Horizontal with Vertical Velocity and Uncertainty + ganssLocationInfo GANSSLocationInfo OPTIONAL, + ganssMeasureInfo GANSSMeasureInfo OPTIONAL, + ... +-- Further Release 7 extensions here +} + +-- GANSS Location Information contains location estimate, time stamp with uncertainty +-- and optionally Reference Frame field +GANSSLocationInfo ::= SEQUENCE { + referenceFrame ReferenceFrame OPTIONAL, -- Reference Frame Number + ganssTODm GANSSTODm OPTIONAL, -- GNSS TOD modulo + ganssTODFrac INTEGER (0 .. 16384) OPTIONAL, -- Coding according to Annex + ganssTODUncertainty GANSSTODUncertainty OPTIONAL, -- Coding according to Annex + ganssTimeID INTEGER (0 .. 3) OPTIONAL, -- Coding according to Annex + fixType FixType, + posData PositionData, + stationaryIndication INTEGER(0 .. 1) OPTIONAL, -- ‘0’ if moving or motion not known + -- Possible shapes carried in posEstimate are + -- ellipsoid point, + -- ellipsoid point with uncertainty circle + -- ellipsoid point with uncertainty ellipse + -- ellipsoid point with altitude and uncertainty ellipsoid + posEstimate Ext-GeographicalInformation, + ... +} + +PositionData ::= BIT STRING { + e-otd(0), + gps (1), + galileo (2) } (SIZE (3..16)) + + +-- GANSS TOD modulo 1 hour +GANSSTODm ::= INTEGER (0 .. 3599999) + +ReferenceFrame ::= SEQUENCE { + referenceFN INTEGER (0 .. 65535), + -- Note that applicable range for referenceFN is 0 - 42431 + referenceFNMSB INTEGER (0 .. 63) OPTIONAL -- MSB of Reference Frame Number +} + + + +-- GANSS Measurement Information +GANSSMeasureInfo ::= SEQUENCE { + -- Measurement info elements + -- user has to make sure that in this element is number of elements + -- defined in reference BTS identity + ganssMsrSetList SeqOfGANSS-MsrSetElement +} +SeqOfGANSS-MsrSetElement ::= SEQUENCE (SIZE(1..3)) OF GANSS-MsrSetElement + +-- GANSS measurement information 1-3 times in a message +GANSS-MsrSetElement ::= SEQUENCE { + referenceFrame ReferenceFrame OPTIONAL, -- Reference Frame Number + ganssTODm GANSSTODm OPTIONAL, -- GANSS TOD modulo + deltaGNASSTOD INTEGER (0 .. 127) OPTIONAL, + ganssTODUncertainty GANSSTODUncertainty OPTIONAL, -- Coding accoring to Annex + + --N_SGN_TYPE can be read from number of elements of SeqOfGANSS-SgnTypeElement + ganss-SgnTypeList SeqOfGANSS-SgnTypeElement +} + +-- Measurements can be returned up to 6 different signal types +SeqOfGANSS-SgnTypeElement ::= SEQUENCE (SIZE(1..6)) OF GANSS-SgnTypeElement + +GANSS-SgnTypeElement ::= SEQUENCE { + ganssSignalID INTEGER (0 .. 15), -- Coding accroding to Annex + --N_SGN can be read from number of elements of SeqOfGANSS-SgnElement + ganss-SgnList SeqOfGANSS-SgnElement +} + +-- Measurements can be returned up to 16 per signal types +SeqOfGANSS-SgnElement ::= SEQUENCE (SIZE(1..16)) OF GANSS-SgnElement + + +GANSS-SgnElement ::= SEQUENCE { + svID SVID, + cNo INTEGER (0 .. 63), + mpathDet MpathIndic, -- Coding according to Annex + carrierQualityInd INTEGER (0 .. 3) OPTIONAL, -- Coding according to Annex + codePhase INTEGER (0 .. 2097151), + integerCodePhase INTEGER (0 .. 63) OPTIONAL, + codePhaseRMSError INTEGER (0..63), -- Coding accoring to Annex + doppler INTEGER (-32768 .. 32767) OPTIONAL, + adr INTEGER (0 .. 33554431) OPTIONAL +} + +Rel7-AssistanceData-Extension ::= SEQUENCE { + ganss-AssistData GANSS-AssistData OPTIONAL, + ganssCarrierPhaseMeasurementRequest NULL OPTIONAL, + ganssTODGSMTimeAssociationMeasurementRequest NULL OPTIONAL, + ... +-- Possibly more extensions for Release 7 here +} + + +Ext-GeographicalInformation ::= OCTET STRING (SIZE (1..maxExt-GeographicalInformation)) +maxExt-GeographicalInformation INTEGER ::= 20 + +END diff --git a/src/core/libs/supl/asn/rrlp-messages.asn b/src/core/libs/supl/asn/rrlp-messages.asn new file mode 100644 index 000000000..e7cb9a96c --- /dev/null +++ b/src/core/libs/supl/asn/rrlp-messages.asn @@ -0,0 +1,30 @@ +RRLP-Messages +-- { RRLP-messages } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + MsrPosition-Req, MsrPosition-Rsp, AssistanceData, + ProtocolError +FROM + RRLP-Components -- { RRLP-Components } +; + +PDU ::= SEQUENCE { + referenceNumber INTEGER (0..7), + component RRLP-Component +} + +RRLP-Component ::= CHOICE { + msrPositionReq MsrPosition-Req, + msrPositionRsp MsrPosition-Rsp, + assistanceData AssistanceData, + assistanceDataAck NULL, + protocolError ProtocolError, + ... + +} + +END diff --git a/src/core/libs/supl/asn/supl-common.asn b/src/core/libs/supl/asn/supl-common.asn new file mode 100644 index 000000000..8c17e064d --- /dev/null +++ b/src/core/libs/supl/asn/supl-common.asn @@ -0,0 +1,275 @@ +ULP-Components DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS + Version, SessionID, IPAddress, SLPAddress, LocationId, Position, StatusCode, + Velocity, QoP, PosMethod, Ver; + +-- protocol version expressed as x.y.z (e.g., 5.1.0) +Version ::= SEQUENCE { + maj INTEGER(0..255), + min INTEGER(0..255), + servind INTEGER(0..255)} + +SessionID ::= SEQUENCE { + setSessionID SetSessionID OPTIONAL, -- the semantics of OPTIONAL applies to the encoding only. The parameter itself is MANDATORY. This is introduced only to minimize bandwidth for the SUPL INIT message. Since the setSessionID is allocated by the SET, there is no setSessionID to be transmitted in the SUPL INIT message. + slpSessionID SlpSessionID OPTIONAL -- the semantics of OPTIONAL applies to the encoding only. The parameter itself is MANDATORY. This is introduced only to minimize bandwidth for the SUPL START message. Since the slpSessionID is allocated by the SLP, there is no slpSessionID to be transmitted in the SUPL START message.--} + +SetSessionID ::= SEQUENCE {sessionId INTEGER(0..65535), + setId SETId} + +SETId ::= CHOICE { + msisdn OCTET STRING(SIZE (8)), + mdn OCTET STRING(SIZE (8)), + min BIT STRING(SIZE (34)), -- coded according to TIA-553 + imsi OCTET STRING(SIZE (8)), + nai IA5String(SIZE (1..1000)), + iPAddress IPAddress, + ...} + +-- msisdn, mdn and imsi are a BCD (Binary Coded Decimal) string +-- represent digits from 0 through 9, +-- two digits per octet, each digit encoded 0000 to 1001 (0 to 9) +-- bits 8765 of octet n encoding digit 2n +-- bits 4321 of octet n encoding digit 2(n-1) +1 +-- not used digits in the string shall be filled with 1111 +SlpSessionID ::= SEQUENCE { + sessionID OCTET STRING(SIZE (4)), + slpId SLPAddress} + +IPAddress ::= CHOICE { + ipv4Address OCTET STRING(SIZE (4)), + ipv6Address OCTET STRING(SIZE (16))} + +SLPAddress ::= CHOICE {iPAddress IPAddress, + fQDN FQDN, + ...} + +FQDN ::= + VisibleString(FROM ("a".."z" | "A".."Z" | "0".."9" | ".-"))(SIZE (1..255)) + +Ver ::= BIT STRING(SIZE (64)) + +LocationId ::= SEQUENCE {cellInfo CellInfo, + status Status, + ...} + +Status ::= ENUMERATED {stale(0), current(1), unknown(2), ... + } + +CellInfo ::= CHOICE { + gsmCell GsmCellInformation, + wcdmaCell WcdmaCellInformation, + cdmaCell CdmaCellInformation, + ...} + +Position ::= SEQUENCE { + timestamp UTCTime, -- shall include seconds and shall use UTC time. + positionEstimate PositionEstimate, + velocity Velocity OPTIONAL, + ...} + +PositionEstimate ::= SEQUENCE { + latitudeSign ENUMERATED {north, south}, + latitude INTEGER(0..8388607), + longitude INTEGER(-8388608..8388607), + uncertainty + SEQUENCE {uncertaintySemiMajor INTEGER(0..127), + uncertaintySemiMinor INTEGER(0..127), + orientationMajorAxis INTEGER(0..180)} OPTIONAL, + -- angle in degree between major axis and North + confidence INTEGER(0..100) OPTIONAL, + altitudeInfo AltitudeInfo OPTIONAL, + ...} + +AltitudeInfo ::= SEQUENCE { + altitudeDirection ENUMERATED {height, depth}, + altitude INTEGER(0..32767), + altUncertainty INTEGER(0..127), + ...} -- based on 3GPP TS 23.032 + +CdmaCellInformation ::= SEQUENCE { + refNID INTEGER(0..65535), -- Network Id + refSID INTEGER(0..32767), -- System Id + refBASEID INTEGER(0..65535), -- Base Station Id + refBASELAT INTEGER(0..4194303), -- Base Station Latitude + reBASELONG INTEGER(0..8388607), -- Base Station Longitude + refREFPN INTEGER(0..511), -- Base Station PN Code + refWeekNumber INTEGER(0..65535), -- GPS Week Number + refSeconds INTEGER(0..4194303)-- GPS Seconds -- , + ...} + +GsmCellInformation ::= SEQUENCE { + refMCC INTEGER(0..999), -- Mobile Country Code + refMNC INTEGER(0..999), -- Mobile Network Code + refLAC INTEGER(0..65535), -- Location area code + refCI INTEGER(0..65535), -- Cell identity + nMR NMR OPTIONAL, + tA INTEGER(0..255) OPTIONAL, --Timing Advance + ...} + +WcdmaCellInformation ::= SEQUENCE { + refMCC INTEGER(0..999), -- Mobile Country Code + refMNC INTEGER(0..999), -- Mobile Network Code + refUC INTEGER(0..268435455), -- Cell identity + frequencyInfo FrequencyInfo OPTIONAL, + primaryScramblingCode INTEGER(0..511) OPTIONAL, + measuredResultsList MeasuredResultsList OPTIONAL, + ...} + +FrequencyInfo ::= SEQUENCE { + -- after asn1c gcc chokes with this being same as in CellMeasuredResults + fmodeSpecificInfo CHOICE {fdd FrequencyInfoFDD, + tdd FrequencyInfoTDD, + ...}, + ...} + +FrequencyInfoFDD ::= SEQUENCE { + uarfcn-UL UARFCN OPTIONAL, + uarfcn-DL UARFCN, + ...} + +FrequencyInfoTDD ::= SEQUENCE {uarfcn-Nt UARFCN, + ...} + +UARFCN ::= INTEGER(0..16383) + +NMR ::= SEQUENCE (SIZE (1..15)) OF NMRelement + +NMRelement ::= SEQUENCE { + aRFCN INTEGER(0..1023), + bSIC INTEGER(0..63), + rxLev INTEGER(0..63), + ...} + +MeasuredResultsList ::= SEQUENCE (SIZE (1..maxFreq)) OF MeasuredResults + +MeasuredResults ::= SEQUENCE { + frequencyInfo FrequencyInfo OPTIONAL, + utra-CarrierRSSI UTRA-CarrierRSSI OPTIONAL, + cellMeasuredResultsList CellMeasuredResultsList OPTIONAL} + +CellMeasuredResultsList ::= + SEQUENCE (SIZE (1..maxCellMeas)) OF CellMeasuredResults + +-- SPARE: UTRA-CarrierRSSI, Max = 76 +-- Values above Max are spare +UTRA-CarrierRSSI ::= INTEGER(0..127) + +CellMeasuredResults ::= SEQUENCE { + cellIdentity INTEGER(0..268435455) OPTIONAL, + modeSpecificInfo + CHOICE {fdd + SEQUENCE {primaryCPICH-Info PrimaryCPICH-Info, + cpich-Ec-N0 CPICH-Ec-N0 OPTIONAL, + cpich-RSCP CPICH-RSCP OPTIONAL, + pathloss Pathloss OPTIONAL}, + tdd + SEQUENCE {cellParametersID CellParametersID, + proposedTGSN TGSN OPTIONAL, + primaryCCPCH-RSCP PrimaryCCPCH-RSCP OPTIONAL, + pathloss Pathloss OPTIONAL, + timeslotISCP-List TimeslotISCP-List OPTIONAL}}} + +CellParametersID ::= INTEGER(0..127) + +TGSN ::= INTEGER(0..14) + +PrimaryCCPCH-RSCP ::= INTEGER(0..127) + +-- SPARE: TimeslotISCP, Max = 91 +-- Values above Max are spare +TimeslotISCP ::= INTEGER(0..127) + +TimeslotISCP-List ::= SEQUENCE (SIZE (1..maxTS)) OF TimeslotISCP + +PrimaryCPICH-Info ::= SEQUENCE {primaryScramblingCode INTEGER(0..511)} + +-- SPARE: CPICH-Ec-No, Max = 49 +-- Values above Max are spare +CPICH-Ec-N0 ::= INTEGER(0..63) + +-- SPARE: CPICH- RSCP, data range from 0 to 91 and from 123 to 127. +-- Values from 92 to 122 are spare +-- the encoding of cpich-RSCP is (as per 25.331 V5.11.0) +-- cpich-RSCP = 123 CPICH RSCP <-120 dBm +-- cpich-RSCP = 124 CPICH RSCP < -119 dBm +-- cpich-RSCP = 125 CPICH RSCP < -118 dBm +-- cpich-RSCP = 126 CPICH RSCP < -117 dBm +-- cpich-RSCP = 127 CPICH RSCP < -116 dBm +-- cpich-RSCP = 0 CPICH RSCP < -115 dBm +-- cpich-RSCP = 1 CPICH +-- cpich-RSCP = 89 CPICH RSCP < -26 dBm +-- cpich-RSCP = 90 CPICH RSCP < -25 dBm +-- cpich-RSCP = 91 CPICH RSCP dBm + +CPICH-RSCP ::= INTEGER(0..127) + +-- SPARE: Pathloss, Max = 158 +-- Values above Max are spare +Pathloss ::= INTEGER(46..173) + +maxCellMeas INTEGER ::= 32 + +maxFreq INTEGER ::= 8 + +maxTS INTEGER ::= 14 + +QoP ::= SEQUENCE { + horacc INTEGER(0..127), + veracc INTEGER(0..127) OPTIONAL, -- as defined in 3GPP TS uncertainty.23 + maxLocAge INTEGER(0..65535) OPTIONAL, + delay INTEGER(0..7) OPTIONAL, -- as defined in 3GPP TS 44.031 + ...} + +Velocity ::= CHOICE { -- velocity definition as per 23.032 + horvel Horvel, + horandvervel Horandvervel, + horveluncert Horveluncert, + horandveruncert Horandveruncert, + ...} + +Horvel ::= SEQUENCE { + bearing BIT STRING(SIZE (9)), + horspeed BIT STRING(SIZE (16)), + ...} + +Horandvervel ::= SEQUENCE { + verdirect BIT STRING(SIZE (1)), + bearing BIT STRING(SIZE (9)), + horspeed BIT STRING(SIZE (16)), + verspeed BIT STRING(SIZE (8)), + ...} + +Horveluncert ::= SEQUENCE { + bearing BIT STRING(SIZE (9)), + horspeed BIT STRING(SIZE (16)), + uncertspeed BIT STRING(SIZE (8)), + ...} + +Horandveruncert ::= SEQUENCE { + verdirect BIT STRING(SIZE (1)), + bearing BIT STRING(SIZE (9)), + horspeed BIT STRING(SIZE (16)), + verspeed BIT STRING(SIZE (8)), + horuncertspeed BIT STRING(SIZE (8)), + veruncertspeed BIT STRING(SIZE (8)), + ...} + +StatusCode ::= ENUMERATED { + unspecified(0), systemFailure(1), unexpectedMessage(2), protocolError(3), + dataMissing(4), unexpectedDataValue(5), posMethodFailure(6), + posMethodMismatch(7), posProtocolMismatch(8), targetSETnotReachable(9), + versionNotSupported(10), resourceShortage(11), invalidSessionId(12), + nonProxyModeNotSupported(13), proxyModeNotSupported(14), + positioningNotPermitted(15), authNetFailure(16), authSuplinitFailure(17), consentDeniedByUser(100), + consentGrantedByUser(101), ... + } + +PosMethod ::= ENUMERATED { + agpsSETassisted(0), agpsSETbased(1), agpsSETassistedpref(2), + agpsSETbasedpref(3), autonomousGPS(4), aFLT(5), eCID(6), eOTD(7), oTDOA(8), + noPosition(9), ... + } + +END diff --git a/src/core/libs/supl/asn/supl-end.asn b/src/core/libs/supl/asn/supl-end.asn new file mode 100644 index 000000000..643d41d8b --- /dev/null +++ b/src/core/libs/supl/asn/supl-end.asn @@ -0,0 +1,15 @@ +SUPL-END DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS SUPLEND; + +IMPORTS StatusCode, Position, Ver + FROM ULP-Components; + +SUPLEND ::= SEQUENCE { + position Position OPTIONAL, + statusCode StatusCode OPTIONAL, + ver Ver OPTIONAL, + ...} + +END diff --git a/src/core/libs/supl/asn/supl-init.asn b/src/core/libs/supl/asn/supl-init.asn new file mode 100644 index 000000000..ba9d8c38b --- /dev/null +++ b/src/core/libs/supl/asn/supl-init.asn @@ -0,0 +1,52 @@ +SUPL-INIT DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS SUPLINIT; + +IMPORTS SLPAddress, QoP, PosMethod + FROM ULP-Components; + +SUPLINIT ::= SEQUENCE { + posMethod PosMethod, + notification Notification OPTIONAL, + sLPAddress SLPAddress OPTIONAL, + qoP QoP OPTIONAL, + sLPMode SLPMode, + mAC MAC OPTIONAL, + keyIdentity KeyIdentity OPTIONAL, + ...} + +Notification ::= SEQUENCE { + notificationType NotificationType, + encodingType EncodingType OPTIONAL, + requestorId OCTET STRING(SIZE (1..maxReqLength)) OPTIONAL, + requestorIdType FormatIndicator OPTIONAL, + clientName OCTET STRING(SIZE (1..maxClientLength)) OPTIONAL, + clientNameType FormatIndicator OPTIONAL, + ...} + +NotificationType ::= ENUMERATED { + noNotificationNoVerification(0), notificationOnly(1), + notificationAndVerficationAllowedNA(2), + notificationAndVerficationDeniedNA(3), privacyOverride(4), ... + } + +EncodingType ::= ENUMERATED {ucs2(0), gsmDefault(1), utf8(2), ... + } + +maxReqLength INTEGER ::= 50 + +maxClientLength INTEGER ::= 50 + +FormatIndicator ::= ENUMERATED { + logicalName(0), e-mailAddress(1), msisdn(2), url(3), sipUrl(4), min(5), + mdn(6), imsPublicIdentity(7), ... + } + +SLPMode ::= ENUMERATED {proxy(0), nonProxy(1)} + +MAC ::= BIT STRING(SIZE (64)) + +KeyIdentity ::= BIT STRING(SIZE (128)) + +END diff --git a/src/core/libs/supl/asn/supl-pos.asn b/src/core/libs/supl/asn/supl-pos.asn new file mode 100644 index 000000000..8ab124a11 --- /dev/null +++ b/src/core/libs/supl/asn/supl-pos.asn @@ -0,0 +1,20 @@ +SUPL-POS DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS SUPLPOS; + +IMPORTS Velocity + FROM ULP-Components; + +SUPLPOS ::= SEQUENCE { + posPayLoad PosPayLoad, + velocity Velocity OPTIONAL, + ...} + +PosPayLoad ::= CHOICE { + tia801payload OCTET STRING(SIZE (1..8192)), + rrcPayload OCTET STRING(SIZE (1..8192)), + rrlpPayload OCTET STRING(SIZE (1..8192)), + ...} + +END diff --git a/src/core/libs/supl/asn/supl-posinit.asn b/src/core/libs/supl/asn/supl-posinit.asn new file mode 100644 index 000000000..c0ce4a939 --- /dev/null +++ b/src/core/libs/supl/asn/supl-posinit.asn @@ -0,0 +1,54 @@ +SUPL-POS-INIT DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS SUPLPOSINIT; + +IMPORTS + SUPLPOS + FROM SUPL-POS + SETCapabilities + FROM SUPL-START + LocationId, Position, Ver + FROM ULP-Components; + +SUPLPOSINIT ::= SEQUENCE { + sETCapabilities SETCapabilities, + requestedAssistData RequestedAssistData OPTIONAL, + locationId LocationId, + position Position OPTIONAL, + sUPLPOS SUPLPOS OPTIONAL, + ver Ver OPTIONAL, + ...} + +RequestedAssistData ::= SEQUENCE { + almanacRequested BOOLEAN, + utcModelRequested BOOLEAN, + ionosphericModelRequested BOOLEAN, + dgpsCorrectionsRequested BOOLEAN, + referenceLocationRequested BOOLEAN, + referenceTimeRequested BOOLEAN, + acquisitionAssistanceRequested BOOLEAN, + realTimeIntegrityRequested BOOLEAN, + navigationModelRequested BOOLEAN, + navigationModelData XNavigationModel OPTIONAL, + ...} + +-- name clash with RRLP stuff +XNavigationModel ::= SEQUENCE { + gpsWeek INTEGER(0..1023), + gpsToe INTEGER(0..167), + nSAT INTEGER(0..31), + toeLimit INTEGER(0..10), + satInfo SatelliteInfo OPTIONAL, + ...} + +-- Further information on this fields can be found +-- in 3GPP TS 44.031 and 49.031 +SatelliteInfo ::= SEQUENCE (SIZE (1..31)) OF SatelliteInfoElement + +SatelliteInfoElement ::= SEQUENCE { + satId INTEGER(0..63), + iODE INTEGER(0..255), + ...} + +END diff --git a/src/core/libs/supl/asn/supl-response.asn b/src/core/libs/supl/asn/supl-response.asn new file mode 100644 index 000000000..aa6284c45 --- /dev/null +++ b/src/core/libs/supl/asn/supl-response.asn @@ -0,0 +1,23 @@ +SUPL-RESPONSE DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS SUPLRESPONSE; + +IMPORTS PosMethod, SLPAddress + FROM ULP-Components; + +SUPLRESPONSE ::= SEQUENCE { + posMethod PosMethod, + sLPAddress SLPAddress OPTIONAL, + sETAuthKey SETAuthKey OPTIONAL, + keyIdentity4 KeyIdentity4 OPTIONAL, + ...} + +SETAuthKey ::= CHOICE { + shortKey BIT STRING(SIZE (128)), + longKey BIT STRING(SIZE (256)), + ...} + +KeyIdentity4 ::= BIT STRING(SIZE (128)) + +END diff --git a/src/core/libs/supl/asn/supl-start.asn b/src/core/libs/supl/asn/supl-start.asn new file mode 100644 index 000000000..69060e4f5 --- /dev/null +++ b/src/core/libs/supl/asn/supl-start.asn @@ -0,0 +1,40 @@ +SUPL-START DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +EXPORTS SUPLSTART, SETCapabilities; + +IMPORTS LocationId, QoP + FROM ULP-Components; + +SUPLSTART ::= SEQUENCE { + sETCapabilities SETCapabilities, + locationId LocationId, + qoP QoP OPTIONAL, + ...} + +SETCapabilities ::= SEQUENCE { + posTechnology PosTechnology, + prefMethod PrefMethod, + posProtocol PosProtocol, + ...} + +PosTechnology ::= SEQUENCE { + agpsSETassisted BOOLEAN, + agpsSETBased BOOLEAN, + autonomousGPS BOOLEAN, + aFLT BOOLEAN, + eCID BOOLEAN, + eOTD BOOLEAN, + oTDOA BOOLEAN, + ...} + +PrefMethod ::= ENUMERATED { + agpsSETassistedPreferred, agpsSETBasedPreferred, noPreference} + +PosProtocol ::= SEQUENCE { + tia801 BOOLEAN, + rrlp BOOLEAN, + rrc BOOLEAN, + ...} + +END diff --git a/src/core/libs/supl/asn/supl-ulp.asn b/src/core/libs/supl/asn/supl-ulp.asn new file mode 100644 index 000000000..a3651241d --- /dev/null +++ b/src/core/libs/supl/asn/supl-ulp.asn @@ -0,0 +1,47 @@ +ULP DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +IMPORTS + Version, SessionID + FROM ULP-Components + SUPLINIT + FROM SUPL-INIT + SUPLSTART + FROM SUPL-START + SUPLRESPONSE + FROM SUPL-RESPONSE + SUPLPOSINIT + FROM SUPL-POS-INIT + SUPLPOS + FROM SUPL-POS + SUPLEND + FROM SUPL-END +-- SUPLAUTHREQ +-- FROM SUPL-AUTH-REQ +-- SUPLAUTHRESP +-- FROM SUPL-AUTH-RESP; +; + +-- general ULP PDU layout; +ULP-PDU ::= SEQUENCE { + length INTEGER(0..65535), + version Version, + sessionID SessionID, + message UlpMessage} + +UlpMessage ::= CHOICE { + msSUPLINIT SUPLINIT, + msSUPLSTART SUPLSTART, + msSUPLRESPONSE SUPLRESPONSE, + msSUPLPOSINIT SUPLPOSINIT, + msSUPLPOS SUPLPOS, + msSUPLEND SUPLEND, +-- msSUPLAUTHREQ SUPLAUTHREQ, + msDUMMY2 DUMMY, +-- msSUPLAUTHRESP SUPLAUTHRESP, + msDUMMY3 DUMMY, + ...} + +DUMMY ::= INTEGER + +END diff --git a/src/core/libs/supl/supl.c b/src/core/libs/supl/supl.c new file mode 100644 index 000000000..02d8b89a4 --- /dev/null +++ b/src/core/libs/supl/supl.c @@ -0,0 +1,958 @@ +/* +** SUPL library with some RRLP +** +** Copyright (c) 2007 Tatu Mannisto +** All rights reserved. +** Redistribution and modifications are permitted subject to BSD license. +** +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ULP-PDU.h" +#include "PDU.h" + +#include "supl.h" + +#define PARAM_GSM_CELL_CURRENT 1 +#define PARAM_GSM_CELL_KNOWN 2 +#define PARAM_WCDMA_CELL_CURRENT 4 + +#define OPTIONAL_MISSING ((void*)0) + +#ifdef SUPL_DEBUG +static struct supl_debug_s { + FILE *log; + int verbose_rrlp, verbose_supl, debug; + int sent,recv, out_msg, in_msg; +} debug; +#endif + +static int server_connect(char *server); +static int pdu_make_ulp_start(supl_ctx_t *ctx, supl_ulp_t *pdu); +static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu); +static int pdu_make_ulp_rrlp_ack(supl_ctx_t *ctx, supl_ulp_t *pdu, PDU_t *rrlp); +static int supl_more_rrlp(PDU_t *rrlp); +static int supl_response_harvest(supl_ctx_t *ctx, supl_ulp_t *pdu); + +int EXPORT supl_ulp_decode(supl_ulp_t *pdu) { + ULP_PDU_t *ulp; + asn_codec_ctx_t ctx; + asn_dec_rval_t rval; + + ulp = calloc(1, sizeof(ULP_PDU_t)); + pdu->pdu = ulp; + + ctx.max_stack_size = 0; + rval = uper_decode_complete(&ctx, &asn_DEF_ULP_PDU, (void **)&ulp, pdu->buffer, pdu->size); + if (rval.code == RC_OK) { + return 0; + } + + free(ulp); + pdu->pdu = 0; + + return E_SUPL_DECODE; +} + +int EXPORT supl_ulp_encode(supl_ulp_t *pdu) { + asn_enc_rval_t ret; + int pdu_len; + + ret = uper_encode_to_buffer(&asn_DEF_ULP_PDU, pdu->pdu, pdu->buffer, sizeof(pdu->buffer)); + if (ret.encoded != -1) { + memset(pdu->buffer, 0, sizeof(pdu->buffer)); + + pdu_len = (ret.encoded + 7) >> 3; + ((ULP_PDU_t *)pdu->pdu)->length = pdu_len; + + ret = uper_encode_to_buffer(&asn_DEF_ULP_PDU, pdu->pdu, pdu->buffer, sizeof(pdu->buffer)); + if (ret.encoded > 0) { + int len = (ret.encoded + 7) >> 3; + + if (len == pdu_len) { + pdu->size = pdu_len; + return 0; + } + } + } + + return E_SUPL_ENCODE; +} + +void EXPORT supl_ulp_free(supl_ulp_t *pdu) { + asn_DEF_ULP_PDU.free_struct(&asn_DEF_ULP_PDU, pdu->pdu, 0); +} + +int EXPORT supl_ulp_send(supl_ctx_t *ctx, supl_ulp_t *pdu) { + int err; + +#if SUPL_DEBUG + if (debug.verbose_supl) { + fprintf(debug.log, "Send %lu bytes\n", pdu->size); + xer_fprint(debug.log, &asn_DEF_ULP_PDU, pdu->pdu); + } +#endif + + err = SSL_write(ctx->ssl, pdu->buffer, pdu->size); + if (err <= 0) { +#if SUPL_DEBUG + if (debug.debug) fprintf(debug.log, "Error: SSL_write error: %s\n", strerror(errno)); +#endif + return E_SUPL_WRITE; + } + +#ifdef SUPL_DEBUG + debug.sent += pdu->size; + debug.out_msg++; +#endif + + return 0; +} + +int EXPORT supl_ulp_recv(supl_ctx_t *ctx, supl_ulp_t *pdu) { + int err; + int n; + asn_dec_rval_t rval; + ULP_PDU_t *length; + + err = SSL_read(ctx->ssl, pdu->buffer, sizeof(pdu->buffer)); + if (err <= 0) { +#ifdef SUPL_DEBUG + if (debug.debug) fprintf(debug.log, "Error: SSL_read error: %s\n", strerror(errno)); +#endif + return E_SUPL_READ; + } + n = err; + + length = calloc(1, sizeof(ULP_PDU_t)); + // decode the very first bytes of the ULP_PDU message, just enough to the get message length + rval = uper_decode_complete(0, &asn_DEF_ULP_PDU, (void **)&length, pdu->buffer, n < 6 ? n : 6); + if (rval.code == RC_WMORE) { + // read the missing data + for (n = err; n < length->length; n += err) { +#ifdef SUPL_DEBUG + if (debug.debug) fprintf(debug.log, "SSL_read got %u bytes (total %lu)\n", n, length->length); +#endif + err = SSL_read(ctx->ssl, &pdu->buffer[n], sizeof(pdu->buffer)-n); + if (err <= 0) { +#ifdef SUPL_DEBUG + if (debug.debug) fprintf(debug.log, "Error: SSL_read (again) error: %s\n", strerror(errno)); +#endif + return E_SUPL_READ; + } + } + } + + asn_DEF_ULP_PDU.free_struct(&asn_DEF_ULP_PDU, length, 0); + + pdu->size = n; + + if (supl_ulp_decode(pdu)) { + return E_SUPL_DECODE; + } + +#ifdef SUPL_DEBUG + if (debug.verbose_supl) { + fprintf(debug.log, "Recv %lu bytes\n", pdu->size); + xer_fprint(debug.log, &asn_DEF_ULP_PDU, pdu->pdu); + } +#endif + +#ifdef SUPL_DEBUG + debug.recv += err; + debug.in_msg++; +#endif + + return 0; +} + +int EXPORT supl_decode_rrlp(supl_ulp_t *ulp_pdu, PDU_t **ret_rrlp) { + asn_dec_rval_t rval; + OCTET_STRING_t *rrlp_pdu; + PDU_t *rrlp; + ULP_PDU_t *ulp; + + ulp = ulp_pdu->pdu; + + if (!(ulp->message.present == UlpMessage_PR_msSUPLPOS && + ulp->message.choice.msSUPLPOS.posPayLoad.present == PosPayLoad_PR_rrlpPayload)) { + return 0; + } + rrlp_pdu = &ulp->message.choice.msSUPLPOS.posPayLoad.choice.rrlpPayload; + + rrlp = calloc(1, sizeof(PDU_t)); + rval = uper_decode_complete(0, &asn_DEF_PDU, (void **)&rrlp, rrlp_pdu->buf, rrlp_pdu->size); + switch (rval.code) { + case RC_OK: +#ifdef SUPL_DEBUG + if (rval.consumed != rrlp_pdu->size) { + if (debug.debug) fprintf(debug.log, "Warning: %lu bytes left over in RRLP decoding\n", rval.consumed); + } +#endif + + *ret_rrlp = rrlp; + return 0; + + case RC_WMORE: + asn_DEF_PDU.free_struct(&asn_DEF_PDU, rrlp, 0); + ret_rrlp = 0; + return E_SUPL_DECODE_RRLP; + + default: + asn_DEF_PDU.free_struct(&asn_DEF_PDU, rrlp, 0); + ret_rrlp = 0; + return E_SUPL_DECODE_RRLP; + } + + return E_SUPL_INTERNAL; +} + +int EXPORT supl_server_connect(supl_ctx_t *ctx, char *server) { + int err; + const SSL_METHOD *meth; + + SSLeay_add_ssl_algorithms(); + // meth = TLSv1_client_method(); + meth = SSLv23_client_method(); + SSL_load_error_strings(); + ctx->ssl_ctx = SSL_CTX_new(meth); + if (!ctx->ssl_ctx) return E_SUPL_CONNECT; + + ctx->ssl = SSL_new(ctx->ssl_ctx); + if (!ctx->ssl) return E_SUPL_CONNECT; + + if (server) { + ctx->fd = server_connect(server); + if (ctx->fd == -1) return E_SUPL_CONNECT; + } + + SSL_set_fd(ctx->ssl, ctx->fd); + err = SSL_connect(ctx->ssl); + if (err == -1) return E_SUPL_CONNECT; + +#if 0 + { + X509 *s_cert = SSL_get_peer_certificate(ctx->ssl); + FILE *fp = fopen("/tmp/s_cert.pem", "w"); + if (fp) + PEM_write_X509(fp, s_cert); + fclose(fp); + X509_free(s_cert); + } +#endif + + return 0; +} + +void EXPORT supl_close(supl_ctx_t *ctx) { + SSL_shutdown(ctx->ssl); + SSL_free(ctx->ssl); + SSL_CTX_free(ctx->ssl_ctx); + close(ctx->fd); +} + + +static int server_connect(char *server) { + int fd = -1; + struct addrinfo *ailist, *aip; + struct addrinfo hint; + int err; + + memset(&hint, 0, sizeof(struct addrinfo)); + hint.ai_socktype = SOCK_STREAM; + err = getaddrinfo(server, SUPL_PORT, &hint, &ailist); + if (err != 0) { + return -1; + } + + for (aip = ailist; aip; aip = aip->ai_next) { + if ((fd = socket(aip->ai_family, SOCK_STREAM, 0)) < 0) { + err = errno; + } + if (connect(fd, aip->ai_addr, aip->ai_addrlen) != 0) { + return -1; + } + break; + } + + return fd; +} + +static int pdu_make_ulp_start(supl_ctx_t *ctx, supl_ulp_t *pdu) { + ULP_PDU_t *ulp; + SetSessionID_t *session_id; + int err; + + ulp = calloc(1, sizeof(ULP_PDU_t)); + session_id = calloc(1, sizeof(SetSessionID_t)); + + ulp->length = 0; + ulp->version.maj = 1; + ulp->version.min = 0; + ulp->version.servind = 0; + + session_id->sessionId = 1; + // session_id->setId.present = SETId_PR_msisdn; + // (void)OCTET_STRING_fromBuf(&session_id->setId.choice.msisdn, ctx->p.msisdn, 8); + session_id->setId.present = SETId_PR_imsi; + (void)OCTET_STRING_fromBuf(&session_id->setId.choice.imsi, ctx->p.msisdn, 8); + + ulp->sessionID.setSessionID = session_id; + ulp->sessionID.slpSessionID = OPTIONAL_MISSING; + + ulp->message.present = UlpMessage_PR_msSUPLSTART; + ulp->message.choice.msSUPLSTART.sETCapabilities.posTechnology.agpsSETBased = 1; + // (void)asn_long2INTEGER(&ulp->message.choice.msSUPLSTART.sETCapabilities.prefMethod, PrefMethod_noPreference); + (void)asn_long2INTEGER(&ulp->message.choice.msSUPLSTART.sETCapabilities.prefMethod, PrefMethod_agpsSETBasedPreferred); + ulp->message.choice.msSUPLSTART.sETCapabilities.posProtocol.rrlp = 1; + + if (ctx->p.set & PARAM_GSM_CELL_CURRENT) { + ulp->message.choice.msSUPLSTART.locationId.cellInfo.present = CellInfo_PR_gsmCell; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.gsmCell.refMCC = ctx->p.gsm.mcc; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.gsmCell.refMNC = ctx->p.gsm.mnc; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.gsmCell.refLAC = ctx->p.gsm.lac; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.gsmCell.refCI = ctx->p.gsm.ci; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.gsmCell.nMR = OPTIONAL_MISSING; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.gsmCell.tA = OPTIONAL_MISSING; + } else if (ctx->p.set & PARAM_WCDMA_CELL_CURRENT) { + ulp->message.choice.msSUPLSTART.locationId.cellInfo.present = CellInfo_PR_wcdmaCell; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.wcdmaCell.refMCC = ctx->p.wcdma.mcc; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.wcdmaCell.refMNC = ctx->p.wcdma.mnc; + ulp->message.choice.msSUPLSTART.locationId.cellInfo.choice.wcdmaCell.refUC = ctx->p.wcdma.uc; + } + + (void)asn_long2INTEGER(&ulp->message.choice.msSUPLSTART.locationId.status, Status_current); + + ulp->message.choice.msSUPLSTART.qoP = OPTIONAL_MISSING; + + pdu->pdu = ulp; + + err = supl_ulp_encode(pdu); + if (err < 0) { + asn_DEF_ULP_PDU.free_struct(&asn_DEF_ULP_PDU, ulp, 0); + return err; + } + + return 0; +} + +// get slpSessionID from SUPLRESPONSE pdu if preset +static int supl_response_harvest(supl_ctx_t *ctx, supl_ulp_t *pdu) { + int ret; + ULP_PDU_t *ulp = pdu->pdu; + void *buf; + + ctx->slp_session_id.buf = 0; + + ret = uper_encode_to_new_buffer(&asn_DEF_SlpSessionID, 0, (void *)ulp->sessionID.slpSessionID, &buf); + if (ret == -1) return -1; + + ctx->slp_session_id.buf = buf; + ctx->slp_session_id.size = ret; + + return 0; +} + +static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu) { + int err; + ULP_PDU_t *ulp; + SetSessionID_t *session_id; + RequestedAssistData_t *req_adata; + + ulp = calloc(1, sizeof(ULP_PDU_t)); + session_id = calloc(1, sizeof(SetSessionID_t)); + req_adata = calloc(1, sizeof(RequestedAssistData_t)); + + ulp->length = 0; + ulp->version.maj = 1; + ulp->version.min = 0; + ulp->version.servind = 0; + + session_id->sessionId = 1; + // session_id->setId.present = SETId_PR_msisdn; + // (void)OCTET_STRING_fromBuf(&session_id->setId.choice.msisdn, ctx->p.msisdn, 8); + session_id->setId.present = SETId_PR_imsi; + (void)OCTET_STRING_fromBuf(&session_id->setId.choice.imsi, ctx->p.msisdn, 8); + + ulp->sessionID.setSessionID = session_id; + // ulp->sessionID.slpSessionID = OPTIONAL_MISSING; + if (ctx->slp_session_id.buf) { + (void)uper_decode_complete(0, &asn_DEF_SlpSessionID, (void **)&ulp->sessionID.slpSessionID, ctx->slp_session_id.buf, ctx->slp_session_id.size); + } else { + ulp->sessionID.slpSessionID = OPTIONAL_MISSING; + } + + ulp->message.present = UlpMessage_PR_msSUPLPOSINIT; + ulp->message.choice.msSUPLPOSINIT.sETCapabilities.posTechnology.agpsSETBased = 1; + // (void)asn_long2INTEGER(&ulp->message.choice.msSUPLPOSINIT.sETCapabilities.prefMethod, PrefMethod_noPreference); + (void)asn_long2INTEGER(&ulp->message.choice.msSUPLPOSINIT.sETCapabilities.prefMethod, PrefMethod_agpsSETBasedPreferred); + ulp->message.choice.msSUPLPOSINIT.sETCapabilities.posProtocol.rrlp = 1; + + //GNSS-SDR mod + // Use ctx->p.request to swith between a pre-defined set of assistence data request + // reason: Some SUPL servers do not respond to Acquisition assistance depending on the status of other assistance flags + + switch (ctx->p.request) + { + case 0: //request almanac, time, and cell positions + req_adata->acquisitionAssistanceRequested = 0; // 1 + req_adata->navigationModelRequested = 0; // 1 + req_adata->referenceTimeRequested = 1; + req_adata->utcModelRequested = 1; //1 + req_adata->ionosphericModelRequested = 1; // 1 + req_adata->referenceLocationRequested = 1; + req_adata->almanacRequested = 1; + req_adata->realTimeIntegrityRequested = 1; // 1 + break; + case 1: // request Navigation Model (Ephemeris) + req_adata->acquisitionAssistanceRequested = 0; // 1 + req_adata->navigationModelRequested = 1; // 1 + req_adata->referenceTimeRequested = 0; + req_adata->utcModelRequested = 0; //1 + req_adata->ionosphericModelRequested = 0; // 1 + req_adata->referenceLocationRequested = 0; + req_adata->almanacRequested = 0; + req_adata->realTimeIntegrityRequested = 0; // 1 + break; + case 2: //request Acquisition assistance (Doppler assistance) + req_adata->acquisitionAssistanceRequested = 1; // 1 + req_adata->navigationModelRequested = 0; // 1 + req_adata->referenceTimeRequested = 1; + req_adata->utcModelRequested = 1; //1 + req_adata->ionosphericModelRequested = 1; // 1 + req_adata->referenceLocationRequested = 1; + req_adata->almanacRequested = 1; + req_adata->realTimeIntegrityRequested = 1; // 1 + break; + default: + req_adata->acquisitionAssistanceRequested = 0; // 1 + req_adata->navigationModelRequested = 0; // 1 + req_adata->referenceTimeRequested = 1; + req_adata->utcModelRequested = 1; //1 + req_adata->ionosphericModelRequested = 1; // 1 + req_adata->referenceLocationRequested = 1; + req_adata->almanacRequested = 1; + req_adata->realTimeIntegrityRequested = 1; // 1 + break; + } + + ulp->message.choice.msSUPLPOSINIT.requestedAssistData = req_adata; + + if (ctx->p.set & PARAM_GSM_CELL_CURRENT) { + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.present = CellInfo_PR_gsmCell; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.gsmCell.refMCC = ctx->p.gsm.mcc; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.gsmCell.refMNC = ctx->p.gsm.mnc; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.gsmCell.refLAC = ctx->p.gsm.lac; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.gsmCell.refCI = ctx->p.gsm.ci; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.gsmCell.nMR = OPTIONAL_MISSING; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.gsmCell.tA = OPTIONAL_MISSING; + } else if (ctx->p.set & PARAM_WCDMA_CELL_CURRENT) { + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.present = CellInfo_PR_wcdmaCell; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.wcdmaCell.refMCC = ctx->p.wcdma.mcc; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.wcdmaCell.refMNC = ctx->p.wcdma.mnc; + ulp->message.choice.msSUPLPOSINIT.locationId.cellInfo.choice.wcdmaCell.refUC = ctx->p.wcdma.uc; + } + + if (ctx->p.set & PARAM_GSM_CELL_KNOWN) { + Position_t *pos = calloc(1, sizeof(Position_t)); + struct tm *tm; + time_t t; + + (void)asn_long2INTEGER(&ulp->message.choice.msSUPLPOSINIT.locationId.status, Status_stale); + + t = time(0); + tm = gmtime(&t); + asn_UT2time(&pos->timestamp, tm ,1); + (void)asn_long2INTEGER(&pos->positionEstimate.latitudeSign, latitudeSign_north); + pos->positionEstimate.latitude = (1 << 23) / 90.0 * ctx->p.known.lat; + pos->positionEstimate.longitude = (1 << 24) / 360.0 * ctx->p.known.lon; + // TODO: set position estimate + + ulp->message.choice.msSUPLPOSINIT.position = pos; + } else { + (void)asn_long2INTEGER(&ulp->message.choice.msSUPLPOSINIT.locationId.status, Status_current); + ulp->message.choice.msSUPLPOSINIT.position = OPTIONAL_MISSING; + } + + ulp->message.choice.msSUPLPOSINIT.sUPLPOS = OPTIONAL_MISSING; + + ulp->message.choice.msSUPLPOSINIT.ver = OPTIONAL_MISSING; + + pdu->pdu = ulp; + + err = supl_ulp_encode(pdu); + if (err < 0) { + asn_DEF_ULP_PDU.free_struct(&asn_DEF_ULP_PDU, ulp, 0); + return err; + } + + return 0; +} + +static int pdu_make_ulp_rrlp_ack(supl_ctx_t *ctx, supl_ulp_t *pdu, PDU_t *rrlp) { + int err; + PDU_t *rrlp_ack; + ULP_PDU_t *ulp; + SetSessionID_t *session_id; + asn_enc_rval_t ret; + int pdu_len; + char buffer[1024]; + + rrlp_ack = calloc(1, sizeof(PDU_t)); + + /* create RRLP assistanceDataAck */ + + rrlp_ack->referenceNumber = rrlp->referenceNumber; + rrlp_ack->component.present = RRLP_Component_PR_assistanceDataAck; + + ret = uper_encode_to_buffer(&asn_DEF_PDU, rrlp_ack, buffer, sizeof(buffer)); + asn_DEF_ULP_PDU.free_struct(&asn_DEF_PDU, rrlp_ack, 0); + if (ret.encoded == -1) { + return E_SUPL_ENCODE_RRLP; + } + pdu_len = (ret.encoded + 7) >> 3; + + /* embedded it in SUPLPOS */ + + ulp = calloc(1, sizeof(ULP_PDU_t)); + session_id = calloc(1, sizeof(SetSessionID_t)); + + ulp->length = 0; + ulp->version.maj = 1; + ulp->version.min = 0; + ulp->version.servind = 0; + + session_id->sessionId = 1; + // session_id->setId.present = SETId_PR_msisdn; + // (void)OCTET_STRING_fromBuf(&session_id->setId.choice.msisdn, ctx->p.msisdn, 8); + session_id->setId.present = SETId_PR_imsi; + (void)OCTET_STRING_fromBuf(&session_id->setId.choice.imsi, ctx->p.msisdn, 8); + + ulp->sessionID.setSessionID = session_id; + // ulp->sessionID.slpSessionID = OPTIONAL_MISSING; + if (ctx->slp_session_id.buf) { + (void)uper_decode_complete(0, &asn_DEF_SlpSessionID, (void **)&ulp->sessionID.slpSessionID, ctx->slp_session_id.buf, ctx->slp_session_id.size); + } else { + ulp->sessionID.slpSessionID = OPTIONAL_MISSING; + } + + ulp->message.present = UlpMessage_PR_msSUPLPOS; + ulp->message.choice.msSUPLPOS.posPayLoad.present = PosPayLoad_PR_rrlpPayload; + (void)OCTET_STRING_fromBuf(&ulp->message.choice.msSUPLPOS.posPayLoad.choice.rrlpPayload, buffer, pdu_len); + + pdu->pdu = ulp; + + err = supl_ulp_encode(pdu); + if (err < 0) { + supl_ulp_free(pdu); + return err; + } + + return 0; +} + +/* +** +** +*/ + +int EXPORT supl_collect_rrlp(supl_assist_t *assist, PDU_t *rrlp, struct timeval *t) { + ControlHeader_t *hdr; + + if (rrlp->component.present != RRLP_Component_PR_assistanceData) return 0; + if (!rrlp->component.choice.assistanceData.gps_AssistData) return 0; + + hdr = &rrlp->component.choice.assistanceData.gps_AssistData->controlHeader; + + if (hdr->referenceTime) { + assist->set |= SUPL_RRLP_ASSIST_REFTIME; + assist->time.gps_tow = hdr->referenceTime->gpsTime.gpsTOW23b; + assist->time.gps_week = hdr->referenceTime->gpsTime.gpsWeek; + memcpy(&assist->time.stamp, t, sizeof(struct timeval)); + } + + if (hdr->refLocation) { + OCTET_STRING_t *loc; + + loc = &hdr->refLocation->threeDLocation; + if (loc->size == 14 && loc->buf[0] == 0x90) { + double lat, lon; + long l; + + /* from 3GPP TS 23.032 V4.0.0 (2001-04) */ + + l = (loc->buf[1] & 0x7f) << 16 | + (loc->buf[2] << 8) | + loc->buf[3]; + if (loc->buf[1] & 0x80) l *= -1; + lat = 90.0 / (1 << 23) * l; + + l = (loc->buf[4] << 16) | + (loc->buf[5] << 8) | + loc->buf[6]; + lon = 360.0 / (1 << 24) * l; + + /* max of uncertainty ellipsoid axis */ + /* uncert in meters = 10 * (1.1 ^ l - 1) */ + /* l == 96 => 100 km uncertainty => not usable */ + l = loc->buf[9]; + if (loc->buf[10] > l) l = loc->buf[10]; + + assist->set |= SUPL_RRLP_ASSIST_REFLOC; + assist->pos.lat = lat; + assist->pos.lon = lon; + assist->pos.uncertainty = l; + } + } + + if (hdr->acquisAssist) { + int n; + + assist->acq_time = hdr->acquisAssist->timeRelation.gpsTOW; + + for (n = 0; n < hdr->acquisAssist->acquisList.list.count; n++) { + struct AcquisElement *e = hdr->acquisAssist->acquisList.list.array[n]; + int i = assist->cnt_acq++; + + assist->acq[i].prn = e->svid + 1; + assist->acq[i].parts = 0; + assist->acq[i].doppler0 = e->doppler0; + + if (e->addionalDoppler) { + assist->acq[i].parts |= SUPL_ACQUIS_DOPPLER; + assist->acq[i].doppler1 = e->addionalDoppler->doppler1; + assist->acq[i].d_win = e->addionalDoppler->dopplerUncertainty; + } + + assist->acq[i].code_ph = e->codePhase; + assist->acq[i].code_ph_int = e->intCodePhase; + assist->acq[i].bit_num = e->gpsBitNumber; + assist->acq[i].code_ph_win = e->codePhaseSearchWindow; + + if (e->addionalAngle) { + assist->acq[i].parts |= SUPL_ACQUIS_ANGLE; + assist->acq[i].az = e->addionalAngle->azimuth; + assist->acq[i].el = e->addionalAngle->elevation; + } + } + } + + if (hdr->almanac) { + int n; + + for (n = 0; n < hdr->almanac->almanacList.list.count; n++) { + struct AlmanacElement *e = hdr->almanac->almanacList.list.array[n]; + int i = assist->cnt_alm++; + + assist->alm[i].prn = e->satelliteID + 1; + assist->alm[i].e = e->almanacE; + assist->alm[i].toa = e->alamanacToa; // nice touch 3gpp + assist->alm[i].Ksii = e->almanacKsii; + assist->alm[i].OMEGA_dot = e->almanacOmegaDot; + assist->alm[i].A_sqrt = e->almanacAPowerHalf; + assist->alm[i].OMEGA_0 = e->almanacOmega0; + assist->alm[i].w = e->almanacW; + assist->alm[i].M0 = e->almanacM0; + assist->alm[i].AF0 = e->almanacAF0; + assist->alm[i].AF1 = e->almanacAF1; + } + } + + if (hdr->navigationModel) { + UncompressedEphemeris_t *ue; + int n; + + for (n = 0; n < hdr->navigationModel->navModelList.list.count; n++) { + struct NavModelElement *e = hdr->navigationModel->navModelList.list.array[n]; + int i = assist->cnt_eph++; + + assist->eph[i].prn = e->satelliteID + 1; + + /* what is the difference between these two */ + ue = 0; + if (e->satStatus.present == SatStatus_PR_newNaviModelUC) + ue = &e->satStatus.choice.newNaviModelUC; + if (e->satStatus.present == SatStatus_PR_newSatelliteAndModelUC) + ue = &e->satStatus.choice.newSatelliteAndModelUC; + + if (ue) { +#if 0 + assist->eph_x[i].L2P = ue->ephemL2Pflag; + assist->eph_x[i].fit = ue->ephemFitFlag; +#endif + assist->eph[i].delta_n = ue->ephemDeltaN; + assist->eph[i].M0 = ue->ephemM0; +#if 0 + // this is needed for asn1c version 0.9.22 + { + long v; + asn_INTEGER2long((INTEGER_t *)&ue->ephemE, &v); + assist->eph[i].e = v; + asn_INTEGER2long((INTEGER_t *)&ue->ephemAPowerHalf, &v); + assist->eph[i].e = v; + } +#else + assist->eph[i].e = ue->ephemE; + assist->eph[i].A_sqrt = ue->ephemAPowerHalf; +#endif + assist->eph[i].OMEGA_0 = ue->ephemOmegaA0; + assist->eph[i].i0 = ue->ephemI0; + assist->eph[i].w = ue->ephemW; + assist->eph[i].OMEGA_dot = ue->ephemOmegaADot; + assist->eph[i].i_dot = ue->ephemIDot; + assist->eph[i].Cuc = ue->ephemCuc; + assist->eph[i].Cus = ue->ephemCus; + assist->eph[i].Crc = ue->ephemCrc; + assist->eph[i].Crs = ue->ephemCrs; + assist->eph[i].Cic = ue->ephemCic; + assist->eph[i].Cis = ue->ephemCis; + assist->eph[i].toe = ue->ephemToe; + assist->eph[i].IODC = ue->ephemIODC; + assist->eph[i].toc = ue->ephemToc; + assist->eph[i].AF0 = ue->ephemAF0; + assist->eph[i].AF1 = ue->ephemAF1; + assist->eph[i].AF2 = ue->ephemAF2; + + assist->eph[i].nav_model = 1; + assist->eph[i].bits = ue->ephemCodeOnL2; + assist->eph[i].ura = ue->ephemURA; + assist->eph[i].health = ue->ephemSVhealth; + assist->eph[i].AODA = ue->ephemAODA; + assist->eph[i].tgd = ue->ephemTgd; + } + } + } + + if (hdr->ionosphericModel) { + assist->set |= SUPL_RRLP_ASSIST_IONO; + assist->iono.a0 = hdr->ionosphericModel->alfa0; + assist->iono.a1 = hdr->ionosphericModel->alfa1; + assist->iono.a2 = hdr->ionosphericModel->alfa2; + assist->iono.a3 = hdr->ionosphericModel->alfa3; //missed in original supl client + assist->iono.b0 = hdr->ionosphericModel->beta0; + assist->iono.b1 = hdr->ionosphericModel->beta1; + assist->iono.b2 = hdr->ionosphericModel->beta2; + assist->iono.b3 = hdr->ionosphericModel->beta3; + } + + if (hdr->utcModel) { + assist->set |= SUPL_RRLP_ASSIST_UTC; + assist->utc.a0 = hdr->utcModel->utcA0; + assist->utc.a1 = hdr->utcModel->utcA1; + assist->utc.tot = hdr->utcModel->utcTot; + assist->utc.wnt = hdr->utcModel->utcWNt; + assist->utc.delta_tls = hdr->utcModel->utcDeltaTls; + assist->utc.wnlsf = hdr->utcModel->utcWNlsf; + assist->utc.dn = hdr->utcModel->utcDN; + assist->utc.delta_tlsf = hdr->utcModel->utcDeltaTlsf; + } + + return 1; +} + +int EXPORT supl_ctx_new(supl_ctx_t *ctx) { + memset(ctx, 0, sizeof(supl_ctx_t)); +#ifdef SUPL_DEBUG + memset(&debug, 0, sizeof(struct supl_debug_s)); +#endif + + return 0; +} + +int EXPORT supl_ctx_free(supl_ctx_t *ctx) { + if (ctx->slp_session_id.buf) { + free(ctx->slp_session_id.buf); + ctx->slp_session_id.buf = 0; + } + + return 0; +} + +static int supl_more_rrlp(PDU_t *rrlp) { + long value; + + return (rrlp->component.present == RRLP_Component_PR_assistanceData && + rrlp->component.choice.assistanceData.moreAssDataToBeSent && + asn_INTEGER2long((INTEGER_t *)rrlp->component.choice.assistanceData.moreAssDataToBeSent, &value) == 0 && + value == MoreAssDataToBeSent_moreMessagesOnTheWay); +} + +int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist) { + supl_ulp_t ulp; + + // memcpy(ctx->p.msisdn, "\xde\xad\xbe\xef\xf0\x0b\xaa\x42", 8); + memcpy(ctx->p.msisdn, "\xFF\xFF\x91\x94\x48\x45\x83\x98", 8); + + /* + ** connect to server + */ + + if (supl_server_connect(ctx, server) < 0) return E_SUPL_CONNECT; + + /* + ** send SUPL_START + */ + + if (pdu_make_ulp_start(ctx, &ulp) < 0) { + return E_SUPL_ENCODE_START; + } + + (void)supl_ulp_send(ctx, &ulp); + supl_ulp_free(&ulp); + + /* + ** should receive SUPL_RESPONSE back + */ + + if (supl_ulp_recv(ctx, &ulp) < 0) { + return E_SUPL_RECV_RESPONSE; + } + + if (ulp.pdu->message.present != UlpMessage_PR_msSUPLRESPONSE) { + supl_ulp_free(&ulp); + return E_SUPL_SUPLRESPONSE; + } + + // get and copy slpSessionID if present + supl_response_harvest(ctx, &ulp); + + supl_ulp_free(&ulp); + + /* + ** send SUPL_POS_INIT + */ + + if (pdu_make_ulp_pos_init(ctx, &ulp) < 0) { + return E_SUPL_ENCODE_POSINIT; + } + + (void)supl_ulp_send(ctx, &ulp); + + /* + ** should get SUPLPOS back - bounce back and forth until all messages have arrived + */ + + memset(assist, 0, sizeof(supl_assist_t)); + + while (1) { + struct timeval t; + PDU_t *rrlp; + + supl_ulp_free(&ulp); + + /* record packet recv time */ + gettimeofday(&t, 0); + + if (supl_ulp_recv(ctx, &ulp) < 0) { + return E_SUPL_RECV_SUPLPOS; + } + + if (ulp.pdu->message.present == UlpMessage_PR_msSUPLEND) { + break; + } + + if (ulp.pdu->message.present != UlpMessage_PR_msSUPLPOS) { + supl_ulp_free(&ulp); + return E_SUPL_SUPLPOS; + } + + /* get the beef, the RRLP payload */ + + if (supl_decode_rrlp(&ulp, &rrlp) < 0) { + supl_ulp_free(&ulp); + return E_SUPL_DECODE_RRLP; + } + +#ifdef SUPL_DEBUG + if (debug.verbose_rrlp) { + fprintf(debug.log, "Embedded RRLP message\n"); + xer_fprint(debug.log, &asn_DEF_PDU, rrlp); + } +#endif + + /* remember important stuff from it */ + + supl_collect_rrlp(assist, rrlp, &t); + + if (!supl_more_rrlp(rrlp)) { + asn_DEF_ULP_PDU.free_struct(&asn_DEF_PDU, rrlp, 0); + break; + } + + /* More data coming in, send SUPLPOS + RRLP ACK */ + + if (pdu_make_ulp_rrlp_ack(ctx, &ulp, rrlp) < 0) { + return E_SUPL_RRLP_ACK; + } + + supl_ulp_send(ctx, &ulp); + asn_DEF_ULP_PDU.free_struct(&asn_DEF_PDU, rrlp, 0); + } + + supl_ulp_free(&ulp); + + /* + ** send SUPL_END (but who really cares) + */ + + supl_close(ctx); + + return 0; +} + +void EXPORT supl_set_gsm_cell(supl_ctx_t *ctx, int mcc, int mns, int lac, int ci) { + ctx->p.set |= PARAM_GSM_CELL_CURRENT; + + ctx->p.gsm.mcc = mcc; + ctx->p.gsm.mnc = mns; + ctx->p.gsm.lac = lac; + ctx->p.gsm.ci = ci; +} + +void EXPORT supl_set_gsm_cell_known(supl_ctx_t *ctx, int mcc, int mns, int lac, int ci, double lat, double lon, int uncert) { + ctx->p.set |= PARAM_GSM_CELL_KNOWN; + + ctx->p.known.mcc = mcc; + ctx->p.known.mnc = mns; + ctx->p.known.lac = lac; + ctx->p.known.ci = ci; + ctx->p.known.lat = lat; + ctx->p.known.lon = lon; + ctx->p.known.uncert = uncert; +} + +void EXPORT supl_set_wcdma_cell(supl_ctx_t *ctx, int mcc, int mns, int uc) { + ctx->p.set |= PARAM_WCDMA_CELL_CURRENT; + + ctx->p.wcdma.mcc = mcc; + ctx->p.wcdma.mnc = mns; + ctx->p.wcdma.uc = uc; +} + +void EXPORT supl_request(supl_ctx_t *ctx, int request) { + ctx->p.request = request; +} + +void EXPORT supl_set_debug(FILE *log, int flags) { +#ifdef SUPL_DEBUG + debug.log = log; + if (flags & SUPL_DEBUG_RRLP) debug.verbose_rrlp = 1; + if (flags & SUPL_DEBUG_SUPL) debug.verbose_supl = 1; + if (flags & SUPL_DEBUG_DEBUG) debug.debug = 1; +#endif +} + diff --git a/src/core/libs/supl/supl.h b/src/core/libs/supl/supl.h new file mode 100644 index 000000000..541a556c9 --- /dev/null +++ b/src/core/libs/supl/supl.h @@ -0,0 +1,251 @@ +/* +** SUPL library +** +** Copyright (c) 2007 Tatu Mannisto +** All rights reserved. +** Redistribution and modifications are permitted subject to BSD license. +** +*/ + +#ifndef SUPL_H +#define SUPL_H + +#ifdef USE_EXPORT +#define EXPORT __attribute__((visibility("default"))) +#else +#define EXPORT +#endif + +#include +#include +#include + +#define SUPL_PORT "7275" + +/* error messages */ + +#define E_SUPL_CONNECT (-1) +#define E_SUPL_ENCODE_START (-2) +#define E_SUPL_RECV_RESPONSE (-3) +#define E_SUPL_SUPLRESPONSE (-4) +#define E_SUPL_ENCODE_POSINIT (-5) +#define E_SUPL_RECV_SUPLPOS (-6) +#define E_SUPL_SUPLPOS (-7) +#define E_SUPL_DECODE_RRLP (-8) +#define E_SUPL_RRLP_ACK (-9) +#define E_SUPL_ENCODE (-10) +#define E_SUPL_WRITE (-11) +#define E_SUPL_READ (-12) +#define E_SUPL_INTERNAL (-13) +#define E_SUPL_DECODE (-14) +#define E_SUPL_ENCODE_RRLP (-15) + +/* diagnostic & debug values */ +#define SUPL_DEBUG_RRLP 1 +#define SUPL_DEBUG_SUPL 2 +#define SUPL_DEBUG_DEBUG 4 + +/* flags for additional assistance requests */ +#define SUPL_REQUEST_ALMANAC 1 + +/* flags for collected assist data elements */ +#define SUPL_RRLP_ASSIST_REFTIME (1) +#define SUPL_RRLP_ASSIST_REFLOC (2) +#define SUPL_RRLP_ASSIST_IONO (4) +#define SUPL_RRLP_ASSIST_EPHEMERIS (8) +#define SUPL_RRLP_ASSIST_UTC (16) + +#define SUPL_ACQUIS_DOPPLER (1) +#define SUPL_ACQUIS_ANGLE (2) + +#define MAX_EPHEMERIS 32 + +struct supl_acquis_s { + u_int8_t prn; + u_int8_t parts; + int16_t doppler0; + int8_t doppler1; + u_int8_t d_win; + u_int16_t code_ph; + u_int8_t code_ph_int; + u_int8_t bit_num; + u_int16_t code_ph_win; + u_int8_t az; + u_int8_t el; + u_int8_t fill[2]; +}; + +struct supl_almanac_s { + u_int8_t prn; + u_int16_t e; + u_int8_t toa; + int16_t Ksii; + int16_t OMEGA_dot; + u_int32_t A_sqrt; + int32_t OMEGA_0; + int32_t w; + int32_t M0; + int16_t AF0; + int16_t AF1; + // int32_t health; +}; + +struct supl_ephemeris_s { + u_int8_t prn; + u_int8_t fill1; + u_int16_t delta_n; + int32_t M0; + u_int32_t e; + u_int32_t A_sqrt; + int32_t OMEGA_0; + int32_t i0; + int32_t w; + int32_t OMEGA_dot; + int16_t i_dot; + int16_t Cuc; + int16_t Cus; + int16_t Crc; + int16_t Crs; + int16_t Cic; + int16_t Cis; + u_int16_t toe; + u_int16_t IODC; + u_int16_t toc; + int32_t AF0; + int16_t AF1; + int8_t AF2; + u_int8_t nav_model; + + /* nav model */ + u_int8_t bits; + u_int8_t ura; + u_int8_t health; + char reserved[11]; + int8_t tgd; + u_int8_t AODA; +}; + +struct supl_ionospheric_s { + int8_t a0, a1, a2,a3, b0, b1, b2, b3; +}; + +struct supl_utc_s { + int32_t a0; + int32_t a1; + int8_t delta_tls; + u_int8_t tot; + u_int8_t wnt; + u_int8_t wnlsf; + u_int8_t dn; + u_int8_t delta_tlsf; + u_int8_t fill[8]; +}; + +typedef struct supl_rrlp_ctx_s { + int set; + + struct { + long gps_tow, gps_week; + struct timeval stamp; + } time; + + struct { + int uncertainty; + double lat, lon; /* of the base station */ + } pos; + + struct supl_ionospheric_s iono; + + struct supl_utc_s utc; + + int cnt_eph; + struct supl_ephemeris_s eph[MAX_EPHEMERIS]; + + int cnt_alm; + int alm_week; + struct supl_almanac_s alm[MAX_EPHEMERIS]; + + int cnt_acq; + int acq_time; + struct supl_acquis_s acq[MAX_EPHEMERIS]; + +} supl_assist_t; + +typedef struct supl_param_s { + int set; + int request; + + struct { + int mcc, mnc, lac, ci; + } gsm; + + struct { + int mcc, mnc, uc; + } wcdma; + + struct { + int mcc, mnc, lac, ci; + double lat, lon; + int uncert; + } known; + + char msisdn[8]; +} supl_param_t; + +typedef struct supl_ctx_s { + supl_param_t p; + + int fd; + SSL *ssl; + SSL_CTX *ssl_ctx; + + struct { + void *buf; + size_t size; + } slp_session_id; + +} supl_ctx_t; + +int supl_ctx_new(supl_ctx_t *ctx); +int supl_ctx_free(supl_ctx_t *ctx); + +void supl_set_gsm_cell(supl_ctx_t *ctx, int mcc, int mns, int lac, int ci); +void supl_set_wcdma_cell(supl_ctx_t *ctx, int mcc, int mns, int uc); +void supl_set_gsm_cell_known(supl_ctx_t *ctx, int mcc, int mns, int lac, int ci, double lat, double lon, int uncert); +void supl_set_server(supl_ctx_t *ctx, char *server); +void supl_set_fd(supl_ctx_t *ctx, int fd); +void supl_request(supl_ctx_t *ctx, int flags); + +int supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist); +void supl_set_debug(FILE *log, int flags); + +/* +** stuff above should be enough for supl client implementation +*/ + +typedef void (*supl_debug_cb)(char format, ...); + +typedef struct supl_ulp_s { + ULP_PDU_t *pdu; + size_t size; + unsigned char buffer[8192]; +} supl_ulp_t; + +typedef struct supl_rrlp_s { + PDU_t *pdu; + size_t size; + unsigned char buffer[8192]; +} supl_rrlp_t; + +void supl_ulp_free(supl_ulp_t *pdu); +int supl_ulp_encode(supl_ulp_t *pdu); +int supl_ulp_decode(supl_ulp_t *pdu); +int supl_decode_rrlp(supl_ulp_t *pdu, PDU_t **rrlp); +int supl_collect_rrlp(supl_assist_t *assist, PDU_t *rrlp, struct timeval *t); + +int supl_server_connect(supl_ctx_t *ctx, char *server); +void supl_close(supl_ctx_t *ctx); +int supl_ulp_send(supl_ctx_t *ctx, supl_ulp_t *pdu); +int supl_ulp_recv(supl_ctx_t *ctx, supl_ulp_t *pdu); + +#endif