Add osmo_ss7_find_free_rctx() function to get unused rctx
Change-Id: I0186e25a1b3a325c6b0e3f50ef1590c4de6dbef6
This commit is contained in:
parent
1e25c3a0ac
commit
a40df808d5
|
@ -15,6 +15,7 @@ struct osmo_sccp_instance;
|
|||
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);
|
||||
|
|
|
@ -53,6 +53,7 @@ static bool ss7_initialized = false;
|
|||
|
||||
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 @@ struct value_string osmo_ss7_asp_protocol_vals[] = {
|
|||
#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
|
||||
|
|
Loading…
Reference in New Issue