1/*
2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef included_vnet_ppp_packet_h
16#define included_vnet_ppp_packet_h
17
18/*
19 * PPP packet format
20 *
21 * Copyright (c) 2009 Eliot Dresselhaus
22 *
23 * Permission is hereby granted, free of charge, to any person obtaining
24 * a copy of this software and associated documentation files (the
25 * "Software"), to deal in the Software without restriction, including
26 * without limitation the rights to use, copy, modify, merge, publish,
27 * distribute, sublicense, and/or sell copies of the Software, and to
28 * permit persons to whom the Software is furnished to do so, subject to
29 * the following conditions:
30 *
31 * The above copyright notice and this permission notice shall be
32 * included in all copies or substantial portions of the Software.
33 *
34 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */
42
43/*
44See http://www.iana.org/assignments/ppp-numbers.
45
46The Point-to-Point Protocol (PPP) Data Link Layer [146,147,175]
47contains a 16 bit Protocol field to identify the the encapsulated
48protocol.  The Protocol field is consistent with the ISO 3309 (HDLC)
49extension mechanism for Address fields.  All Protocols MUST be
50assigned such that the least significant bit of the most significant
51octet equals "0", and the least significant bit of the least
52significant octet equals "1".
53*/
54
55#define foreach_ppp_protocol			\
56_ (0x0001, padding)				\
57_ (0x0003, rohc_small_cid)			\
58_ (0x0005, rohc_large_cid)			\
59_ (0x0021, ip4)					\
60_ (0x0023, osi)					\
61_ (0x0025, xerox_ns_idp)			\
62_ (0x0027, decnet)				\
63_ (0x0029, appletalk)				\
64_ (0x002b, ipx)					\
65_ (0x002d, vj_compressed_tcp)			\
66_ (0x002f, vj_uncompressed_tcp)			\
67_ (0x0031, bpdu)				\
68_ (0x0033, streams)				\
69_ (0x0035, vines)				\
70_ (0x0039, appletalk_eddp)			\
71_ (0x003b, appletalk_smart_buffered)		\
72_ (0x003d, multilink)				\
73_ (0x003f, netbios_framing)			\
74_ (0x0041, cisco)				\
75_ (0x0043, timeplex)				\
76_ (0x0045, fujitsu_lblb)			\
77_ (0x0047, dca_remote_lan)			\
78_ (0x0049, sdtp)				\
79_ (0x004b, sna_over_802_2)			\
80_ (0x004d, sna)					\
81_ (0x004f, ip6_header_compression)		\
82_ (0x0051, knx)					\
83_ (0x0053, encryption)				\
84_ (0x0055, link_encryption)			\
85_ (0x0057, ip6)					\
86_ (0x0059, ppp_mux)				\
87_ (0x005b, vendor_specific_a)			\
88_ (0x0061, rtp_iphc_full_header)		\
89_ (0x0063, rtp_iphc_compressed_tcp)		\
90_ (0x0065, rtp_iphc_compressed_non_tcp)		\
91_ (0x0067, rtp_iphc_compressed_udp_8)		\
92_ (0x0069, rtp_iphc_compressed_rtp_8)		\
93_ (0x006f, stampede)				\
94_ (0x0073, mp_plus)				\
95_ (0x007d, control)				\
96_ (0x00c1, ntcits_ipi)				\
97_ (0x00cf, ppp_nlpid)				\
98_ (0x00fb, multilink_compression)		\
99_ (0x00fd, compressed_datagram)			\
100_ (0x0201, 802_1d_hello)			\
101_ (0x0203, ibm_source_routing)			\
102_ (0x0205, dec_lanbridge)			\
103_ (0x0207, cdp)					\
104_ (0x0209, netcs)				\
105_ (0x020b, stp)					\
106_ (0x020d, edp)					\
107_ (0x0211, oscp_a)				\
108_ (0x0213, oscp_b)				\
109_ (0x0231, luxcom)				\
110_ (0x0233, sigma)				\
111_ (0x0235, apple_client_server)			\
112_ (0x0281, mpls_unicast)			\
113_ (0x0283, mpls_multicast)			\
114_ (0x0285, ieee_p1284_4)			\
115_ (0x0287, tetra)				\
116_ (0x0289, multichannel_flow_treatment)		\
117_ (0x2063, rtp_iphc_compressed_tcp_no_delta)	\
118_ (0x2065, rtp_iphc_context_state)		\
119_ (0x2067, rtp_iphc_compressed_udp_16)		\
120_ (0x2069, rtp_iphc_compressed_rtp_16)		\
121_ (0x4001, cray)				\
122_ (0x4003, cdpd)				\
123_ (0x4005, expand)				\
124_ (0x4007, odsicp)				\
125_ (0x4009, docsis_dll)				\
126_ (0x400B, cetacean)				\
127_ (0x4021, lzs)					\
128_ (0x4023, reftek)				\
129_ (0x4025, fibre_channel)			\
130_ (0x4027, emit)				\
131_ (0x405b, vendor_specific_b)			\
132_ (0xc021, lcp)					\
133_ (0xc023, pap)					\
134_ (0xc025, link_quality_report)			\
135_ (0xc027, shiva_password)			\
136_ (0xc029, cbcp)				\
137_ (0xc02b, bacp)				\
138_ (0xc02d, bap)					\
139_ (0xc05b, vendor_specific_password)		\
140_ (0xc081, container_control)			\
141_ (0xc223, chap)				\
142_ (0xc225, rsa)					\
143_ (0xc227, extensible_authentication)		\
144_ (0xc229, mitsubishi_security_info)		\
145_ (0xc26f, stampede_authorization)		\
146_ (0xc281, proprietary_authentication_a)	\
147_ (0xc283, proprietary_authentication_b)	\
148_ (0xc481, proprietary_node_id_authentication)
149
150typedef enum
151{
152#define _(n,f) PPP_PROTOCOL_##f = n,
153  foreach_ppp_protocol
154#undef _
155} ppp_protocol_t;
156
157/* PPP Link Control Protocol (LCP) and Internet Protocol Control Protocol (IPCP) Codes
158
159The Point-to-Point Protocol (PPP) Link Control Protocol (LCP),
160the Compression Control Protocol (CCP), Internet Protocol Control
161Protocol (IPCP), and other control protocols, contain an 8 bit
162Code field which identifies the type of packet. */
163
164#define foreach_ppp_lcp_code			\
165_ (0, vendor_specific)				\
166_ (1, configure_request)			\
167_ (2, configure_ack)				\
168_ (3, configure_nak)				\
169_ (4, configure_reject)				\
170_ (5, terminate_request)			\
171_ (6, terminate_ack)				\
172_ (7, code_reject)				\
173_ (8, protocol_reject)				\
174_ (9, echo_request)				\
175_ (10, echo_reply)				\
176_ (11, discard_request)				\
177_ (12, identification)				\
178_ (13, time_remaining)				\
179_ (14, reset_request)				\
180_ (15, reset_reply)
181
182typedef struct
183{
184  /* Set to 0xff 0x03 */
185  u8 address, control;
186
187  /* Layer 3 protocol for this packet. */
188  u16 protocol;
189} ppp_header_t;
190
191#endif /* included_vnet_ppp_packet_h */
192
193/*
194 * fd.io coding-style-patch-verification: ON
195 *
196 * Local Variables:
197 * eval: (c-set-style "gnu")
198 * End:
199 */
200