osmith submitted this change.

View Change

Approvals: osmith: Looks good to me, approved; Verified pespin: Looks good to me, but someone else must approve
Add osmo_ss7 APIs

Prepare OsmoHNBGW to work with newer versions of libosmo-sigtran, where
struct osmo_ss7_instance was made private. Ensure the APIs are always
present even if building with older libosmo-sigtran, so we can apply a
patch that switches over to using these APIs instead of accessing the
struct directly.

Related: OS#6617
Change-Id: I9e53953bc56fc5920eefb0a39dbf1e0b9843e00e
---
M configure.ac
M include/osmocom/hnbgw/hnbgw.h
2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7fe12de..7a5effd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,6 +240,18 @@
echo "$m no ($f not in $h)"
fi

+# OS#6617: check if libosmo-sigtran has private structs
+# We need to use grep here, can't set the includedir with AC_CHECK_DECL.
+m="OS#6617: checking whether libosmo-sigtran has private structs..."
+h="$($PKG_CONFIG --variable=includedir libosmo-sigtran)/osmocom/sigtran/osmo_ss7.h"
+f=osmo_ss7_instance_get_primary_pc
+if grep -q "$f" "$h"; then
+ echo "$m yes ($f in $h)"
+ AC_DEFINE(SIGTRAN_PRIVATE_STRUCTS, [1], ["OS#6617"])
+else
+ echo "$m no ($f not in $h)"
+fi
+
dnl Generate the output
AM_CONFIG_HEADER(config.h)

diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index caaff5f..58eb512 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -1,5 +1,8 @@
#pragma once

+/* This is fine because hnbgw.h is in noinst_HEADERS in Makefile.am */
+#include "config.h"
+
#include <osmocom/core/select.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/hashtable.h>
@@ -325,6 +328,23 @@
return cnlink && cnlink->pool->domain == DOMAIN_PS;
}

+#ifndef SIGTRAN_PRIVATE_STRUCTS
+static inline struct osmo_sccp_instance *osmo_ss7_get_sccp(const struct osmo_ss7_instance *inst)
+{
+ return inst->sccp;
+}
+
+static inline uint32_t osmo_ss7_instance_get_primary_pc(const struct osmo_ss7_instance *inst)
+{
+ return inst->cfg.primary_pc;
+}
+
+static inline uint32_t osmo_ss7_instance_get_id(const struct osmo_ss7_instance *inst)
+{
+ return inst->cfg.id;
+}
+#endif
+
static inline struct osmo_sccp_instance *cnlink_sccp(const struct hnbgw_cnlink *cnlink)
{
if (!cnlink)

To view, visit change 38736. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: osmith/1.6.2
Gerrit-Change-Id: I9e53953bc56fc5920eefb0a39dbf1e0b9843e00e
Gerrit-Change-Number: 38736
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>