| 1 |
pcg |
1.1 |
/* |
| 2 |
|
|
netcompat.h -- network compatibility header |
| 3 |
pcg |
1.3 |
Copyright (C) 2003 Marc Lehmann <pcg@goof.com> |
| 4 |
pcg |
1.1 |
|
| 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 |
pcg |
1.5 |
#include <sys/types.h> |
| 24 |
pcg |
1.1 |
#include <sys/socket.h> |
| 25 |
|
|
#ifdef HAVE_NETINET_IN_H |
| 26 |
|
|
# include <netinet/in.h> |
| 27 |
|
|
#endif |
| 28 |
pcg |
1.2 |
#ifdef HAVE_ARPA_INET_H |
| 29 |
|
|
# include <arpa/inet.h> |
| 30 |
|
|
#endif |
| 31 |
pcg |
1.1 |
#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 |
pcg |
1.4 |
#ifndef IPTOS_MINCOST |
| 40 |
|
|
# define IPTOS_MINCOST 0x02 |
| 41 |
pcg |
1.1 |
#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 |
|
|
|