server/stables.c

Go to the documentation of this file.
00001 /* stables.c
00002 
00003    Tables of information only used by server... */
00004 
00005 /*
00006  * Copyright (c) 2004-2011,2013-2014 by Internet Systems Consortium, Inc. ("ISC")
00007  * Copyright (c) 1995-2003 by Internet Software Consortium
00008  *
00009  * Permission to use, copy, modify, and distribute this software for any
00010  * purpose with or without fee is hereby granted, provided that the above
00011  * copyright notice and this permission notice appear in all copies.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
00014  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00015  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
00016  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00017  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00018  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
00019  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00020  *
00021  *   Internet Systems Consortium, Inc.
00022  *   950 Charter Street
00023  *   Redwood City, CA 94063
00024  *   <info@isc.org>
00025  *   https://www.isc.org/
00026  *
00027  */
00028 
00029 #include "dhcpd.h"
00030 #include <syslog.h>
00031 
00032 #if defined (FAILOVER_PROTOCOL)
00033 
00034 /* This is used to indicate some kind of failure when generating a
00035    failover option. */
00036 failover_option_t null_failover_option = { 0, 0 };
00037 failover_option_t skip_failover_option = { 0, 0 };
00038 
00039 /* Information about failover options, for printing, encoding
00040    and decoding. */
00041 struct failover_option_info ft_options [] =
00042 {
00043         { 0, "unused", FT_UNDEF, 0, 0, 0 },
00044         { FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1,
00045           FM_OFFSET(addresses_transferred), FTB_ADDRESSES_TRANSFERRED },
00046         { FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1,
00047           FM_OFFSET(assigned_addr), FTB_ASSIGNED_IP_ADDRESS },
00048         { FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1,
00049           FM_OFFSET(binding_status), FTB_BINDING_STATUS },
00050         { FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0,
00051           FM_OFFSET(client_identifier), FTB_CLIENT_IDENTIFIER },
00052         { FTO_CHADDR, "client-hardware-address", FT_BYTES, 0,
00053           FM_OFFSET(chaddr), FTB_CHADDR },
00054         { FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1,
00055           FM_OFFSET(cltt), FTB_CLTT },
00056         { FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0,
00057           FM_OFFSET(reply_options), FTB_REPLY_OPTIONS },
00058         { FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0,
00059           FM_OFFSET(request_options), FTB_REQUEST_OPTIONS },
00060         { FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET(ddns), FTB_DDNS },
00061         { FTO_DELAYED_SERVICE, "delayed-service", FT_UINT8, 1,
00062           FM_OFFSET(delayed_service), FTB_DELAYED_SERVICE },
00063         { FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0,
00064           FM_OFFSET(hba), FTB_HBA },
00065         { FTO_IP_FLAGS, "IP-flags", FT_UINT16, 1,
00066           FM_OFFSET(ip_flags), FTB_IP_FLAGS },
00067         { FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1,
00068           FM_OFFSET(expiry), FTB_LEASE_EXPIRY },
00069         { FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1, 
00070           FM_OFFSET(max_unacked), FTB_MAX_UNACKED },
00071         { FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET(mclt), FTB_MCLT },
00072         { FTO_MESSAGE, "message", FT_TEXT, 0,
00073           FM_OFFSET(message), FTB_MESSAGE },
00074         { FTO_MESSAGE_DIGEST, "message-digest", FT_BYTES, 0,
00075           FM_OFFSET(message_digest), FTB_MESSAGE_DIGEST },
00076         { FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1,
00077           FM_OFFSET(potential_expiry), FTB_POTENTIAL_EXPIRY },
00078         { FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1,
00079           FM_OFFSET(receive_timer), FTB_RECEIVE_TIMER },
00080         { FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1,
00081           FM_OFFSET(protocol_version), FTB_PROTOCOL_VERSION },
00082         { FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1,
00083           FM_OFFSET(reject_reason), FTB_REJECT_REASON },
00084         { FTO_RELATIONSHIP_NAME, "relationship-name", FT_BYTES, 0,
00085           FM_OFFSET(relationship_name), FTB_RELATIONSHIP_NAME },
00086         { FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1,
00087           FM_OFFSET(server_flags), FTB_SERVER_FLAGS },
00088         { FTO_SERVER_STATE, "server-state", FT_UINT8, 1,
00089           FM_OFFSET(server_state), FTB_SERVER_STATE },
00090         { FTO_STOS, "start-time-of-state", FT_UINT32, 1,
00091           FM_OFFSET(stos), FTB_STOS },
00092         { FTO_TLS_REPLY, "TLS-reply", FT_UINT8, 1,
00093           FM_OFFSET(tls_reply), FTB_TLS_REPLY },
00094         { FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 1,
00095           FM_OFFSET(tls_request), FTB_TLS_REQUEST },
00096         { FTO_VENDOR_CLASS, "vendor-class-identifier", FT_BYTES, 0,
00097           FM_OFFSET(vendor_class), FTB_VENDOR_CLASS },
00098         { FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0,
00099           FM_OFFSET(vendor_options), FTB_VENDOR_OPTIONS }
00100 };
00101 
00102 /* These are really options that make sense for a particular request - if
00103    some other option comes in, we're not going to use it, so we can just
00104    discard it.  Note that the message-digest option is allowed for all
00105    message types, but is not saved - it's just used to validate the message
00106    and then discarded - so it's not mentioned here. */
00107 
00108 u_int32_t fto_allowed [] = {
00109         0,      /* 0 unused */
00110         0,      /* 1 POOLREQ */
00111         FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */
00112         (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
00113          FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
00114          FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
00115          FTB_REPLY_OPTIONS), /* 3 BNDUPD */
00116         (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER |
00117          FTB_CHADDR | FTB_DDNS | FTB_IP_FLAGS | FTB_LEASE_EXPIRY |
00118          FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS |
00119          FTB_REPLY_OPTIONS | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */
00120         (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
00121          FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST |
00122          FTB_MCLT | FTB_HBA), /* 5 CONNECT */
00123         (FTB_RELATIONSHIP_NAME | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER |
00124          FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY |
00125          FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */
00126         0, /* 7 UPDREQALL */
00127         0, /* 8 UPDDONE */
00128         0, /* 9 UPDREQ */
00129         (FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */
00130         0,      /* 11 CONTACT */
00131         (FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */
00132 };
00133 
00134 /* Sizes of the various types. */
00135 int ft_sizes [] = {
00136         1, /* FT_UINT8 */
00137         4, /* FT_IPADDR */
00138         4, /* FT_UINT32 */
00139         1, /* FT_BYTES */
00140         1, /* FT_TEXT_OR_BYTES */
00141         0, /* FT_DDNS */
00142         0, /* FT_DDNS1 */
00143         2, /* FT_UINT16 */
00144         1, /* FT_TEXT */
00145         0, /* FT_UNDEF */
00146         0, /* FT_DIGEST */
00147 };
00148 
00149 /* Names of the various failover link states. */
00150 const char *dhcp_flink_state_names [] = {
00151         "invalid state 0",
00152         "startup",
00153         "message length wait",
00154         "message wait",
00155         "disconnected"
00156 };
00157 #endif /* FAILOVER_PROTOCOL */
00158 
00159 /* Failover binding state names.   These are used even if there is no
00160    failover protocol support. */
00161 const char *binding_state_names [] = {
00162         "free", "active", "expired", "released", "abandoned",
00163         "reset", "backup" };
00164 
00165 struct universe agent_universe;
00166 static struct option agent_options[] = {
00167         { "circuit-id", "X",                    &agent_universe,   1, 1 },
00168         { "remote-id", "X",                     &agent_universe,   2, 1 },
00169         { "agent-id", "I",                      &agent_universe,   3, 1 },
00170         { "DOCSIS-device-class", "L",           &agent_universe,   4, 1 },
00171         { "link-selection", "I",                &agent_universe,   5, 1 },
00172         { NULL, NULL, NULL, 0, 0 }
00173 };
00174 
00175 struct universe server_universe;
00176 static struct option server_options[] = {
00177         { "default-lease-time", "T",            &server_universe,   1, 1 },
00178         { "max-lease-time", "T",                &server_universe,   2, 1 },
00179         { "min-lease-time", "T",                &server_universe,   3, 1 },
00180         { "dynamic-bootp-lease-cutoff", "T",    &server_universe,   4, 1 },
00181         { "dynamic-bootp-lease-length", "L",    &server_universe,   5, 1 },
00182         { "boot-unknown-clients", "f",          &server_universe,   6, 1 },
00183         { "dynamic-bootp", "f",                 &server_universe,   7, 1 },
00184         { "allow-bootp", "f",                   &server_universe,   8, 1 },
00185         { "allow-booting", "f",                 &server_universe,   9, 1 },
00186         { "one-lease-per-client", "f",          &server_universe,  10, 1 },
00187         { "get-lease-hostnames", "f",           &server_universe,  11, 1 },
00188         { "use-host-decl-names", "f",           &server_universe,  12, 1 },
00189         { "use-lease-addr-for-default-route", "f",
00190                                                 &server_universe,  13, 1 },
00191         { "min-secs", "B",                      &server_universe,  14, 1 },
00192         { "filename", "t",                      &server_universe,  15, 1 },
00193         { "server-name", "t",                   &server_universe,  16, 1 },
00194         { "next-server", "I",                   &server_universe,  17, 1 },
00195         { "authoritative", "f",                 &server_universe,  18, 1 },
00196         { "vendor-option-space", "U",           &server_universe,  19, 1 },
00197         { "always-reply-rfc1048", "f",          &server_universe,  20, 1 },
00198         { "site-option-space", "X",             &server_universe,  21, 1 },
00199         { "always-broadcast", "f",              &server_universe,  22, 1 },
00200         { "ddns-domainname", "t",               &server_universe,  23, 1 },
00201         { "ddns-hostname", "t",                 &server_universe,  24, 1 },
00202         { "ddns-rev-domainname", "t",           &server_universe,  25, 1 },
00203         { "lease-file-name", "t",               &server_universe,  26, 1 },
00204         { "pid-file-name", "t",                 &server_universe,  27, 1 },
00205         { "duplicates", "f",                    &server_universe,  28, 1 },
00206         { "declines", "f",                      &server_universe,  29, 1 },
00207         { "ddns-updates", "f",                  &server_universe,  30, 1 },
00208         { "omapi-port", "S",                    &server_universe,  31, 1 },
00209         { "local-port", "S",                    &server_universe,  32, 1 },
00210         { "limited-broadcast-address", "I",     &server_universe,  33, 1 },
00211         { "remote-port", "S",                   &server_universe,  34, 1 },
00212         { "local-address", "I",                 &server_universe,  35, 1 },
00213         { "omapi-key", "d",                     &server_universe,  36, 1 },
00214         { "stash-agent-options", "f",           &server_universe,  37, 1 },
00215         { "ddns-ttl", "T",                      &server_universe,  38, 1 },
00216         { "ddns-update-style", "Nddns-styles.", &server_universe,  39, 1 },
00217         { "client-updates", "f",                &server_universe,  40, 1 },
00218         { "update-optimization", "f",           &server_universe,  41, 1 },
00219         { "ping-check", "f",                    &server_universe,  42, 1 },
00220         { "update-static-leases", "f",          &server_universe,  43, 1 },
00221         { "log-facility", "Nsyslog-facilities.",
00222                                                 &server_universe,  44, 1 },
00223         { "do-forward-updates", "f",            &server_universe,  45, 1 },
00224         { "ping-timeout", "T",                  &server_universe,  46, 1 },
00225         { "infinite-is-reserved", "f",          &server_universe,  47, 1 },
00226         { "update-conflict-detection", "f",     &server_universe,  48, 1 },
00227         { "leasequery", "f",                    &server_universe,  49, 1 },
00228         { "adaptive-lease-time-threshold", "B", &server_universe,  50, 1 },
00229         { "do-reverse-updates", "f",            &server_universe,  51, 1 },
00230         { "fqdn-reply", "f",                    &server_universe,  52, 1 },
00231         { "preferred-lifetime", "T",            &server_universe,  53, 1 },
00232         { "dhcpv6-lease-file-name", "t",        &server_universe,  54, 1 },
00233         { "dhcpv6-pid-file-name", "t",          &server_universe,  55, 1 },
00234         { "limit-addrs-per-ia", "L",            &server_universe,  56, 1 },
00235         { "limit-prefs-per-ia", "L",            &server_universe,  57, 1 },
00236 /* Assert a configuration parsing error if delayed-ack isn't compiled in. */
00237 #if defined(DELAYED_ACK)
00238         { "delayed-ack", "S",                   &server_universe,  58, 1 },
00239         { "max-ack-delay", "L",                 &server_universe,  59, 1 },
00240 #endif
00241 #if defined(LDAP_CONFIGURATION)
00242         { "ldap-server", "t",                   &server_universe,  60, 1 },
00243         { "ldap-port", "d",                     &server_universe,  61, 1 },
00244         { "ldap-username", "t",                 &server_universe,  62, 1 },
00245         { "ldap-password", "t",                 &server_universe,  63, 1 },
00246         { "ldap-base-dn", "t",                  &server_universe,  64, 1 },
00247         { "ldap-method", "Nldap-methods.",      &server_universe,  65, 1 },
00248         { "ldap-debug-file", "t",               &server_universe,  66, 1 },
00249         { "ldap-dhcp-server-cn", "t",           &server_universe,  67, 1 },
00250         { "ldap-referrals", "f",                &server_universe,  68, 1 },
00251 #if defined(LDAP_USE_SSL)
00252         { "ldap-ssl", "Nldap-ssl-usage.",       &server_universe,  69, 1 },
00253         { "ldap-tls-reqcert", "Nldap-tls-reqcert.",     &server_universe,  70, 1 },
00254         { "ldap-tls-ca-file", "t",              &server_universe,  71, 1 },
00255         { "ldap-tls-ca-dir", "t",               &server_universe,  72, 1 },
00256         { "ldap-tls-cert", "t",                 &server_universe,  73, 1 },
00257         { "ldap-tls-key", "t",                  &server_universe,  74, 1 },
00258         { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.",   &server_universe,  75, 1 },
00259         { "ldap-tls-ciphers", "t",              &server_universe,  76, 1 },
00260         { "ldap-tls-randfile", "t",             &server_universe,  77, 1 },
00261 #endif /* LDAP_USE_SSL */
00262 #endif /* LDAP_CONFIGURATION */
00263         { "dhcp-cache-threshold", "B",          &server_universe,  78, 1 },
00264         { "dont-use-fsync", "f",                &server_universe,  79, 1 },
00265         { "ddns-local-address4", "I",           &server_universe,  80, 1 },
00266         { "ddns-local-address6", "6",           &server_universe,  81, 1 },
00267         { "ignore-client-uids", "f",            &server_universe,  82, 1 },
00268         { NULL, NULL, NULL, 0, 0 }
00269 };
00270 
00271 #if defined(LDAP_CONFIGURATION)
00272 struct enumeration_value ldap_values [] = {
00273         { "static", LDAP_METHOD_STATIC },
00274         { "dynamic", LDAP_METHOD_DYNAMIC },
00275         { (char *) 0, 0 }
00276 };
00277 
00278 struct enumeration ldap_methods = {
00279         (struct enumeration *)0,
00280         "ldap-methods", 1,
00281         ldap_values
00282 };
00283 
00284 #if defined(LDAP_USE_SSL)
00285 struct enumeration_value ldap_ssl_usage_values [] = {
00286         { "off", LDAP_SSL_OFF },
00287         { "on",LDAP_SSL_ON },
00288         { "ldaps", LDAP_SSL_LDAPS },
00289         { "start_tls", LDAP_SSL_TLS },
00290         { (char *) 0, 0 }
00291 };
00292 
00293 struct enumeration ldap_ssl_usage_enum = {
00294         (struct enumeration *)0,
00295         "ldap-ssl-usage", 1,
00296         ldap_ssl_usage_values
00297 };
00298 
00299 struct enumeration_value ldap_tls_reqcert_values [] = {
00300         { "never", LDAP_OPT_X_TLS_NEVER },
00301         { "hard", LDAP_OPT_X_TLS_HARD  },
00302         { "demand", LDAP_OPT_X_TLS_DEMAND},
00303         { "allow", LDAP_OPT_X_TLS_ALLOW },
00304         { "try", LDAP_OPT_X_TLS_TRY   },
00305         { (char *) 0, 0 }
00306 };
00307 struct enumeration ldap_tls_reqcert_enum = {
00308         (struct enumeration *)0,
00309         "ldap-tls-reqcert", 1,
00310         ldap_tls_reqcert_values
00311 };
00312 
00313 struct enumeration_value ldap_tls_crlcheck_values [] = {
00314         { "none", LDAP_OPT_X_TLS_CRL_NONE},
00315         { "peer", LDAP_OPT_X_TLS_CRL_PEER},
00316         { "all",  LDAP_OPT_X_TLS_CRL_ALL },
00317         { (char *) 0, 0 }
00318 };
00319 struct enumeration ldap_tls_crlcheck_enum = {
00320         (struct enumeration *)0,
00321         "ldap-tls-crlcheck", 1,
00322         ldap_tls_crlcheck_values
00323 };
00324 #endif
00325 #endif
00326 
00327 struct enumeration_value ddns_styles_values [] = {
00328         { "none", 0 },
00329         { "ad-hoc", 1 },
00330         { "interim", 2 },
00331         { "standard", 3 },
00332         { (char *)0, 0 }
00333 };
00334 
00335 struct enumeration ddns_styles = {
00336         (struct enumeration *)0,
00337         "ddns-styles", 1,
00338         ddns_styles_values
00339 };
00340 
00341 struct enumeration_value syslog_values [] = {
00342 #if defined (LOG_KERN)
00343         { "kern", LOG_KERN },
00344 #endif
00345 #if defined (LOG_USER)
00346         { "user", LOG_USER },
00347 #endif
00348 #if defined (LOG_MAIL)
00349         { "mail", LOG_MAIL },
00350 #endif
00351 #if defined (LOG_DAEMON)
00352         { "daemon", LOG_DAEMON },
00353 #endif
00354 #if defined (LOG_AUTH)
00355         { "auth", LOG_AUTH },
00356 #endif
00357 #if defined (LOG_SYSLOG)
00358         { "syslog", LOG_SYSLOG },
00359 #endif
00360 #if defined (LOG_LPR)
00361         { "lpr", LOG_LPR },
00362 #endif
00363 #if defined (LOG_NEWS)
00364         { "news", LOG_NEWS },
00365 #endif
00366 #if defined (LOG_UUCP)
00367         { "uucp", LOG_UUCP },
00368 #endif
00369 #if defined (LOG_CRON)
00370         { "cron", LOG_CRON },
00371 #endif
00372 #if defined (LOG_AUTHPRIV)
00373         { "authpriv", LOG_AUTHPRIV },
00374 #endif
00375 #if defined (LOG_FTP)
00376         { "ftp", LOG_FTP },
00377 #endif
00378 #if defined (LOG_LOCAL0)
00379         { "local0", LOG_LOCAL0 },
00380 #endif
00381 #if defined (LOG_LOCAL1)
00382         { "local1", LOG_LOCAL1 },
00383 #endif
00384 #if defined (LOG_LOCAL2)
00385         { "local2", LOG_LOCAL2 },
00386 #endif
00387 #if defined (LOG_LOCAL3)
00388         { "local3", LOG_LOCAL3 },
00389 #endif
00390 #if defined (LOG_LOCAL4)
00391         { "local4", LOG_LOCAL4 },
00392 #endif
00393 #if defined (LOG_LOCAL5)
00394         { "local5", LOG_LOCAL5 },
00395 #endif
00396 #if defined (LOG_LOCAL6)
00397         { "local6", LOG_LOCAL6 },
00398 #endif
00399 #if defined (LOG_LOCAL7)
00400         { "local7", LOG_LOCAL7 },
00401 #endif
00402         { (char *)0, 0 }
00403 };
00404 
00405 struct enumeration syslog_enum = {
00406         (struct enumeration *)0,
00407         "syslog-facilities", 1,
00408         syslog_values
00409 };
00410 
00411 void initialize_server_option_spaces()
00412 {
00413         int i;
00414         unsigned code;
00415 
00416         /* Set up the Relay Agent Information Option suboption space... */
00417         agent_universe.name = "agent";
00418         agent_universe.concat_duplicates = 0;
00419         agent_universe.option_state_dereference =
00420                 linked_option_state_dereference;
00421         agent_universe.lookup_func = lookup_linked_option;
00422         agent_universe.save_func = save_linked_option;
00423         agent_universe.delete_func = delete_linked_option;
00424         agent_universe.encapsulate = linked_option_space_encapsulate;
00425         agent_universe.foreach = linked_option_space_foreach;
00426         agent_universe.decode = parse_option_buffer;
00427         agent_universe.index = universe_count++;
00428         agent_universe.length_size = 1;
00429         agent_universe.tag_size = 1;
00430         agent_universe.get_tag = getUChar;
00431         agent_universe.store_tag = putUChar;
00432         agent_universe.get_length = getUChar;
00433         agent_universe.store_length = putUChar;
00434         agent_universe.site_code_min = 0;
00435         agent_universe.end = 0;
00436         universes [agent_universe.index] = &agent_universe;
00437         if (!option_name_new_hash(&agent_universe.name_hash,
00438                                   AGENT_HASH_SIZE, MDL) ||
00439             !option_code_new_hash(&agent_universe.code_hash,
00440                                   AGENT_HASH_SIZE, MDL))
00441                 log_fatal ("Can't allocate agent option hash table.");
00442         for (i = 0 ; agent_options[i].name ; i++) {
00443                 option_code_hash_add(agent_universe.code_hash,
00444                                      &agent_options[i].code, 0,
00445                                      &agent_options[i], MDL);
00446                 option_name_hash_add(agent_universe.name_hash,
00447                                      agent_options[i].name, 0,
00448                                      &agent_options[i], MDL);
00449         }
00450 #if defined(REPORT_HASH_PERFORMANCE)
00451         log_info("Relay Agent name hash: %s",
00452                  option_name_hash_report(agent_universe.name_hash));
00453         log_info("Relay Agent code hash: %s",
00454                  option_code_hash_report(agent_universe.code_hash));
00455 #endif
00456         code = DHO_DHCP_AGENT_OPTIONS;
00457         option_code_hash_lookup(&agent_universe.enc_opt,
00458                                 dhcp_universe.code_hash, &code, 0, MDL);
00459 
00460         /* Set up the server option universe... */
00461         server_universe.name = "server";
00462         server_universe.concat_duplicates = 0;
00463         server_universe.lookup_func = lookup_hashed_option;
00464         server_universe.option_state_dereference =
00465                 hashed_option_state_dereference;
00466         server_universe.save_func = save_hashed_option;
00467         server_universe.delete_func = delete_hashed_option;
00468         server_universe.encapsulate = hashed_option_space_encapsulate;
00469         server_universe.foreach = hashed_option_space_foreach;
00470         server_universe.length_size = 1; /* Never used ... */
00471         server_universe.tag_size = 4;
00472         server_universe.store_tag = putUChar;
00473         server_universe.store_length = putUChar;
00474         server_universe.site_code_min = 0;
00475         server_universe.end = 0;
00476         server_universe.index = universe_count++;
00477         universes [server_universe.index] = &server_universe;
00478         if (!option_name_new_hash(&server_universe.name_hash,
00479                                   SERVER_HASH_SIZE, MDL) ||
00480             !option_code_new_hash(&server_universe.code_hash,
00481                                   SERVER_HASH_SIZE, MDL))
00482                 log_fatal ("Can't allocate server option hash table.");
00483         for (i = 0 ; server_options[i].name ; i++) {
00484                 option_code_hash_add(server_universe.code_hash,
00485                                      &server_options[i].code, 0,
00486                                      &server_options[i], MDL);
00487                 option_name_hash_add(server_universe.name_hash,
00488                                      server_options[i].name, 0,
00489                                      &server_options[i], MDL);
00490         }
00491 #if defined(REPORT_HASH_PERFORMANCE)
00492         log_info("Server-Config Option name hash: %s",
00493                  option_name_hash_report(server_universe.name_hash));
00494         log_info("Server-Config Option code hash: %s",
00495                  option_code_hash_report(server_universe.code_hash));
00496 #endif
00497 
00498         /* Add the server and agent option spaces to the option space hash. */
00499         universe_hash_add (universe_hash,
00500                            agent_universe.name, 0, &agent_universe, MDL);
00501         universe_hash_add (universe_hash,
00502                            server_universe.name, 0, &server_universe, MDL);
00503 
00504         /* Make the server universe the configuration option universe. */
00505         config_universe = &server_universe;
00506 
00507         code = SV_VENDOR_OPTION_SPACE;
00508         option_code_hash_lookup(&vendor_cfg_option, server_universe.code_hash,
00509                                 &code, 0, MDL);
00510 }

Generated on 5 Apr 2014 for ISC DHCP by  doxygen 1.6.1