blob: 0eaa45e494671917c2ae86c05a99a16ee086715c [file] [log] [blame]
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +01001module PCO_Types {
2
3/* PCO_Types, defining abstract TTCN-3 data types for the Protocol Configuration Options (PCO).
4 *
5 * (C) 2024 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
6 * All rights reserved.
7 *
8 * Released under the terms of GNU General Public License, Version 2 or
9 * (at your option) any later version.
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 */
13
14/* 3GPP TS 24.008 10.5.6.3, 3GPP TS 29.060 7.7.31 */
15
16import from General_Types all;
17import from Osmocom_Types all;
18
19type enumerated PCO_P {
20 PCO_P_LCP ('C021'O),
21 PCO_P_PAP ('C023'O),
22 PCO_P_CHAP ('C223'O),
23 PCO_P_IPCP ('8021'O),
24 PCO_P_PCSCF_ADDR ('0001'O),
25 PCO_P_IM_CN_SS_F ('0002'O),
26 PCO_P_DNS_IPv6_ADDR ('0003'O),
27 PCO_P_POLICY_CTRL_REJ ('0004'O), /* only in Network->MS */
28 PCO_P_MS_SUP_NETREQ_BCI ('0005'O),
29 /* reserved */
30 PCO_P_DSMIPv6_HA_ADDR ('0007'O),
31 PCO_P_DSMIPv6_HN_PREF ('0008'O),
32 PCO_P_DSMIPv6_v4_HA_ADDR ('0009'O),
33 PCO_P_IP_ADDR_VIA_NAS ('000a'O), /* only MS->Network */
34 PCO_P_IPv4_ADDR_VIA_DHCP ('000b'O), /* only MS->Netowrk */
35 PCO_P_PCSCF_IPv4_ADDR ('000c'O),
36 PCO_P_DNS_IPv4_ADDR ('000d'O),
37 PCO_P_MSISDN ('000e'O),
38 PCO_P_IFOM_SUPPORT ('000f'O),
39 PCO_P_IPv4_LINK_MTU ('0010'O),
40 PCO_P_MS_SUPP_LOC_A_TFT ('0011'O),
41 PCO_P_PCSCF_RESEL_SUP ('0012'O), /* only MS->Network */
42 PCO_P_NBIFOM_REQ ('0013'O),
43 PCO_P_NBIFOM_MODE ('0014'O),
44 PCO_P_NONIP_LINK_MTU ('0015'O),
45 PCO_P_APN_RATE_CTRL_SUP ('0016'O),
46 PCO_P_PS_DATA_OFF_UE ('0017'O),
47 PCO_P_REL_DATA_SVC ('0018'O)
48} with { variant "FIELDLENGTH(16)";
49 variant "BYTEORDER(last)" };
50
Pau Espin Pedrolf2925862024-02-22 20:12:30 +010051function PCO_P_to_OCT2(PCO_P p) return OCT2 {
52 return int2oct(enum2int(p), 2);
53}
54
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +010055/* RFC 1332 IP Control Protocol options, extensions in RFC 1877 */
56type enumerated IPCP_OPT {
57 IPCP_OPT_IPADDR (3), /* RFC 1332 3.3 */
58 IPCP_OPT_PRIMARY_DNS (129), /* RFC 1877 1.1 */
59 IPCP_OPT_SECONDARY_DNS (131) /* RFC 1877 1.2 */
60} with { variant "FIELDLENGTH(8)" };
61
62/* RFC 1334, section 3.2. Packet Format */
63type enumerated PAP_CODE_ {
64 PAP_CODE__IPADDR (1),
65 PAP_CODE__PRIMARY_DNS (2),
66 PAP_CODE__SECONDARY_DNS (3)
67} with { variant "FIELDLENGTH(8)" };
68
69type set of ProtocolElement ProtocolIDList;
70
71type record ProtocolElement {
72 PCO_P protocolID,
73 uint8_t lengthProtoID,
74 octetstring protoIDContents
75} with { variant (lengthProtoID) "LENGTHTO(protoIDContents)" };
76
77type record PCO_DATA {
78 BIT1 extension0,
79 BIT4 spare,
80 BIT3 configProtocol,
81 ProtocolIDList protocols
82};
83
84external function enc_PCO_DATA(in PCO_DATA pco_data) return octetstring
85with { extension "prototype(convert)" extension "encode(RAW)" }
86
87external function dec_PCO_DATA(in octetstring pco_payload) return PCO_DATA
88with { extension "prototype(convert) decode(RAW)" };
89
90/**********************
91 * PCO_Templates:
92 **********************/
93
94template (value) ProtocolElement ts_PCO_P_OCTSTR(template (value) PCO_P protocolID,
95 template (value) uint8_t lengthProtoID := 0,
96 template (value) octetstring protoIDContents := ''O)
97:= {
98 protocolID := protocolID,
99 lengthProtoID := lengthProtoID,
100 protoIDContents := protoIDContents
101}
102
103template (present) ProtocolElement tr_PCO_P_OCTSTR(template (present) PCO_P protocolID := ?,
104 template (present) uint8_t lengthProtoID := ?,
105 template (present) octetstring protoIDContents := ?)
106:= {
107 protocolID := protocolID,
108 lengthProtoID := lengthProtoID,
109 protoIDContents := protoIDContents
110}
111
112
113template (value) ProtocolElement ts_PCO_P_DNS_IPv4(template (value) octetstring dns4 := ''O) :=
114 ts_PCO_P_OCTSTR(PCO_P_DNS_IPv4_ADDR, protoIDContents := dns4);
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100115template (present) ProtocolElement tr_PCO_P_DNS_IPv4(template (present) octetstring dns4 := ?) :=
116 tr_PCO_P_OCTSTR(PCO_P_DNS_IPv4_ADDR, protoIDContents := dns4);
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100117
118template (value) ProtocolElement ts_PCO_P_DNS_IPv6(template (value) octetstring dns6 := ''O) :=
119 ts_PCO_P_OCTSTR(PCO_P_DNS_IPv6_ADDR, protoIDContents := dns6);
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100120template (present) ProtocolElement tr_PCO_P_DNS_IPv6(template (present) octetstring dns6 := ?) :=
121 tr_PCO_P_OCTSTR(PCO_P_DNS_IPv6_ADDR, protoIDContents := dns6);
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100122
123template (value) ProtocolElement ts_PCO_P_PCSCF_IPv4(template (value) octetstring pcscf4 := ''O) :=
124 ts_PCO_P_OCTSTR(PCO_P_PCSCF_IPv4_ADDR, protoIDContents := pcscf4);
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100125template (present) ProtocolElement tr_PCO_P_PCSCF_IPv4(template (present) octetstring pcscf4 := ?) :=
126 tr_PCO_P_OCTSTR(PCO_P_PCSCF_IPv4_ADDR, protoIDContents := pcscf4);
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100127
128template (value) ProtocolElement ts_PCO_P_PCSCF_IPv6(template (value) octetstring pcscf6 := ''O) :=
129 ts_PCO_P_OCTSTR(PCO_P_PCSCF_ADDR, protoIDContents := pcscf6);
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100130template (present) ProtocolElement tr_PCO_P_PCSCF_IPv6(template (present) octetstring pcscf6 := ?) :=
131 tr_PCO_P_OCTSTR(PCO_P_PCSCF_ADDR, protoIDContents := pcscf6);
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100132
133/* PCO send base template */
134template (value) PCO_DATA ts_PCO(template (value) ProtocolIDList protocols := {}) := {
135 extension0 := '1'B,
136 spare := '0000'B,
137 configProtocol := '000'B,
138 protocols := protocols
139}
140/* PCO receive base template */
141template (present) PCO_DATA tr_PCO(template (present) ProtocolIDList protocols := ?) := {
142 extension0 := '1'B,
143 spare := ?,
144 configProtocol := '000'B,
145 protocols := protocols
146}
147
148template (value) PCO_DATA ts_PCO_IPv4_DNS(template (value) octetstring dns4 := ''O) :=
149 ts_PCO({ ts_PCO_P_DNS_IPv4(dns4) });
150
151} with { encode "RAW"; variant "FIELDORDER(msb)" }