Add helper function to convert numerical BSSGP PDU type to string

This commit is contained in:
Max 2016-03-09 12:29:23 +01:00 committed by Harald Welte
parent e859aec952
commit c0d9a6c083
2 changed files with 47 additions and 0 deletions

View File

@ -14,6 +14,7 @@ extern struct gprs_ns_inst *bssgp_nsi;
struct msgb *bssgp_msgb_alloc(void);
struct msgb *bssgp_msgb_copy(const struct msgb *msg, const char *name);
const char *bssgp_cause_str(enum gprs_bssgp_cause cause);
const char *bssgp_pdu_str(enum bssgp_pdu_type pdu);
/* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */
int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei,
uint16_t bvci, uint16_t ns_bvci);

View File

@ -62,11 +62,57 @@ static const struct value_string bssgp_cause_strings[] = {
{ 0, NULL },
};
static const struct value_string bssgp_pdu_strings[] = {
{ BSSGP_PDUT_DL_UNITDATA, "DL-UNITDATA" },
{ BSSGP_PDUT_UL_UNITDATA, "UL-UNITDATA" },
{ BSSGP_PDUT_RA_CAPABILITY, "RA-CAPABILITY" },
{ BSSGP_PDUT_PTM_UNITDATA, "PTM-UNITDATA" },
{ BSSGP_PDUT_PAGING_PS, "PAGING-PS" },
{ BSSGP_PDUT_PAGING_CS, "PAGING-CS" },
{ BSSGP_PDUT_RA_CAPA_UDPATE, "RA-CAPABILITY-UPDATE" },
{ BSSGP_PDUT_RA_CAPA_UPDATE_ACK, "RA-CAPABILITY-UPDATE-ACK" },
{ BSSGP_PDUT_RADIO_STATUS, "RADIO-STATUS" },
{ BSSGP_PDUT_SUSPEND, "SUSPEND" },
{ BSSGP_PDUT_SUSPEND_ACK, "SUSPEND-ACK" },
{ BSSGP_PDUT_SUSPEND_NACK, "SUSPEND-NACK" },
{ BSSGP_PDUT_RESUME, "RESUME" },
{ BSSGP_PDUT_RESUME_ACK, "RESUME-ACK" },
{ BSSGP_PDUT_RESUME_NACK, "RESUME-NACK" },
{ BSSGP_PDUT_BVC_BLOCK, "BVC-BLOCK" },
{ BSSGP_PDUT_BVC_BLOCK_ACK, "BVC-BLOCK-ACK" },
{ BSSGP_PDUT_BVC_RESET, "BVC-RESET" },
{ BSSGP_PDUT_BVC_RESET_ACK, "BVC-RESET-ACK" },
{ BSSGP_PDUT_BVC_UNBLOCK, "BVC-UNBLOCK" },
{ BSSGP_PDUT_BVC_UNBLOCK_ACK, "BVC-UNBLOCK-ACK" },
{ BSSGP_PDUT_FLOW_CONTROL_BVC, "FLOW-CONTROL-BVC" },
{ BSSGP_PDUT_FLOW_CONTROL_BVC_ACK, "FLOW-CONTROL-BVC-ACK" },
{ BSSGP_PDUT_FLOW_CONTROL_MS, "FLOW-CONTROL-MS" },
{ BSSGP_PDUT_FLOW_CONTROL_MS_ACK, "FLOW-CONTROL-MS-ACK" },
{ BSSGP_PDUT_FLUSH_LL, "FLUSH-LL" },
{ BSSGP_PDUT_FLUSH_LL_ACK, "FLUSH-LL-ACK" },
{ BSSGP_PDUT_LLC_DISCARD, "LLC DISCARDED" },
{ BSSGP_PDUT_SGSN_INVOKE_TRACE, "SGSN-INVOKE-TRACE" },
{ BSSGP_PDUT_STATUS, "STATUS" },
{ BSSGP_PDUT_DOWNLOAD_BSS_PFC, "DOWNLOAD-BSS-PFC" },
{ BSSGP_PDUT_CREATE_BSS_PFC, "CREATE-BSS-PFC" },
{ BSSGP_PDUT_CREATE_BSS_PFC_ACK, "CREATE-BSS-PFC-ACK" },
{ BSSGP_PDUT_CREATE_BSS_PFC_NACK, "CREATE-BSS-PFC-NACK" },
{ BSSGP_PDUT_MODIFY_BSS_PFC, "MODIFY-BSS-PFC" },
{ BSSGP_PDUT_MODIFY_BSS_PFC_ACK, "MODIFY-BSS-PFC-ACK" },
{ BSSGP_PDUT_DELETE_BSS_PFC, "DELETE-BSS-PFC" },
{ BSSGP_PDUT_DELETE_BSS_PFC_ACK, "DELETE-BSS-PFC-ACK" },
{ 0, NULL },
};
const char *bssgp_cause_str(enum gprs_bssgp_cause cause)
{
return get_value_string(bssgp_cause_strings, cause);
}
const char *bssgp_pdu_str(enum bssgp_pdu_type pdu)
{
return get_value_string(bssgp_pdu_strings, pdu);
}
struct msgb *bssgp_msgb_alloc(void)
{