pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40190?usp=email )
Change subject: xua_asp_fsm: Reuse ss7_asp_get_all_rctx_be() in xua_msg_add_asp_rctx()
......................................................................
xua_asp_fsm: Reuse ss7_asp_get_all_rctx_be() in xua_msg_add_asp_rctx()
Change-Id: I6fe4f388b11991e7c7396c9d632b376e8591a8f3
---
M src/xua_asp_fsm.c
1 file changed, 5 insertions(+), 23 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/90/40190/1
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 4603734..11a34b4 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -173,32 +173,14 @@
/* 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)
{
- struct osmo_ss7_as *as;
uint32_t rctx[OSMO_SS7_MAX_RCTX_COUNT];
- unsigned int i = 0;
+ unsigned int cnt;
- /* iterate over all ASs and build array of routing contexts */
- llist_for_each_entry(as, &asp->inst->as_list, list) {
- if (!osmo_ss7_as_has_asp(as, asp))
- continue;
- rctx[i++] = htonl(as->cfg.routing_key.context);
- if (i >= ARRAY_SIZE(rctx)-1) {
- break;
- }
- }
- /* add xUA IE with routing contests to the message (if any) */
- if (i) {
- /* bail out (and not add the IE) if there's only one routing context (and hence
- * only one AS) within this ASP, and that routing context is zero, meaning no routing
- * context IE shall be used */
- if (i == 1 && rctx[0] == 0)
- return 0;
-
- xua_msg_add_data(xua, M3UA_IEI_ROUTE_CTX, i*sizeof(uint32_t), (uint8_t *)rctx);
- }
-
+ cnt = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), NULL);
+ if (cnt > 0)
+ xua_msg_add_data(xua, M3UA_IEI_ROUTE_CTX, cnt*sizeof(uint32_t), (uint8_t *)rctx);
/* return count of routing contexts added */
- return i;
+ return cnt;
}
/* ask the xUA implementation to transmit a specific message */
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40190?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: I6fe4f388b11991e7c7396c9d632b376e8591a8f3
Gerrit-Change-Number: 40190
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>