pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38660?usp=email )
Change subject: sigtran: Add API osmo_ss7_instances_llist_entry
......................................................................
sigtran: Add API osmo_ss7_instances_llist_entry
This API allows iterating over the public global list of ss7 instances,
without knowing the structure internal layout.
Change-Id: I148438aecd64bdd66848d4b3404d379a380c5e9c
---
M TODO-RELEASE
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
3 files changed, 16 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/60/38660/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 366c680..f56b4e5 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -12,3 +12,4 @@
libosmo-sigtran add API osmo_ss7_route_get_dest_as()
libosmo-sigtran Make private osmo_ss7_route
libosmo-sigtran add API osmo_ss7_instance_get_id(), osmo_ss7_instance_get_name(),
osmo_ss7_instance_get_pc_fmt(), osmo_ss7_instance_get_primary_pc(), osmo_ss7_get_sccp()
+libosmo-sigtran add API osmo_ss7_instances_llist_entry()
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 8f22b8a..9da94b3 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -11,9 +11,12 @@
#include <osmocom/core/socket.h>
#include <osmocom/core/rate_ctr.h>
-extern struct llist_head osmo_ss7_instances;
-
struct osmo_ss7_instance;
+
+extern struct llist_head osmo_ss7_instances;
+/* Get an entry pointer from a list item in osmo_ss7_instances: */
+struct osmo_ss7_instance *osmo_ss7_instances_llist_entry(struct llist_head *list);
+
struct osmo_ss7_user;
struct osmo_sccp_instance;
struct osmo_mtp_prim;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index fb9c0fe..2dad013 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -63,6 +63,16 @@
bool ss7_initialized = false;
LLIST_HEAD(osmo_ss7_instances);
+/* This API allows iterating over the public global list of ss7 instances,
+ * without knowing the structure internal layout.
+ */
+struct osmo_ss7_instance *osmo_ss7_instances_llist_entry(struct llist_head *list)
+{
+ struct osmo_ss7_instance *pos;
+ pos = llist_entry((list)->next, typeof(*pos), list);
+ return pos;
+}
+
static int32_t next_rctx = 1;
static int32_t next_l_rk_id = 1;
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38660?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I148438aecd64bdd66848d4b3404d379a380c5e9c
Gerrit-Change-Number: 38660
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>