diff --git a/asn1/RSPRO.asn b/asn1/RSPRO.asn index e0dde2b..65152ec 100644 --- a/asn1/RSPRO.asn +++ b/asn1/RSPRO.asn @@ -221,19 +221,31 @@ RemoveMappingRes ::= SEQUENCE { ... } --- SERVER->CLIENT: set configuration (client ID and BANK IP/Port) -ConfigClientReq ::= SEQUENCE { +-- SERVER->CLIENT: set Client ID +ConfigClientIdReq ::= SEQUENCE { -- server-allocated assignment of a client ID clientSlot ClientSlot, + ... +} +ConfigClientIdRes ::= SEQUENCE { + result ResultCode, + ... +} + +-- SERVER->CLIENT: set BankId/Slot and IP/Port +ConfigClientBankReq ::= SEQUENCE { + -- server-allocated assignment of a client ID + bankSlot BankSlot, -- bank to which the client shall connect bankd IpPort, ... } -ConfigClientRes ::= SEQUENCE { +ConfigClientBankRes ::= SEQUENCE { result ResultCode, ... } + -- BANKD->CLIENT: configure the ATR which the card emulator (client) shall send to the modem SetAtrReq ::= SEQUENCE { slot ClientSlot, @@ -311,8 +323,10 @@ RsproPDUchoice ::= CHOICE { createMappingRes [5] CreateMappingRes, removeMappingReq [6] RemoveMappingReq, removeMappingRes [7] RemoveMappingRes, - configClientReq [8] ConfigClientReq, - configClientRes [9] ConfigClientRes, + configClientIdReq [8] ConfigClientIdReq, + configClientIdRes [9] ConfigClientIdRes, + configClientBankReq [17] ConfigClientBankReq, + configClientBankRes [18] ConfigClientBankRes, errorInd [16] ErrorInd, -- APDUs etc. setAtrReq [10] SetAtrReq, diff --git a/include/osmocom/rspro/ConfigClientBankReq.h b/include/osmocom/rspro/ConfigClientBankReq.h new file mode 100644 index 0000000..4856a45 --- /dev/null +++ b/include/osmocom/rspro/ConfigClientBankReq.h @@ -0,0 +1,43 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#ifndef _ConfigClientBankReq_H_ +#define _ConfigClientBankReq_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ConfigClientBankReq */ +typedef struct ConfigClientBankReq { + BankSlot_t bankSlot; + IpPort_t bankd; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ConfigClientBankReq_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ConfigClientBankReq; + +#ifdef __cplusplus +} +#endif + +#endif /* _ConfigClientBankReq_H_ */ +#include diff --git a/include/osmocom/rspro/ConfigClientBankRes.h b/include/osmocom/rspro/ConfigClientBankRes.h new file mode 100644 index 0000000..b3719f5 --- /dev/null +++ b/include/osmocom/rspro/ConfigClientBankRes.h @@ -0,0 +1,41 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#ifndef _ConfigClientBankRes_H_ +#define _ConfigClientBankRes_H_ + + +#include + +/* Including external dependencies */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ConfigClientBankRes */ +typedef struct ConfigClientBankRes { + ResultCode_t result; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ConfigClientBankRes_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ConfigClientBankRes; + +#ifdef __cplusplus +} +#endif + +#endif /* _ConfigClientBankRes_H_ */ +#include diff --git a/include/osmocom/rspro/ConfigClientReq.h b/include/osmocom/rspro/ConfigClientIdReq.h similarity index 67% rename from include/osmocom/rspro/ConfigClientReq.h rename to include/osmocom/rspro/ConfigClientIdReq.h index 73a6768..f8bdce0 100644 --- a/include/osmocom/rspro/ConfigClientReq.h +++ b/include/osmocom/rspro/ConfigClientIdReq.h @@ -4,25 +4,23 @@ * found in "../../asn1/RSPRO.asn" */ -#ifndef _ConfigClientReq_H_ -#define _ConfigClientReq_H_ +#ifndef _ConfigClientIdReq_H_ +#define _ConfigClientIdReq_H_ #include /* Including external dependencies */ #include -#include #include #ifdef __cplusplus extern "C" { #endif -/* ConfigClientReq */ -typedef struct ConfigClientReq { +/* ConfigClientIdReq */ +typedef struct ConfigClientIdReq { ClientSlot_t clientSlot; - IpPort_t bankd; /* * This type is extensible, * possible extensions are below. @@ -30,14 +28,14 @@ typedef struct ConfigClientReq { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; -} ConfigClientReq_t; +} ConfigClientIdReq_t; /* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_ConfigClientReq; +extern asn_TYPE_descriptor_t asn_DEF_ConfigClientIdReq; #ifdef __cplusplus } #endif -#endif /* _ConfigClientReq_H_ */ +#endif /* _ConfigClientIdReq_H_ */ #include diff --git a/include/osmocom/rspro/ConfigClientRes.h b/include/osmocom/rspro/ConfigClientIdRes.h similarity index 70% rename from include/osmocom/rspro/ConfigClientRes.h rename to include/osmocom/rspro/ConfigClientIdRes.h index 96c4441..1b33620 100644 --- a/include/osmocom/rspro/ConfigClientRes.h +++ b/include/osmocom/rspro/ConfigClientIdRes.h @@ -4,8 +4,8 @@ * found in "../../asn1/RSPRO.asn" */ -#ifndef _ConfigClientRes_H_ -#define _ConfigClientRes_H_ +#ifndef _ConfigClientIdRes_H_ +#define _ConfigClientIdRes_H_ #include @@ -18,8 +18,8 @@ extern "C" { #endif -/* ConfigClientRes */ -typedef struct ConfigClientRes { +/* ConfigClientIdRes */ +typedef struct ConfigClientIdRes { ResultCode_t result; /* * This type is extensible, @@ -28,14 +28,14 @@ typedef struct ConfigClientRes { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; -} ConfigClientRes_t; +} ConfigClientIdRes_t; /* Implementation */ -extern asn_TYPE_descriptor_t asn_DEF_ConfigClientRes; +extern asn_TYPE_descriptor_t asn_DEF_ConfigClientIdRes; #ifdef __cplusplus } #endif -#endif /* _ConfigClientRes_H_ */ +#endif /* _ConfigClientIdRes_H_ */ #include diff --git a/include/osmocom/rspro/ErrorInd.h b/include/osmocom/rspro/ErrorInd.h index 48bddf7..eb32ac8 100644 --- a/include/osmocom/rspro/ErrorInd.h +++ b/include/osmocom/rspro/ErrorInd.h @@ -12,9 +12,9 @@ /* Including external dependencies */ #include -#include "ErrorSeverity.h" -#include "ErrorCode.h" -#include "ErrorString.h" +#include +#include +#include #include #ifdef __cplusplus diff --git a/include/osmocom/rspro/Makefile.am b/include/osmocom/rspro/Makefile.am index 41df9dc..4ffaa32 100644 --- a/include/osmocom/rspro/Makefile.am +++ b/include/osmocom/rspro/Makefile.am @@ -9,8 +9,10 @@ noinst_HEADERS = \ ComponentIdentity.h \ ComponentName.h \ ComponentType.h \ - ConfigClientReq.h \ - ConfigClientRes.h \ + ConfigClientIdReq.h \ + ConfigClientIdRes.h \ + ConfigClientBankReq.h \ + ConfigClientBankRes.h \ ConnectBankReq.h \ ConnectBankRes.h \ ConnectClientReq.h \ diff --git a/include/osmocom/rspro/RsproPDUchoice.h b/include/osmocom/rspro/RsproPDUchoice.h index 98a8ca1..d603fa1 100644 --- a/include/osmocom/rspro/RsproPDUchoice.h +++ b/include/osmocom/rspro/RsproPDUchoice.h @@ -19,9 +19,11 @@ #include #include #include -#include -#include -#include "ErrorInd.h" +#include +#include +#include +#include +#include #include #include #include @@ -45,8 +47,10 @@ typedef enum RsproPDUchoice_PR { RsproPDUchoice_PR_createMappingRes, RsproPDUchoice_PR_removeMappingReq, RsproPDUchoice_PR_removeMappingRes, - RsproPDUchoice_PR_configClientReq, - RsproPDUchoice_PR_configClientRes, + RsproPDUchoice_PR_configClientIdReq, + RsproPDUchoice_PR_configClientIdRes, + RsproPDUchoice_PR_configClientBankReq, + RsproPDUchoice_PR_configClientBankRes, RsproPDUchoice_PR_errorInd, RsproPDUchoice_PR_setAtrReq, RsproPDUchoice_PR_setAtrRes, @@ -70,8 +74,10 @@ typedef struct RsproPDUchoice { CreateMappingRes_t createMappingRes; RemoveMappingReq_t removeMappingReq; RemoveMappingRes_t removeMappingRes; - ConfigClientReq_t configClientReq; - ConfigClientRes_t configClientRes; + ConfigClientIdReq_t configClientIdReq; + ConfigClientIdRes_t configClientIdRes; + ConfigClientBankReq_t configClientBankReq; + ConfigClientBankRes_t configClientBankRes; ErrorInd_t errorInd; SetAtrReq_t setAtrReq; SetAtrRes_t setAtrRes; diff --git a/src/remsim_client.c b/src/remsim_client.c index 7cb05a9..b31a849 100644 --- a/src/remsim_client.c +++ b/src/remsim_client.c @@ -129,19 +129,26 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu) rspro_comp_id_retrieve(&srvc->peer_comp_id, &pdu->msg.choice.connectClientRes.identity); osmo_fsm_inst_dispatch(srvc->fi, SRVC_E_CLIENT_CONN_RES, (void *) pdu); break; - case RsproPDUchoice_PR_configClientReq: + case RsproPDUchoice_PR_configClientIdReq: /* store/set the clientID as instructed by the server */ if (!g_client->srv_conn.clslot) g_client->srv_conn.clslot = talloc_zero(g_client, ClientSlot_t); - *g_client->srv_conn.clslot = pdu->msg.choice.configClientReq.clientSlot; + *g_client->srv_conn.clslot = pdu->msg.choice.configClientIdReq.clientSlot; + /* send response to server */ + resp = rspro_gen_ConfigClientIdRes(ResultCode_ok); + server_conn_send_rspro(srvc, resp); + break; + case RsproPDUchoice_PR_configClientBankReq: /* store/set the bankd ip/port as instructed by the server */ osmo_talloc_replace_string(g_client, &g_client->bankd_host, - rspro_IpAddr2str(&pdu->msg.choice.configClientReq.bankd.ip)); - g_client->bankd_port = ntohs(pdu->msg.choice.configClientReq.bankd.port); + rspro_IpAddr2str(&pdu->msg.choice.configClientBankReq.bankd.ip)); + g_client->bankd_port = ntohs(pdu->msg.choice.configClientBankReq.bankd.port); + /* FIXME: Store bankslot */ + //*g_client->srv_conn.bslot = pdu->msg.choice.configClientBankReq.bankSlot; /* instruct bankd FSM to connect */ osmo_fsm_inst_dispatch(g_client->bankd_fi, BDC_E_ESTABLISH, NULL); /* send response to server */ - resp = rspro_gen_ConfigClientRes(ResultCode_ok); + resp = rspro_gen_ConfigClientBankRes(ResultCode_ok); server_conn_send_rspro(srvc, resp); break; default: diff --git a/src/rspro/ConfigClientBankReq.c b/src/rspro/ConfigClientBankReq.c new file mode 100644 index 0000000..f19c9ee --- /dev/null +++ b/src/rspro/ConfigClientBankReq.c @@ -0,0 +1,69 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ConfigClientBankReq.h" + +static asn_TYPE_member_t asn_MBR_ConfigClientBankReq_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ConfigClientBankReq, bankSlot), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_BankSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "bankSlot" + }, + { ATF_NOFLAGS, 0, offsetof(struct ConfigClientBankReq, bankd), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_IpPort, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "bankd" + }, +}; +static const ber_tlv_tag_t asn_DEF_ConfigClientBankReq_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ConfigClientBankReq_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* bankSlot */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* bankd */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ConfigClientBankReq_specs_1 = { + sizeof(struct ConfigClientBankReq), + offsetof(struct ConfigClientBankReq, _asn_ctx), + asn_MAP_ConfigClientBankReq_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_ConfigClientBankReq = { + "ConfigClientBankReq", + "ConfigClientBankReq", + 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_ConfigClientBankReq_tags_1, + sizeof(asn_DEF_ConfigClientBankReq_tags_1) + /sizeof(asn_DEF_ConfigClientBankReq_tags_1[0]), /* 1 */ + asn_DEF_ConfigClientBankReq_tags_1, /* Same as above */ + sizeof(asn_DEF_ConfigClientBankReq_tags_1) + /sizeof(asn_DEF_ConfigClientBankReq_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ConfigClientBankReq_1, + 2, /* Elements count */ + &asn_SPC_ConfigClientBankReq_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ConfigClientBankRes.c b/src/rspro/ConfigClientBankRes.c new file mode 100644 index 0000000..4b3c18a --- /dev/null +++ b/src/rspro/ConfigClientBankRes.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ConfigClientBankRes.h" + +static asn_TYPE_member_t asn_MBR_ConfigClientBankRes_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ConfigClientBankRes, result), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_ResultCode, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "result" + }, +}; +static const ber_tlv_tag_t asn_DEF_ConfigClientBankRes_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ConfigClientBankRes_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* result */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ConfigClientBankRes_specs_1 = { + sizeof(struct ConfigClientBankRes), + offsetof(struct ConfigClientBankRes, _asn_ctx), + asn_MAP_ConfigClientBankRes_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_ConfigClientBankRes = { + "ConfigClientBankRes", + "ConfigClientBankRes", + 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_ConfigClientBankRes_tags_1, + sizeof(asn_DEF_ConfigClientBankRes_tags_1) + /sizeof(asn_DEF_ConfigClientBankRes_tags_1[0]), /* 1 */ + asn_DEF_ConfigClientBankRes_tags_1, /* Same as above */ + sizeof(asn_DEF_ConfigClientBankRes_tags_1) + /sizeof(asn_DEF_ConfigClientBankRes_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ConfigClientBankRes_1, + 1, /* Elements count */ + &asn_SPC_ConfigClientBankRes_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ConfigClientIdReq.c b/src/rspro/ConfigClientIdReq.c new file mode 100644 index 0000000..570013a --- /dev/null +++ b/src/rspro/ConfigClientIdReq.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ConfigClientIdReq.h" + +static asn_TYPE_member_t asn_MBR_ConfigClientIdReq_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ConfigClientIdReq, clientSlot), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_ClientSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "clientSlot" + }, +}; +static const ber_tlv_tag_t asn_DEF_ConfigClientIdReq_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ConfigClientIdReq_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* clientSlot */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ConfigClientIdReq_specs_1 = { + sizeof(struct ConfigClientIdReq), + offsetof(struct ConfigClientIdReq, _asn_ctx), + asn_MAP_ConfigClientIdReq_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_ConfigClientIdReq = { + "ConfigClientIdReq", + "ConfigClientIdReq", + 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_ConfigClientIdReq_tags_1, + sizeof(asn_DEF_ConfigClientIdReq_tags_1) + /sizeof(asn_DEF_ConfigClientIdReq_tags_1[0]), /* 1 */ + asn_DEF_ConfigClientIdReq_tags_1, /* Same as above */ + sizeof(asn_DEF_ConfigClientIdReq_tags_1) + /sizeof(asn_DEF_ConfigClientIdReq_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ConfigClientIdReq_1, + 1, /* Elements count */ + &asn_SPC_ConfigClientIdReq_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ConfigClientIdRes.c b/src/rspro/ConfigClientIdRes.c new file mode 100644 index 0000000..a8b0691 --- /dev/null +++ b/src/rspro/ConfigClientIdRes.c @@ -0,0 +1,59 @@ +/* + * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) + * From ASN.1 module "RSPRO" + * found in "../../asn1/RSPRO.asn" + */ + +#include "ConfigClientIdRes.h" + +static asn_TYPE_member_t asn_MBR_ConfigClientIdRes_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ConfigClientIdRes, result), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_ResultCode, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "result" + }, +}; +static const ber_tlv_tag_t asn_DEF_ConfigClientIdRes_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_ConfigClientIdRes_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* result */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_ConfigClientIdRes_specs_1 = { + sizeof(struct ConfigClientIdRes), + offsetof(struct ConfigClientIdRes, _asn_ctx), + asn_MAP_ConfigClientIdRes_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_ConfigClientIdRes = { + "ConfigClientIdRes", + "ConfigClientIdRes", + 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_ConfigClientIdRes_tags_1, + sizeof(asn_DEF_ConfigClientIdRes_tags_1) + /sizeof(asn_DEF_ConfigClientIdRes_tags_1[0]), /* 1 */ + asn_DEF_ConfigClientIdRes_tags_1, /* Same as above */ + sizeof(asn_DEF_ConfigClientIdRes_tags_1) + /sizeof(asn_DEF_ConfigClientIdRes_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + asn_MBR_ConfigClientIdRes_1, + 1, /* Elements count */ + &asn_SPC_ConfigClientIdRes_specs_1 /* Additional specs */ +}; + diff --git a/src/rspro/ConfigClientReq.c b/src/rspro/ConfigClientReq.c deleted file mode 100644 index 586ac41..0000000 --- a/src/rspro/ConfigClientReq.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) - * From ASN.1 module "RSPRO" - * found in "../../asn1/RSPRO.asn" - */ - -#include - -static asn_TYPE_member_t asn_MBR_ConfigClientReq_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ConfigClientReq, clientSlot), - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_ClientSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* PER is not compiled, use -gen-PER */ - 0, - "clientSlot" - }, - { ATF_NOFLAGS, 0, offsetof(struct ConfigClientReq, bankd), - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_IpPort, - 0, /* Defer constraints checking to the member type */ - 0, /* PER is not compiled, use -gen-PER */ - 0, - "bankd" - }, -}; -static const ber_tlv_tag_t asn_DEF_ConfigClientReq_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static const asn_TYPE_tag2member_t asn_MAP_ConfigClientReq_tag2el_1[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* clientSlot */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* bankd */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_ConfigClientReq_specs_1 = { - sizeof(struct ConfigClientReq), - offsetof(struct ConfigClientReq, _asn_ctx), - asn_MAP_ConfigClientReq_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_ConfigClientReq = { - "ConfigClientReq", - "ConfigClientReq", - 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_ConfigClientReq_tags_1, - sizeof(asn_DEF_ConfigClientReq_tags_1) - /sizeof(asn_DEF_ConfigClientReq_tags_1[0]), /* 1 */ - asn_DEF_ConfigClientReq_tags_1, /* Same as above */ - sizeof(asn_DEF_ConfigClientReq_tags_1) - /sizeof(asn_DEF_ConfigClientReq_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_ConfigClientReq_1, - 2, /* Elements count */ - &asn_SPC_ConfigClientReq_specs_1 /* Additional specs */ -}; - diff --git a/src/rspro/ConfigClientRes.c b/src/rspro/ConfigClientRes.c deleted file mode 100644 index e30fda1..0000000 --- a/src/rspro/ConfigClientRes.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) - * From ASN.1 module "RSPRO" - * found in "../../asn1/RSPRO.asn" - */ - -#include - -static asn_TYPE_member_t asn_MBR_ConfigClientRes_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ConfigClientRes, result), - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), - 0, - &asn_DEF_ResultCode, - 0, /* Defer constraints checking to the member type */ - 0, /* PER is not compiled, use -gen-PER */ - 0, - "result" - }, -}; -static const ber_tlv_tag_t asn_DEF_ConfigClientRes_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static const asn_TYPE_tag2member_t asn_MAP_ConfigClientRes_tag2el_1[] = { - { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* result */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_ConfigClientRes_specs_1 = { - sizeof(struct ConfigClientRes), - offsetof(struct ConfigClientRes, _asn_ctx), - asn_MAP_ConfigClientRes_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_ConfigClientRes = { - "ConfigClientRes", - "ConfigClientRes", - 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_ConfigClientRes_tags_1, - sizeof(asn_DEF_ConfigClientRes_tags_1) - /sizeof(asn_DEF_ConfigClientRes_tags_1[0]), /* 1 */ - asn_DEF_ConfigClientRes_tags_1, /* Same as above */ - sizeof(asn_DEF_ConfigClientRes_tags_1) - /sizeof(asn_DEF_ConfigClientRes_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - asn_MBR_ConfigClientRes_1, - 1, /* Elements count */ - &asn_SPC_ConfigClientRes_specs_1 /* Additional specs */ -}; - diff --git a/src/rspro/ErrorCode.c b/src/rspro/ErrorCode.c index 7b404fc..e603c7a 100644 --- a/src/rspro/ErrorCode.c +++ b/src/rspro/ErrorCode.c @@ -4,7 +4,7 @@ * found in "../../asn1/RSPRO.asn" */ -#include "ErrorCode.h" +#include int ErrorCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, diff --git a/src/rspro/ErrorInd.c b/src/rspro/ErrorInd.c index 63e96d4..47e479a 100644 --- a/src/rspro/ErrorInd.c +++ b/src/rspro/ErrorInd.c @@ -4,7 +4,7 @@ * found in "../../asn1/RSPRO.asn" */ -#include "ErrorInd.h" +#include static asn_TYPE_member_t asn_MBR_ErrorInd_1[] = { { ATF_NOFLAGS, 0, offsetof(struct ErrorInd, sender), diff --git a/src/rspro/ErrorSeverity.c b/src/rspro/ErrorSeverity.c index cae6447..1a33063 100644 --- a/src/rspro/ErrorSeverity.c +++ b/src/rspro/ErrorSeverity.c @@ -4,7 +4,7 @@ * found in "../../asn1/RSPRO.asn" */ -#include "ErrorSeverity.h" +#include int ErrorSeverity_constraint(asn_TYPE_descriptor_t *td, const void *sptr, diff --git a/src/rspro/ErrorString.c b/src/rspro/ErrorString.c index 82c4700..98d0eda 100644 --- a/src/rspro/ErrorString.c +++ b/src/rspro/ErrorString.c @@ -4,7 +4,7 @@ * found in "../../asn1/RSPRO.asn" */ -#include "ErrorString.h" +#include static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ diff --git a/src/rspro/Makefile.am b/src/rspro/Makefile.am index 4d3f18a..91f0f35 100644 --- a/src/rspro/Makefile.am +++ b/src/rspro/Makefile.am @@ -9,8 +9,10 @@ ASN_MODULE_SOURCES = \ ComponentIdentity.c \ ComponentName.c \ ComponentType.c \ - ConfigClientReq.c \ - ConfigClientRes.c \ + ConfigClientIdReq.c \ + ConfigClientIdRes.c \ + ConfigClientBankReq.c \ + ConfigClientBankRes.c \ ConnectBankReq.c \ ConnectBankRes.c \ ConnectClientReq.c \ @@ -52,8 +54,10 @@ ASN_MODULE_INC = \ ComponentIdentity.h \ ComponentName.h \ ComponentType.h \ - ConfigClientReq.h \ - ConfigClientRes.h \ + ConfigClientIdReq.h \ + ConfigClientIdRes.h \ + ConfigClientBankReq.h \ + ConfigClientBankRes.h \ ConnectBankReq.h \ ConnectBankRes.h \ ConnectClientReq.h \ diff --git a/src/rspro/RsproPDUchoice.c b/src/rspro/RsproPDUchoice.c index e842876..a5f7161 100644 --- a/src/rspro/RsproPDUchoice.c +++ b/src/rspro/RsproPDUchoice.c @@ -79,23 +79,41 @@ static asn_TYPE_member_t asn_MBR_RsproPDUchoice_1[] = { 0, "removeMappingRes" }, - { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.configClientReq), + { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.configClientIdReq), (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ - &asn_DEF_ConfigClientReq, + &asn_DEF_ConfigClientIdReq, 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, - "configClientReq" + "configClientIdReq" }, - { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.configClientRes), + { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.configClientIdRes), (ASN_TAG_CLASS_CONTEXT | (9 << 2)), -1, /* IMPLICIT tag at current level */ - &asn_DEF_ConfigClientRes, + &asn_DEF_ConfigClientIdRes, 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, - "configClientRes" + "configClientIdRes" + }, + { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.configClientBankReq), + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ConfigClientBankReq, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "configClientBankReq" + }, + { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.configClientBankRes), + (ASN_TAG_CLASS_CONTEXT | (18 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ConfigClientBankRes, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "configClientBankRes" }, { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.errorInd), (ASN_TAG_CLASS_CONTEXT | (16 << 2)), @@ -170,15 +188,17 @@ static const asn_TYPE_tag2member_t asn_MAP_RsproPDUchoice_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* createMappingRes */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* removeMappingReq */ { (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)), 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 */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* configClientIdReq */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* configClientIdRes */ + { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 13, 0, 0 }, /* setAtrReq */ + { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 14, 0, 0 }, /* setAtrRes */ + { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 15, 0, 0 }, /* tpduModemToCard */ + { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 16, 0, 0 }, /* tpduCardToModem */ + { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 17, 0, 0 }, /* clientSlotStatusInd */ + { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 18, 0, 0 }, /* bankSlotStatusInd */ + { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 12, 0, 0 }, /* errorInd */ + { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 10, 0, 0 }, /* configClientBankReq */ + { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 11, 0, 0 } /* configClientBankRes */ }; static asn_CHOICE_specifics_t asn_SPC_RsproPDUchoice_specs_1 = { sizeof(struct RsproPDUchoice), @@ -186,9 +206,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, - 17, /* Count of tags in the map */ + 19, /* Count of tags in the map */ 0, - 17 /* Extensions start */ + 19 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_RsproPDUchoice = { "RsproPDUchoice", @@ -209,7 +229,7 @@ asn_TYPE_descriptor_t asn_DEF_RsproPDUchoice = { 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_RsproPDUchoice_1, - 17, /* Elements count */ + 19, /* Elements count */ &asn_SPC_RsproPDUchoice_specs_1 /* Additional specs */ }; diff --git a/src/rspro_util.c b/src/rspro_util.c index 271ae86..27bf025 100644 --- a/src/rspro_util.c +++ b/src/rspro_util.c @@ -276,27 +276,51 @@ RsproPDU_t *rspro_gen_RemoveMappingRes(e_ResultCode res) return pdu; } -RsproPDU_t *rspro_gen_ConfigClientReq(const ClientSlot_t *client, uint32_t ip, uint16_t port) +RsproPDU_t *rspro_gen_ConfigClientIReq(const ClientSlot_t *client) { RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu)); if (!pdu) return NULL; pdu->version = 2; - pdu->msg.present = RsproPDUchoice_PR_configClientReq; - pdu->msg.choice.configClientReq.clientSlot = *client; - fill_ip4_port(&pdu->msg.choice.configClientReq.bankd, ip, port); + pdu->msg.present = RsproPDUchoice_PR_configClientIdReq; + pdu->msg.choice.configClientIdReq.clientSlot = *client; return pdu; } -RsproPDU_t *rspro_gen_ConfigClientRes(e_ResultCode res) +RsproPDU_t *rspro_gen_ConfigClientIdRes(e_ResultCode res) { RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu)); if (!pdu) return NULL; pdu->version = 2; - pdu->msg.present = RsproPDUchoice_PR_configClientRes; - pdu->msg.choice.configClientRes.result = res; + pdu->msg.present = RsproPDUchoice_PR_configClientIdRes; + pdu->msg.choice.configClientIdRes.result = res; + + return pdu; +} + +RsproPDU_t *rspro_gen_ConfigClientBankReq(const BankSlot_t *bank, uint32_t ip, uint16_t port) +{ + RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu)); + if (!pdu) + return NULL; + pdu->version = 2; + pdu->msg.present = RsproPDUchoice_PR_configClientBankReq; + pdu->msg.choice.configClientBankReq.bankSlot = *bank; + fill_ip4_port(&pdu->msg.choice.configClientBankReq.bankd, ip, port); + + return pdu; +} + +RsproPDU_t *rspro_gen_ConfigClientBankRes(e_ResultCode res) +{ + RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu)); + if (!pdu) + return NULL; + pdu->version = 2; + pdu->msg.present = RsproPDUchoice_PR_configClientBankRes; + pdu->msg.choice.configClientBankRes.result = res; return pdu; } diff --git a/src/rspro_util.h b/src/rspro_util.h index f8124eb..518b2f0 100644 --- a/src/rspro_util.h +++ b/src/rspro_util.h @@ -31,8 +31,10 @@ RsproPDU_t *rspro_gen_CreateMappingReq(const ClientSlot_t *client, const BankSlo RsproPDU_t *rspro_gen_CreateMappingRes(e_ResultCode res); RsproPDU_t *rspro_gen_RemoveMappingReq(const ClientSlot_t *client, const BankSlot_t *bank); RsproPDU_t *rspro_gen_RemoveMappingRes(e_ResultCode res); -RsproPDU_t *rspro_gen_ConfigClientReq(const ClientSlot_t *client, uint32_t ip, uint16_t port); -RsproPDU_t *rspro_gen_ConfigClientRes(e_ResultCode res); +RsproPDU_t *rspro_gen_ConfigClientIdReq(const ClientSlot_t *client); +RsproPDU_t *rspro_gen_ConfigClientIdRes(e_ResultCode res); +RsproPDU_t *rspro_gen_ConfigClientBankReq(const BankSlot_t *bank, uint32_t ip, uint16_t port); +RsproPDU_t *rspro_gen_ConfigClientBankRes(e_ResultCode res); RsproPDU_t *rspro_gen_SetAtrReq(uint16_t client_id, uint16_t slot_nr, const uint8_t *atr, unsigned int atr_len); RsproPDU_t *rspro_gen_TpduModem2Card(const ClientSlot_t *client, const BankSlot_t *bank, diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c index b593f93..432bc16 100644 --- a/src/server/rspro_server.c +++ b/src/server/rspro_server.c @@ -447,7 +447,7 @@ static int handle_rx_rspro(struct rspro_client_conn *conn, const RsproPDU_t *pdu case RsproPDUchoice_PR_removeMappingRes: osmo_fsm_inst_dispatch(conn->fi, CLNTC_E_REMOVE_MAP_RES, (void *)pdu); break; - case RsproPDUchoice_PR_configClientRes: + case RsproPDUchoice_PR_configClientIdRes: osmo_fsm_inst_dispatch(conn->fi, CLNTC_E_CONFIG_CL_RES, (void *)pdu); break; default: diff --git a/src/simtrace2-remsim_client.c b/src/simtrace2-remsim_client.c index e9568fa..f15bdfe 100644 --- a/src/simtrace2-remsim_client.c +++ b/src/simtrace2-remsim_client.c @@ -619,19 +619,26 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu) rspro_comp_id_retrieve(&srvc->peer_comp_id, &pdu->msg.choice.connectClientRes.identity); osmo_fsm_inst_dispatch(srvc->fi, SRVC_E_CLIENT_CONN_RES, (void *) pdu); break; - case RsproPDUchoice_PR_configClientReq: + case RsproPDUchoice_PR_configClientIdReq: /* store/set the clientID as instructed by the server */ if (!g_client->srv_conn.clslot) g_client->srv_conn.clslot = talloc_zero(g_client, ClientSlot_t); - *g_client->srv_conn.clslot = pdu->msg.choice.configClientReq.clientSlot; + *g_client->srv_conn.clslot = pdu->msg.choice.configClientIdReq.clientSlot; + /* send response to server */ + resp = rspro_gen_ConfigClientIdRes(ResultCode_ok); + server_conn_send_rspro(srvc, resp); + break; + case RsproPDUchoice_PR_configClientBankReq: /* store/set the bankd ip/port as instructed by the server */ osmo_talloc_replace_string(g_client, &g_client->bankd_host, - rspro_IpAddr2str(&pdu->msg.choice.configClientReq.bankd.ip)); - g_client->bankd_port = ntohs(pdu->msg.choice.configClientReq.bankd.port); + rspro_IpAddr2str(&pdu->msg.choice.configClientBankReq.bankd.ip)); + /* FIXME: Store bankslot */ + //g_client->bankd_slot = pdu->msg.choice.configClientBankReq.bankSlot; + g_client->bankd_port = ntohs(pdu->msg.choice.configClientBankReq.bankd.port); /* instruct bankd FSM to connect */ osmo_fsm_inst_dispatch(g_client->bankd_fi, BDC_E_ESTABLISH, NULL); /* send response to server */ - resp = rspro_gen_ConfigClientRes(ResultCode_ok); + resp = rspro_gen_ConfigClientBankRes(ResultCode_ok); server_conn_send_rspro(srvc, resp); break; default: