remsim_client: Store and use BankSlot received in ConfigClientBankReq

Change-Id: I6858b68590789d38741e541b9028d2b9b142e0c0
changes/97/13497/1
Harald Welte 4 years ago
parent cf8b89ad84
commit 9cf013a343
  1. 2
      src/client.h
  2. 3
      src/remsim_client.c
  3. 7
      src/simtrace2-remsim_client.c

@ -6,6 +6,7 @@
#include "rspro_util.h"
#include "rspro_client_fsm.h"
#include "slotmap.h"
#include "debug.h"
/* fsm.c */
@ -32,6 +33,7 @@ struct bankd_client {
/* connection to the remsim-bankd */
char *bankd_host;
uint16_t bankd_port;
struct bank_slot bankd_slot;
struct ipa_client_conn *bankd_conn;
struct osmo_fsm_inst *bankd_fi;
};

@ -143,8 +143,7 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu)
osmo_talloc_replace_string(g_client, &g_client->bankd_host,
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;
rspro2bank_slot(&g_client->bankd_slot, &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 */

@ -427,7 +427,9 @@ static int process_do_rx_da(struct cardem_inst *ci, uint8_t *buf, int len)
memcpy(apdu_command + sizeof(ac.hdr), ac.dc, ac.lc.tot); // copy APDU command data
}
// send APDU to card
RsproPDU_t *pdu = rspro_gen_TpduModem2Card(g_client->srv_conn.clslot, &(BankSlot_t){ .bankId = 0, .slotNr = 0}, apdu_command, sizeof(ac.hdr) + ac.lc.tot); // create RSPRO packet
BankSlot_t bslot;
bank_slot2rspro(&bslot, &g_client->bankd_slot);
RsproPDU_t *pdu = rspro_gen_TpduModem2Card(g_client->srv_conn.clslot, &bslot, apdu_command, sizeof(ac.hdr) + ac.lc.tot); // create RSPRO packet
ipa_client_conn_send_rspro(g_client->bankd_conn, pdu); // send RSPRO packet
// the response will come separately
free(apdu_command);
@ -632,8 +634,7 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu)
/* 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.configClientBankReq.bankd.ip));
/* FIXME: Store bankslot */
//g_client->bankd_slot = pdu->msg.choice.configClientBankReq.bankSlot;
rspro2bank_slot(&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);

Loading…
Cancel
Save