[PATCH] libosmo-sccp[master]: sccp: drive local address from given sccp instance

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

dexter gerrit-no-reply at lists.osmocom.org
Fri Jul 21 14:26:44 UTC 2017


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

sccp: drive local address from given sccp instance

The most important parts of an SCCP address are the routing
indicator and the pointcode. The latter one is always available
via the SS7 instance, so a basic local address can be derived
from there.

Add function osmo_sccp_local_addr_by_instance() to derive a basic
local SCCP address from a given SCCP instance

Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_user.c
2 files changed, 24 insertions(+), 0 deletions(-)


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

diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h
index 2258b0d..9cfdeb2 100644
--- a/include/osmocom/sigtran/sccp_sap.h
+++ b/include/osmocom/sigtran/sccp_sap.h
@@ -253,3 +253,6 @@
 
 char * osmo_sccp_name_by_addr(const struct osmo_sccp_addr *addr,
 			      const struct osmo_ss7_instance *ss7);
+
+void osmo_sccp_local_addr_by_instance(struct osmo_sccp_addr *dest_addr,
+				     const struct osmo_sccp_instance *inst);
diff --git a/src/sccp_user.c b/src/sccp_user.c
index c9443a2..d23cdef 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -22,6 +22,7 @@
  */
 
 #include <stdbool.h>
+#include <string.h>
 
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/logging.h>
@@ -231,6 +232,26 @@
 	talloc_free(inst);
 }
 
+/*! \brief derive a basic local SCCP-Address from a given SCCP instance.
+ *  \param[out] dest_addr pointer to output address memory
+ *  \param[in] inst SCCP instance */
+void osmo_sccp_local_addr_by_instance(struct osmo_sccp_addr *dest_addr,
+				      const struct osmo_sccp_instance *inst)
+{
+	struct osmo_ss7_instance *ss7;
+
+	OSMO_ASSERT(dest_addr);
+	OSMO_ASSERT(inst);
+	ss7 = inst->ss7;
+	OSMO_ASSERT(ss7);
+
+	memset(dest_addr, 0, sizeof(*dest_addr));
+
+	dest_addr->ri = OSMO_SCCP_RI_SSN_PC;
+	dest_addr->presence |= OSMO_SCCP_ADDR_T_PC;
+	dest_addr->pc = ss7->cfg.primary_pc;
+}
+
 /***********************************************************************
  * Convenience function for CLIENT
  ***********************************************************************/

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list