blob: 657289af071d630210fe72389b2a1c93f2caa03c [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* 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 Welte71a36022017-12-04 18:55:58 +010011module IPCP_Types {
12
13import from Osmocom_Types all;
14
15/* RFC1331 Section 6 */
16type 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
31type 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 */
39type 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
50type record IpcpOption {
51 IpcpConfigOptCode code,
52 uint8_t len,
53 octetstring data
54} with { variant (len) "LENGTHTO(code,len,data)" };
55
56type record of IpcpOption IpcpOptionList;
57
58external function enc_IpcpPacket(in IpcpPacket inp) return octetstring
59with { extension "prototype(convert)" extension "encode(RAW)" };
60
61external function dec_IpcpPacket(in octetstring inp) return IpcpPacket
62with { extension "prototype(convert)" extension "decode(RAW)" };
63
64
65} with { encode "RAW" ; variant "FIELDORDER(msb)" }