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
Review at https://gerrit.osmocom.org/2258
Add osmo_ss7_find_free_rctx() function to get unused rctx
Change-Id: I0186e25a1b3a325c6b0e3f50ef1590c4de6dbef6
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
2 files changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/58/2258/1
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index b8fab99..527efb8 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -15,6 +15,7 @@
struct osmo_mtp_prim;
int osmo_ss7_init(void);
+int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst);
bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc);
int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str);
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index d569475..5790356 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -53,6 +53,7 @@
static LLIST_HEAD(ss7_instances);
static LLIST_HEAD(ss7_xua_servers);
+static int32_t next_rctx = 1;
struct value_string osmo_ss7_as_traffic_mode_vals[] = {
{ OSMO_SS7_AS_TMOD_BCAST, "broadcast" },
@@ -72,6 +73,16 @@
#define LOGSS7(inst, level, fmt, args ...) \
LOGP(DLSS7, level, "%u: " fmt, (inst)->cfg.id, ## args)
+int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst)
+{
+ int32_t rctx;
+
+ for (rctx = next_rctx; rctx; rctx = ++next_rctx) {
+ if (!osmo_ss7_as_find_by_rctx(inst, next_rctx))
+ return rctx;
+ }
+ return -1;
+}
/***********************************************************************
* SS7 Point Code Parsing / Printing
--
To view, visit https://gerrit.osmocom.org/2258
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0186e25a1b3a325c6b0e3f50ef1590c4de6dbef6
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>