fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/35967?usp=email )
Change subject: move osmo_ss7_xua_server_find() to osmo_ss7_xua_srv.c ......................................................................
move osmo_ss7_xua_server_find() to osmo_ss7_xua_srv.c
Change-Id: I4fe2a79115bd630fb7d3f0f8677aa274361afebd Related: SYS#5424 --- M src/osmo_ss7.c M src/osmo_ss7_xua_srv.c 2 files changed, 35 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/67/35967/1
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index dbbef6b..ef958ae 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1054,21 +1054,6 @@ return ss7_asp_alloc(inst, name, remote_port, local_port, proto); }
-struct osmo_xua_server * -osmo_ss7_xua_server_find(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, - uint16_t local_port) -{ - struct osmo_xua_server *xs; - - OSMO_ASSERT(ss7_initialized); - llist_for_each_entry(xs, &inst->xua_servers, list) { - if (proto == xs->cfg.proto && - local_port == xs->cfg.local.port) - return xs; - } - return NULL; -} - bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc) { OSMO_ASSERT(ss7_initialized); diff --git a/src/osmo_ss7_xua_srv.c b/src/osmo_ss7_xua_srv.c index 32266ff..5928bae 100644 --- a/src/osmo_ss7_xua_srv.c +++ b/src/osmo_ss7_xua_srv.c @@ -169,6 +169,31 @@ return rc; }
+/*! \brief find an xUA server with the given parameters + * \param[in] inst SS7 Instance on which we operate + * \param[in] proto protocol (xUA variant) in use + * \param[in] local_port local port of the server + * \returns \ref osmo_xua_server or NULL (not found) + */ +struct osmo_xua_server * +osmo_ss7_xua_server_find(struct osmo_ss7_instance *inst, + enum osmo_ss7_asp_protocol proto, + uint16_t local_port) +{ + struct osmo_xua_server *xs; + + OSMO_ASSERT(ss7_initialized); + llist_for_each_entry(xs, &inst->xua_servers, list) { + if (proto != xs->cfg.proto) + continue; + if (local_port != xs->cfg.local.port) + continue; + return xs; + } + + return NULL; +} + /*! \brief create a new xUA server configured with given ip/port * \param[in] ctx talloc allocation context * \param[in] proto protocol (xUA variant) to use