rspro_util: Add functions to generate TDPU transfer messages

Change-Id: I35daf740724e4914b09e3c7eaaac4f933116f48d
laforge/bankd-fsm-mistake
Harald Welte 4 years ago
parent 84ba234c2c
commit 5d16b1c865
  1. 30
      src/rspro_util.c
  2. 4
      src/rspro_util.h

@ -155,3 +155,33 @@ RsproPDU_t *rspro_gen_SetAtrReq(uint16_t client_id, uint16_t slot_nr, const uint
return pdu;
}
RsproPDU_t *rspro_gen_TpduModem2Card(const ClientSlot_t *client, const BankSlot_t *bank,
const uint8_t *tpdu, unsigned int tpdu_len)
{
RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
if (!pdu)
return NULL;
pdu->msg.present = RsproPDUchoice_PR_tpduModemToCard;
pdu->msg.choice.tpduModemToCard.fromClientSlot = *client;
pdu->msg.choice.tpduModemToCard.toBankSlot = *bank;
/* TODO: flags? */
OCTET_STRING_fromBuf(&pdu->msg.choice.tpduModemToCard.data, (const char *)tpdu, tpdu_len);
return pdu;
}
RsproPDU_t *rspro_gen_TpduCard2Modem(const BankSlot_t *bank, const ClientSlot_t *client,
const uint8_t *tpdu, unsigned int tpdu_len)
{
RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
if (!pdu)
return NULL;
pdu->msg.present = RsproPDUchoice_PR_tpduCardToModem;
pdu->msg.choice.tpduCardToModem.fromBankSlot = *bank;
pdu->msg.choice.tpduCardToModem.toClientSlot = *client;
/* TODO: flags? */
OCTET_STRING_fromBuf(&pdu->msg.choice.tpduCardToModem.data, (const char *)tpdu, tpdu_len);
return pdu;
}

@ -27,3 +27,7 @@ RsproPDU_t *rspro_gen_CreateMappingReq(const ClientSlot_t *client, const BankSlo
RsproPDU_t *rspro_gen_ConfigClientReq(const ClientSlot_t *client, uint32_t ip, uint16_t port);
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,
const uint8_t *tpdu, unsigned int tpdu_len);
RsproPDU_t *rspro_gen_TpduCard2Modem(const BankSlot_t *bank, const ClientSlot_t *client,
const uint8_t *tpdu, unsigned int tpdu_len);

Loading…
Cancel
Save