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_hdlc_packet_h
16cb9cadadSEd Warnicke#define included_vnet_hdlc_packet_h
17cb9cadadSEd Warnicke
18cb9cadadSEd Warnicke/*
19cb9cadadSEd Warnicke * HDLC 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#define foreach_hdlc_protocol			\
44cb9cadadSEd Warnicke  _ (0x0800, ip4)				\
45cb9cadadSEd Warnicke  _ (0x2000, cdp)				\
46cb9cadadSEd Warnicke  _ (0x8035, slarp)				\
47cb9cadadSEd Warnicke  _ (0x8847, mpls_unicast)			\
48cb9cadadSEd Warnicke  _ (0x8848, mpls_multicast)			\
49cb9cadadSEd Warnicke  _ (0x86dd, ip6)				\
50cb9cadadSEd Warnicke  _ (0xfefe, osi)
51cb9cadadSEd Warnicke
52cc42db82SSwarup Nayaktypedef enum
53cc42db82SSwarup Nayak{
54cb9cadadSEd Warnicke#define _(n,f) HDLC_PROTOCOL_##f = n,
55cb9cadadSEd Warnicke  foreach_hdlc_protocol
56cb9cadadSEd Warnicke#undef _
57cb9cadadSEd Warnicke} hdlc_protocol_t;
58cb9cadadSEd Warnicke
59cc42db82SSwarup Nayaktypedef struct
60cc42db82SSwarup Nayak{
61cb9cadadSEd Warnicke  /* Set to 0x0f for unicast; 0x8f for broadcast. */
62cb9cadadSEd Warnicke  u8 address;
63cb9cadadSEd Warnicke
64cb9cadadSEd Warnicke  /* Always zero. */
65cb9cadadSEd Warnicke  u8 control;
66cb9cadadSEd Warnicke
67cb9cadadSEd Warnicke  /* Layer 3 protocol for this packet. */
68cb9cadadSEd Warnicke  u16 protocol;
69cb9cadadSEd Warnicke
70cb9cadadSEd Warnicke  /* Layer 3 payload. */
71cb9cadadSEd Warnicke  u8 payload[0];
72cb9cadadSEd Warnicke} hdlc_header_t;
73cb9cadadSEd Warnicke
74cb9cadadSEd Warnicke#endif /* included_vnet_hdlc_packet_h */
75cc42db82SSwarup Nayak
76cc42db82SSwarup Nayak/*
77cc42db82SSwarup Nayak * fd.io coding-style-patch-verification: ON
78cc42db82SSwarup Nayak *
79cc42db82SSwarup Nayak * Local Variables:
80cc42db82SSwarup Nayak * eval: (c-set-style "gnu")
81cc42db82SSwarup Nayak * End:
82cc42db82SSwarup Nayak */
83