diff options
Diffstat (limited to 'src/gsm/gsm48.c')
-rw-r--r-- | src/gsm/gsm48.c | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index d4088977..757a8550 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -697,3 +697,201 @@ const struct value_string gsm48_pdisc_names[] = { OSMO_VALUE_STRING(GSM48_PDISC_USSD), { 0, NULL } }; + +const struct value_string gsm48_rr_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_RR_INIT_REQ), + OSMO_VALUE_STRING(GSM48_MT_RR_ADD_ASS), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS_EXT), + OSMO_VALUE_STRING(GSM48_MT_RR_IMM_ASS_REJ), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_ASS_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_REJECT), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_REQUEST), + OSMO_VALUE_STRING(GSM48_MT_RR_PACKET_ASS), + + OSMO_VALUE_STRING(GSM48_MT_RR_CIPH_M_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_CIPH_M_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_ACK), + OSMO_VALUE_STRING(GSM48_MT_RR_CFG_CHG_REJ), + + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_COMPL), + OSMO_VALUE_STRING(GSM48_MT_RR_ASS_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_CMD), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_COMPL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_FAIL), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_INFO), + OSMO_VALUE_STRING(GSM48_MT_RR_HANDO_INFO), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_ASS_CMD), + + OSMO_VALUE_STRING(GSM48_MT_RR_CELL_CHG_ORDER), + OSMO_VALUE_STRING(GSM48_MT_RR_PDCH_ASS_CMD), + + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_REL), + OSMO_VALUE_STRING(GSM48_MT_RR_PART_REL), + OSMO_VALUE_STRING(GSM48_MT_RR_PART_REL_COMP), + + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_1), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_2), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_REQ_3), + OSMO_VALUE_STRING(GSM48_MT_RR_PAG_RESP), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_NCH), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_FACCH), + OSMO_VALUE_STRING(GSM48_MT_RR_NOTIF_RESP), + OSMO_VALUE_STRING(GSM48_MT_RR_PACKET_NOTIF), + OSMO_VALUE_STRING(GSM48_MT_RR_UTRAN_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_CDMA2K_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_IS_TO_UTRAN_HANDO), + OSMO_VALUE_STRING(GSM48_MT_RR_IS_TO_CDMA2K_HANDO), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_8), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_1), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_3), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_4), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_6), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_7), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2bis), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2ter), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_2quater), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5bis), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_5ter), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_9), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_13), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_16), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_17), + + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_18), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_19), + OSMO_VALUE_STRING(GSM48_MT_RR_SYSINFO_20), + + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_MODE_MODIF), + OSMO_VALUE_STRING(GSM48_MT_RR_STATUS), + OSMO_VALUE_STRING(GSM48_MT_RR_CHAN_MODE_MODIF_ACK), + OSMO_VALUE_STRING(GSM48_MT_RR_FREQ_REDEF), + OSMO_VALUE_STRING(GSM48_MT_RR_MEAS_REP), + OSMO_VALUE_STRING(GSM48_MT_RR_CLSM_CHG), + OSMO_VALUE_STRING(GSM48_MT_RR_CLSM_ENQ), + OSMO_VALUE_STRING(GSM48_MT_RR_EXT_MEAS_REP), + OSMO_VALUE_STRING(GSM48_MT_RR_EXT_MEAS_REP_ORD), + OSMO_VALUE_STRING(GSM48_MT_RR_GPRS_SUSP_REQ), + OSMO_VALUE_STRING(GSM48_MT_RR_DTM_INFO), + + OSMO_VALUE_STRING(GSM48_MT_RR_VGCS_UPL_GRANT), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_RELEASE), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_FREE), + OSMO_VALUE_STRING(GSM48_MT_RR_UPLINK_BUSY), + OSMO_VALUE_STRING(GSM48_MT_RR_TALKER_IND), + { 0, NULL } +}; + +const struct value_string gsm48_mm_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_MM_IMSI_DETACH_IND), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_ACCEPT), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_REJECT), + OSMO_VALUE_STRING(GSM48_MT_MM_LOC_UPD_REQUEST), + + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_REJ), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_RESP), + OSMO_VALUE_STRING(GSM48_MT_MM_AUTH_FAIL), + OSMO_VALUE_STRING(GSM48_MT_MM_ID_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_ID_RESP), + OSMO_VALUE_STRING(GSM48_MT_MM_TMSI_REALL_CMD), + OSMO_VALUE_STRING(GSM48_MT_MM_TMSI_REALL_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_ACC), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_REJ), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_ABORT), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_SERV_PROMPT), + OSMO_VALUE_STRING(GSM48_MT_MM_CM_REEST_REQ), + OSMO_VALUE_STRING(GSM48_MT_MM_ABORT), + + OSMO_VALUE_STRING(GSM48_MT_MM_NULL), + OSMO_VALUE_STRING(GSM48_MT_MM_STATUS), + OSMO_VALUE_STRING(GSM48_MT_MM_INFO), + { 0, NULL } +}; + +const struct value_string gsm48_cc_msgtype_names[] = { + OSMO_VALUE_STRING(GSM48_MT_CC_ALERTING), + OSMO_VALUE_STRING(GSM48_MT_CC_CALL_CONF), + OSMO_VALUE_STRING(GSM48_MT_CC_CALL_PROC), + OSMO_VALUE_STRING(GSM48_MT_CC_CONNECT), + OSMO_VALUE_STRING(GSM48_MT_CC_CONNECT_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_EMERG_SETUP), + OSMO_VALUE_STRING(GSM48_MT_CC_PROGRESS), + OSMO_VALUE_STRING(GSM48_MT_CC_ESTAB), + OSMO_VALUE_STRING(GSM48_MT_CC_ESTAB_CONF), + OSMO_VALUE_STRING(GSM48_MT_CC_RECALL), + OSMO_VALUE_STRING(GSM48_MT_CC_START_CC), + OSMO_VALUE_STRING(GSM48_MT_CC_SETUP), + + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY), + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY_COMPL), + OSMO_VALUE_STRING(GSM48_MT_CC_MODIFY_REJECT), + OSMO_VALUE_STRING(GSM48_MT_CC_USER_INFO), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_HOLD_REJ), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_RETR_REJ), + + OSMO_VALUE_STRING(GSM48_MT_CC_DISCONNECT), + OSMO_VALUE_STRING(GSM48_MT_CC_RELEASE), + OSMO_VALUE_STRING(GSM48_MT_CC_RELEASE_COMPL), + + OSMO_VALUE_STRING(GSM48_MT_CC_CONG_CTRL), + OSMO_VALUE_STRING(GSM48_MT_CC_NOTIFY), + OSMO_VALUE_STRING(GSM48_MT_CC_STATUS), + OSMO_VALUE_STRING(GSM48_MT_CC_STATUS_ENQ), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF), + OSMO_VALUE_STRING(GSM48_MT_CC_STOP_DTMF), + OSMO_VALUE_STRING(GSM48_MT_CC_STOP_DTMF_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF_ACK), + OSMO_VALUE_STRING(GSM48_MT_CC_START_DTMF_REJ), + OSMO_VALUE_STRING(GSM48_MT_CC_FACILITY), + { 0, NULL } +}; + +/*! /brief Compose a string naming the message type for given protocol. + * If the message type string is known, return the message type name, otherwise + * return "<protocol discriminator name>:<message type in hex>". + * /param pdisc[in] protocol discriminator like GSM48_PDISC_MM + * /param msg_type[in] message type like GSM48_MT_MM_LOC_UPD_REQUEST + * /returns statically allocated string or string constant. + */ +const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type) +{ + static char namebuf[64]; + const struct value_string *msgt_names; + + switch (pdisc) { + case GSM48_PDISC_RR: + msgt_names = gsm48_rr_msgtype_names; + break; + case GSM48_PDISC_MM: + msgt_names = gsm48_mm_msgtype_names; + break; + case GSM48_PDISC_CC: + msgt_names = gsm48_cc_msgtype_names; + break; + default: + msgt_names = NULL; + break; + } + + if (msgt_names) + return get_value_string(msgt_names, msg_type); + + snprintf(namebuf, sizeof(namebuf), "%s:0x%02x", + gsm48_pdisc_name(pdisc), msg_type); + return namebuf; +} |