RSPRO: split ConfigClient into ConfigClientId and ConfigClientBank

The point is that the ClientId is only set once at start-up (and
also only optionally), while the Bank IP/port/ID/slot can be changed
any number of times during a RSPRO connection.

Change-Id: Ic76207c7dd7c18fe93bc5133b29c5f9438a9fb0e
This commit is contained in:
Harald Welte 2019-03-11 22:09:50 +01:00
parent 19f881a373
commit d571a3e2e1
25 changed files with 493 additions and 207 deletions

View File

@ -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,

View File

@ -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 <asn_application.h>
/* Including external dependencies */
#include <osmocom/rspro/BankSlot.h>
#include <osmocom/rspro/IpPort.h>
#include <constr_SEQUENCE.h>
#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 <asn_internal.h>

View File

@ -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 <asn_application.h>
/* Including external dependencies */
#include <osmocom/rspro/ResultCode.h>
#include <constr_SEQUENCE.h>
#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 <asn_internal.h>

View File

@ -4,25 +4,23 @@
* found in "../../asn1/RSPRO.asn"
*/
#ifndef _ConfigClientReq_H_
#define _ConfigClientReq_H_
#ifndef _ConfigClientIdReq_H_
#define _ConfigClientIdReq_H_
#include <asn_application.h>
/* Including external dependencies */
#include <osmocom/rspro/ClientSlot.h>
#include <osmocom/rspro/IpPort.h>
#include <constr_SEQUENCE.h>
#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 <asn_internal.h>

View File

@ -4,8 +4,8 @@
* found in "../../asn1/RSPRO.asn"
*/
#ifndef _ConfigClientRes_H_
#define _ConfigClientRes_H_
#ifndef _ConfigClientIdRes_H_
#define _ConfigClientIdRes_H_
#include <asn_application.h>
@ -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 <asn_internal.h>

View File

@ -12,9 +12,9 @@
/* Including external dependencies */
#include <osmocom/rspro/ComponentType.h>
#include "ErrorSeverity.h"
#include "ErrorCode.h"
#include "ErrorString.h"
#include <osmocom/rspro/ErrorSeverity.h>
#include <osmocom/rspro/ErrorCode.h>
#include <osmocom/rspro/ErrorString.h>
#include <constr_SEQUENCE.h>
#ifdef __cplusplus

View File

@ -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 \

View File

@ -19,9 +19,11 @@
#include <osmocom/rspro/CreateMappingRes.h>
#include <osmocom/rspro/RemoveMappingReq.h>
#include <osmocom/rspro/RemoveMappingRes.h>
#include <osmocom/rspro/ConfigClientReq.h>
#include <osmocom/rspro/ConfigClientRes.h>
#include "ErrorInd.h"
#include <osmocom/rspro/ConfigClientIdReq.h>
#include <osmocom/rspro/ConfigClientIdRes.h>
#include <osmocom/rspro/ConfigClientBankReq.h>
#include <osmocom/rspro/ConfigClientBankRes.h>
#include <osmocom/rspro/ErrorInd.h>
#include <osmocom/rspro/SetAtrReq.h>
#include <osmocom/rspro/SetAtrRes.h>
#include <osmocom/rspro/TpduModemToCard.h>
@ -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;

View File

@ -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:

View File

@ -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 */
};

View File

@ -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 */
};

View File

@ -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 */
};

View File

@ -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 */
};

View File

@ -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 <osmocom/rspro/ConfigClientReq.h>
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 */
};

View File

@ -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 <osmocom/rspro/ConfigClientRes.h>
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 */
};

View File

@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
#include "ErrorCode.h"
#include <osmocom/rspro/ErrorCode.h>
int
ErrorCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr,

View File

@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
#include "ErrorInd.h"
#include <osmocom/rspro/ErrorInd.h>
static asn_TYPE_member_t asn_MBR_ErrorInd_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ErrorInd, sender),

View File

@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
#include "ErrorSeverity.h"
#include <osmocom/rspro/ErrorSeverity.h>
int
ErrorSeverity_constraint(asn_TYPE_descriptor_t *td, const void *sptr,

View File

@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
#include "ErrorString.h"
#include <osmocom/rspro/ErrorString.h>
static int check_permitted_alphabet_1(const void *sptr) {
/* The underlying type is IA5String */

View File

@ -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 \

View File

@ -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 */
};

View File

@ -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;
}

View File

@ -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,

View File

@ -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:

View File

@ -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: