[PATCH] osmo-ttcn3-hacks[master]: MGCP_Emulation part of "bsc: Register expect criteria for MG...

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 26 09:43:07 UTC 2018


Review at  https://gerrit.osmocom.org/6083

MGCP_Emulation part of "bsc: Register expect criteria for MGCP CRCX"

Change-Id: I466df816eef9863bf1664e785b996c0697dc04e3
---
M library/MGCP_Emulation.ttcn
1 file changed, 25 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/83/6083/1

diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index 2ab5669..b164748 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -48,10 +48,11 @@
 	uint16_t mgw_udp_port
 }
 
-function main(MGCP_conn_parameters p, charstring id) runs on MGCP_Emulation_CT {
+function main(MGCPOps ops, MGCP_conn_parameters p, charstring id) runs on MGCP_Emulation_CT {
 	var Result res;
 	g_mgcp_id := id;
 	//f_conn_table_init();
+	f_expect_table_init();
 
 	map(self:MGCP, system:MGCP_CODEC_PT);
 	res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, p.mgw_ip,
@@ -65,6 +66,10 @@
 			}
 		[] MGCP.receive(MGCP_RecvFrom:?) {
 			}
+		[] PROC.getcall(MGCPEM_register:{?,?}) -> param(crit, vc_conn) {
+			f_create_expect(crit, vc_conn);
+			PROC.reply(MGCPEM_register:{crit, vc_conn});
+			}
 		}
 	}
 }
@@ -72,18 +77,18 @@
 /* "Expect" Handling */
 
 /*  */
-type union ExpectCriteria {
-	MgcpConnectionId connid,
-	MgcpEndpoint endpoint,
-	MgcpTransId transid
+type record ExpectCriteria {
+	MgcpConnectionId connid optional,
+	MgcpEndpoint endpoint optional,
+	MgcpTransId transid optional
 }
 
 type record ExpectData {
 	ExpectCriteria crit optional,
-	MGCP_ConnHdlr vc_conn optional
+	MGCP_ConnHdlr vc_conn
 }
 
-signature MGCPEM_register(in MgcpCommand cmd, in MGCP_ConnHdlr hdlr);
+signature MGCPEM_register(in ExpectCriteria cmd, in MGCP_ConnHdlr hdlr);
 
 type port MGCPEM_PROC_PT procedure {
 	inout MGCPEM_register;
@@ -107,18 +112,19 @@
 	/* Ensure cmd is a CRCX? */
 
 	for (i := 0; i < sizeof(ExpectTable); i := i+1) {
-		if (not ispresent(ExpectTable[i].vc_conn)) {
+		if (not ispresent(ExpectTable[i].crit)) {
 			continue;
 		}
-		mgcpcmd := f_get_mgcp_by_crit(ExpectTable[i].crit);
-		if (match(cmd, mgcpcmd)) {
+		/* FIXME: Ignore criteria for now */
+//		mgcpcmd := f_get_mgcp_by_crit(ExpectTable[i].crit);
+//		if (match(cmd, mgcpcmd)) {
 			ret := ExpectTable[i].vc_conn;
 			/* Release this entry */
 			ExpectTable[i].crit := omit;
 			ExpectTable[i].vc_conn := null;
 			log("Found Expect[", i, "] for ", cmd, " handled at ", ret);
 			return ret;
-		}
+//		}
 	}
 	setverdict(fail, "Couldn't find Expect for CRCX", cmd);
 	return ret;
@@ -146,4 +152,12 @@
 	setverdict(fail, "No space left in ExpectTable")
 }
 
+private function f_expect_table_init()
+runs on MGCP_Emulation_CT {
+	var integer i;
+	for (i := 0; i < sizeof(ExpectTable); i := i + 1) {
+		ExpectTable[i].crit := omit;
+	}
+}
+
 }

-- 
To view, visit https://gerrit.osmocom.org/6083
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I466df816eef9863bf1664e785b996c0697dc04e3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>



More information about the gerrit-log mailing list