Change in libosmo-netif[master]: Introduce sctp.h to provide SCTP related functionalities

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
Wed Nov 24 20:07:00 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/26340 )

Change subject: Introduce sctp.h to provide SCTP related functionalities
......................................................................

Introduce sctp.h to provide SCTP related functionalities

These value_strings are taken from existing private ones in
libosmo-sccp.git osmo_ss7.c, and are moved here in order to be
reused by other projects, such as osmo-hnodeb.

Change-Id: Ica6f01851fb94e31f4ef097494bb1b8a95597ba6
---
M TODO-RELEASE
M include/osmocom/netif/Makefile.am
A include/osmocom/netif/sctp.h
M src/Makefile.am
A src/sctp.c
5 files changed, 50 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved; Verified



diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..1c9a2a6 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public release: c:r:0.
 #library	what		description / commit summary line
+sctp.h          new APIs
diff --git a/include/osmocom/netif/Makefile.am b/include/osmocom/netif/Makefile.am
index 39df08a..d9d030b 100644
--- a/include/osmocom/netif/Makefile.am
+++ b/include/osmocom/netif/Makefile.am
@@ -8,4 +8,8 @@
 		    rtp.h		\
 		    stream.h
 
+if ENABLE_LIBSCTP
+osmonetif_HEADERS += sctp.h
+endif
+
 osmonetifdir = $(includedir)/osmocom/netif
diff --git a/include/osmocom/netif/sctp.h b/include/osmocom/netif/sctp.h
new file mode 100644
index 0000000..2b2e072
--- /dev/null
+++ b/include/osmocom/netif/sctp.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <osmocom/core/utils.h>
+
+enum sctp_sac_state;
+extern const struct value_string osmo_sctp_assoc_chg_strs[];
+static inline const char *osmo_sctp_assoc_chg_str(enum sctp_sac_state val)
+{ return get_value_string(osmo_sctp_assoc_chg_strs, val); }
+
+enum sctp_sn_type;
+extern const struct value_string osmo_sctp_sn_type_strs[];
+static inline const char *osmo_sctp_sn_type_str(enum sctp_sn_type val)
+{ return get_value_string(osmo_sctp_sn_type_strs, val); }
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e71c71..438b58e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,3 +20,7 @@
 			  rs232.c		\
 			  rtp.c			\
 			  stream.c
+
+if ENABLE_LIBSCTP
+libosmonetif_la_SOURCES += sctp.c
+endif
diff --git a/src/sctp.c b/src/sctp.c
new file mode 100644
index 0000000..c24e0f7
--- /dev/null
+++ b/src/sctp.c
@@ -0,0 +1,28 @@
+#include <netinet/sctp.h>
+#include <osmocom/netif/sctp.h>
+
+const struct value_string osmo_sctp_assoc_chg_strs[] = {
+	{ SCTP_COMM_UP,		"COMM_UP" },
+	{ SCTP_COMM_LOST,	"COMM_LOST" },
+	{ SCTP_RESTART,		"RESTART" },
+	{ SCTP_SHUTDOWN_COMP,	"SHUTDOWN_COMP" },
+	{ SCTP_CANT_STR_ASSOC,	"CANT_STR_ASSOC" },
+	{ 0, NULL }
+};
+
+const struct value_string osmo_sctp_sn_type_strs[] = {
+	{ SCTP_ASSOC_CHANGE,		"ASSOC_CHANGE" },
+	{ SCTP_PEER_ADDR_CHANGE,	"PEER_ADDR_CHANGE" },
+	{ SCTP_SHUTDOWN_EVENT, 		"SHUTDOWN_EVENT" },
+	{ SCTP_SEND_FAILED,		"SEND_FAILED" },
+	{ SCTP_REMOTE_ERROR,		"REMOTE_ERROR" },
+	{ SCTP_PARTIAL_DELIVERY_EVENT,	"PARTIAL_DELIVERY_EVENT" },
+	{ SCTP_ADAPTATION_INDICATION,	"ADAPTATION_INDICATION" },
+#ifdef SCTP_AUTHENTICATION_INDICATION
+	{ SCTP_AUTHENTICATION_INDICATION, "AUTHENTICATION_INDICATION" },
+#endif
+#ifdef SCTP_SENDER_DRY_EVENT
+	{ SCTP_SENDER_DRY_EVENT,	"SENDER_DRY_EVENT" },
+#endif
+	{ 0, NULL }
+};

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/26340
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ica6f01851fb94e31f4ef097494bb1b8a95597ba6
Gerrit-Change-Number: 26340
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211124/f1bc3b69/attachment.htm>


More information about the gerrit-log mailing list