pespin has uploaded this change for review.

View Change

library: Move IPCP templates GTPv1C_Templates.ttcn -> IPCP_Templates.ttcn

We already have an IPCP_Types.ttcn, and the GTPv1C_Types from
ProtocolModules dep we use doesn't actually specify any record for IPCP,
so those are totally protocol independent.

Change-Id: I233292ea886e1b69a2f9aa1a159c816791b47136
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M library/GTPv1C_Templates.ttcn
A library/IPCP_Templates.ttcn
4 files changed, 72 insertions(+), 54 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/64/38464/1
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 7c4c5a1..8d091f9 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -27,6 +27,7 @@
import from GTPv1C_Templates all;
import from GTPv1U_Templates all;
import from IPCP_Types all;
+ import from IPCP_Templates all;
import from PAP_Types all;
import from IP_Types all;
import from ICMP_Types all;
diff --git a/ggsn_tests/gen_links.sh b/ggsn_tests/gen_links.sh
index bc17b64..45c84bd 100755
--- a/ggsn_tests/gen_links.sh
+++ b/ggsn_tests/gen_links.sh
@@ -58,7 +58,7 @@
gen_links $DIR $FILES

DIR=../library
-FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn PAP_Types.ttcn "
+FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn PAP_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn "
diff --git a/library/GTPv1C_Templates.ttcn b/library/GTPv1C_Templates.ttcn
index 8eae7c0..9f963f3 100644
--- a/library/GTPv1C_Templates.ttcn
+++ b/library/GTPv1C_Templates.ttcn
@@ -16,6 +16,7 @@
import from GTPC_Types all;
import from GTPv1C_CodecPort all;
import from IPCP_Types all;
+import from IPCP_Templates all;
import from GSM_Types all; // RoutingAreaIdentification, CellIdentity

template (present) OCT1 gtp1_requests := (
@@ -1307,59 +1308,6 @@
return ''O;
}

-template (present) IpcpPacket tr_IPCP(template (present) LcpCode code,
- template (present) uint8_t identifier,
- template (present) IpcpOptionList opts) := {
- code := code,
- identifier := identifier,
- len := ?,
- options := opts
-}
-template (value) IpcpPacket ts_IPCP(template (value) LcpCode code,
- template (value) uint8_t identifier,
- template (value) IpcpOptionList opts) := {
- code := code,
- identifier := identifier,
- len := 0, /* overwritten */
- options := opts
-}
-template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
- code := IPCP_OPT_PrimaryDNS,
- len := 6,
- data := addr
-}
-template (value) IpcpOption ts_IPCP_PrimaryDns(template (value) OCT4 addr) := {
- code := IPCP_OPT_PrimaryDNS,
- len := 6,
- data := addr
-}
-template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
- code := IPCP_OPT_SecondaryDNS,
- len := 6,
- data := addr
-}
-template (value) IpcpOption ts_IPCP_SecondaryDns(template (value) OCT4 addr) := {
- code := IPCP_OPT_SecondaryDNS,
- len := 6,
- data := addr
-}
-template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
- template (present) OCT4 dns1 := ?,
- template (present) OCT4 dns2 := ?) :=
- tr_IPCP(LCP_Configure_Ack, identifier,
- { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
-
-template (value) IpcpPacket ts_IPCP_ReqDNS(template (value) uint8_t identifier := 0) :=
- ts_IPCP(LCP_Configure_Request, identifier,
- { ts_IPCP_PrimaryDns('00000000'O), ts_IPCP_SecondaryDns('00000000'O) });
-
-template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(template (value) uint8_t identifier := 0) :=
- ts_IPCP(LCP_Configure_Request, identifier,
- { ts_IPCP_PrimaryDns('00000000'O) });
-template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(template (value) uint8_t identifier := 0) :=
- ts_IPCP(LCP_Configure_Request, identifier,
- { ts_IPCP_SecondaryDns('00000000'O) });
-
function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
if (istemplatekind(ind, "omit")) {
return omit;
diff --git a/library/IPCP_Templates.ttcn b/library/IPCP_Templates.ttcn
new file mode 100644
index 0000000..bdf1a70
--- /dev/null
+++ b/library/IPCP_Templates.ttcn
@@ -0,0 +1,69 @@
+/* Templates for IPCP (IP Configuration Protocol) in TTCN-3
+ * (C) 2017 Harald Welte <laforge@gnumonks.org>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+module IPCP_Templates {
+import from General_Types all;
+import from Osmocom_Types all;
+import from IPCP_Types all;
+
+template (present) IpcpPacket tr_IPCP(template (present) LcpCode code,
+ template (present) uint8_t identifier,
+ template (present) IpcpOptionList opts) := {
+ code := code,
+ identifier := identifier,
+ len := ?,
+ options := opts
+}
+template (value) IpcpPacket ts_IPCP(template (value) LcpCode code,
+ template (value) uint8_t identifier,
+ template (value) IpcpOptionList opts) := {
+ code := code,
+ identifier := identifier,
+ len := 0, /* overwritten */
+ options := opts
+}
+template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
+ code := IPCP_OPT_PrimaryDNS,
+ len := 6,
+ data := addr
+}
+template (value) IpcpOption ts_IPCP_PrimaryDns(template (value) OCT4 addr) := {
+ code := IPCP_OPT_PrimaryDNS,
+ len := 6,
+ data := addr
+}
+template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
+ code := IPCP_OPT_SecondaryDNS,
+ len := 6,
+ data := addr
+}
+template (value) IpcpOption ts_IPCP_SecondaryDns(template (value) OCT4 addr) := {
+ code := IPCP_OPT_SecondaryDNS,
+ len := 6,
+ data := addr
+}
+template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
+ template (present) OCT4 dns1 := ?,
+ template (present) OCT4 dns2 := ?) :=
+ tr_IPCP(LCP_Configure_Ack, identifier,
+ { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
+
+template (value) IpcpPacket ts_IPCP_ReqDNS(template (value) uint8_t identifier := 0) :=
+ ts_IPCP(LCP_Configure_Request, identifier,
+ { ts_IPCP_PrimaryDns('00000000'O), ts_IPCP_SecondaryDns('00000000'O) });
+
+template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(template (value) uint8_t identifier := 0) :=
+ ts_IPCP(LCP_Configure_Request, identifier,
+ { ts_IPCP_PrimaryDns('00000000'O) });
+template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(template (value) uint8_t identifier := 0) :=
+ ts_IPCP(LCP_Configure_Request, identifier,
+ { ts_IPCP_SecondaryDns('00000000'O) });
+
+} with { encode "RAW" }

To view, visit change 38464. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I233292ea886e1b69a2f9aa1a159c816791b47136
Gerrit-Change-Number: 38464
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>