pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40696?usp=email )
Change subject: xua_asp_fsm: Move helper function to ss7_asp internal API
......................................................................
xua_asp_fsm: Move helper function to ss7_asp internal API
This function will be used in other files in follow-up commit.
Change-Id: I3eb57c3fb690e7486b52b2c433b25930d16599e5
---
M src/ss7_asp.c
M src/ss7_asp.h
M src/xua_asp_fsm.c
3 files changed, 30 insertions(+), 28 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/96/40696/1
diff --git a/src/ss7_asp.c b/src/ss7_asp.c
index 0fea556..86de153 100644
--- a/src/ss7_asp.c
+++ b/src/ss7_asp.c
@@ -1549,3 +1549,30 @@
{
return _ss7_asp_get_all_rctx(asp, rctx, rctx_size, excl_as, false);
}
+
+/* determine the osmo_ss7_as_traffic_mode to be used by this ASP; will
+ * iterate over all AS configured for this ASP. If they're compatible,
+ * a single traffic mode is returned as enum osmo_ss7_as_traffic_mode.
+ * If they're incompatible, -EINVAL is returned. If there is none
+ * configured, -1 is returned */
+int ss7_asp_determine_traf_mode(const struct osmo_ss7_asp *asp)
+{
+ struct osmo_ss7_as *as;
+ int tmode = -1;
+
+ llist_for_each_entry(as, &asp->inst->as_list, list) {
+ if (!osmo_ss7_as_has_asp(as, asp))
+ continue;
+ /* we only care about traffic modes explicitly set */
+ if (!as->cfg.mode_set_by_vty)
+ continue;
+ if (tmode == -1) {
+ /* this is the first AS; we use this traffic mode */
+ tmode = as->cfg.mode;
+ } else {
+ if (tmode != as->cfg.mode)
+ return -EINVAL;
+ }
+ }
+ return tmode;
+}
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index ec74e82..e25c85c 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -172,5 +172,7 @@
unsigned int ss7_asp_get_all_rctx_be(const struct osmo_ss7_asp *asp, uint32_t *rctx,
unsigned int rctx_size,
const struct osmo_ss7_as *excl_as);
+int ss7_asp_determine_traf_mode(const struct osmo_ss7_asp *asp);
+
#define LOGPASP(asp, subsys, level, fmt, args ...) \
_LOGSS7((asp)->inst, subsys, level, "ASP(%s) " fmt, (asp)->cfg.name, ##
args)
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 06d4a86..730b97a 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -194,33 +194,6 @@
talloc_free(aff_pc);
}
-/* determine the osmo_ss7_as_traffic_mode to be used by this ASP; will
- * iterate over all AS configured for this ASP. If they're compatible,
- * a single traffic mode is returned as enum osmo_ss7_as_traffic_mode.
- * If they're incompatible, -EINVAL is returned. If there is none
- * configured, -1 is returned */
-static int determine_traf_mode(struct osmo_ss7_asp *asp)
-{
- struct osmo_ss7_as *as;
- int tmode = -1;
-
- llist_for_each_entry(as, &asp->inst->as_list, list) {
- if (!osmo_ss7_as_has_asp(as, asp))
- continue;
- /* we only care about traffic modes explicitly set */
- if (!as->cfg.mode_set_by_vty)
- continue;
- if (tmode == -1) {
- /* this is the first AS; we use this traffic mode */
- tmode = as->cfg.mode;
- } else {
- if (tmode != as->cfg.mode)
- return -EINVAL;
- }
- }
- return tmode;
-}
-
/* add M3UA_IEI_ROUTE_CTX to xua_msg containig all routing keys of ASs within ASP */
static int xua_msg_add_asp_rctx(struct xua_msg *xua, struct osmo_ss7_asp *asp)
{
@@ -302,7 +275,7 @@
/* RFC3868 Ch. 3.6.1 */
xua->hdr = XUA_HDR(SUA_MSGC_ASPTM, SUA_ASPTM_ACTIVE);
/* Optional: Traffic Mode Type */
- rc = determine_traf_mode(asp);
+ rc = ss7_asp_determine_traf_mode(asp);
if (rc >= 0)
xua_msg_add_u32(xua, M3UA_IEI_TRAF_MODE_TYP, osmo_ss7_tmode_to_xua(rc));
/* Optional: Routing Context */
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40696?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: I3eb57c3fb690e7486b52b2c433b25930d16599e5
Gerrit-Change-Number: 40696
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>