aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-06-30 11:05:20 +0200
committerHarald Welte <laforge@gnumonks.org>2019-02-18 20:25:00 +0100
commitf4bf131ecaa5cf1b686870d1fadc94ce95104f80 (patch)
tree65f733e2d09d08f891946f44c9dc69f6481624db
parent387ab37dfd679f0577fc52337dbeea3cfd0a7d13 (diff)
Osocom_Gb_Types: Add send/receive templates for SNS-SIZE and SNS-CONFIG procedure
-rw-r--r--library/Osmocom_Gb_Types.ttcn280
-rwxr-xr-xpcu/gen_links.sh2
-rwxr-xr-xpcu/regen_makefile.sh2
3 files changed, 275 insertions, 9 deletions
diff --git a/library/Osmocom_Gb_Types.ttcn b/library/Osmocom_Gb_Types.ttcn
index c337cb4d..86b4d499 100644
--- a/library/Osmocom_Gb_Types.ttcn
+++ b/library/Osmocom_Gb_Types.ttcn
@@ -9,6 +9,7 @@ module Osmocom_Gb_Types {
import from GSM_RR_Types all;
import from BSSGP_Types all
import from NS_Types all
+ import from Native_Functions all;
type uint16_t Nsvci;
type uint16_t Nsei;
@@ -81,26 +82,49 @@ module Osmocom_Gb_Types {
},
cause := int2oct(enum2int(valueof(cause)), 1)
}
+ function ts_NS_IE_CAUSE_omit(template (omit) NsCause cause) return template (omit) CauseNS {
+ var template (omit) CauseNS ret;
+ if (istemplatekind(cause, "omit")) {
+ return omit;
+ } else {
+ ret := {
+ iEI := '00'O,
+ ext := '1'B,
+ lengthIndicator := {
+ length1 := 1
+ },
+ cause := int2oct(enum2int(valueof(cause)), 1)
+ }
+ return ret;
+ }
+ }
function tr_NS_IE_CAUSE(template NsCause cause) return template CauseNS {
var template CauseNS ret;
ret.iEI := '00'O;
ret.ext := '1'B;
ret.lengthIndicator := { length1 := 1 };
- if (isvalue(cause)) {
- ret.cause := int2oct(enum2int(valueof(cause)), 1);
- } else {
+ if (istemplatekind(cause, "omit")) {
+ return omit;
+ } else if (istemplatekind(cause, "*")) {
+ return *;
+ } else if (istemplatekind(cause, "?")) {
ret.cause := ?
+ } else {
+ ret.cause := int2oct(enum2int(valueof(cause)), 1);
}
return ret;
}
private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
- if (isvalue(inp)) {
- return int2oct(valueof(inp), len);
- } else {
- return ?
+ if (istemplatekind(inp, "omit")) {
+ return omit;
+ } else if (istemplatekind(inp, "*")) {
+ return *;
+ } else if (istemplatekind(inp, "?")) {
+ return ?;
}
+ return int2oct(valueof(inp), len);
}
template (value) NS_VCI ts_NS_IE_NSVCI(Nsvci nsvci) := {
@@ -137,6 +161,40 @@ module Osmocom_Gb_Types {
nSEI := f_oct_or_wc(nsei, 2)
}
+ template (value) IP4_Element ts_SNS_IPv4(charstring ip, integer udp_port,
+ uint8_t sig_weight := 1, uint8_t data_weight := 1) := {
+ ipAddress := f_inet_addr(ip),
+ uDP_Port := int2oct(udp_port, 2),
+ signallingWeight := int2oct(sig_weight, 1),
+ dataWeight := int2oct(data_weight, 1)
+ }
+ function tr_SNS_IPv4(template charstring ip, template integer udp_port,
+ template uint8_t sig_weight := ?, template uint8_t data_weight := ?)
+ return template IP4_Element {
+ var template IP4_Element e;
+ if (istemplatekind(ip, "?")) {
+ e.ipAddress := ?;
+ } else {
+ e.ipAddress := f_inet_addr(valueof(ip));
+ }
+ if (istemplatekind(udp_port, "?")) {
+ e.uDP_Port := ?;
+ } else {
+ e.uDP_Port := int2oct(valueof(udp_port), 2);
+ }
+ if (istemplatekind(sig_weight, "?")) {
+ e.signallingWeight := ?;
+ } else {
+ e.signallingWeight := int2oct(valueof(sig_weight), 1);
+ }
+ if (istemplatekind(data_weight, "?")) {
+ e.dataWeight := ?;
+ } else {
+ e.dataWeight := int2oct(valueof(data_weight), 1);
+ }
+ return e;
+ }
+
template (value) PDU_NS ts_NS_RESET(NsCause cause, Nsvci nsvci, Nsei nsei) := {
pDU_NS_Reset := {
@@ -260,6 +318,214 @@ octetstring sdu) := {
}
+
+ private function ts_num_of_ep(OCT1 iei, template (omit) uint16_t num_ep)
+ return template (omit) NumberOfIP_Endpoints {
+ var template (omit) NumberOfIP_Endpoints t;
+ if (istemplatekind(num_ep, "omit")) {
+ return omit;
+ } else {
+ t.iEI := iei;
+ t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
+ return t;
+ }
+ }
+ private function tr_num_of_ep(OCT1 iei, template uint16_t num_ep)
+ return template NumberOfIP_Endpoints {
+ var template NumberOfIP_Endpoints t;
+ if (istemplatekind(num_ep, "omit")) {
+ return omit;
+ } else if (istemplatekind(num_ep, "*")) {
+ return *;
+ } else if (istemplatekind(num_ep, "?")) {
+ return ?;
+ } else {
+ t.iEI := iei;
+ t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
+ return t;
+ }
+ }
+
+
+ template (value) ResetFlag ts_SNS_IE_ResetFlag(boolean rst) := {
+ iEI := '0A'O,
+ resetBIT := bool2bit(rst),
+ spare := '0000000'B
+ }
+ template ResetFlag tr_SNS_IE_ResetFlag(template boolean rst) := {
+ iEI := '0A'O,
+ resetBIT := bool2bit_tmpl(rst),
+ spare := '0000000'B
+ }
+
+ template (value) EndFlag ts_SNS_IE_EndFlag(boolean end) := {
+ eBIT := bool2bit(end),
+ spare := '0000000'B
+ }
+ template EndFlag tr_SNS_IE_EndFlag(template boolean end) := {
+ eBIT := bool2bit_tmpl(end),
+ spare := '0000000'B
+ }
+
+ template (value) MaxNumberOfNSVCs ts_SNS_IE_MaxNumOfNSVCs(uint16_t num) := {
+ iEI := '07'O,
+ maxNumberOfNSVCs := int2oct(num, 2)
+ }
+ template MaxNumberOfNSVCs tr_SNS_IE_MaxNumOfNSVCs(template uint16_t num) := {
+ iEI := '07'O,
+ maxNumberOfNSVCs := f_oct_or_wc(num, 2)
+ }
+
+ template (value) PDU_NS ts_SNS_SIZE(Nsei nsei, boolean rst_flag := true,
+ uint16_t max_nsvcs := 2,
+ template (omit) uint16_t num_v4 := 1,
+ template (omit) uint16_t num_v6 := omit) := {
+ pDU_SNS_Size := {
+ nsPduType := '12'O,
+ nSEI_NS := ts_NS_IE_NSEI(nsei),
+ resetFlag := ts_SNS_IE_ResetFlag(rst_flag),
+ maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
+ numberOfIP4_Endpoints := ts_num_of_ep('08'O, num_v4),
+ numberOfIP6_Endpoints := ts_num_of_ep('09'O, num_v6)
+ }
+ }
+ template PDU_NS tr_SNS_SIZE(template Nsei nsei, template boolean rst_flag := ?,
+ template uint16_t max_nsvcs := ?,
+ template uint16_t num_v4 := ?,
+ template uint16_t num_v6 := *) := {
+ pDU_SNS_Size := {
+ nsPduType := '12'O,
+ nSEI_NS := tr_NS_IE_NSEI(nsei),
+ resetFlag := tr_SNS_IE_ResetFlag(rst_flag),
+ maxNumberOfNSVCs := tr_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
+ numberOfIP4_Endpoints := tr_num_of_ep('08'O, num_v4),
+ numberOfIP6_Endpoints := tr_num_of_ep('09'O, num_v6)
+ }
+ }
+
+ template PDU_NS ts_SNS_SIZE_ACK(Nsei nsei, template (omit) NsCause cause) := {
+ pDU_SNS_Size_Ack := {
+ nsPduType := '13'O,
+ nSEI_NS := ts_NS_IE_NSEI(nsei),
+ causeNS := ts_NS_IE_CAUSE_omit(cause)
+ }
+ }
+ template PDU_NS tr_SNS_SIZE_ACK(template Nsei nsei, template NsCause cause) := {
+ pDU_SNS_Size_Ack := {
+ nsPduType := '13'O,
+ nSEI_NS := tr_NS_IE_NSEI(nsei),
+ causeNS := tr_NS_IE_CAUSE(cause)
+ }
+ }
+
+ private function ts_SNS_IE_ListIP4(template (omit) IP4_Elements elem)
+ return template (omit) ListofIP4Elements {
+ var template (omit) ListofIP4Elements r;
+ if (istemplatekind(elem, "omit")) {
+ return omit;
+ } else {
+ r := {
+ iEI := '05'O,
+ ext := '1'B,
+ lengthIndicator := {
+ length1 := 0 /* overwritten */
+ },
+ iP4_Elements := elem
+ }
+ return r;
+ }
+ }
+ private function tr_SNS_IE_ListIP4(template IP4_Elements elem)
+ return template ListofIP4Elements {
+ var template ListofIP4Elements r;
+ if (istemplatekind(elem, "omit")) {
+ return omit;
+ } else {
+ r := {
+ iEI := '05'O,
+ ext := '1'B,
+ lengthIndicator := {
+ length1 := ? /* overwritten */
+ },
+ iP4_Elements := elem
+ }
+ return r;
+ }
+ }
+
+ private function ts_SNS_IE_ListIP6(template (omit) IP6_Elements elem)
+ return template (omit) ListofIP6Elements {
+ var template (omit) ListofIP6Elements r;
+ if (istemplatekind(elem, "omit")) {
+ return omit;
+ } else {
+ r := {
+ iEI := '06'O,
+ ext := '1'B,
+ lengthIndicator := {
+ length1 := 0 /* overwritten */
+ },
+ iP6_Elements := elem
+ }
+ return r;
+ }
+ }
+ private function tr_SNS_IE_ListIP6(template IP6_Elements elem)
+ return template ListofIP6Elements {
+ var template ListofIP6Elements r;
+ if (istemplatekind(elem, "omit")) {
+ return omit;
+ } else {
+ r := {
+ iEI := '06'O,
+ ext := '1'B,
+ lengthIndicator := {
+ length1 := ? /* overwritten */
+ },
+ iP6_Elements := elem
+ }
+ return r;
+ }
+ }
+
+ template (value) PDU_NS ts_SNS_CONFIG(Nsei nsei, boolean end_flag,
+ template (omit) IP4_Elements v4,
+ template (omit) IP6_Elements v6 := omit) := {
+ pDU_SNS_Config := {
+ nsPduType := '0F'O,
+ endFlag := ts_SNS_IE_EndFlag(end_flag),
+ nSEI_NS := ts_NS_IE_NSEI(nsei),
+ listofIP4Elements := ts_SNS_IE_ListIP4(v4),
+ listofIP6Elements := ts_SNS_IE_ListIP6(v6)
+ }
+ }
+ template PDU_NS tr_SNS_CONFIG(template Nsei nsei, template boolean end_flag,
+ template IP4_Elements v4,
+ template IP6_Elements v6 := omit) := {
+ pDU_SNS_Config := {
+ nsPduType := '0F'O,
+ endFlag := tr_SNS_IE_EndFlag(end_flag),
+ nSEI_NS := tr_NS_IE_NSEI(nsei),
+ listofIP4Elements := tr_SNS_IE_ListIP4(v4),
+ listofIP6Elements := tr_SNS_IE_ListIP6(v6)
+ }
+ }
+
+ template (value) PDU_NS ts_SNS_CONFIG_ACK(Nsei nsei, template (omit) NsCause cause) := {
+ pDU_SNS_Config_Ack := {
+ nsPduType := '10'O,
+ nSEI_NS := ts_NS_IE_NSEI(nsei),
+ causeNS := ts_NS_IE_CAUSE_omit(cause)
+ }
+ }
+ template PDU_NS tr_SNS_CONFIG_ACK(template Nsei nsei, template NsCause cause) := {
+ pDU_SNS_Config_Ack := {
+ nsPduType := '10'O,
+ nSEI_NS := tr_NS_IE_NSEI(nsei),
+ causeNS := tr_NS_IE_CAUSE(cause)
+ }
+ }
+
type record BssgpCellId {
RoutingAreaIdentification ra_id,
CellIdentity cell_id
diff --git a/pcu/gen_links.sh b/pcu/gen_links.sh
index 6f33433f..6e549ebd 100755
--- a/pcu/gen_links.sh
+++ b/pcu/gen_links.sh
@@ -46,7 +46,7 @@ gen_links $DIR $FILES
DIR=../library
-FILES="Misc_Helpers.ttcn 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="Misc_Helpers.ttcn General_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc 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/pcu/regen_makefile.sh b/pcu/regen_makefile.sh
index 7eefd2cc..ff712dc4 100755
--- a/pcu/regen_makefile.sh
+++ b/pcu/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 L1CTL_PortType_CtrlFunctDef.cc"
+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 L1CTL_PortType_CtrlFunctDef.cc Native_FunctionDefs.cc"
../regen-makefile.sh PCU_Tests.ttcn $FILES