1 |
/* |
2 |
netcompat.h -- network compatibility header |
3 |
|
4 |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2 of the License, or |
7 |
(at your option) any later version. |
8 |
|
9 |
This program is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
13 |
|
14 |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
16 |
Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 |
*/ |
18 |
|
19 |
#ifndef VPE_NETCOMPAT_H |
20 |
#define VPE_NETCOMPAT_H |
21 |
|
22 |
#include "config.h" |
23 |
|
24 |
#include <sys/socket.h> |
25 |
#ifdef HAVE_NETINET_IN_H |
26 |
# include <netinet/in.h> |
27 |
#endif |
28 |
#ifdef HAVE_ARPA_INET_H |
29 |
# include <arpa/inet.h> |
30 |
#endif |
31 |
#include <net/if.h> |
32 |
#ifdef HAVE_NETINET_IN_SYSTM_H |
33 |
# include <netinet/in_systm.h> |
34 |
#endif |
35 |
#ifdef HAVE_NETINET_IP_H |
36 |
# include <netinet/ip.h> |
37 |
#endif |
38 |
|
39 |
#ifndef IPTOS_LOWCOST |
40 |
# define IPTOS_LOWCOST 0x02 |
41 |
#endif |
42 |
#ifndef IPTOS_RELIABILITY |
43 |
# define IPTOS_RELIABILITY 0x04 |
44 |
#endif |
45 |
#ifndef IPTOS_THROUGHPUT |
46 |
# define IPTOS_THROUGHPUT 0x08 |
47 |
#endif |
48 |
#ifndef IPTOS_LOWDELAY |
49 |
# define IPTOS_LOWDELAY 0x10 |
50 |
#endif |
51 |
|
52 |
#ifndef IPTOS_TOS_MASK |
53 |
# define IPTOS_TOS_MASK (IPTOS_LOWDELAY | IPTOS_THROUGHPUT | IPTOS_RELIABILITY | IPTOS_MINCOST) |
54 |
#endif |
55 |
|
56 |
#if !defined(SOL_IP) && defined(IPPROTO_IP) |
57 |
# define SOL_IP IPPROTO_IP |
58 |
#endif |
59 |
|
60 |
#ifndef IPPROTO_GRE |
61 |
# define IPPROTO_GRE 47 |
62 |
#endif |
63 |
|
64 |
#ifndef HAVE_SOCKLEN_T |
65 |
typedef int socklen_t; |
66 |
#endif |
67 |
|
68 |
#if ENABLE_ICMP |
69 |
# include <netinet/ip_icmp.h> |
70 |
struct icmp_header { |
71 |
u8 type; |
72 |
u8 code; |
73 |
u16 checksum; |
74 |
union { |
75 |
struct { |
76 |
u16 id; |
77 |
u16 sequence; |
78 |
} echo; |
79 |
u32 gateway; |
80 |
struct { |
81 |
u16 unused; |
82 |
u16 mtu; |
83 |
} frag; |
84 |
} un; |
85 |
}; |
86 |
#endif |
87 |
|
88 |
#endif |
89 |
|