[MERGED] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: L1CTL: Add message segmentation helper via getMsgLen()
..


L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M deps/Makefile
M gprs_gb/gen_links.sh
M gprs_gb/regen_makefile.sh
M lapdm/gen_links.sh
M lapdm/regen_makefile.sh
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
10 files changed, 56 insertions(+), 9 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/deps/Makefile b/deps/Makefile
index 1d9a6e6..d67e065 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -20,8 +20,7 @@
titan.TestPorts.SIPmsg \
titan.TestPorts.TCPasp \
titan.TestPorts.TELNETasp \
-   titan.TestPorts.UDPasp \
-   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
+   titan.TestPorts.UDPasp
 
 ECLIPSEGIT2_REPOS= titan.ProtocolModules.GRE \
titan.ProtocolModules.M2PA \
@@ -40,7 +39,8 @@
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SNDCP_v7.0.0
 
-OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp
+OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp \
+   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
 
diff --git a/gprs_gb/gen_links.sh b/gprs_gb/gen_links.sh
index 5cbaaae..54d2bdd 100755
--- a/gprs_gb/gen_links.sh
+++ b/gprs_gb/gen_links.sh
@@ -53,7 +53,7 @@
 
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn 
L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
diff --git a/gprs_gb/regen_makefile.sh b/gprs_gb/regen_makefile.sh
index 8b79d73..e49618a 100755
--- a/gprs_gb/regen_makefile.sh
+++ b/gprs_gb/regen_makefile.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc 
RLCMAC_EncDec.cc LLC_EncDec.cc"
+FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc 

osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6922

to look at the new patch set (#3).

L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M deps/Makefile
M gprs_gb/gen_links.sh
M gprs_gb/regen_makefile.sh
M lapdm/gen_links.sh
M lapdm/regen_makefile.sh
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
10 files changed, 56 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/22/6922/3

diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/deps/Makefile b/deps/Makefile
index 1d9a6e6..d67e065 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -20,8 +20,7 @@
titan.TestPorts.SIPmsg \
titan.TestPorts.TCPasp \
titan.TestPorts.TELNETasp \
-   titan.TestPorts.UDPasp \
-   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
+   titan.TestPorts.UDPasp
 
 ECLIPSEGIT2_REPOS= titan.ProtocolModules.GRE \
titan.ProtocolModules.M2PA \
@@ -40,7 +39,8 @@
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SNDCP_v7.0.0
 
-OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp
+OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp \
+   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
 
diff --git a/gprs_gb/gen_links.sh b/gprs_gb/gen_links.sh
index 5cbaaae..54d2bdd 100755
--- a/gprs_gb/gen_links.sh
+++ b/gprs_gb/gen_links.sh
@@ -53,7 +53,7 @@
 
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn 
L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
diff --git a/gprs_gb/regen_makefile.sh b/gprs_gb/regen_makefile.sh
index 8b79d73..e49618a 100755
--- a/gprs_gb/regen_makefile.sh
+++ b/gprs_gb/regen_makefile.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc 
RLCMAC_EncDec.cc LLC_EncDec.cc"
+FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc 

[PATCH] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6922

to look at the new patch set (#2).

L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M deps/Makefile
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
6 files changed, 49 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/22/6922/2

diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/deps/Makefile b/deps/Makefile
index 1d9a6e6..d67e065 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -20,8 +20,7 @@
titan.TestPorts.SIPmsg \
titan.TestPorts.TCPasp \
titan.TestPorts.TELNETasp \
-   titan.TestPorts.UDPasp \
-   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
+   titan.TestPorts.UDPasp
 
 ECLIPSEGIT2_REPOS= titan.ProtocolModules.GRE \
titan.ProtocolModules.M2PA \
@@ -40,7 +39,8 @@
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SNDCP_v7.0.0
 
-OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp
+OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp \
+   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
 
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index b82419e..4dcacb8 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -6,6 +6,7 @@
import from Osmocom_Types all;
import from GSM_Types all;
import from GSM_RR_Types all;
+   import from L1CTL_PortType_CtrlFunct all;
 
type record L1CTL_connect {
charstring  path
@@ -18,6 +19,18 @@
 
modulepar {
charstring  m_l1ctl_sock_path := "/tmp/osmocom_l2";
+   }
+
+   function f_L1CTL_getMsgLen(in octetstring stream, inout ro_integer 
args) return integer {
+   var integer stream_len := lengthof(stream);
+   var integer len;
+   if (stream_len < 2) {
+   log("getMsgLen(", stream, ",", args, ")=-1");
+   return -1;
+   }
+   len := 2 + oct2int(substr(stream, 0, 2));
+   log("getMsgLen(", stream, ",", args, ")=", len);
+   return len;
}
 
function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode 
:= CCCH_MODE_COMBINED) {
@@ -88,8 +101,11 @@
}
 
function f_connect_reset(L1CTL_PT pt, charstring l1ctl_sock_path := 
m_l1ctl_sock_path) {
+   var f_UD_getMsgLen vl_f := refers(f_L1CTL_getMsgLen);
+   f_L1CTL_setGetMsgLen(pt, -1, vl_f, {});

osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-26 Thread Harald Welte

Patch Set 1: Code-Review-1

Logging can be removed; got source repo of UD_PT needs change

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-26 Thread Harald Welte

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

L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
5 files changed, 46 insertions(+), 2 deletions(-)


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

diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index b82419e..4dcacb8 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -6,6 +6,7 @@
import from Osmocom_Types all;
import from GSM_Types all;
import from GSM_RR_Types all;
+   import from L1CTL_PortType_CtrlFunct all;
 
type record L1CTL_connect {
charstring  path
@@ -18,6 +19,18 @@
 
modulepar {
charstring  m_l1ctl_sock_path := "/tmp/osmocom_l2";
+   }
+
+   function f_L1CTL_getMsgLen(in octetstring stream, inout ro_integer 
args) return integer {
+   var integer stream_len := lengthof(stream);
+   var integer len;
+   if (stream_len < 2) {
+   log("getMsgLen(", stream, ",", args, ")=-1");
+   return -1;
+   }
+   len := 2 + oct2int(substr(stream, 0, 2));
+   log("getMsgLen(", stream, ",", args, ")=", len);
+   return len;
}
 
function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode 
:= CCCH_MODE_COMBINED) {
@@ -88,8 +101,11 @@
}
 
function f_connect_reset(L1CTL_PT pt, charstring l1ctl_sock_path := 
m_l1ctl_sock_path) {
+   var f_UD_getMsgLen vl_f := refers(f_L1CTL_getMsgLen);
+   f_L1CTL_setGetMsgLen(pt, -1, vl_f, {});
pt.send(L1CTL_connect:{path:=l1ctl_sock_path});
pt.receive(L1CTL_connect_result:{result_code := SUCCESS, 
err:=omit});
+   f_L1CTL_setGetMsgLen(pt, 0, vl_f, {});
 
pt.send(t_L1ctlResetReq(L1CTL_RES_T_SCHED));
pt.receive;
diff --git a/library/L1CTL_PortType_CtrlFunct.ttcn 
b/library/L1CTL_PortType_CtrlFunct.ttcn
new file mode 100644
index 000..0f9cc94
--- /dev/null
+++ b/library/L1CTL_PortType_CtrlFunct.ttcn
@@ -0,0 +1,13 @@
+module L1CTL_PortType_CtrlFunct {
+
+import from L1CTL_PortType all;
+import from UD_Types all;
+
+  external function f_L1CTL_setGetMsgLen(
+inout L1CTL_PT portRef,
+in integer id,
+inout f_UD_getMsgLen f,
+in ro_integer msgLenArgs
+  );
+
+}
diff --git a/library/L1CTL_PortType_CtrlFunctDef.cc 
b/library/L1CTL_PortType_CtrlFunctDef.cc
new file mode 100644
index 000..0a6df4d
--- /dev/null
+++ b/library/L1CTL_PortType_CtrlFunctDef.cc
@@ -0,0 +1,15 @@
+#include "UD_PortType.hh"
+#include "L1CTL_PortType.hh"
+#include "UD_PT.hh"
+
+namespace