Change in libosmo-sccp[master]: sccp: Add value_string for SCCP message types

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Jan 16 17:24:37 UTC 2020


pespin has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/96/16896/1

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..efe9aca
--- /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[] = {
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_CR),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_CC),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_CREF),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_RLSD),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_RLC),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_DT1),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_DT2),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_AK),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_UDT),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_UDTS),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_ED),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_EA),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_RSR),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_RSC),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_ERR),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_IT),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_XUDT),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_XUDTS),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_LUDT),
+	OSMO_VALUE_STRING(SCCP_MSG_TYPE_LUDTS),
+	{}
+};

-- 
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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200116/c249fe1f/attachment.htm>


More information about the gerrit-log mailing list