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

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


Hello Jenkins Builder,

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

    https://gerrit.osmocom.org/1809

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

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, 35 insertions(+), 36 deletions(-)


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

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 8610621..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>
@@ -236,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: newpatchset
Gerrit-Change-Id: I07fa00dd71d8ecdf1542734598fab8ecad5a7b53
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list