diff options
author | Tobias Brunner <tobias@strongswan.org> | 2009-04-30 11:37:54 +0000 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2009-04-30 11:37:54 +0000 |
commit | d24a74c5b4fb62b720a79b632021746b69de7c45 (patch) | |
tree | fd8854673b9d72059d7f9459a82663d5a70617ce /src/libfreeswan/freeswan.h | |
parent | 466f11bfaf56c389947b2cbee6dd4f1fb56a821e (diff) | |
download | strongswan-d24a74c5b4fb62b720a79b632021746b69de7c45.tar.bz2 strongswan-d24a74c5b4fb62b720a79b632021746b69de7c45.tar.xz |
merging changes from portability branch back to trunk
important change for developers: %Y replaces %D to print identities!
Diffstat (limited to 'src/libfreeswan/freeswan.h')
-rw-r--r-- | src/libfreeswan/freeswan.h | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/src/libfreeswan/freeswan.h b/src/libfreeswan/freeswan.h index 56b9893b0..09af2c24a 100644 --- a/src/libfreeswan/freeswan.h +++ b/src/libfreeswan/freeswan.h @@ -18,19 +18,7 @@ */ #define _FREESWAN_H /* seen it, no need to see it again */ - - -/* - * We've just got to have some datatypes defined... And annoyingly, just - * where we get them depends on whether we're in userland or not. - */ -#ifdef __KERNEL__ - -# include <linux/types.h> -# include <linux/in.h> - -#else /* __KERNEL__ */ - +# include <sys/types.h> # include <stdio.h> # include <netinet/in.h> @@ -41,25 +29,13 @@ # define DEBUG_NO_STATIC static -#endif /* __KERNEL__ */ - #include <ipsec_param.h> #include <utils.h> /* - * Grab the kernel version to see if we have NET_21, and therefore - * IPv6. Some of this is repeated from ipsec_kversions.h. Of course, - * we aren't really testing if the kernel has IPv6, but rather if the - * the include files do. + * We assume header files have IPv6 (i.e. kernel version >= 2.1.0) */ -#include <linux/version.h> -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z)) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) #define NET_21 -#endif #ifndef IPPROTO_COMP # define IPPROTO_COMP 108 @@ -84,28 +60,6 @@ * use their definitions directly, they are subject to change! */ -/* first, some quick fakes in case we're on an old system with no IPv6 */ -#ifndef s6_addr16 -struct in6_addr { - union - { - __u8 u6_addr8[16]; - __u16 u6_addr16[8]; - __u32 u6_addr32[4]; - } in6_u; -#define s6_addr in6_u.u6_addr8 -#define s6_addr16 in6_u.u6_addr16 -#define s6_addr32 in6_u.u6_addr32 -}; -struct sockaddr_in6 { - unsigned short int sin6_family; /* AF_INET6 */ - __u16 sin6_port; /* Transport layer port # */ - __u32 sin6_flowinfo; /* IPv6 flow information */ - struct in6_addr sin6_addr; /* IPv6 address */ - __u32 sin6_scope_id; /* scope id (new in RFC2553) */ -}; -#endif /* !s6_addr16 */ - /* then the main types */ typedef struct { union { @@ -119,11 +73,7 @@ typedef struct { } ip_subnet; /* and the SA ID stuff */ -#ifdef __KERNEL__ -typedef __u32 ipsec_spi_t; -#else typedef u_int32_t ipsec_spi_t; -#endif typedef struct { /* to identify an SA, we need: */ ip_address dst; /* A. destination host */ ipsec_spi_t spi; /* B. 32-bit SPI, assigned by dest. host */ @@ -159,6 +109,8 @@ struct prng { /* pseudo-random-number-generator guts */ */ typedef uint32_t IPsecSAref_t; +#define IPSEC_SA_REF_TABLE_NUM_ENTRIES (1 << IPSEC_SA_REF_TABLE_IDX_WIDTH) + #define IPSEC_SA_REF_FIELD_WIDTH (8 * sizeof(IPsecSAref_t)) #define IPsecSAref2NFmark(x) ((x) << (IPSEC_SA_REF_FIELD_WIDTH - IPSEC_SA_REF_TABLE_IDX_WIDTH)) @@ -441,11 +393,9 @@ bitstomask( * general utilities */ -#ifndef __KERNEL__ -/* option pickup from files (userland only because of use of FILE) */ +/* option pickup from files */ const char *optionsfrom(const char *filename, int *argcp, char ***argvp, int optind, FILE *errorreport); -#endif /* * Debugging levels for pfkey_lib_debug |