Error messages.
[tinc] / lib / ethernet.h
1 /*
2     ethernet.h -- missing Ethernet related definitions
3     Copyright (C) 2003 Ivo Timmermans <ivo@o2w.nl>
4                   2003 Guus Sliepen <guus@sliepen.eu.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: ethernet.h,v 1.1.2.3 2003/07/18 13:42:35 guus Exp $
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 ETHER_ADDR_LEN
31 #define ETHER_ADDR_LEN 6
32 #endif
33
34 #ifndef ARPHRD_ETHER
35 #define ARPHRD_ETHER 1
36 #endif
37
38 #ifndef ETHERTYPE_IP
39 #define ETHERTYPE_IP 0x0800
40 #endif
41
42 #ifndef HAVE_STRUCT_ARPHDR
43 struct arphdr {
44         unsigned short int ar_hrd;
45         unsigned short int ar_pro;
46         unsigned char ar_hln;
47         unsigned char ar_pln; 
48         unsigned short int ar_op; 
49 };
50
51 #define ARPOP_REQUEST 1 
52 #define ARPOP_REPLY 2 
53 #define ARPOP_RREQUEST 3 
54 #define ARPOP_RREPLY 4 
55 #define ARPOP_InREQUEST 8 
56 #define ARPOP_InREPLY 9 
57 #define ARPOP_NAK 10 
58 #endif
59
60 #ifndef HAVE_STRUCT_ETHER_ARP
61 struct  ether_arp {
62         struct  arphdr ea_hdr;
63         uint8_t arp_sha[ETH_ALEN];
64         uint8_t arp_spa[4];
65         uint8_t arp_tha[ETH_ALEN];
66         uint8_t arp_tpa[4];
67 };
68 #define arp_hrd ea_hdr.ar_hrd
69 #define arp_pro ea_hdr.ar_pro
70 #define arp_hln ea_hdr.ar_hln
71 #define arp_pln ea_hdr.ar_pln
72 #define arp_op ea_hdr.ar_op
73 #endif
74
75 #endif /* __TINC_ETHERNET_H__ */