]> git.ipfire.org Git - people/ms/strongswan.git/blob - linux/lib/libfreeswan/internal.h
16ad78da0e61131ed757720eebd5d3ddf38cb9d3
[people/ms/strongswan.git] / linux / lib / libfreeswan / internal.h
1 /*
2 * internal definitions for use within the library; do not export!
3 * Copyright (C) 1998, 1999 Henry Spencer.
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 * License for more details.
14 *
15 * RCSID $Id: internal.h,v 1.1 2004/03/15 20:35:26 as Exp $
16 */
17
18 #ifndef ABITS
19 #define ABITS 32 /* bits in an IPv4 address */
20 #endif
21
22 /* case-independent ASCII character equality comparison */
23 #define CIEQ(c1, c2) ( ((c1)&~040) == ((c2)&~040) )
24
25 /* syntax for passthrough SA */
26 #ifndef PASSTHROUGHNAME
27 #define PASSTHROUGHNAME "%passthrough"
28 #define PASSTHROUGH4NAME "%passthrough4"
29 #define PASSTHROUGH6NAME "%passthrough6"
30 #define PASSTHROUGHIS "tun0@0.0.0.0"
31 #define PASSTHROUGH4IS "tun0@0.0.0.0"
32 #define PASSTHROUGH6IS "tun0@::"
33 #define PASSTHROUGHTYPE "tun"
34 #define PASSTHROUGHSPI 0
35 #define PASSTHROUGHDST 0
36 #endif
37
38 /*
39 * Headers, greatly complicated by stupid and unnecessary inconsistencies
40 * between the user environment and the kernel environment. These are done
41 * here so that this mess need exist in only one place.
42 *
43 * It may seem like a -I or two could avoid most of this, but on closer
44 * inspection it is not quite that easy.
45 */
46
47 /* things that need to come from one place or the other, depending */
48 #ifdef __KERNEL__
49 #include <linux/types.h>
50 #include <linux/socket.h>
51 #include <linux/in.h>
52 #include <linux/string.h>
53 #include <linux/ctype.h>
54 #define assert(foo) /* nothing */
55 #else
56 #include <sys/types.h>
57 #include <netinet/in.h>
58 #include <string.h>
59 #include <ctype.h>
60 #include <assert.h>
61 #endif
62
63 /* things that exist only in userland */
64 #ifndef __KERNEL__
65
66 /* You'd think this would be okay in the kernel too -- it's just a */
67 /* bunch of constants -- but no, in RH5.1 it screws up other things. */
68 /* (Credit: Mike Warfield tracked this problem down. Thanks Mike!) */
69 /* Fortunately, we don't need it in the kernel subset of the library. */
70 #include <limits.h>
71
72 /* header files for things that should never be called in kernel */
73 #include <netdb.h>
74
75 /* memory allocation, currently user-only, macro-ized just in case */
76 #include <stdlib.h>
77 #define MALLOC(n) malloc(n)
78 #define FREE(p) free(p)
79
80 #endif /* __KERNEL__ */
81