| 1 |
pcg |
1.1 |
/* |
| 2 |
|
|
netcompat.h -- network compatibility header |
| 3 |
pcg |
1.10 |
Copyright (C) 2003-2008 Marc Lehmann <gvpe@schmorp.de> |
| 4 |
pcg |
1.1 |
|
| 5 |
pcg |
1.7 |
This file is part of GVPE. |
| 6 |
|
|
|
| 7 |
pcg |
1.10 |
GVPE is free software; you can redistribute it and/or modify it |
| 8 |
|
|
under the terms of the GNU General Public License as published by the |
| 9 |
|
|
Free Software Foundation; either version 3 of the License, or (at your |
| 10 |
|
|
option) any later version. |
| 11 |
|
|
|
| 12 |
|
|
This program is distributed in the hope that it will be useful, but |
| 13 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 15 |
|
|
Public License for more details. |
| 16 |
|
|
|
| 17 |
|
|
You should have received a copy of the GNU General Public License along |
| 18 |
|
|
with this program; if not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
|
|
| 20 |
|
|
Additional permission under GNU GPL version 3 section 7 |
| 21 |
|
|
|
| 22 |
|
|
If you modify this Program, or any covered work, by linking or |
| 23 |
|
|
combining it with the OpenSSL project's OpenSSL library (or a modified |
| 24 |
|
|
version of that library), containing parts covered by the terms of the |
| 25 |
|
|
OpenSSL or SSLeay licenses, the licensors of this Program grant you |
| 26 |
|
|
additional permission to convey the resulting work. Corresponding |
| 27 |
|
|
Source for a non-source form of such a combination shall include the |
| 28 |
|
|
source code for the parts of OpenSSL used as well as that of the |
| 29 |
|
|
covered work. |
| 30 |
pcg |
1.1 |
*/ |
| 31 |
|
|
|
| 32 |
pcg |
1.8 |
#ifndef GVPE_NETCOMPAT_H |
| 33 |
|
|
#define GVPE_NETCOMPAT_H |
| 34 |
pcg |
1.1 |
|
| 35 |
pcg |
1.5 |
#include <sys/types.h> |
| 36 |
pcg |
1.1 |
#include <sys/socket.h> |
| 37 |
|
|
#ifdef HAVE_NETINET_IN_H |
| 38 |
|
|
# include <netinet/in.h> |
| 39 |
|
|
#endif |
| 40 |
pcg |
1.2 |
#ifdef HAVE_ARPA_INET_H |
| 41 |
|
|
# include <arpa/inet.h> |
| 42 |
|
|
#endif |
| 43 |
pcg |
1.1 |
#include <net/if.h> |
| 44 |
|
|
#ifdef HAVE_NETINET_IN_SYSTM_H |
| 45 |
|
|
# include <netinet/in_systm.h> |
| 46 |
|
|
#endif |
| 47 |
|
|
#ifdef HAVE_NETINET_IP_H |
| 48 |
|
|
# include <netinet/ip.h> |
| 49 |
|
|
#endif |
| 50 |
|
|
|
| 51 |
pcg |
1.4 |
#ifndef IPTOS_MINCOST |
| 52 |
|
|
# define IPTOS_MINCOST 0x02 |
| 53 |
pcg |
1.1 |
#endif |
| 54 |
|
|
#ifndef IPTOS_RELIABILITY |
| 55 |
|
|
# define IPTOS_RELIABILITY 0x04 |
| 56 |
|
|
#endif |
| 57 |
|
|
#ifndef IPTOS_THROUGHPUT |
| 58 |
|
|
# define IPTOS_THROUGHPUT 0x08 |
| 59 |
|
|
#endif |
| 60 |
|
|
#ifndef IPTOS_LOWDELAY |
| 61 |
|
|
# define IPTOS_LOWDELAY 0x10 |
| 62 |
|
|
#endif |
| 63 |
|
|
|
| 64 |
|
|
#ifndef IPTOS_TOS_MASK |
| 65 |
|
|
# define IPTOS_TOS_MASK (IPTOS_LOWDELAY | IPTOS_THROUGHPUT | IPTOS_RELIABILITY | IPTOS_MINCOST) |
| 66 |
|
|
#endif |
| 67 |
|
|
|
| 68 |
|
|
#if !defined(SOL_IP) && defined(IPPROTO_IP) |
| 69 |
|
|
# define SOL_IP IPPROTO_IP |
| 70 |
|
|
#endif |
| 71 |
|
|
|
| 72 |
|
|
#ifndef IPPROTO_GRE |
| 73 |
|
|
# define IPPROTO_GRE 47 |
| 74 |
|
|
#endif |
| 75 |
|
|
|
| 76 |
pcg |
1.6 |
#ifndef ICMP_ECHOREPLY |
| 77 |
|
|
# define ICMP_ECHOREPLY 0 |
| 78 |
|
|
#endif |
| 79 |
|
|
|
| 80 |
pcg |
1.1 |
#ifndef HAVE_SOCKLEN_T |
| 81 |
|
|
typedef int socklen_t; |
| 82 |
|
|
#endif |
| 83 |
|
|
|
| 84 |
|
|
#if ENABLE_ICMP |
| 85 |
|
|
# include <netinet/ip_icmp.h> |
| 86 |
|
|
struct icmp_header { |
| 87 |
|
|
u8 type; |
| 88 |
|
|
u8 code; |
| 89 |
|
|
u16 checksum; |
| 90 |
|
|
union { |
| 91 |
|
|
struct { |
| 92 |
|
|
u16 id; |
| 93 |
|
|
u16 sequence; |
| 94 |
|
|
} echo; |
| 95 |
|
|
u32 gateway; |
| 96 |
|
|
struct { |
| 97 |
|
|
u16 unused; |
| 98 |
|
|
u16 mtu; |
| 99 |
|
|
} frag; |
| 100 |
|
|
} un; |
| 101 |
|
|
}; |
| 102 |
|
|
#endif |
| 103 |
|
|
|
| 104 |
|
|
#endif |
| 105 |
|
|
|