Change in libosmo-sccp[master]: WIP: ss7: Set Traffic Mode Type in ASPAC msg if set in VTY

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/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Oct 21 09:00:46 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/15817 )


Change subject: WIP: ss7: Set Traffic Mode Type in ASPAC msg if set in VTY
......................................................................

WIP: ss7: Set Traffic Mode Type in ASPAC msg if set in VTY

TODO: Make sure the new prim is used to construct the message in lower
layers.

Related: OS#4220
Change-Id: Icce0e672f6180ebc92ca34f538d41161d02fecb9
---
M src/xua_asp_fsm.c
1 file changed, 55 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/17/15817/1

diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 9dc9a82..166811e 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -1,6 +1,6 @@
 /* SCCP M3UA / SUA ASP osmo_fsm according to RFC3868 4.3.1 */
 /* (C) Copyright 2017 by Harald Welte <laforge at gnumonks.org>
- * 
+ *
  * All Rights reserved.
  *
  * SPDX-License-Identifier: GPL-2.0+
@@ -36,7 +36,7 @@
  * * translate incoming SUA/M3UA msg_class/msg_type to xua_asp_event
  * * propagate state transitions to XUA_AS_FSM via _onenter functiosn
  * * notify the Layer Management of any relevant changes
- * * 
+ * *
  */
 
 /* According to RFC3868 Section 8 */
@@ -99,6 +99,38 @@
 	} t_ack;
 };
 
+static unsigned int xua_asp_get_rctx(struct osmo_ss7_asp *asp, uint32_t *rctxs, size_t len)
+{
+	size_t rctx_next = 0;
+	struct osmo_ss7_as *as;
+
+	llist_for_each_entry(as, &asp->inst->as_list, list) {
+		if (!osmo_ss7_as_has_asp(as, asp))
+			continue;
+		rctxs[rctx_next] = as->cfg.routing_key.context;
+		rctx_next++;
+	}
+	return rctx_next;
+}
+
+/*
+static int xua_asp_add_rctx(struct osmo_ss7_asp *asp, struct xua_msg *xua)
+{
+	uint32_t rctxs[32];
+	size_t rctx_cnt = 0;
+	size_t i;
+
+	rctx_cnt = xua_asp_get_rctx(asp, rctxs, ARRAY_SIZE(rctxs));
+
+	if (rctx_cnt == 0)
+		return 0;
+
+	for (i = 0; i < rctx_cnt; i++)
+		rctxs[i] = htonl(rctxs[i]);
+	// FIXME: add 4 bytes for TAG + LEN?
+	return xua_msg_add_data(xua, SUA_IEI_ROUTE_CTX, rctx_cnt * sizeof(uint32_t), (uint8_t *) &rctxs[0]);
+}*/
+
 struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type,
 					 enum osmo_prim_operation op)
 {
@@ -194,8 +226,27 @@
 	case XUA_ASP_E_ASPTM_ASPAC:
 		/* RFC3868 Ch. 3.6.1 */
 		xua->hdr = XUA_HDR(SUA_MSGC_ASPTM, SUA_ASPTM_ACTIVE);
-		/* Optional: Traffic Mode Type */
 		/* Optional: Routing Context */
+		uint32_t rctxs[32];
+		size_t rctx_cnt = 0;
+		size_t i;
+		struct osmo_ss7_as *as;
+
+		rctx_cnt = xua_asp_get_rctx(asp, rctxs, ARRAY_SIZE(rctxs));
+
+		/* Optional: Traffic Mode */
+		if (rctx_cnt) {
+			as = osmo_ss7_as_find_by_rctx(asp->inst, rctxs[0]);
+			if (as->cfg.mode_set_by_vty)
+				xua_msg_add_u32(xua, SUA_IEI_TRAF_MODE_TYP, as->cfg.mode);
+		}
+		/* Optional: Routing Context */
+		if (rctx_cnt) {
+			for (i = 0; i < rctx_cnt; i++)
+				rctxs[i] = htonl(rctxs[i]);
+			// FIXME: add 4 bytes for TAG + LEN?
+			xua_msg_add_data(xua, SUA_IEI_ROUTE_CTX, rctx_cnt * sizeof(uint32_t), (uint8_t *) &rctxs[0]);
+		}
 		/* Optional: TID Label */
 		/* Optional: DRN Label */
 		/* Optional: Info String */
@@ -205,7 +256,7 @@
 		xua->hdr = XUA_HDR(SUA_MSGC_ASPTM, SUA_ASPTM_ACTIVE_ACK);
 		/* Optional: Traffic Mode Type */
 		/* Mandatory: Routing Context */
-		//FIXME xua_msg_add_u32(xua, SUA_IEI_ROUTE_CTX, 
+		//FIXME xua_msg_add_u32(xua, SUA_IEI_ROUTE_CTX,
 		/* Optional: Info String */
 		break;
 	case XUA_ASP_E_ASPTM_ASPIA:

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/15817
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Icce0e672f6180ebc92ca34f538d41161d02fecb9
Gerrit-Change-Number: 15817
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191021/8258c2ad/attachment.htm>


More information about the gerrit-log mailing list