laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16896 )
Change subject: sccp: Add value_string for SCCP message types ...................................................................... sccp: Add value_string for SCCP message types Change-Id: Ibf3ee4be88a4ca633a01fad08d4c714bfa9008bc --- M include/osmocom/sccp/sccp_types.h M src/Makefile.am M src/sccp2sua.c A src/sccp_types.c 4 files changed, 36 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/include/osmocom/sccp/sccp_types.h b/include/osmocom/sccp/sccp_types.h index 18b54f4..71cbb0f 100644 --- a/include/osmocom/sccp/sccp_types.h +++ b/include/osmocom/sccp/sccp_types.h @@ -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 @@ 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, diff --git a/src/Makefile.am b/src/Makefile.am index 4ef753c..484886c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,7 @@ 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_' diff --git a/src/sccp2sua.c b/src/sccp2sua.c index f68f9a9..7e6b3a3 100644 --- a/src/sccp2sua.c +++ b/src/sccp2sua.c @@ -1341,6 +1341,10 @@ 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]); diff --git a/src/sccp_types.c b/src/sccp_types.c new file mode 100644 index 0000000..c6e24cc --- /dev/null +++ b/src/sccp_types.c @@ -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" }, + {} +}; -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16896 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: Ibf3ee4be88a4ca633a01fad08d4c714bfa9008bc Gerrit-Change-Number: 16896 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-MessageType: merged