GSUP: Convert PDP-Type IE to PDP-Address IE

The previous PDP-Type IE should have been a PDP-Address from the
start, since having only PDP-Type with no address is only a specific
case (dynamic addressing).
This becomes clear by looking at other similar protocols like:
* MAP: APN-Configuration IE has servedPartyIP-IP{v4,v6}-Address IEs
* Diameter S6b, 3GPP TS 29.272 7.3.35 APN-Configuration contains
  Served-Party-IP-Address AVPs
* Diameter SWx, 3GPP TS 29.273 APN-Configuration.
* GTPv1C Ts 29.060 7.7.29 PDP Context containing PDP Address.

Since PDP-Type on its own really makes no sense, being it a special case
of PDP-Address, let's keep the IE by renaming it (keeping old name too
for API backward compat) and extend it to support lengths > 2 bytes.

Old implementation of libosmogsm gsup actually ignored lengths > 2
bytes, so we are safe acting against older implementations here, both
on the sending and receiving side on the wire.

Change-Id: I3e92368fff61694bcef6a48320595b59ae8f54ca
Related: OS#6091
Related: libosmocore.git Change-Id I775ff9c3be165d9f30d6ab55d03f99b6104eadd6
Related: osmo-gsm-manuals.git Change-Id I775ff9c3be165d9f30d6ab55d03f99b6104eadd6
diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index f9faeb7..666d8d0 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -29,7 +29,7 @@
 	OSMO_GSUP_MSISDN_IE		('08'O),
 	OSMO_GSUP_HLR_NUMBER_IE		('09'O),
 	OSMO_GSUP_PDP_CONTEXT_ID_IE	('10'O),
-	OSMO_GSUP_PDP_TYPE_IE		('11'O),
+	OSMO_GSUP_PDP_ADDRESS_IE	('11'O),
 	OSMO_GSUP_ACCESS_POINT_NAME_IE	('12'O),
 	OSMO_GSUP_PDP_QOS_IE		('13'O),
 	OSMO_GSUP_CHARG_CHAR_IE		('14'O),
@@ -196,6 +196,45 @@
 	octetstring pdu
 };
 
+type union GSUP_PDP_Address {
+	GSUP_PDP_Address_IPv4		ipv4,
+	GSUP_PDP_Address_IPv6		ipv6,
+	GSUP_PDP_Address_IPv4v6	ipv4v6,
+	GSUP_PDP_Address_unknown	other
+} with { variant "TAG(ipv4, pdp_typenum = '21'O;
+		      ipv6, pdp_typenum = '57'O;
+		      ipv4v6, pdp_typenum = '8D'O;
+		      other, OTHERWISE;)" };
+
+type record  GSUP_PDP_Address_IPv4 {
+	BIT4	pdp_typeorg,
+	BIT4	spare,
+	OCT1	pdp_typenum,
+	OCT4	ipv4_address optional
+};
+
+type record GSUP_PDP_Address_IPv6 {
+	BIT4 	pdp_typeorg,
+	BIT4 	spare,
+	OCT1 	pdp_typenum,
+	OCT16	ipv6_address optional
+};
+
+type record GSUP_PDP_Address_IPv4v6 {
+	BIT4 	pdp_typeorg,
+	BIT4 	spare,
+	OCT1 	pdp_typenum,
+	OCT4 	ipv4_address optional,
+	OCT16	ipv6_address optional
+};
+
+type record  GSUP_PDP_Address_unknown {
+	BIT4	pdp_typeorg,
+	BIT4	spare,
+	OCT1	pdp_typenum,
+	octetstring addr optional
+};
+
 type record GSUP_IE {
 	GSUP_IEI	tag,
 	uint8_t		len,
@@ -219,7 +258,7 @@
 				 pdp_info, tag = OSMO_GSUP_PDP_INFO_IE;
 				 apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE;
 				 pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE;
-				 pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE;
+				 pdp_address, tag = OSMO_GSUP_PDP_ADDRESS_IE;
 				 charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE;
 				 pdp_ctx_id, tag = OSMO_GSUP_PDP_CONTEXT_ID_IE;
 				 session_state, tag = OSMO_GSUP_SESSION_STATE_IE;
@@ -281,7 +320,7 @@
 	OCT1		pdp_ctx_id,
 	octetstring	apn,
 	octetstring	pdp_qos,
-	OCT2		pdp_type,
+	GSUP_PDP_Address	pdp_address,
 	octetstring	charg_char,
 	/* Session information */
 	GSUP_SessionState	session_state,