library/PCUIF_Types: version 10: support IPv6 NSVC addr
Change-Id: I13b03c380edc2dc609c5e4053462a3cd6f78ce72
Tweaked-By: Vadim Yanitskiy <vyanitskiy@sysmocom.de>
Related: SYS#4915
diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index f0200af..b400267 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -13,6 +13,7 @@
import from General_Types all;
import from Osmocom_Types all;
+import from Native_Functions all;
modulepar {
/* PCUIF version supported by the IUT */
@@ -212,13 +213,34 @@
record length(2) of uint16_t nsvci,
record length(2) of uint16_t local_port,
record length(2) of uint16_t remote_port,
- record length(2) of OCT4 remote_ip
+ PCUIF_RemoteAddr remote_addr
} with {
/* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
* so we cannot support more than two versions at the same time here. Sigh. */
variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
+ variant (remote_addr) "CROSSTAG(v09, version = 9; v10, version = 10)"
};
+type union PCUIF_RemoteAddr {
+ PCUIF_RemoteAddrV09 v09,
+ PCUIF_RemoteAddrV10 v10
+} with { variant "" };
+
+type record PCUIF_RemoteAddrV09 {
+ record length(2) of OCT4 addr
+} with { variant "" };
+
+type enumerated PCUIF_AddrType {
+ PCUIF_ADDR_TYPE_UNSPEC ('00'O),
+ PCUIF_ADDR_TYPE_IPV4 ('04'O),
+ PCUIF_ADDR_TYPE_IPV6 ('29'O)
+} with { variant "FIELDLENGTH(8)" };
+
+type record PCUIF_RemoteAddrV10 {
+ record length(2) of PCUIF_AddrType addr_type,
+ record length(2) of octetstring addr length(16)
+} with { variant "" };
+
type record PCUIF_act_req {
uint8_t is_activate,
uint8_t trx_nr,
@@ -839,7 +861,7 @@
nsvci := ?,
local_port := ?,
remote_port := ?,
- remote_ip := ?
+ remote_addr := ?
}
}
}
@@ -947,5 +969,34 @@
}
}
+/* TODO: second (redundant) NSVC connection is not (yet) supported */
+function f_PCUIF_ver_INFO_RemoteAddr(PCUIF_AddrType addr_type,
+ charstring addr)
+return PCUIF_RemoteAddr {
+ var PCUIF_RemoteAddr remote_addr;
+
+ if (PCUIF_Types.mp_pcuif_version >= 10) {
+ remote_addr.v10.addr_type[0] := addr_type;
+ if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
+ remote_addr.v10.addr[0] := f_inet_addr(addr);
+ } else {
+ remote_addr.v10.addr[0] := f_inet6_addr(addr);
+ }
+ remote_addr.v10.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
+ remote_addr.v10.addr[1] := f_pad_oct(''O, 16, '00'O);
+ } else {
+ if (addr_type != PCUIF_ADDR_TYPE_IPV4) {
+ testcase.stop("NSVC address type := ", addr_type,
+ "is not supported in version := ",
+ PCUIF_Types.mp_pcuif_version);
+ }
+ /* v9 requires the IP in host byte order */
+ remote_addr.v09.addr[0] := f_inet_haddr(addr);
+ remote_addr.v09.addr[0] := f_pad_oct(''O, 4, '00'O);
+ }
+
+ return remote_addr;
+}
+
} with { encode "RAW" variant "BYTEORDER(first)" };