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