blob: a641cd2edafabd642e74c792afa259b40b8e13a7 [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
Swarup Nayakcc42db82017-11-22 16:41:57 +053052typedef enum
53{
Ed Warnickecb9cada2015-12-08 15:45:58 -070054#define _(n,f) HDLC_PROTOCOL_##f = n,
55 foreach_hdlc_protocol
56#undef _
57} hdlc_protocol_t;
58
Swarup Nayakcc42db82017-11-22 16:41:57 +053059typedef struct
60{
Ed Warnickecb9cada2015-12-08 15:45:58 -070061 /* Set to 0x0f for unicast; 0x8f for broadcast. */
62 u8 address;
63
64 /* Always zero. */
65 u8 control;
66
67 /* Layer 3 protocol for this packet. */
68 u16 protocol;
69
70 /* Layer 3 payload. */
71 u8 payload[0];
72} hdlc_header_t;
73
74#endif /* included_vnet_hdlc_packet_h */
Swarup Nayakcc42db82017-11-22 16:41:57 +053075
76/*
77 * fd.io coding-style-patch-verification: ON
78 *
79 * Local Variables:
80 * eval: (c-set-style "gnu")
81 * End:
82 */