Fix all spelling errors found by codespell.
[tinc] / src / ethernet.h
1 #ifndef TINC_ETHERNET_H
2 #define TINC_ETHERNET_H
3
4 /*
5     ethernet.h -- missing Ethernet related definitions
6     Copyright (C) 2005 Ivo Timmermans
7                   2006 Guus Sliepen <guus@tinc-vpn.org>
8
9     This program is free software; you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation; either version 2 of the License, or
12     (at your option) any later version.
13
14     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18
19     You should have received a copy of the GNU General Public License along
20     with this program; if not, write to the Free Software Foundation, Inc.,
21     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24 #ifndef ETH_ALEN
25 #define ETH_ALEN 6
26 #endif
27
28 #ifndef ARPHRD_ETHER
29 #define ARPHRD_ETHER 1
30 #endif
31
32 #ifndef ETH_P_IP
33 #define ETH_P_IP 0x0800
34 #endif
35
36 #ifndef ETH_P_ARP
37 #define ETH_P_ARP 0x0806
38 #endif
39
40 #ifndef ETH_P_IPV6
41 #define ETH_P_IPV6 0x86DD
42 #endif
43
44 #ifndef ETH_P_8021Q
45 #define ETH_P_8021Q 0x8100
46 #endif
47
48 #ifndef HAVE_STRUCT_ETHER_HEADER
49 struct ether_header {
50         uint8_t ether_dhost[ETH_ALEN];
51         uint8_t ether_shost[ETH_ALEN];
52         uint16_t ether_type;
53 } __attribute__((__packed__));
54 #endif
55
56 #ifndef HAVE_STRUCT_ARPHDR
57 struct arphdr {
58         uint16_t ar_hrd;
59         uint16_t ar_pro;
60         uint8_t ar_hln;
61         uint8_t ar_pln;
62         uint16_t ar_op;
63 } __attribute__((__packed__));
64
65 #define ARPOP_REQUEST 1
66 #define ARPOP_REPLY 2
67 #define ARPOP_RREQUEST 3
68 #define ARPOP_RREPLY 4
69 #define ARPOP_InREQUEST 8
70 #define ARPOP_InREPLY 9
71 #define ARPOP_NAK 10
72 #endif
73
74 #ifndef HAVE_STRUCT_ETHER_ARP
75 struct  ether_arp {
76         struct  arphdr ea_hdr;
77         uint8_t arp_sha[ETH_ALEN];
78         uint8_t arp_spa[4];
79         uint8_t arp_tha[ETH_ALEN];
80         uint8_t arp_tpa[4];
81 } __attribute__((__packed__));
82 #define arp_hrd ea_hdr.ar_hrd
83 #define arp_pro ea_hdr.ar_pro
84 #define arp_hln ea_hdr.ar_hln
85 #define arp_pln ea_hdr.ar_pln
86 #define arp_op ea_hdr.ar_op
87 #endif
88
89 #endif