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

2020-01-17 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/16896 )

Change subject: sccp: Add value_string for SCCP message types
..


Patch Set 2: Code-Review+2


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Fri, 17 Jan 2020 14:58:33 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2020-01-17 Thread laforge
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 
 #include 
+#include 

 /* 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 000..c6e24cc
--- /dev/null
+++ b/src/sccp_types.c
@@ -0,0 +1,26 @@
+#include 
+
+/* 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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


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

2020-01-17 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/16896 )

Change subject: sccp: Add value_string for SCCP message types
..


Patch Set 2: Code-Review+1


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Fri, 17 Jan 2020 14:58:28 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2020-01-17 Thread pespin
Hello laforge, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/libosmo-sccp/+/16896

to look at the new patch set (#2).

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/2
--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


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

2020-01-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/16896 )

Change subject: sccp: Add value_string for SCCP message types
..


Patch Set 1: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/c/libosmo-sccp/+/16896/1/src/sccp_types.c
File src/sccp_types.c:

https://gerrit.osmocom.org/c/libosmo-sccp/+/16896/1/src/sccp_types.c@6
PS1, Line 6:OSMO_VALUE_STRING(SCCP_MSG_TYPE_CC),
I would once again vote for having conscise names as used in the spec 
(CR/CC/...) rather than a lengthy SCCP_MSG_TYPE_CC in the logs.  That kind of 
usage is exactly why I dislike OSMO_VALUE_STRING in many situations.



--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Thu, 16 Jan 2020 20:24:31 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2020-01-16 Thread pespin
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 
 #include 
+#include 

 /* 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 000..efe9aca
--- /dev/null
+++ b/src/sccp_types.c
@@ -0,0 +1,26 @@
+#include 
+
+/* 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 
Gerrit-MessageType: newchange