[PATCH] libosmo-sccp[master]: Move xua_msg_add_sccp_addr() to xua_msg.h and export it

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 13 03:09:49 UTC 2017


Review at  https://gerrit.osmocom.org/1809

Move xua_msg_add_sccp_addr() to xua_msg.h and export it

Change-Id: I07fa00dd71d8ecdf1542734598fab8ecad5a7b53
---
M include/osmocom/sigtran/xua_msg.h
M src/sua.c
M src/xua_msg.c
3 files changed, 36 insertions(+), 36 deletions(-)


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

diff --git a/include/osmocom/sigtran/xua_msg.h b/include/osmocom/sigtran/xua_msg.h
index 4c8fe83..5dc3894 100644
--- a/include/osmocom/sigtran/xua_msg.h
+++ b/include/osmocom/sigtran/xua_msg.h
@@ -24,6 +24,7 @@
 #define XUA_HDR(class, type)	((struct xua_common_hdr) { .spare = 0, .msg_class = (class), .msg_type = (type) })
 
 struct msgb;
+struct osmo_sccp_addr;
 
 struct xua_msg {
 	struct xua_common_hdr hdr;
@@ -60,3 +61,4 @@
 int msgb_t16l16vp_put_u32(struct msgb *msg, uint16_t tag, uint32_t val);
 int xua_msg_add_u32(struct xua_msg *xua, uint16_t iei, uint32_t val);
 uint32_t xua_msg_get_u32(struct xua_msg *xua, uint16_t iei);
+int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr);
diff --git a/src/sua.c b/src/sua.c
index 8bbaa58..cdc2cf0 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -117,42 +117,6 @@
 
 
 /***********************************************************************
- * Message encoding helper functions
- ***********************************************************************/
-
-static int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr)
-{
-	struct msgb *tmp = msgb_alloc(128, "SCCP Address");
-	int rc;
-
-	if (!tmp)
-		return -ENOMEM;
-
-	msgb_put_u16(tmp, SUA_RI_SSN_PC); /* route on SSN + PC */
-	msgb_put_u16(tmp, 7); /* always put all addresses on SCCP side */
-
-	if (addr->presence & OSMO_SCCP_ADDR_T_GT) {
-		/* FIXME */
-	}
-	if (addr->presence & OSMO_SCCP_ADDR_T_PC) {
-		msgb_t16l16vp_put_u32(tmp, SUA_IEI_PC, addr->pc);
-	}
-	if (addr->presence & OSMO_SCCP_ADDR_T_SSN) {
-		msgb_t16l16vp_put_u32(tmp, SUA_IEI_SSN, addr->ssn);
-	}
-	if (addr->presence & OSMO_SCCP_ADDR_T_IPv4) {
-		/* FIXME: IPv4 address */
-	} else if (addr->presence & OSMO_SCCP_ADDR_T_IPv6) {
-		/* FIXME: IPv6 address */
-	}
-	rc = xua_msg_add_data(xua, iei, msgb_length(tmp), tmp->data);
-	msgb_free(tmp);
-
-	return rc;
-}
-
-
-/***********************************************************************
  * SUA Link and Connection handling
  ***********************************************************************/
 
diff --git a/src/xua_msg.c b/src/xua_msg.c
index 21d37ad..3d335d9 100644
--- a/src/xua_msg.c
+++ b/src/xua_msg.c
@@ -17,6 +17,8 @@
  */
 
 #include <osmocom/sigtran/xua_msg.h>
+#include <osmocom/sigtran/protocol/sua.h>
+#include <osmocom/sigtran/sccp_sap.h>
 
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/logging.h>
@@ -25,6 +27,7 @@
 #include <arpa/inet.h>
 
 #include <string.h>
+#include <errno.h>
 
 static void *tall_xua;
 int DXUA = -1;
@@ -235,3 +238,34 @@
 		rc = ntohl(*(uint32_t *)part->dat);
 	return rc;
 }
+
+int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr)
+{
+	struct msgb *tmp = msgb_alloc(128, "SCCP Address");
+	int rc;
+
+	if (!tmp)
+		return -ENOMEM;
+
+	msgb_put_u16(tmp, SUA_RI_SSN_PC); /* route on SSN + PC */
+	msgb_put_u16(tmp, 7); /* always put all addresses on SCCP side */
+
+	if (addr->presence & OSMO_SCCP_ADDR_T_GT) {
+		/* FIXME */
+	}
+	if (addr->presence & OSMO_SCCP_ADDR_T_PC) {
+		msgb_t16l16vp_put_u32(tmp, SUA_IEI_PC, addr->pc);
+	}
+	if (addr->presence & OSMO_SCCP_ADDR_T_SSN) {
+		msgb_t16l16vp_put_u32(tmp, SUA_IEI_SSN, addr->ssn);
+	}
+	if (addr->presence & OSMO_SCCP_ADDR_T_IPv4) {
+		/* FIXME: IPv4 address */
+	} else if (addr->presence & OSMO_SCCP_ADDR_T_IPv6) {
+		/* FIXME: IPv6 address */
+	}
+	rc = xua_msg_add_data(xua, iei, msgb_length(tmp), tmp->data);
+	msgb_free(tmp);
+
+	return rc;
+}

-- 
To view, visit https://gerrit.osmocom.org/1809
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07fa00dd71d8ecdf1542734598fab8ecad5a7b53
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list