Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* IPCP (IP Configuration Protocol) in TTCN-3 |
| 2 | * (C) 2017 Harald Welte <laforge@gnumonks.org> |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Released under the terms of GNU General Public License, Version 2 or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 9 | */ |
| 10 | |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 11 | module IPCP_Types { |
| 12 | |
| 13 | import from Osmocom_Types all; |
| 14 | |
| 15 | /* RFC1331 Section 6 */ |
| 16 | type enumerated LcpCode { |
| 17 | LCP_Configure_Request ('01'O), |
| 18 | LCP_Configure_Ack ('02'O), |
| 19 | LCP_Configure_Nak ('03'O), |
| 20 | LCP_Configure_Reject ('04'O), |
| 21 | LCP_Terminate_Requeest ('05'O), |
| 22 | LCP_Terminate_Ack ('06'O), |
| 23 | LCP_Code_Reject ('07'O), |
| 24 | LCP_Protocol_Reject ('08'O), |
| 25 | LCP_Echo_Request ('09'O), |
| 26 | LCP_Echo_Reply ('10'O), |
| 27 | LCP_Discarded_Request ('11'O), |
| 28 | LCP_Reserved ('12'O) |
| 29 | } with { variant "FIELDLENGTH(8)" }; |
| 30 | |
| 31 | type record IpcpPacket { |
| 32 | LcpCode code, |
| 33 | uint8_t identifier, |
| 34 | uint16_t len, |
| 35 | IpcpOptionList options |
| 36 | } with { variant (len) "LENGTHTO(code,identifier,len,options)" }; |
| 37 | |
| 38 | /* RFC1332 */ |
| 39 | type enumerated IpcpConfigOptCode { |
| 40 | IPCP_OPT_IpAddresses ('01'O), |
| 41 | IPCP_OPT_IpCompressionProtocol ('02'O), |
| 42 | IPCP_OPT_IpAddress ('03'O), |
| 43 | IPCP_OPT_MobileIPv4 ('04'O),/* RFC 2290 */ |
| 44 | IPCP_OPT_PrimaryDNS (129), /* RFC 1877 */ |
| 45 | IPCP_OPT_PrimaryNBNS (130), /* RFC 1877 */ |
| 46 | IPCP_OPT_SecondaryDNS (131), /* RFC 1877 */ |
| 47 | IPCP_OPT_SecondaryNBNS (132) /* RFC 1877 */ |
| 48 | } with { variant "FIELDLENGTH(8)" }; |
| 49 | |
| 50 | type record IpcpOption { |
| 51 | IpcpConfigOptCode code, |
| 52 | uint8_t len, |
| 53 | octetstring data |
| 54 | } with { variant (len) "LENGTHTO(code,len,data)" }; |
| 55 | |
| 56 | type record of IpcpOption IpcpOptionList; |
| 57 | |
| 58 | external function enc_IpcpPacket(in IpcpPacket inp) return octetstring |
| 59 | with { extension "prototype(convert)" extension "encode(RAW)" }; |
| 60 | |
| 61 | external function dec_IpcpPacket(in octetstring inp) return IpcpPacket |
| 62 | with { extension "prototype(convert)" extension "decode(RAW)" }; |
| 63 | |
| 64 | |
| 65 | } with { encode "RAW" ; variant "FIELDORDER(msb)" } |