]> git.ipfire.org Git - thirdparty/dhcp.git/blame - server/stables.c
Update README to clarify EOL status
[thirdparty/dhcp.git] / server / stables.c
CommitLineData
5020567a
TL
1/* stables.c
2
3 Tables of information only used by server... */
4
5/*
49a7fb58 6 * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC")
98311e4b 7 * Copyright (c) 1995-2003 by Internet Software Consortium
5020567a 8 *
7512d88b
TM
9 * This Source Code Form is subject to the terms of the Mozilla Public
10 * License, v. 2.0. If a copy of the MPL was not distributed with this
11 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5020567a 12 *
98311e4b
DH
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5020567a 20 *
98311e4b 21 * Internet Systems Consortium, Inc.
429a56d7
TM
22 * PO Box 360
23 * Newmarket, NH 03857 USA
98311e4b 24 * <info@isc.org>
2c85ac9b 25 * https://www.isc.org/
49733f31 26 *
5020567a
TL
27 */
28
5020567a 29#include "dhcpd.h"
3af71c19 30#include <syslog.h>
5020567a
TL
31
32#if defined (FAILOVER_PROTOCOL)
f64d028b
TL
33
34/* This is used to indicate some kind of failure when generating a
35 failover option. */
36failover_option_t null_failover_option = { 0, 0 };
3d8b4d91 37failover_option_t skip_failover_option = { 0, 0 };
f64d028b
TL
38
39/* Information about failover options, for printing, encoding
40 and decoding. */
d9eefc5d 41struct failover_option_info ft_options [] =
5020567a 42{
d9eefc5d 43 { 0, "unused", FT_UNDEF, 0, 0, 0 },
a55ccdd0
DH
44 { FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1,
45 FM_OFFSET(addresses_transferred), FTB_ADDRESSES_TRANSFERRED },
46 { FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1,
47 FM_OFFSET(assigned_addr), FTB_ASSIGNED_IP_ADDRESS },
48 { FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1,
49 FM_OFFSET(binding_status), FTB_BINDING_STATUS },
50 { FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0,
51 FM_OFFSET(client_identifier), FTB_CLIENT_IDENTIFIER },
52 { FTO_CHADDR, "client-hardware-address", FT_BYTES, 0,
53 FM_OFFSET(chaddr), FTB_CHADDR },
54 { FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1,
55 FM_OFFSET(cltt), FTB_CLTT },
56 { FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0,
57 FM_OFFSET(reply_options), FTB_REPLY_OPTIONS },
58 { FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0,
59 FM_OFFSET(request_options), FTB_REQUEST_OPTIONS },
60 { FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET(ddns), FTB_DDNS },
61 { FTO_DELAYED_SERVICE, "delayed-service", FT_UINT8, 1,
62 FM_OFFSET(delayed_service), FTB_DELAYED_SERVICE },
63 { FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0,
64 FM_OFFSET(hba), FTB_HBA },
65 { FTO_IP_FLAGS, "IP-flags", FT_UINT16, 1,
66 FM_OFFSET(ip_flags), FTB_IP_FLAGS },
67 { FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1,
68 FM_OFFSET(expiry), FTB_LEASE_EXPIRY },
f6b8f48d 69 { FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1,
a55ccdd0
DH
70 FM_OFFSET(max_unacked), FTB_MAX_UNACKED },
71 { FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET(mclt), FTB_MCLT },
72 { FTO_MESSAGE, "message", FT_TEXT, 0,
73 FM_OFFSET(message), FTB_MESSAGE },
74 { FTO_MESSAGE_DIGEST, "message-digest", FT_BYTES, 0,
75 FM_OFFSET(message_digest), FTB_MESSAGE_DIGEST },
76 { FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1,
77 FM_OFFSET(potential_expiry), FTB_POTENTIAL_EXPIRY },
78 { FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1,
79 FM_OFFSET(receive_timer), FTB_RECEIVE_TIMER },
80 { FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1,
81 FM_OFFSET(protocol_version), FTB_PROTOCOL_VERSION },
82 { FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1,
83 FM_OFFSET(reject_reason), FTB_REJECT_REASON },
84 { FTO_RELATIONSHIP_NAME, "relationship-name", FT_BYTES, 0,
85 FM_OFFSET(relationship_name), FTB_RELATIONSHIP_NAME },
86 { FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1,
87 FM_OFFSET(server_flags), FTB_SERVER_FLAGS },
88 { FTO_SERVER_STATE, "server-state", FT_UINT8, 1,
89 FM_OFFSET(server_state), FTB_SERVER_STATE },
90 { FTO_STOS, "start-time-of-state", FT_UINT32, 1,
91 FM_OFFSET(stos), FTB_STOS },
92 { FTO_TLS_REPLY, "TLS-reply", FT_UINT8, 1,
93 FM_OFFSET(tls_reply), FTB_TLS_REPLY },
94 { FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 1,
95 FM_OFFSET(tls_request), FTB_TLS_REQUEST },
96 { FTO_VENDOR_CLASS, "vendor-class-identifier", FT_BYTES, 0,
97 FM_OFFSET(vendor_class), FTB_VENDOR_CLASS },
98 { FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0,
99 FM_OFFSET(vendor_options), FTB_VENDOR_OPTIONS }
5020567a
TL
100};
101
102/* These are really options that make sense for a particular request - if
103 some other option comes in, we're not going to use it, so we can just
104 discard it. Note that the message-digest option is allowed for all
105 message types, but is not saved - it's just used to validate the message
106 and then discarded - so it's not mentioned here. */
107
108u_int32_t fto_allowed [] = {
109 0, /* 0 unused */
110 0, /* 1 POOLREQ */
111 FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */
112 (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
a55ccdd0
DH
113 FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
114 FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
115 FTB_REPLY_OPTIONS), /* 3 BNDUPD */
5020567a 116 (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
a55ccdd0
DH
117 FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
118 FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
119 FTB_REPLY_OPTIONS | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */
120 (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
5020567a
TL
121 FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST |
122 FTB_MCLT | FTB_HBA), /* 5 CONNECT */
a55ccdd0 123 (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
5020567a
TL
124 FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY |
125 FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */
a55ccdd0 126 0, /* 7 UPDREQALL */
3505ef68 127 0, /* 8 UPDDONE */
a55ccdd0 128 0, /* 9 UPDREQ */
f64d028b 129 (FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */
5020567a
TL
130 0, /* 11 CONTACT */
131 (FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */
132};
133
f64d028b 134/* Sizes of the various types. */
5020567a
TL
135int ft_sizes [] = {
136 1, /* FT_UINT8 */
137 4, /* FT_IPADDR */
138 4, /* FT_UINT32 */
139 1, /* FT_BYTES */
f64d028b 140 1, /* FT_TEXT_OR_BYTES */
5020567a 141 0, /* FT_DDNS */
f64d028b 142 0, /* FT_DDNS1 */
5020567a
TL
143 2, /* FT_UINT16 */
144 1, /* FT_TEXT */
145 0, /* FT_UNDEF */
146 0, /* FT_DIGEST */
147};
d9eefc5d 148
f64d028b
TL
149/* Names of the various failover link states. */
150const char *dhcp_flink_state_names [] = {
d9eefc5d
TL
151 "invalid state 0",
152 "startup",
153 "message length wait",
154 "message wait",
155 "disconnected"
156};
5020567a
TL
157#endif /* FAILOVER_PROTOCOL */
158
007e3ee4
TL
159/* Failover binding state names. These are used even if there is no
160 failover protocol support. */
161const char *binding_state_names [] = {
162 "free", "active", "expired", "released", "abandoned",
a55ccdd0 163 "reset", "backup" };
007e3ee4 164
5020567a 165struct universe agent_universe;
f7fdb216
DH
166static struct option agent_options[] = {
167 { "circuit-id", "X", &agent_universe, 1, 1 },
168 { "remote-id", "X", &agent_universe, 2, 1 },
169 { "agent-id", "I", &agent_universe, 3, 1 },
170 { "DOCSIS-device-class", "L", &agent_universe, 4, 1 },
334bf491 171 { "link-selection", "I", &agent_universe, 5, 1 },
563f0b8a 172 { "relay-port", "Z", &agent_universe, 19, 1 },
f7fdb216 173 { NULL, NULL, NULL, 0, 0 }
5020567a
TL
174};
175
176struct universe server_universe;
f7fdb216
DH
177static struct option server_options[] = {
178 { "default-lease-time", "T", &server_universe, 1, 1 },
179 { "max-lease-time", "T", &server_universe, 2, 1 },
180 { "min-lease-time", "T", &server_universe, 3, 1 },
181 { "dynamic-bootp-lease-cutoff", "T", &server_universe, 4, 1 },
182 { "dynamic-bootp-lease-length", "L", &server_universe, 5, 1 },
183 { "boot-unknown-clients", "f", &server_universe, 6, 1 },
184 { "dynamic-bootp", "f", &server_universe, 7, 1 },
185 { "allow-bootp", "f", &server_universe, 8, 1 },
186 { "allow-booting", "f", &server_universe, 9, 1 },
187 { "one-lease-per-client", "f", &server_universe, 10, 1 },
188 { "get-lease-hostnames", "f", &server_universe, 11, 1 },
189 { "use-host-decl-names", "f", &server_universe, 12, 1 },
190 { "use-lease-addr-for-default-route", "f",
191 &server_universe, 13, 1 },
192 { "min-secs", "B", &server_universe, 14, 1 },
193 { "filename", "t", &server_universe, 15, 1 },
194 { "server-name", "t", &server_universe, 16, 1 },
195 { "next-server", "I", &server_universe, 17, 1 },
196 { "authoritative", "f", &server_universe, 18, 1 },
197 { "vendor-option-space", "U", &server_universe, 19, 1 },
198 { "always-reply-rfc1048", "f", &server_universe, 20, 1 },
199 { "site-option-space", "X", &server_universe, 21, 1 },
200 { "always-broadcast", "f", &server_universe, 22, 1 },
201 { "ddns-domainname", "t", &server_universe, 23, 1 },
202 { "ddns-hostname", "t", &server_universe, 24, 1 },
203 { "ddns-rev-domainname", "t", &server_universe, 25, 1 },
204 { "lease-file-name", "t", &server_universe, 26, 1 },
205 { "pid-file-name", "t", &server_universe, 27, 1 },
206 { "duplicates", "f", &server_universe, 28, 1 },
207 { "declines", "f", &server_universe, 29, 1 },
208 { "ddns-updates", "f", &server_universe, 30, 1 },
209 { "omapi-port", "S", &server_universe, 31, 1 },
210 { "local-port", "S", &server_universe, 32, 1 },
211 { "limited-broadcast-address", "I", &server_universe, 33, 1 },
212 { "remote-port", "S", &server_universe, 34, 1 },
213 { "local-address", "I", &server_universe, 35, 1 },
9a2f9db5 214 { "omapi-key", "k", &server_universe, 36, 1 },
f7fdb216
DH
215 { "stash-agent-options", "f", &server_universe, 37, 1 },
216 { "ddns-ttl", "T", &server_universe, 38, 1 },
217 { "ddns-update-style", "Nddns-styles.", &server_universe, 39, 1 },
218 { "client-updates", "f", &server_universe, 40, 1 },
219 { "update-optimization", "f", &server_universe, 41, 1 },
220 { "ping-check", "f", &server_universe, 42, 1 },
221 { "update-static-leases", "f", &server_universe, 43, 1 },
222 { "log-facility", "Nsyslog-facilities.",
223 &server_universe, 44, 1 },
224 { "do-forward-updates", "f", &server_universe, 45, 1 },
225 { "ping-timeout", "T", &server_universe, 46, 1 },
1db5e2c0 226 { "infinite-is-reserved", "f", &server_universe, 47, 1 },
3004bebf 227 { "update-conflict-detection", "f", &server_universe, 48, 1 },
bd2bc2fa 228 { "leasequery", "f", &server_universe, 49, 1 },
b22de500 229 { "adaptive-lease-time-threshold", "B", &server_universe, 50, 1 },
4d2eaafb 230 { "do-reverse-updates", "f", &server_universe, 51, 1 },
1ba87b37 231 { "fqdn-reply", "f", &server_universe, 52, 1 },
98bd7ca0 232 { "preferred-lifetime", "T", &server_universe, 53, 1 },
75135a3f
EH
233 { "dhcpv6-lease-file-name", "t", &server_universe, 54, 1 },
234 { "dhcpv6-pid-file-name", "t", &server_universe, 55, 1 },
b024480e 235 { "limit-addrs-per-ia", "L", &server_universe, 56, 1 },
80c9fdb0 236 { "limit-prefs-per-ia", "L", &server_universe, 57, 1 },
fbcee149 237/* Assert a configuration parsing error if delayed-ack isn't compiled in. */
700e3fca 238#if defined(DELAYED_ACK)
80c9fdb0 239 { "delayed-ack", "S", &server_universe, 58, 1 },
f8cbf390 240 { "max-ack-delay", "L", &server_universe, 59, 1 },
fbcee149 241#endif
33692791
DH
242#if defined(LDAP_CONFIGURATION)
243 { "ldap-server", "t", &server_universe, 60, 1 },
9a2f9db5 244 { "ldap-port", "L", &server_universe, 61, 1 },
33692791
DH
245 { "ldap-username", "t", &server_universe, 62, 1 },
246 { "ldap-password", "t", &server_universe, 63, 1 },
247 { "ldap-base-dn", "t", &server_universe, 64, 1 },
248 { "ldap-method", "Nldap-methods.", &server_universe, 65, 1 },
249 { "ldap-debug-file", "t", &server_universe, 66, 1 },
250 { "ldap-dhcp-server-cn", "t", &server_universe, 67, 1 },
251 { "ldap-referrals", "f", &server_universe, 68, 1 },
252#if defined(LDAP_USE_SSL)
253 { "ldap-ssl", "Nldap-ssl-usage.", &server_universe, 69, 1 },
254 { "ldap-tls-reqcert", "Nldap-tls-reqcert.", &server_universe, 70, 1 },
255 { "ldap-tls-ca-file", "t", &server_universe, 71, 1 },
256 { "ldap-tls-ca-dir", "t", &server_universe, 72, 1 },
257 { "ldap-tls-cert", "t", &server_universe, 73, 1 },
258 { "ldap-tls-key", "t", &server_universe, 74, 1 },
259 { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 75, 1 },
260 { "ldap-tls-ciphers", "t", &server_universe, 76, 1 },
261 { "ldap-tls-randfile", "t", &server_universe, 77, 1 },
9a2f9db5 262 { "ldap-init-retry", "L", &server_universe, SV_LDAP_INIT_RETRY, 1 },
33692791 263#endif /* LDAP_USE_SSL */
743d6937
TM
264#if defined(LDAP_USE_GSSAPI)
265 { "ldap-gssapi-keytab", "t", &server_universe, SV_LDAP_GSSAPI_KEYTAB, 1},
266 { "ldap-gssapi-principal", "t", &server_universe, SV_LDAP_GSSAPI_PRINCIPAL, 1},
267#endif /* LDAP_USE_GSSAPI */
33692791 268#endif /* LDAP_CONFIGURATION */
929a2364 269 { "dhcp-cache-threshold", "B", &server_universe, 78, 1 },
cde11a4c 270 { "dont-use-fsync", "f", &server_universe, 79, 1 },
61ef216b
SR
271 { "ddns-local-address4", "I", &server_universe, 80, 1 },
272 { "ddns-local-address6", "6", &server_universe, 81, 1 },
38ee81bd 273 { "ignore-client-uids", "f", &server_universe, 82, 1 },
250f7134
SR
274 { "log-threshold-low", "B", &server_universe, 83, 1 },
275 { "log-threshold-high", "B", &server_universe, 84, 1 },
e046c826 276 { "echo-client-id", "f", &server_universe, SV_ECHO_CLIENT_ID, 1 },
7116a34f 277 { "server-id-check", "f", &server_universe, SV_SERVER_ID_CHECK, 1 },
1a006ff6 278 { "prefix-length-mode", "Nprefix_length_modes.", &server_universe, SV_PREFIX_LEN_MODE, 1 },
dce576b8 279 { "dhcpv6-set-tee-times", "f", &server_universe, SV_DHCPV6_SET_TEE_TIMES, 1 },
a5252220 280 { "abandon-lease-time", "T", &server_universe, SV_ABANDON_LEASE_TIME, 1 },
417b7b4a
TM
281#ifdef EUI_64
282 { "use-eui-64", "f", &server_universe, SV_USE_EUI_64, 1 },
c2e5ee28 283 { "persist-eui-64-leases", "f", &server_universe, SV_PERSIST_EUI_64_LEASES, 1 },
30593241
TM
284#endif
285#if defined (FAILOVER_PROTOCOL)
286 { "check-secs-byte-order", "f", &server_universe, SV_CHECK_SECS_BYTE_ORDER, 1 },
417b7b4a 287#endif
905c58b9
TM
288 { "ddns-dual-stack-mixed-mode", "f", &server_universe, SV_DDNS_DUAL_STACK_MIXED_MODE, 1 },
289 { "ddns-guard-id-must-match", "f", &server_universe, SV_DDNS_GUARD_ID_MUST_MATCH, 1 },
290 { "ddns-other-guard-is-dynamic", "f", &server_universe, SV_DDNS_OTHER_GUARD_IS_DYNAMIC, 1 },
bafa7b74 291 { "release-on-roam", "f", &server_universe, SV_RELEASE_ON_ROAM, 1 },
a2a0f98c
FD
292 { "local-address6", "6", &server_universe, SV_LOCAL_ADDRESS6, 1 },
293 { "bind-local-address6", "f", &server_universe, SV_BIND_LOCAL_ADDRESS6, 1 },
a5b21e16 294 { "ping-cltt-secs", "T", &server_universe, SV_PING_CLTT_SECS, 1 },
e6eccd10 295 { "ping-timeout-ms", "T", &server_universe, SV_PING_TIMEOUT_MS, 1 },
f7fdb216 296 { NULL, NULL, NULL, 0, 0 }
5020567a
TL
297};
298
33692791
DH
299#if defined(LDAP_CONFIGURATION)
300struct enumeration_value ldap_values [] = {
301 { "static", LDAP_METHOD_STATIC },
302 { "dynamic", LDAP_METHOD_DYNAMIC },
303 { (char *) 0, 0 }
304};
305
306struct enumeration ldap_methods = {
307 (struct enumeration *)0,
308 "ldap-methods", 1,
309 ldap_values
310};
311
312#if defined(LDAP_USE_SSL)
313struct enumeration_value ldap_ssl_usage_values [] = {
314 { "off", LDAP_SSL_OFF },
315 { "on",LDAP_SSL_ON },
316 { "ldaps", LDAP_SSL_LDAPS },
317 { "start_tls", LDAP_SSL_TLS },
318 { (char *) 0, 0 }
319};
320
321struct enumeration ldap_ssl_usage_enum = {
322 (struct enumeration *)0,
323 "ldap-ssl-usage", 1,
324 ldap_ssl_usage_values
325};
326
327struct enumeration_value ldap_tls_reqcert_values [] = {
328 { "never", LDAP_OPT_X_TLS_NEVER },
329 { "hard", LDAP_OPT_X_TLS_HARD },
330 { "demand", LDAP_OPT_X_TLS_DEMAND},
331 { "allow", LDAP_OPT_X_TLS_ALLOW },
332 { "try", LDAP_OPT_X_TLS_TRY },
333 { (char *) 0, 0 }
334};
335struct enumeration ldap_tls_reqcert_enum = {
336 (struct enumeration *)0,
337 "ldap-tls-reqcert", 1,
338 ldap_tls_reqcert_values
339};
340
341struct enumeration_value ldap_tls_crlcheck_values [] = {
342 { "none", LDAP_OPT_X_TLS_CRL_NONE},
343 { "peer", LDAP_OPT_X_TLS_CRL_PEER},
344 { "all", LDAP_OPT_X_TLS_CRL_ALL },
345 { (char *) 0, 0 }
346};
347struct enumeration ldap_tls_crlcheck_enum = {
348 (struct enumeration *)0,
349 "ldap-tls-crlcheck", 1,
350 ldap_tls_crlcheck_values
351};
352#endif
353#endif
354
a256fd85
TL
355struct enumeration_value ddns_styles_values [] = {
356 { "none", 0 },
357 { "ad-hoc", 1 },
358 { "interim", 2 },
d7d9c0c7 359 { "standard", 3 },
a256fd85
TL
360 { (char *)0, 0 }
361};
362
363struct enumeration ddns_styles = {
364 (struct enumeration *)0,
98bd7ca0 365 "ddns-styles", 1,
a256fd85
TL
366 ddns_styles_values
367};
368
1a006ff6
TM
369struct enumeration_value prefix_length_modes_values[] = {
370 { "ignore", PLM_IGNORE },
371 { "prefer", PLM_PREFER },
372 { "exact", PLM_EXACT },
373 { "minimum", PLM_MINIMUM },
374 { "maximum", PLM_MAXIMUM },
375 { (char *)0, 0 }
376};
377
378struct enumeration prefix_length_modes = {
379 (struct enumeration *)0,
380 "prefix_length_modes", 1,
381 prefix_length_modes_values
382};
383
0feab074
TL
384struct enumeration_value syslog_values [] = {
385#if defined (LOG_KERN)
386 { "kern", LOG_KERN },
387#endif
388#if defined (LOG_USER)
389 { "user", LOG_USER },
390#endif
391#if defined (LOG_MAIL)
392 { "mail", LOG_MAIL },
393#endif
394#if defined (LOG_DAEMON)
395 { "daemon", LOG_DAEMON },
396#endif
397#if defined (LOG_AUTH)
398 { "auth", LOG_AUTH },
399#endif
400#if defined (LOG_SYSLOG)
401 { "syslog", LOG_SYSLOG },
402#endif
403#if defined (LOG_LPR)
404 { "lpr", LOG_LPR },
405#endif
406#if defined (LOG_NEWS)
407 { "news", LOG_NEWS },
408#endif
409#if defined (LOG_UUCP)
410 { "uucp", LOG_UUCP },
411#endif
412#if defined (LOG_CRON)
413 { "cron", LOG_CRON },
414#endif
415#if defined (LOG_AUTHPRIV)
416 { "authpriv", LOG_AUTHPRIV },
417#endif
418#if defined (LOG_FTP)
419 { "ftp", LOG_FTP },
420#endif
421#if defined (LOG_LOCAL0)
422 { "local0", LOG_LOCAL0 },
423#endif
424#if defined (LOG_LOCAL1)
425 { "local1", LOG_LOCAL1 },
426#endif
427#if defined (LOG_LOCAL2)
428 { "local2", LOG_LOCAL2 },
429#endif
430#if defined (LOG_LOCAL3)
431 { "local3", LOG_LOCAL3 },
432#endif
433#if defined (LOG_LOCAL4)
434 { "local4", LOG_LOCAL4 },
435#endif
436#if defined (LOG_LOCAL5)
437 { "local5", LOG_LOCAL5 },
438#endif
439#if defined (LOG_LOCAL6)
440 { "local6", LOG_LOCAL6 },
441#endif
442#if defined (LOG_LOCAL7)
443 { "local7", LOG_LOCAL7 },
444#endif
445 { (char *)0, 0 }
446};
447
448struct enumeration syslog_enum = {
449 (struct enumeration *)0,
98bd7ca0 450 "syslog-facilities", 1,
0feab074
TL
451 syslog_values
452};
453
5020567a
TL
454void initialize_server_option_spaces()
455{
456 int i;
f7fdb216 457 unsigned code;
5020567a
TL
458
459 /* Set up the Relay Agent Information Option suboption space... */
460 agent_universe.name = "agent";
98bd7ca0 461 agent_universe.concat_duplicates = 0;
5020567a 462 agent_universe.option_state_dereference =
e929278f
TL
463 linked_option_state_dereference;
464 agent_universe.lookup_func = lookup_linked_option;
465 agent_universe.save_func = save_linked_option;
466 agent_universe.delete_func = delete_linked_option;
467 agent_universe.encapsulate = linked_option_space_encapsulate;
468 agent_universe.foreach = linked_option_space_foreach;
469 agent_universe.decode = parse_option_buffer;
5020567a
TL
470 agent_universe.index = universe_count++;
471 agent_universe.length_size = 1;
472 agent_universe.tag_size = 1;
f7fdb216 473 agent_universe.get_tag = getUChar;
5020567a 474 agent_universe.store_tag = putUChar;
f7fdb216 475 agent_universe.get_length = getUChar;
5020567a 476 agent_universe.store_length = putUChar;
2c9bf1f4
DH
477 agent_universe.site_code_min = 0;
478 agent_universe.end = 0;
5020567a 479 universes [agent_universe.index] = &agent_universe;
f7fdb216
DH
480 if (!option_name_new_hash(&agent_universe.name_hash,
481 AGENT_HASH_SIZE, MDL) ||
482 !option_code_new_hash(&agent_universe.code_hash,
483 AGENT_HASH_SIZE, MDL))
5020567a 484 log_fatal ("Can't allocate agent option hash table.");
f7fdb216
DH
485 for (i = 0 ; agent_options[i].name ; i++) {
486 option_code_hash_add(agent_universe.code_hash,
487 &agent_options[i].code, 0,
488 &agent_options[i], MDL);
489 option_name_hash_add(agent_universe.name_hash,
490 agent_options[i].name, 0,
491 &agent_options[i], MDL);
5020567a 492 }
6708d944
DH
493#if defined(REPORT_HASH_PERFORMANCE)
494 log_info("Relay Agent name hash: %s",
495 option_name_hash_report(agent_universe.name_hash));
496 log_info("Relay Agent code hash: %s",
497 option_code_hash_report(agent_universe.code_hash));
498#endif
f7fdb216
DH
499 code = DHO_DHCP_AGENT_OPTIONS;
500 option_code_hash_lookup(&agent_universe.enc_opt,
501 dhcp_universe.code_hash, &code, 0, MDL);
5020567a
TL
502
503 /* Set up the server option universe... */
504 server_universe.name = "server";
98bd7ca0 505 server_universe.concat_duplicates = 0;
5020567a
TL
506 server_universe.lookup_func = lookup_hashed_option;
507 server_universe.option_state_dereference =
508 hashed_option_state_dereference;
5020567a
TL
509 server_universe.save_func = save_hashed_option;
510 server_universe.delete_func = delete_hashed_option;
511 server_universe.encapsulate = hashed_option_space_encapsulate;
e929278f 512 server_universe.foreach = hashed_option_space_foreach;
f7fdb216
DH
513 server_universe.length_size = 1; /* Never used ... */
514 server_universe.tag_size = 4;
5020567a
TL
515 server_universe.store_tag = putUChar;
516 server_universe.store_length = putUChar;
2c9bf1f4
DH
517 server_universe.site_code_min = 0;
518 server_universe.end = 0;
5020567a
TL
519 server_universe.index = universe_count++;
520 universes [server_universe.index] = &server_universe;
f7fdb216
DH
521 if (!option_name_new_hash(&server_universe.name_hash,
522 SERVER_HASH_SIZE, MDL) ||
523 !option_code_new_hash(&server_universe.code_hash,
524 SERVER_HASH_SIZE, MDL))
5020567a 525 log_fatal ("Can't allocate server option hash table.");
f7fdb216
DH
526 for (i = 0 ; server_options[i].name ; i++) {
527 option_code_hash_add(server_universe.code_hash,
528 &server_options[i].code, 0,
529 &server_options[i], MDL);
530 option_name_hash_add(server_universe.name_hash,
531 server_options[i].name, 0,
532 &server_options[i], MDL);
5020567a 533 }
6708d944
DH
534#if defined(REPORT_HASH_PERFORMANCE)
535 log_info("Server-Config Option name hash: %s",
536 option_name_hash_report(server_universe.name_hash));
537 log_info("Server-Config Option code hash: %s",
538 option_code_hash_report(server_universe.code_hash));
539#endif
5020567a
TL
540
541 /* Add the server and agent option spaces to the option space hash. */
20916cae
TL
542 universe_hash_add (universe_hash,
543 agent_universe.name, 0, &agent_universe, MDL);
544 universe_hash_add (universe_hash,
545 server_universe.name, 0, &server_universe, MDL);
588af269
TL
546
547 /* Make the server universe the configuration option universe. */
548 config_universe = &server_universe;
f7fdb216
DH
549
550 code = SV_VENDOR_OPTION_SPACE;
551 option_code_hash_lookup(&vendor_cfg_option, server_universe.code_hash,
552 &code, 0, MDL);
5020567a 553}