diff --git a/asn1/RSPRO.asn b/asn1/RSPRO.asn index 1214f91..e0dde2b 100644 --- a/asn1/RSPRO.asn +++ b/asn1/RSPRO.asn @@ -101,6 +101,24 @@ ResultCode ::= ENUMERATED { ... } +ErrorCode ::= ENUMERATED { + -- Bankd or Server has received connection form unknown client (no mapping) + unknownClientConnected (1), + -- unexpected disconnect (typically bankd reports client disconnect) + unexpectedDisconnect (2), + unexpectedProtocolVersion (3), + ... +} + +ErrorString ::= IA5String (SIZE (1..255)) + +ErrorSeverity ::= ENUMERATED { + minor (1), + major (2), + fatal (3), + ... +} + -- Slot number within a SIM bank or a client. SlotNumber ::= INTEGER(0..1023) @@ -263,6 +281,22 @@ BankSlotStatusInd ::= SEQUENCE { ... } +-- *->SERVER: indication about some kind of error +ErrorInd ::= SEQUENCE { + -- whoever is detecting + sending us the error + sender ComponentType, + severity ErrorSeverity, + code ErrorCode, + -- any bank-side slot that's affected + bankSlot [0] BankSlot OPTIONAL, + -- any client-side slot that's affected + clientSlot [1] ClientSlot OPTIONAL, + -- any additional textual information + errorString [2] ErrorString OPTIONAL, + ... +} + + ---------------------------------------------------------------------- -- PDU ---------------------------------------------------------------------- @@ -279,6 +313,7 @@ RsproPDUchoice ::= CHOICE { removeMappingRes [7] RemoveMappingRes, configClientReq [8] ConfigClientReq, configClientRes [9] ConfigClientRes, + errorInd [16] ErrorInd, -- APDUs etc. setAtrReq [10] SetAtrReq, setAtrRes [11] SetAtrRes, diff --git a/include/osmocom/rspro/ErrorCode.h b/include/osmocom/rspro/ErrorCode.h new file mode 100644 index 0000000..1a8a62e --- /dev/null +++ b/include/osmocom/rspro/ErrorCode.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#ifndef _ErrorCode_H_ +#define _ErrorCode_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ErrorCode { + ErrorCode_unknownClientConnected = 1, + ErrorCode_unexpectedDisconnect = 2, + ErrorCode_unexpectedProtocolVersion = 3 + /* + * Enumeration is extensible + */ +} e_ErrorCode; + +/* ErrorCode */ +typedef long ErrorCode_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ErrorCode; +asn_struct_free_f ErrorCode_free; +asn_struct_print_f ErrorCode_print; +asn_constr_check_f ErrorCode_constraint; +ber_type_decoder_f ErrorCode_decode_ber; +der_type_encoder_f ErrorCode_encode_der; +xer_type_decoder_f ErrorCode_decode_xer; +xer_type_encoder_f ErrorCode_encode_xer; + +#ifdef __cplusplus +} +#endif + +#endif /* _ErrorCode_H_ */ +#include diff --git a/include/osmocom/rspro/ErrorInd.h b/include/osmocom/rspro/ErrorInd.h new file mode 100644 index 0000000..48bddf7 --- /dev/null +++ b/include/osmocom/rspro/ErrorInd.h @@ -0,0 +1,57 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#ifndef _ErrorInd_H_ +#define _ErrorInd_H_ + + +#include + +/* Including external dependencies */ +#include +#include "ErrorSeverity.h" +#include "ErrorCode.h" +#include "ErrorString.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +struct BankSlot; +struct ClientSlot; + +/* ErrorInd */ +typedef struct ErrorInd { + ComponentType_t sender; + ErrorSeverity_t severity; + ErrorCode_t code; + struct BankSlot *bankSlot /* OPTIONAL */; + struct ClientSlot *clientSlot /* OPTIONAL */; + ErrorString_t *errorString /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ErrorInd_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ErrorInd; + +#ifdef __cplusplus +} +#endif + +/* Referred external types */ +#include +#include + +#endif /* _ErrorInd_H_ */ +#include diff --git a/include/osmocom/rspro/ErrorSeverity.h b/include/osmocom/rspro/ErrorSeverity.h new file mode 100644 index 0000000..90fa93f --- /dev/null +++ b/include/osmocom/rspro/ErrorSeverity.h @@ -0,0 +1,48 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#ifndef _ErrorSeverity_H_ +#define _ErrorSeverity_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ErrorSeverity { + ErrorSeverity_minor = 1, + ErrorSeverity_major = 2, + ErrorSeverity_fatal = 3 + /* + * Enumeration is extensible + */ +} e_ErrorSeverity; + +/* ErrorSeverity */ +typedef long ErrorSeverity_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ErrorSeverity; +asn_struct_free_f ErrorSeverity_free; +asn_struct_print_f ErrorSeverity_print; +asn_constr_check_f ErrorSeverity_constraint; +ber_type_decoder_f ErrorSeverity_decode_ber; +der_type_encoder_f ErrorSeverity_encode_der; +xer_type_decoder_f ErrorSeverity_decode_xer; +xer_type_encoder_f ErrorSeverity_encode_xer; + +#ifdef __cplusplus +} +#endif + +#endif /* _ErrorSeverity_H_ */ +#include diff --git a/include/osmocom/rspro/ErrorString.h b/include/osmocom/rspro/ErrorString.h new file mode 100644 index 0000000..00d3efe --- /dev/null +++ b/include/osmocom/rspro/ErrorString.h @@ -0,0 +1,38 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#ifndef _ErrorString_H_ +#define _ErrorString_H_ + + +#include + +/* Including external dependencies */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ErrorString */ +typedef IA5String_t ErrorString_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ErrorString; +asn_struct_free_f ErrorString_free; +asn_struct_print_f ErrorString_print; +asn_constr_check_f ErrorString_constraint; +ber_type_decoder_f ErrorString_decode_ber; +der_type_encoder_f ErrorString_encode_der; +xer_type_decoder_f ErrorString_decode_xer; +xer_type_encoder_f ErrorString_encode_xer; + +#ifdef __cplusplus +} +#endif + +#endif /* _ErrorString_H_ */ +#include diff --git a/include/osmocom/rspro/Makefile.am b/include/osmocom/rspro/Makefile.am index f189c0a..41df9dc 100644 --- a/include/osmocom/rspro/Makefile.am +++ b/include/osmocom/rspro/Makefile.am @@ -17,6 +17,10 @@ noinst_HEADERS = \ ConnectClientRes.h \ CreateMappingReq.h \ CreateMappingRes.h \ + ErrorCode.h \ + ErrorInd.h \ + ErrorSeverity.h \ + ErrorString.h \ IpAddress.h \ IpPort.h \ Ipv4Address.h \ diff --git a/include/osmocom/rspro/RsproPDUchoice.h b/include/osmocom/rspro/RsproPDUchoice.h index 07d387e..98a8ca1 100644 --- a/include/osmocom/rspro/RsproPDUchoice.h +++ b/include/osmocom/rspro/RsproPDUchoice.h @@ -21,6 +21,7 @@ #include #include #include +#include "ErrorInd.h" #include #include #include @@ -46,6 +47,7 @@ typedef enum RsproPDUchoice_PR { RsproPDUchoice_PR_removeMappingRes, RsproPDUchoice_PR_configClientReq, RsproPDUchoice_PR_configClientRes, + RsproPDUchoice_PR_errorInd, RsproPDUchoice_PR_setAtrReq, RsproPDUchoice_PR_setAtrRes, RsproPDUchoice_PR_tpduModemToCard, @@ -70,6 +72,7 @@ typedef struct RsproPDUchoice { RemoveMappingRes_t removeMappingRes; ConfigClientReq_t configClientReq; ConfigClientRes_t configClientRes; + ErrorInd_t errorInd; SetAtrReq_t setAtrReq; SetAtrRes_t setAtrRes; TpduModemToCard_t tpduModemToCard; diff --git a/src/rspro/ErrorCode.c b/src/rspro/ErrorCode.c new file mode 100644 index 0000000..7b404fc --- /dev/null +++ b/src/rspro/ErrorCode.c @@ -0,0 +1,132 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ErrorCode.h" + +int +ErrorCode_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_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +ErrorCode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +ErrorCode_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ErrorCode_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ErrorCode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ErrorCode_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ErrorCode_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) { + ErrorCode_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ErrorCode_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) { + ErrorCode_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ErrorCode_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) { + ErrorCode_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ErrorCode_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) { + ErrorCode_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static const asn_INTEGER_enum_map_t asn_MAP_ErrorCode_value2enum_1[] = { + { 1, 22, "unknownClientConnected" }, + { 2, 20, "unexpectedDisconnect" }, + { 3, 25, "unexpectedProtocolVersion" } + /* This list is extensible */ +}; +static const unsigned int asn_MAP_ErrorCode_enum2value_1[] = { + 1, /* unexpectedDisconnect(2) */ + 2, /* unexpectedProtocolVersion(3) */ + 0 /* unknownClientConnected(1) */ + /* This list is extensible */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ErrorCode_specs_1 = { + asn_MAP_ErrorCode_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_ErrorCode_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 const ber_tlv_tag_t asn_DEF_ErrorCode_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ErrorCode = { + "ErrorCode", + "ErrorCode", + ErrorCode_free, + ErrorCode_print, + ErrorCode_constraint, + ErrorCode_decode_ber, + ErrorCode_encode_der, + ErrorCode_decode_xer, + ErrorCode_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ErrorCode_tags_1, + sizeof(asn_DEF_ErrorCode_tags_1) + /sizeof(asn_DEF_ErrorCode_tags_1[0]), /* 1 */ + asn_DEF_ErrorCode_tags_1, /* Same as above */ + sizeof(asn_DEF_ErrorCode_tags_1) + /sizeof(asn_DEF_ErrorCode_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_ErrorCode_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ErrorInd.c b/src/rspro/ErrorInd.c new file mode 100644 index 0000000..63e96d4 --- /dev/null +++ b/src/rspro/ErrorInd.c @@ -0,0 +1,109 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ErrorInd.h" + +static asn_TYPE_member_t asn_MBR_ErrorInd_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ErrorInd, sender), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_ComponentType, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "sender" + }, + { ATF_NOFLAGS, 0, offsetof(struct ErrorInd, severity), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_ErrorSeverity, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "severity" + }, + { ATF_NOFLAGS, 0, offsetof(struct ErrorInd, code), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_ErrorCode, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "code" + }, + { ATF_POINTER, 3, offsetof(struct ErrorInd, bankSlot), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_BankSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "bankSlot" + }, + { ATF_POINTER, 2, offsetof(struct ErrorInd, clientSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ClientSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "clientSlot" + }, + { ATF_POINTER, 1, offsetof(struct ErrorInd, errorString), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ErrorString, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "errorString" + }, +}; +static const ber_tlv_tag_t asn_DEF_ErrorInd_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ErrorInd_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 2 }, /* sender */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, -1, 1 }, /* severity */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, -2, 0 }, /* code */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* bankSlot */ + { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 4, 0, 0 }, /* clientSlot */ + { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 5, 0, 0 } /* errorString */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ErrorInd_specs_1 = { + sizeof(struct ErrorInd), + offsetof(struct ErrorInd, _asn_ctx), + asn_MAP_ErrorInd_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_ErrorInd = { + "ErrorInd", + "ErrorInd", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ErrorInd_tags_1, + sizeof(asn_DEF_ErrorInd_tags_1) + /sizeof(asn_DEF_ErrorInd_tags_1[0]), /* 1 */ + asn_DEF_ErrorInd_tags_1, /* Same as above */ + sizeof(asn_DEF_ErrorInd_tags_1) + /sizeof(asn_DEF_ErrorInd_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ErrorInd_1, + 6, /* Elements count */ + &asn_SPC_ErrorInd_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ErrorSeverity.c b/src/rspro/ErrorSeverity.c new file mode 100644 index 0000000..cae6447 --- /dev/null +++ b/src/rspro/ErrorSeverity.c @@ -0,0 +1,132 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ErrorSeverity.h" + +int +ErrorSeverity_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_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +ErrorSeverity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +void +ErrorSeverity_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ErrorSeverity_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ErrorSeverity_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ErrorSeverity_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ErrorSeverity_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) { + ErrorSeverity_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ErrorSeverity_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) { + ErrorSeverity_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ErrorSeverity_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) { + ErrorSeverity_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ErrorSeverity_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) { + ErrorSeverity_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static const asn_INTEGER_enum_map_t asn_MAP_ErrorSeverity_value2enum_1[] = { + { 1, 5, "minor" }, + { 2, 5, "major" }, + { 3, 5, "fatal" } + /* This list is extensible */ +}; +static const unsigned int asn_MAP_ErrorSeverity_enum2value_1[] = { + 2, /* fatal(3) */ + 1, /* major(2) */ + 0 /* minor(1) */ + /* This list is extensible */ +}; +static const asn_INTEGER_specifics_t asn_SPC_ErrorSeverity_specs_1 = { + asn_MAP_ErrorSeverity_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_ErrorSeverity_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 const ber_tlv_tag_t asn_DEF_ErrorSeverity_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ErrorSeverity = { + "ErrorSeverity", + "ErrorSeverity", + ErrorSeverity_free, + ErrorSeverity_print, + ErrorSeverity_constraint, + ErrorSeverity_decode_ber, + ErrorSeverity_encode_der, + ErrorSeverity_decode_xer, + ErrorSeverity_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ErrorSeverity_tags_1, + sizeof(asn_DEF_ErrorSeverity_tags_1) + /sizeof(asn_DEF_ErrorSeverity_tags_1[0]), /* 1 */ + asn_DEF_ErrorSeverity_tags_1, /* Same as above */ + sizeof(asn_DEF_ErrorSeverity_tags_1) + /sizeof(asn_DEF_ErrorSeverity_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_ErrorSeverity_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ErrorString.c b/src/rspro/ErrorString.c new file mode 100644 index 0000000..82c4700 --- /dev/null +++ b/src/rspro/ErrorString.c @@ -0,0 +1,143 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ErrorString.h" + +static int check_permitted_alphabet_1(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 <= 127l)) return -1; + } + return 0; +} + +int +ErrorString_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; + 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 >= 1l && size <= 255l) + && !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; + } +} + +/* + * This type is implemented using IA5String, + * so here we adjust the DEF accordingly. + */ +static void +ErrorString_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_IA5String.free_struct; + td->print_struct = asn_DEF_IA5String.print_struct; + td->check_constraints = asn_DEF_IA5String.check_constraints; + td->ber_decoder = asn_DEF_IA5String.ber_decoder; + td->der_encoder = asn_DEF_IA5String.der_encoder; + td->xer_decoder = asn_DEF_IA5String.xer_decoder; + td->xer_encoder = asn_DEF_IA5String.xer_encoder; + td->uper_decoder = asn_DEF_IA5String.uper_decoder; + td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_IA5String.per_constraints; + td->elements = asn_DEF_IA5String.elements; + td->elements_count = asn_DEF_IA5String.elements_count; + td->specifics = asn_DEF_IA5String.specifics; +} + +void +ErrorString_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + ErrorString_1_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +int +ErrorString_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + ErrorString_1_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +asn_dec_rval_t +ErrorString_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) { + ErrorString_1_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +asn_enc_rval_t +ErrorString_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) { + ErrorString_1_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +asn_dec_rval_t +ErrorString_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) { + ErrorString_1_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +asn_enc_rval_t +ErrorString_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) { + ErrorString_1_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static const ber_tlv_tag_t asn_DEF_ErrorString_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_ErrorString = { + "ErrorString", + "ErrorString", + ErrorString_free, + ErrorString_print, + ErrorString_constraint, + ErrorString_decode_ber, + ErrorString_encode_der, + ErrorString_decode_xer, + ErrorString_encode_xer, + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ErrorString_tags_1, + sizeof(asn_DEF_ErrorString_tags_1) + /sizeof(asn_DEF_ErrorString_tags_1[0]), /* 1 */ + asn_DEF_ErrorString_tags_1, /* Same as above */ + sizeof(asn_DEF_ErrorString_tags_1) + /sizeof(asn_DEF_ErrorString_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + 0 /* No specifics */ +}; + diff --git a/src/rspro/Makefile.am b/src/rspro/Makefile.am index 4744886..4d3f18a 100644 --- a/src/rspro/Makefile.am +++ b/src/rspro/Makefile.am @@ -17,6 +17,10 @@ ASN_MODULE_SOURCES = \ ConnectClientRes.c \ CreateMappingReq.c \ CreateMappingRes.c \ + ErrorCode.c \ + ErrorInd.c \ + ErrorSeverity.c \ + ErrorString.c \ IpAddress.c \ IpPort.c \ Ipv4Address.c \ @@ -56,6 +60,10 @@ ASN_MODULE_INC = \ ConnectClientRes.h \ CreateMappingReq.h \ CreateMappingRes.h \ + ErrorCode.h \ + ErrorInd.h \ + ErrorSeverity.h \ + ErrorString.h \ IpAddress.h \ IpPort.h \ Ipv4Address.h \ diff --git a/src/rspro/RsproPDUchoice.c b/src/rspro/RsproPDUchoice.c index 330821f..e842876 100644 --- a/src/rspro/RsproPDUchoice.c +++ b/src/rspro/RsproPDUchoice.c @@ -97,6 +97,15 @@ static asn_TYPE_member_t asn_MBR_RsproPDUchoice_1[] = { 0, "configClientRes" }, + { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.errorInd), + (ASN_TAG_CLASS_CONTEXT | (16 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ErrorInd, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "errorInd" + }, { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.setAtrReq), (ASN_TAG_CLASS_CONTEXT | (10 << 2)), -1, /* IMPLICIT tag at current level */ @@ -163,12 +172,13 @@ static const asn_TYPE_tag2member_t asn_MAP_RsproPDUchoice_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* removeMappingRes */ { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* configClientReq */ { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* configClientRes */ - { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* setAtrReq */ - { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* setAtrRes */ - { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* tpduModemToCard */ - { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* tpduCardToModem */ - { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* clientSlotStatusInd */ - { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 } /* bankSlotStatusInd */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 11, 0, 0 }, /* setAtrReq */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 12, 0, 0 }, /* setAtrRes */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 13, 0, 0 }, /* tpduModemToCard */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 14, 0, 0 }, /* tpduCardToModem */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 15, 0, 0 }, /* clientSlotStatusInd */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 16, 0, 0 }, /* bankSlotStatusInd */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 10, 0, 0 } /* errorInd */ }; static asn_CHOICE_specifics_t asn_SPC_RsproPDUchoice_specs_1 = { sizeof(struct RsproPDUchoice), @@ -176,9 +186,9 @@ static asn_CHOICE_specifics_t asn_SPC_RsproPDUchoice_specs_1 = { offsetof(struct RsproPDUchoice, present), sizeof(((struct RsproPDUchoice *)0)->present), asn_MAP_RsproPDUchoice_tag2el_1, - 16, /* Count of tags in the map */ + 17, /* Count of tags in the map */ 0, - 16 /* Extensions start */ + 17 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_RsproPDUchoice = { "RsproPDUchoice", @@ -199,7 +209,7 @@ asn_TYPE_descriptor_t asn_DEF_RsproPDUchoice = { 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_RsproPDUchoice_1, - 16, /* Elements count */ + 17, /* Elements count */ &asn_SPC_RsproPDUchoice_specs_1 /* Additional specs */ };