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