sccp: Add value_string for SCCP message types

Change-Id: Ibf3ee4be88a4ca633a01fad08d4c714bfa9008bc
This commit is contained in:
Pau Espin 2020-01-16 18:06:05 +01:00
parent 61d890f88f
commit d3e28faa35
4 changed files with 36 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include <stdint.h>
#include <osmocom/core/endian.h>
#include <osmocom/core/utils.h>
/* Table 1/Q.713 - SCCP message types */
enum sccp_message_types {
@ -51,6 +52,10 @@ enum sccp_message_types {
SCCP_MSG_TYPE_LUDTS = 20
};
extern const struct value_string osmo_sccp_msg_type_names[];
static inline const char *osmo_sccp_msg_type_name(enum sccp_message_types val)
{ return get_value_string(osmo_sccp_msg_type_names, val); }
/* Table 2/Q.713 - SCCP parameter name codes */
enum sccp_parameter_name_codes {
SCCP_PNC_END_OF_OPTIONAL = 0,

View File

@ -29,7 +29,7 @@ LIBVERSION=5:0:0
libosmo_sigtran_la_SOURCES = sccp_sap.c sua.c m3ua.c xua_msg.c sccp_helpers.c \
sccp2sua.c sccp_scrc.c sccp_sclc.c sccp_scoc.c \
sccp_user.c xua_rkm.c xua_default_lm_fsm.c \
sccp_user.c sccp_types.c xua_rkm.c xua_default_lm_fsm.c \
osmo_ss7.c osmo_ss7_hmrt.c xua_asp_fsm.c xua_as_fsm.c \
osmo_ss7_vty.c sccp_vty.c ipa.c
libosmo_sigtran_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined -export-symbols-regex '^osmo_'

View File

@ -1341,6 +1341,10 @@ struct xua_msg *osmo_sccp_to_xua(struct msgb *msg)
case SCCP_MSG_TYPE_XUDTS:
case SCCP_MSG_TYPE_LUDT:
case SCCP_MSG_TYPE_LUDTS:
LOGP(DLSUA, LOGL_ERROR, "Unsupported SCCP message %s\n",
osmo_sccp_msg_type_name(msg->l2h[0]));
xua_msg_free(xua);
return NULL;
default:
LOGP(DLSUA, LOGL_ERROR, "Unsupported SCCP message type %u\n",
msg->l2h[0]);

26
src/sccp_types.c Normal file
View File

@ -0,0 +1,26 @@
#include <osmocom/sccp/sccp_types.h>
/* Table 1/Q.713 - SCCP message types */
const struct value_string osmo_sccp_msg_type_names[] = {
{ SCCP_MSG_TYPE_CR, "Connection request" },
{ SCCP_MSG_TYPE_CC, "Connection confirm" },
{ SCCP_MSG_TYPE_CREF, "Connection refused" },
{ SCCP_MSG_TYPE_RLSD, "Released" },
{ SCCP_MSG_TYPE_RLC, "Release complete" },
{ SCCP_MSG_TYPE_DT1, "Data form 1" },
{ SCCP_MSG_TYPE_DT2, "Data form 2" },
{ SCCP_MSG_TYPE_AK, "Data acknowledgement" },
{ SCCP_MSG_TYPE_UDT, "Unitdata" },
{ SCCP_MSG_TYPE_UDTS, "Unitdata service" },
{ SCCP_MSG_TYPE_ED, "Expedited data" },
{ SCCP_MSG_TYPE_EA, "Expedited data acknowledgement" },
{ SCCP_MSG_TYPE_RSR, "Reset request" },
{ SCCP_MSG_TYPE_RSC, "Reset confirmation" },
{ SCCP_MSG_TYPE_ERR, "Protocol data unit error" },
{ SCCP_MSG_TYPE_IT, "Inactivity test" },
{ SCCP_MSG_TYPE_XUDT, "Extended unitdata" },
{ SCCP_MSG_TYPE_XUDTS, "Extended unitdata service" },
{ SCCP_MSG_TYPE_LUDT, "Long unitdata" },
{ SCCP_MSG_TYPE_LUDTS, "Long unitdata service" },
{}
};