Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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_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 Nayak | cc42db8 | 2017-11-22 16:41:57 +0530 | [diff] [blame] | 52 | typedef enum |
| 53 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 54 | #define _(n,f) HDLC_PROTOCOL_##f = n, |
| 55 | foreach_hdlc_protocol |
| 56 | #undef _ |
| 57 | } hdlc_protocol_t; |
| 58 | |
Swarup Nayak | cc42db8 | 2017-11-22 16:41:57 +0530 | [diff] [blame] | 59 | typedef struct |
| 60 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 61 | /* 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 Nayak | cc42db8 | 2017-11-22 16:41:57 +0530 | [diff] [blame] | 75 | |
| 76 | /* |
| 77 | * fd.io coding-style-patch-verification: ON |
| 78 | * |
| 79 | * Local Variables: |
| 80 | * eval: (c-set-style "gnu") |
| 81 | * End: |
| 82 | */ |