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 |
#include <arpa/inet.h> |
29 |
#include <net/if.h> |
30 |
#ifdef HAVE_NETINET_IN_SYSTM_H |
31 |
# include <netinet/in_systm.h> |
32 |
#endif |
33 |
#ifdef HAVE_NETINET_IP_H |
34 |
# include <netinet/ip.h> |
35 |
#endif |
36 |
|
37 |
#ifndef IPTOS_LOWCOST |
38 |
# define IPTOS_LOWCOST 0x02 |
39 |
#endif |
40 |
#ifndef IPTOS_RELIABILITY |
41 |
# define IPTOS_RELIABILITY 0x04 |
42 |
#endif |
43 |
#ifndef IPTOS_THROUGHPUT |
44 |
# define IPTOS_THROUGHPUT 0x08 |
45 |
#endif |
46 |
#ifndef IPTOS_LOWDELAY |
47 |
# define IPTOS_LOWDELAY 0x10 |
48 |
#endif |
49 |
|
50 |
#ifndef IPTOS_TOS_MASK |
51 |
# define IPTOS_TOS_MASK (IPTOS_LOWDELAY | IPTOS_THROUGHPUT | IPTOS_RELIABILITY | IPTOS_MINCOST) |
52 |
#endif |
53 |
|
54 |
#if !defined(SOL_IP) && defined(IPPROTO_IP) |
55 |
# define SOL_IP IPPROTO_IP |
56 |
#endif |
57 |
|
58 |
#ifndef IPPROTO_GRE |
59 |
# define IPPROTO_GRE 47 |
60 |
#endif |
61 |
|
62 |
#ifndef HAVE_SOCKLEN_T |
63 |
typedef int socklen_t; |
64 |
#endif |
65 |
|
66 |
#if ENABLE_ICMP |
67 |
# include <netinet/ip_icmp.h> |
68 |
struct icmp_header { |
69 |
u8 type; |
70 |
u8 code; |
71 |
u16 checksum; |
72 |
union { |
73 |
struct { |
74 |
u16 id; |
75 |
u16 sequence; |
76 |
} echo; |
77 |
u32 gateway; |
78 |
struct { |
79 |
u16 unused; |
80 |
u16 mtu; |
81 |
} frag; |
82 |
} un; |
83 |
}; |
84 |
#endif |
85 |
|
86 |
#endif |
87 |
|