Enable OpenSSL ENGINE, so crypto hardware gets used. Thanks to Andreas van Cranenburgh.
[oweals/tinc.git] / lib / ethernet.h
1 /*
2     ethernet.h -- missing Ethernet related definitions
3     Copyright (C) 2005 Ivo Timmermans <ivo@tinc-vpn.org>
4                   2005 Guus Sliepen <guus@tinc-vpn.org>
5
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.
10
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.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20     $Id$
21 */
22
23 #ifndef __TINC_ETHERNET_H__
24 #define __TINC_ETHERNET_H__
25
26 #ifndef ETH_ALEN
27 #define ETH_ALEN 6
28 #endif
29
30 #ifndef ARPHRD_ETHER
31 #define ARPHRD_ETHER 1
32 #endif
33
34 #ifndef ETH_P_IP
35 #define ETH_P_IP 0x0800
36 #endif
37
38 #ifndef ETH_P_ARP
39 #define ETH_P_ARP 0x0806
40 #endif
41
42 #ifndef ETH_P_IPV6
43 #define ETH_P_IPV6 0x86DD
44 #endif
45
46 #ifndef HAVE_STRUCT_ETHER_HEADER
47 struct ether_header {
48         uint8_t ether_dhost[ETH_ALEN];
49         uint8_t ether_shost[ETH_ALEN];
50         uint16_t ether_type;
51 } __attribute__ ((__packed__));
52 #endif
53
54 #ifndef HAVE_STRUCT_ARPHDR
55 struct arphdr {
56         uint16_t ar_hrd;
57         uint16_t ar_pro;
58         uint8_t ar_hln;
59         uint8_t ar_pln; 
60         uint16_t ar_op; 
61 } __attribute__ ((__packed__));
62
63 #define ARPOP_REQUEST 1 
64 #define ARPOP_REPLY 2 
65 #define ARPOP_RREQUEST 3 
66 #define ARPOP_RREPLY 4 
67 #define ARPOP_InREQUEST 8 
68 #define ARPOP_InREPLY 9 
69 #define ARPOP_NAK 10 
70 #endif
71
72 #ifndef HAVE_STRUCT_ETHER_ARP
73 struct  ether_arp {
74         struct  arphdr ea_hdr;
75         uint8_t arp_sha[ETH_ALEN];
76         uint8_t arp_spa[4];
77         uint8_t arp_tha[ETH_ALEN];
78         uint8_t arp_tpa[4];
79 } __attribute__ ((__packed__));
80 #define arp_hrd ea_hdr.ar_hrd
81 #define arp_pro ea_hdr.ar_pro
82 #define arp_hln ea_hdr.ar_hln
83 #define arp_pln ea_hdr.ar_pln
84 #define arp_op ea_hdr.ar_op
85 #endif
86
87 #endif /* __TINC_ETHERNET_H__ */