laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28139 ) Change subject: GSUP: Add function to unregister expect; clarify naming ...................................................................... GSUP: Add function to unregister expect; clarify naming Change-Id: I4f2eb3c2b48c8626eb2da633579a874d089be73a --- M library/GSUP_Emulation.ttcn 1 file changed, 36 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/39/28139/1 diff --git a/library/GSUP_Emulation.ttcn b/library/GSUP_Emulation.ttcn index 0905806..213810e 100644 --- a/library/GSUP_Emulation.ttcn +++ b/library/GSUP_Emulation.ttcn @@ -217,9 +217,14 @@ /* Client -> us: procedure call to register expect */ - [] GSUP_PROC.getcall(GSUPEM_register:{?,?}) -> param(imsi, vc_hdlr) { + [] GSUP_PROC.getcall(GSUPEM_register_expect:{?,?}) -> param(imsi, vc_hdlr) { f_create_expect(imsi, vc_hdlr); - GSUP_PROC.reply(GSUPEM_register:{imsi, vc_hdlr}) to vc_hdlr; + GSUP_PROC.reply(GSUPEM_register_expect:{imsi, vc_hdlr}) to vc_hdlr; + } + /* Client -> us: procedure call to unregister expect */ + [] GSUP_PROC.getcall(GSUPEM_unregister_expect:{?,?}) -> param(imsi, vc_hdlr) { + f_destroy_expect(imsi, vc_hdlr); + GSUP_PROC.reply(GSUPEM_unregister_expect:{imsi, vc_hdlr}) to vc_hdlr; } [] GSUP_PROC.getcall(GSUPEM_change_connhdlr:{?,?}) -> param(imsi, vc_hdlr) { @@ -245,11 +250,12 @@ } /* procedure based port to register for incoming calls */ -signature GSUPEM_register(in charstring imsi, in GSUP_ConnHdlr hdlr); +signature GSUPEM_register_expect(in charstring imsi, in GSUP_ConnHdlr hdlr); +signature GSUPEM_unregister_expect(in charstring imsi, in GSUP_ConnHdlr hdlr); signature GSUPEM_change_connhdlr(in charstring imsi, in GSUP_ConnHdlr hdlr); type port GSUPEM_PROC_PT procedure { - inout GSUPEM_register, GSUPEM_change_connhdlr; + inout GSUPEM_register_expect, GSUPEM_unregister_expect, GSUPEM_change_connhdlr; } with { extension "internal" }; /* CreateCallback that can be used as create_cb and will use the expectation table */ @@ -295,17 +301,39 @@ testcase.stop("No space left in GsupExpectTable"); } +/* server/emulation side function to destroy expect */ +private function f_destroy_expect(charstring imsi, GSUP_ConnHdlr hdlr) +runs on GSUP_Emulation_CT { + var integer i; + for (i := 0; i < sizeof(GsupExpectTable); i := i+1) { + if (GsupExpectTable[i].imsi == imsi and GsupExpectTable[i].vc_conn == hdlr) { + GsupExpectTable[i].imsi := omit; + GsupExpectTable[i].vc_conn := null; + log("Destroyed GsupExpect[", i, "] for ", imsi, " to be handled at ", hdlr); + return; + } + } + testcase.stop("No matching expect found to be destoyed"); +} + /* client/conn_hdlr side function to use procedure port to create expect in emulation */ function f_create_gsup_expect(charstring imsi) runs on GSUP_ConnHdlr { - GSUP_PROC.call(GSUPEM_register:{imsi, self}) { - [] GSUP_PROC.getreply(GSUPEM_register:{?,?}) {}; + GSUP_PROC.call(GSUPEM_register_expect:{imsi, self}) { + [] GSUP_PROC.getreply(GSUPEM_register_expect:{?,?}) {}; } } +function f_destroy_gsup_expect(charstring imsi) runs on GSUP_ConnHdlr { + GSUP_PROC.call(GSUPEM_unregister_expect:{imsi, self}) { + [] GSUP_PROC.getreply(GSUPEM_unregister_expect:{?,?}) {}; + } +} + + /* Same as f_create_gsup_expect, but with explicit addressing. Needed when connecting multiple ports to GSUP_PROC. */ function f_create_gsup_expect_explicit(charstring imsi, GSUP_Emulation_CT ct) runs on GSUP_ConnHdlr { - GSUP_PROC.call(GSUPEM_register:{imsi, self}) to ct { - [] GSUP_PROC.getreply(GSUPEM_register:{?,?}) {}; + GSUP_PROC.call(GSUPEM_register_expect:{imsi, self}) to ct { + [] GSUP_PROC.getreply(GSUPEM_register_expect:{?,?}) {}; } } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28139 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4f2eb3c2b48c8626eb2da633579a874d089be73a Gerrit-Change-Number: 28139 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-MessageType: newchange