summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-16 18:06:05 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-17 14:38:22 +0100
commitd3e28faa35ff60737347dd5194ea852b5d799356 (patch)
tree1571f08dd3d170d03e10c1d694ffc508fed24ea6
parent61d890f88f1a46131ed75a95020756e4c8b29eb2 (diff)
sccp: Add value_string for SCCP message types
-rw-r--r--include/osmocom/sccp/sccp_types.h5
-rw-r--r--src/Makefile.am2
-rw-r--r--src/sccp2sua.c4
-rw-r--r--src/sccp_types.c26
4 files changed, 36 insertions, 1 deletions
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 @@ 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,
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 @@ 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_'
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 @@ 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]);
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" },
+ {}
+};