Change in osmo-ttcn3-hacks[master]: library/DIAMETER_Emulation: initiate CER/CEA exchange in client mode
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31292 ) Change subject: library/DIAMETER_Emulation: initiate CER/CEA exchange in client mode ...................................................................... library/DIAMETER_Emulation: initiate CER/CEA exchange in client mode Change-Id: I7537b306c2a569e2232597f21e15d3cf4ec9a12c Related: SYS#5602 --- M library/DIAMETER_Emulation.ttcn 1 file changed, 14 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/92/31292/1 diff --git a/library/DIAMETER_Emulation.ttcn b/library/DIAMETER_Emulation.ttcn index 3fa6a5c..28db6b5 100644 --- a/library/DIAMETER_Emulation.ttcn +++ b/library/DIAMETER_Emulation.ttcn @@ -272,13 +272,14 @@ } function main(DIAMETEROps ops, DIAMETER_conn_parameters p, charstring id) runs on DIAMETER_Emulation_CT { + var boolean server_mode := p.remote_sctp_port == -1; var Result res; g_diameter_id := id; f_imsi_table_init(); f_expect_table_init(); map(self:DIAMETER, system:DIAMETER_CODEC_PT); - if (p.remote_sctp_port == -1) { + if (server_mode) { res := DIAMETER_CodecPort_CtrlFunct.f_IPL4_listen(DIAMETER, p.local_ip, p.local_sctp_port, { sctp := valueof(ts_SCTP) }); } else { res := DIAMETER_CodecPort_CtrlFunct.f_IPL4_connect(DIAMETER, p.remote_ip, p.remote_sctp_port, @@ -290,6 +291,18 @@ } g_diameter_conn_id := res.connId; + /* If in client mode, send CER immediately */ + if (not server_mode) { + var template (value) PDU_DIAMETER req; + var PDU_DIAMETER rsp; + + req := ts_DIA_CER(f_inet_addr(p.local_ip), p.vendor_app_id, + orig_host := p.origin_host, orig_realm := p.origin_realm); + rsp := f_diameter_xceive(req, tr_DIAMETER_A(Capabilities_Exchange, req.application_id)); + /* notify our user that the CER->CEA exchange has happened */ + DIAMETER_UNIT.send(DiameterCapabilityExchgInd:{rx := rsp, tx := valueof(req)}); + } + while (true) { var DIAMETER_ConnHdlr vc_conn; var template IMSI imsi_t; -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31292 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: I7537b306c2a569e2232597f21e15d3cf4ec9a12c Gerrit-Change-Number: 31292 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
fixeria