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