| module PCO_Types { |
| |
| /* PCO_Types, defining abstract TTCN-3 data types for the Protocol Configuration Options (PCO). |
| * |
| * (C) 2024 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
| * 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 |
| */ |
| |
| /* 3GPP TS 24.008 10.5.6.3, 3GPP TS 29.060 7.7.31 */ |
| |
| import from General_Types all; |
| import from Osmocom_Types all; |
| |
| type enumerated PCO_P { |
| PCO_P_LCP ('C021'O), |
| PCO_P_PAP ('C023'O), |
| PCO_P_CHAP ('C223'O), |
| PCO_P_IPCP ('8021'O), |
| PCO_P_PCSCF_ADDR ('0001'O), |
| PCO_P_IM_CN_SS_F ('0002'O), |
| PCO_P_DNS_IPv6_ADDR ('0003'O), |
| PCO_P_POLICY_CTRL_REJ ('0004'O), /* only in Network->MS */ |
| PCO_P_MS_SUP_NETREQ_BCI ('0005'O), |
| /* reserved */ |
| PCO_P_DSMIPv6_HA_ADDR ('0007'O), |
| PCO_P_DSMIPv6_HN_PREF ('0008'O), |
| PCO_P_DSMIPv6_v4_HA_ADDR ('0009'O), |
| PCO_P_IP_ADDR_VIA_NAS ('000a'O), /* only MS->Network */ |
| PCO_P_IPv4_ADDR_VIA_DHCP ('000b'O), /* only MS->Netowrk */ |
| PCO_P_PCSCF_IPv4_ADDR ('000c'O), |
| PCO_P_DNS_IPv4_ADDR ('000d'O), |
| PCO_P_MSISDN ('000e'O), |
| PCO_P_IFOM_SUPPORT ('000f'O), |
| PCO_P_IPv4_LINK_MTU ('0010'O), |
| PCO_P_MS_SUPP_LOC_A_TFT ('0011'O), |
| PCO_P_PCSCF_RESEL_SUP ('0012'O), /* only MS->Network */ |
| PCO_P_NBIFOM_REQ ('0013'O), |
| PCO_P_NBIFOM_MODE ('0014'O), |
| PCO_P_NONIP_LINK_MTU ('0015'O), |
| PCO_P_APN_RATE_CTRL_SUP ('0016'O), |
| PCO_P_PS_DATA_OFF_UE ('0017'O), |
| PCO_P_REL_DATA_SVC ('0018'O) |
| } with { variant "FIELDLENGTH(16)"; |
| variant "BYTEORDER(last)" }; |
| |
| function PCO_P_to_OCT2(PCO_P p) return OCT2 { |
| return int2oct(enum2int(p), 2); |
| } |
| |
| /* RFC 1332 IP Control Protocol options, extensions in RFC 1877 */ |
| type enumerated IPCP_OPT { |
| IPCP_OPT_IPADDR (3), /* RFC 1332 3.3 */ |
| IPCP_OPT_PRIMARY_DNS (129), /* RFC 1877 1.1 */ |
| IPCP_OPT_SECONDARY_DNS (131) /* RFC 1877 1.2 */ |
| } with { variant "FIELDLENGTH(8)" }; |
| |
| /* RFC 1334, section 3.2. Packet Format */ |
| type enumerated PAP_CODE_ { |
| PAP_CODE__IPADDR (1), |
| PAP_CODE__PRIMARY_DNS (2), |
| PAP_CODE__SECONDARY_DNS (3) |
| } with { variant "FIELDLENGTH(8)" }; |
| |
| type set of ProtocolElement ProtocolIDList; |
| |
| type record ProtocolElement { |
| PCO_P protocolID, |
| uint8_t lengthProtoID, |
| octetstring protoIDContents |
| } with { variant (lengthProtoID) "LENGTHTO(protoIDContents)" }; |
| |
| type record PCO_DATA { |
| BIT1 extension0, |
| BIT4 spare, |
| BIT3 configProtocol, |
| ProtocolIDList protocols |
| }; |
| |
| external function enc_PCO_DATA(in PCO_DATA pco_data) return octetstring |
| with { extension "prototype(convert)" extension "encode(RAW)" } |
| |
| external function dec_PCO_DATA(in octetstring pco_payload) return PCO_DATA |
| with { extension "prototype(convert) decode(RAW)" }; |
| |
| /********************** |
| * PCO_Templates: |
| **********************/ |
| |
| template (value) ProtocolElement ts_PCO_P_OCTSTR(template (value) PCO_P protocolID, |
| template (value) uint8_t lengthProtoID := 0, |
| template (value) octetstring protoIDContents := ''O) |
| := { |
| protocolID := protocolID, |
| lengthProtoID := lengthProtoID, |
| protoIDContents := protoIDContents |
| } |
| |
| template (present) ProtocolElement tr_PCO_P_OCTSTR(template (present) PCO_P protocolID := ?, |
| template (present) uint8_t lengthProtoID := ?, |
| template (present) octetstring protoIDContents := ?) |
| := { |
| protocolID := protocolID, |
| lengthProtoID := lengthProtoID, |
| protoIDContents := protoIDContents |
| } |
| |
| |
| template (value) ProtocolElement ts_PCO_P_DNS_IPv4(template (value) octetstring dns4 := ''O) := |
| ts_PCO_P_OCTSTR(PCO_P_DNS_IPv4_ADDR, protoIDContents := dns4); |
| template (present) ProtocolElement tr_PCO_P_DNS_IPv4(template (present) octetstring dns4 := ?) := |
| tr_PCO_P_OCTSTR(PCO_P_DNS_IPv4_ADDR, protoIDContents := dns4); |
| |
| template (value) ProtocolElement ts_PCO_P_DNS_IPv6(template (value) octetstring dns6 := ''O) := |
| ts_PCO_P_OCTSTR(PCO_P_DNS_IPv6_ADDR, protoIDContents := dns6); |
| template (present) ProtocolElement tr_PCO_P_DNS_IPv6(template (present) octetstring dns6 := ?) := |
| tr_PCO_P_OCTSTR(PCO_P_DNS_IPv6_ADDR, protoIDContents := dns6); |
| |
| template (value) ProtocolElement ts_PCO_P_PCSCF_IPv4(template (value) octetstring pcscf4 := ''O) := |
| ts_PCO_P_OCTSTR(PCO_P_PCSCF_IPv4_ADDR, protoIDContents := pcscf4); |
| template (present) ProtocolElement tr_PCO_P_PCSCF_IPv4(template (present) octetstring pcscf4 := ?) := |
| tr_PCO_P_OCTSTR(PCO_P_PCSCF_IPv4_ADDR, protoIDContents := pcscf4); |
| |
| template (value) ProtocolElement ts_PCO_P_PCSCF_IPv6(template (value) octetstring pcscf6 := ''O) := |
| ts_PCO_P_OCTSTR(PCO_P_PCSCF_ADDR, protoIDContents := pcscf6); |
| template (present) ProtocolElement tr_PCO_P_PCSCF_IPv6(template (present) octetstring pcscf6 := ?) := |
| tr_PCO_P_OCTSTR(PCO_P_PCSCF_ADDR, protoIDContents := pcscf6); |
| |
| /* PCO send base template */ |
| template (value) PCO_DATA ts_PCO(template (value) ProtocolIDList protocols := {}) := { |
| extension0 := '1'B, |
| spare := '0000'B, |
| configProtocol := '000'B, |
| protocols := protocols |
| } |
| /* PCO receive base template */ |
| template (present) PCO_DATA tr_PCO(template (present) ProtocolIDList protocols := ?) := { |
| extension0 := '1'B, |
| spare := ?, |
| configProtocol := '000'B, |
| protocols := protocols |
| } |
| |
| template (value) PCO_DATA ts_PCO_IPv4_DNS(template (value) octetstring dns4 := ''O) := |
| ts_PCO({ ts_PCO_P_DNS_IPv4(dns4) }); |
| |
| } with { encode "RAW"; variant "FIELDORDER(msb)" } |