Introduce {server,bankd}_conn_send_rspro()

Change-Id: I8cae6f67567dcbf4b6d62fb5a76f5b7134b16f5d
changes/97/13497/1
Harald Welte 4 years ago
parent 3dcdd20343
commit a844bb07d8
  1. 7
      src/bankd_client_fsm.c
  2. 2
      src/client.h
  3. 2
      src/remsim_client.c
  4. 13
      src/rspro_client_fsm.c
  5. 2
      src/rspro_client_fsm.h
  6. 2
      src/simtrace2-remsim_client.c

@ -47,6 +47,11 @@ static void bankd_updown_cb(struct ipa_client_conn *conn, int up)
osmo_fsm_inst_dispatch(bc->bankd_fi, up ? BDC_E_TCP_UP: BDC_E_TCP_DOWN, 0);
}
int bankd_conn_send_rspro(struct bankd_client *bc, RsproPDU_t *rspro)
{
return ipa_client_conn_send_rspro(bc->bankd_conn, rspro);
}
/***********************************************************************
* bankd connection FSM: Remsim Client connection to Bankd
***********************************************************************/
@ -92,7 +97,7 @@ static void bdc_st_established_onenter(struct osmo_fsm_inst *fi, uint32_t prev_s
/* FIXME: Send ClientConnReq */
pdu = rspro_gen_ConnectClientReq(&bc->srv_conn.own_comp_id, bc->srv_conn.clslot);
ipa_client_conn_send_rspro(bc->bankd_conn, pdu);
bankd_conn_send_rspro(bc, pdu);
}
static void bdc_st_established(struct osmo_fsm_inst *fi, uint32_t event, void *data)

@ -36,6 +36,6 @@ struct bankd_client {
struct osmo_fsm_inst *bankd_fi;
};
void ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro);
int bankd_conn_send_rspro(struct bankd_client *bc, RsproPDU_t *pdu);
int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg);
int bankd_conn_fsm_alloc(struct bankd_client *bc);

@ -140,7 +140,7 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu)
osmo_fsm_inst_dispatch(g_client->bankd_fi, BDC_E_ESTABLISH, NULL);
/* send response to server */
resp = rspro_gen_ConfigClientRes(ResultCode_ok);
ipa_client_conn_send_rspro(srvc->conn, resp);
server_conn_send_rspro(srvc, resp);
break;
default:
fprintf(stderr, "Unknown/Unsupported RSPRO PDU type: %u\n", pdu->msg.present);

@ -55,11 +55,18 @@ static void push_and_send(struct ipa_client_conn *ipa, struct msgb *msg_tx)
/* msg_tx is now queued and will be freed. */
}
void ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro)
int ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro)
{
struct msgb *msg = rspro_enc_msg(rspro);
OSMO_ASSERT(msg);
if (!msg)
return -1;
push_and_send(ipa, msg);
return 0;
}
int server_conn_send_rspro(struct rspro_server_conn *srvc, RsproPDU_t *rspro)
{
return ipa_client_conn_send_rspro(srvc->conn, rspro);
}
enum server_conn_fsm_state {
@ -210,7 +217,7 @@ static void srvc_st_established_onenter(struct osmo_fsm_inst *fi, uint32_t prev_
pdu = rspro_gen_ConnectClientReq(&srvc->own_comp_id, srvc->clslot);
else
pdu = rspro_gen_ConnectBankReq(&srvc->own_comp_id, 1, 8 /* FIXME */);
ipa_client_conn_send_rspro(srvc->conn, pdu);
server_conn_send_rspro(srvc, pdu);
}
static void srvc_st_established(struct osmo_fsm_inst *fi, uint32_t event, void *data)

@ -36,4 +36,6 @@ struct rspro_server_conn {
uint16_t server_port;
};
int ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro);
int server_conn_send_rspro(struct rspro_server_conn *srvc, RsproPDU_t *rspro);
int server_conn_fsm_alloc(void *ctx, struct rspro_server_conn *srvc);

@ -632,7 +632,7 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu)
osmo_fsm_inst_dispatch(g_client->bankd_fi, BDC_E_ESTABLISH, NULL);
/* send response to server */
resp = rspro_gen_ConfigClientRes(ResultCode_ok);
ipa_client_conn_send_rspro(srvc->conn, resp);
server_conn_send_rspro(srvc, resp);
break;
default:
fprintf(stderr, "Unknown/Unsupported RSPRO PDU type: %u\n", pdu->msg.present);

Loading…
Cancel
Save