IPA_Emulation: Allow client/server to specify CCM parameters
diff --git a/library/IPA_Emulation.ttcn b/library/IPA_Emulation.ttcn
index 98fbb92..92e0a35 100644
--- a/library/IPA_Emulation.ttcn
+++ b/library/IPA_Emulation.ttcn
@@ -57,14 +57,43 @@
var boolean g_is_bsc_mgw;
var IpaMode g_mode;
+ var IPA_CCM_Parameters g_ccm_pars := c_default_ccm_pars;
}
+type record IPA_CCM_Parameters {
+ charstring ser_nr optional,
+ charstring name optional,
+ charstring location1 optional,
+ charstring location2 optional,
+ charstring equip_version optional,
+ charstring sw_version optional,
+ charstring ip_addr optional,
+ charstring mac_addr optional,
+ charstring unit_id optional,
+ charstring osmo_rand optional
+}
+
+private const IPA_CCM_Parameters c_default_ccm_pars := {
+ ser_nr := omit,
+ name := "mahlzeit",
+ location1 := omit,
+ location2 := omit,
+ equip_version := omit,
+ sw_version := omit,
+ ip_addr := omit,
+ mac_addr := omit,
+ unit_id := "0/1/2",
+ osmo_rand := omit
+};
+
function f_connect(charstring remote_host, PortNumber remote_port,
- charstring local_host, PortNumber local_port) runs on IPA_Emulation_CT {
+ charstring local_host, PortNumber local_port,
+ IPA_CCM_Parameters ccm_pars := c_default_ccm_pars) runs on IPA_Emulation_CT {
var Result res;
res := IPA_CodecPort_CtrlFunct.f_IPL4_connect(IPA_PORT, remote_host, remote_port,
local_host, local_port, 0, { tcp:={} });
g_ipa_conn_id := res.connId;
+ g_ccm_pars := ccm_pars;
/* Set function for dissecting the binary */
var f_IPL4_getMsgLen vl_f := refers(f_IPL4_fixedMsgLen);
IPA_CodecPort_CtrlFunct.f_IPL4_setGetMsgLen(IPA_PORT, g_ipa_conn_id, vl_f, {0, 2, 3, 1, 0});
@@ -72,11 +101,13 @@
g_is_bsc_mgw := true;
}
-function f_bind(charstring local_host, PortNumber local_port) runs on IPA_Emulation_CT {
+function f_bind(charstring local_host, PortNumber local_port,
+ IPA_CCM_Parameters ccm_pars := c_default_ccm_pars) runs on IPA_Emulation_CT {
var Result res;
res := IPA_CodecPort_CtrlFunct.f_IPL4_listen(IPA_PORT,
local_host, local_port, { tcp:={} });
g_ipa_conn_id := res.connId;
+ g_ccm_pars := ccm_pars;
g_is_bsc_mgw := false;
}
@@ -96,7 +127,7 @@
}
/* build IPA CCM ID RESP response from IPA CCM GET */
-private function f_ccm_make_id_resp(PDU_IPA_CCM get) return PDU_IPA_CCM {
+private function f_ccm_make_id_resp(PDU_IPA_CCM get) runs on IPA_Emulation_CT return PDU_IPA_CCM {
var integer i;
var PDU_IPA_CCM resp := {
msg_type := IPAC_MSGT_ID_RESP,
@@ -109,14 +140,38 @@
var IpaCcmIdTag tag := get.u.get[i].tag;
var charstring foo;
select (tag) {
- case (IPAC_IDTAG_UNIT) {
- foo := "0/1/2";
+ case (IPAC_IDTAG_SERNR) {
+ foo := g_ccm_pars.ser_nr;
}
case (IPAC_IDTAG_UNITNAME) {
- foo := "mahlzeit";
+ foo := g_ccm_pars.name;
+ }
+ case (IPAC_IDTAG_LOCATION1) {
+ foo := g_ccm_pars.location1;
+ }
+ case (IPAC_IDTAG_LOCATION2) {
+ foo := g_ccm_pars.location2;
+ }
+ case (IPAC_IDTAG_EQUIPVERS) {
+ foo := g_ccm_pars.equip_version;
+ }
+ case (IPAC_IDTAG_SWVERSION) {
+ foo := g_ccm_pars.sw_version;
+ }
+ case (IPAC_IDTAG_IPADDR) {
+ foo := g_ccm_pars.ip_addr;
+ }
+ case (IPAC_IDTAG_MACADDR) {
+ foo := g_ccm_pars.mac_addr;
+ }
+ case (IPAC_IDTAG_UNIT) {
+ foo := g_ccm_pars.unit_id;
+ }
+ case (IPAC_IDTAG_OSMO_RAND) {
+ foo := g_ccm_pars.osmo_rand;
}
case else {
- foo := "foo";
+ foo := "unknown";
}
}
resp.u.resp[sizeof(resp.u.resp)] := valueof(t_IdRespPart(tag, foo));