MGCP_Emulation part of "bsc: Register expect criteria for MGCP CRCX"
Change-Id: I466df816eef9863bf1664e785b996c0697dc04e3
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;
+ }
+}
+
}