blob: 45e5496fbc80d9edc4b192498f9aa8a59e7dc921 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001/*
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_hdlc_packet_h
16#define included_vnet_hdlc_packet_h
17
18/*
19 * HDLC 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#define foreach_hdlc_protocol \
44 _ (0x0800, ip4) \
45 _ (0x2000, cdp) \
46 _ (0x8035, slarp) \
47 _ (0x8847, mpls_unicast) \
48 _ (0x8848, mpls_multicast) \
49 _ (0x86dd, ip6) \
50 _ (0xfefe, osi)
51
52typedef enum {
53#define _(n,f) HDLC_PROTOCOL_##f = n,
54 foreach_hdlc_protocol
55#undef _
56} hdlc_protocol_t;
57
58typedef struct {
59 /* Set to 0x0f for unicast; 0x8f for broadcast. */
60 u8 address;
61
62 /* Always zero. */
63 u8 control;
64
65 /* Layer 3 protocol for this packet. */
66 u16 protocol;
67
68 /* Layer 3 payload. */
69 u8 payload[0];
70} hdlc_header_t;
71
72#endif /* included_vnet_hdlc_packet_h */