2 ethernet.h -- missing Ethernet related definitions
3 Copyright (C) 2005 Ivo Timmermans
4 2006 Guus Sliepen <guus@tinc-vpn.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef __TINC_ETHERNET_H__
22 #define __TINC_ETHERNET_H__
32 #ifndef ETHER_TYPE_LEN
33 #define ETHER_TYPE_LEN 2
38 #define ARPHRD_ETHER 1
42 #define ETH_P_IP 0x0800
46 #define ETH_P_ARP 0x0806
50 #define ETH_P_IPV6 0x86DD
54 #define ETH_P_8021Q 0x8100
58 #define ETH_P_MAX 0xFFFF
61 #ifndef HAVE_STRUCT_ETHER_HEADER
63 uint8_t ether_dhost[ETH_ALEN];
64 uint8_t ether_shost[ETH_ALEN];
66 } __attribute__ ((__gcc_struct__, __packed__));
69 #ifndef HAVE_STRUCT_ARPHDR
76 } __attribute__ ((__gcc_struct__, __packed__));
78 #define ARPOP_REQUEST 1
80 #define ARPOP_RREQUEST 3
81 #define ARPOP_RREPLY 4
82 #define ARPOP_InREQUEST 8
83 #define ARPOP_InREPLY 9
87 #ifndef HAVE_STRUCT_ETHER_ARP
90 uint8_t arp_sha[ETH_ALEN];
92 uint8_t arp_tha[ETH_ALEN];
94 } __attribute__ ((__gcc_struct__, __packed__));
95 #define arp_hrd ea_hdr.ar_hrd
96 #define arp_pro ea_hdr.ar_pro
97 #define arp_hln ea_hdr.ar_hln
98 #define arp_pln ea_hdr.ar_pln
99 #define arp_op ea_hdr.ar_op
102 #endif /* __TINC_ETHERNET_H__ */