]> git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/cf/linux.h
571354e6302e4bcc62caff96d40648735f0f307c
[thirdparty/dhcp.git] / includes / cf / linux.h
1 /* linux.h
2
3 System dependencies for Linux.
4
5 Based on a configuration originally supplied by Jonathan Stone. */
6
7 /*
8 * Copyright (c) 1996, 1998, 1999 The Internet Software Consortium.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of The Internet Software Consortium nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
25 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
26 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
28 * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35 * OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 #include <features.h>
39 #ifndef __BIT_TYPES_DEFINED__
40 #define __BIT_TYPES_DEFINED__
41 #undef __USE_BSD
42 typedef char int8_t;
43 typedef short int16_t;
44 typedef long int32_t;
45
46 typedef unsigned char u_int8_t;
47 typedef unsigned short u_int16_t;
48 typedef unsigned long u_int32_t;
49 #endif /* __BIT_TYPES_DEFINED__ */
50
51 typedef u_int8_t u8;
52 typedef u_int16_t u16;
53 typedef u_int32_t u32;
54
55 #include <syslog.h>
56 #include <sys/types.h>
57 #include <string.h>
58 #include <errno.h>
59 #include <unistd.h>
60 #include <sys/wait.h>
61 #include <signal.h>
62 #include <setjmp.h>
63 #include <limits.h>
64
65 extern int h_errno;
66
67 #include <net/if.h>
68 #include <net/route.h>
69
70 #if LINUX_MAJOR == 1
71 # include <linux/if_arp.h>
72 # include <linux/time.h> /* also necessary */
73 #else
74 # include <net/if_arp.h>
75 #endif
76
77 #include <sys/time.h> /* gettimeofday()*/
78
79 /* Databases go in /var/state/dhcp. It would also be valid to put them
80 in /var/state/misc - indeed, given that there's only one lease file, it
81 would probably be better. However, I have some ideas for optimizing
82 the lease database that may result in a _lot_ of smaller files being
83 created, so in that context it makes more sense to have a seperate
84 directory. */
85
86 #ifndef _PATH_DHCPD_DB
87 #define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases"
88 #endif
89
90 #ifndef _PATH_DHCLIENT_DB
91 #define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases"
92 #endif
93
94 /* Varargs stuff... */
95 #include <stdarg.h>
96 #define VA_DOTDOTDOT ...
97 #define VA_start(list, last) va_start (list, last)
98 #define va_dcl
99
100 #define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
101 #define NO_SNPRINTF
102
103 #define VOIDPTR void *
104
105 #define EOL '\n'
106
107 /* Time stuff... */
108
109 #include <time.h>
110
111 #define TIME time_t
112 #define GET_TIME(x) time ((x))
113
114 #if (LINUX_MAJOR >= 2)
115 # if (LINUX_MINOR >= 1)
116 # if defined (USE_DEFAULT_NETWORK)
117 # define USE_LPF
118 # endif
119 # define LINUX_SLASHPROC_DISCOVERY
120 # define PROCDEV_DEVICE "/proc/net/dev"
121 # define HAVE_ARPHRD_TUNNEL
122 # endif
123 # define HAVE_ARPHRD_METRICOM
124 # define HAVE_ARPHRD_IEEE802
125 # define HAVE_ARPHRD_LOOPBACK
126 # define HAVE_SO_BINDTODEVICE
127 # define HAVE_SIOCGIFHWADDR
128 #endif
129
130 #if !defined (USE_LPF)
131 # if defined (USE_DEFAULT_NETWORK)
132 # define USE_SOCKETS
133 # endif
134 # define IGNORE_HOSTUNREACH
135 #endif
136
137 #define ALIAS_NAMES_PERMUTED
138 #define SKIP_DUMMY_INTERFACES