2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-03 07:45:20 +00:00

Make universe_hash using new_hash.

This commit is contained in:
Ted Lemon
2000-03-18 03:34:11 +00:00
parent 0bcad76189
commit 68f5590808
7 changed files with 65 additions and 64 deletions

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: options.c,v 1.57 2000/03/17 03:59:01 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: options.c,v 1.58 2000/03/18 03:34:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#define DHCP_OPTION_DATA #define DHCP_OPTION_DATA
@@ -1192,7 +1192,7 @@ int option_space_encapsulate (result, packet, lease,
{ {
struct universe *u; struct universe *u;
u = (struct universe *)hash_lookup (&universe_hash, u = (struct universe *)hash_lookup (universe_hash,
name -> data, name -> len); name -> data, name -> len);
if (!u) { if (!u) {
log_error ("unknown option space %s.", name -> data); log_error ("unknown option space %s.", name -> data);

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: parse.c,v 1.67 2000/03/18 02:15:37 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: parse.c,v 1.68 2000/03/18 03:34:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -794,7 +794,7 @@ struct option *parse_option_name (cfile, allocate, known)
/* Look up the option name hash table for the specified /* Look up the option name hash table for the specified
uname. */ uname. */
universe = ((struct universe *) universe = ((struct universe *)
hash_lookup (&universe_hash, hash_lookup (universe_hash,
(unsigned char *)uname, 0)); (unsigned char *)uname, 0));
/* If it's not there, we can't parse the rest of the /* If it's not there, we can't parse the rest of the
declaration. */ declaration. */
@@ -907,7 +907,7 @@ void parse_option_space_decl (cfile)
nu -> hash = new_hash (0, 0, 1); nu -> hash = new_hash (0, 0, 1);
if (!nu -> hash) if (!nu -> hash)
log_fatal ("Can't allocate %s option hash table.", nu -> name); log_fatal ("Can't allocate %s option hash table.", nu -> name);
add_hash (&universe_hash, add_hash (universe_hash,
(const unsigned char *)nu -> name, 0, (unsigned char *)nu); (const unsigned char *)nu -> name, 0, (unsigned char *)nu);
parse_semi (cfile); parse_semi (cfile);
} }

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: tables.c,v 1.39 2000/03/18 02:15:37 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: tables.c,v 1.40 2000/03/18 03:34:06 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -846,7 +846,7 @@ const char *hardware_types [] = {
"unknown-254", "unknown-254",
"unknown-255" }; "unknown-255" };
struct hash_table universe_hash; struct hash_table *universe_hash;
struct universe **universes; struct universe **universes;
int universe_count, universe_max; int universe_count, universe_max;
@@ -920,11 +920,11 @@ void initialize_common_option_spaces()
} }
/* Set up the hash of universes. */ /* Set up the hash of universes. */
universe_hash.hash_count = DEFAULT_HASH_SIZE; universe_hash = new_hash (0, 0, 1);
add_hash (&universe_hash, add_hash (universe_hash,
(const unsigned char *)dhcp_universe.name, 0, (const unsigned char *)dhcp_universe.name, 0,
(unsigned char *)&dhcp_universe); (unsigned char *)&dhcp_universe);
add_hash (&universe_hash, add_hash (universe_hash,
(const unsigned char *)nwip_universe.name, 0, (const unsigned char *)nwip_universe.name, 0,
(unsigned char *)&nwip_universe); (unsigned char *)&nwip_universe);
} }

View File

@@ -1491,7 +1491,7 @@ extern int dhcp_option_default_priority_list_count;
extern const char *hardware_types [256]; extern const char *hardware_types [256];
int universe_count, universe_max; int universe_count, universe_max;
struct universe **universes; struct universe **universes;
extern struct hash_table universe_hash; extern struct hash_table *universe_hash;
void initialize_common_option_spaces PROTO ((void)); void initialize_common_option_spaces PROTO ((void));
struct universe *config_universe; struct universe *config_universe;

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: dhcp.c,v 1.142 2000/03/17 04:00:31 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: dhcp.c,v 1.143 2000/03/18 03:34:10 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -726,7 +726,7 @@ void dhcpinform (packet, ms_nulltp)
const struct universe *u; const struct universe *u;
u = ((const struct universe *) u = ((const struct universe *)
hash_lookup (&universe_hash, d1.data, d1.len)); hash_lookup (universe_hash, d1.data, d1.len));
if (!u) { if (!u) {
log_error ("unknown option space %s.", d1.data); log_error ("unknown option space %s.", d1.data);
option_state_dereference (&options, MDL); option_state_dereference (&options, MDL);
@@ -1926,7 +1926,7 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
const struct universe *u; const struct universe *u;
u = ((const struct universe *) u = ((const struct universe *)
hash_lookup (&universe_hash, d1.data, d1.len)); hash_lookup (universe_hash, d1.data, d1.len));
if (!u) { if (!u) {
log_error ("unknown option space %s.", d1.data); log_error ("unknown option space %s.", d1.data);
return; return;

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char ocopyright[] = static char ocopyright[] =
"$Id: dhcpd.c,v 1.86 2000/03/17 04:00:31 mellon Exp $ Copyright 1995-2000 The Internet Software Consortium."; "$Id: dhcpd.c,v 1.87 2000/03/18 03:34:10 mellon Exp $ Copyright 1995-2000 The Internet Software Consortium.";
#endif #endif
static char copyright[] = static char copyright[] =
@@ -76,52 +76,53 @@ struct in_addr limited_broadcast;
at all, but as soon as I fix the resolver it should try to. */ at all, but as soon as I fix the resolver it should try to. */
#if defined (NSUPDATE) #if defined (NSUPDATE)
char std_nsupdate [] = " \ char std_nsupdate [] = " \n\
on commit { \ on commit { \n\
if (not defined (ddns-fwd-name)) { \ if (not defined (ddns-fwd-name)) { \n\
set ddns-fwd-name = concat (pick (config-option server.ddns-hostname, \ set ddns-fwd-name = concat (pick (config-option server.ddns-hostname, \n\
option host-name), \".\", \ option host-name), \".\", \n\
pick (config-option server.ddns-domainname, \ pick (config-option server.ddns-domainname, \n\
config-option domain-name)); \ config-option domain-name)); \n\
if defined (ddns-fwd-name) { \ if defined (ddns-fwd-name) { \n\
switch (ns-update (not exists (IN, A, ddns-fwd-name, null), \ switch (ns-update (not exists (IN, A, ddns-fwd-name, null), \n\
add (IN, A, ddns-fwd-name, leased-address, \ add (IN, A, ddns-fwd-name, leased-address, \n\
lease-time / 2))) { \ lease-time / 2))) { \n\
default: \ default: \n\
unset ddns-fwd-name; \ unset ddns-fwd-name; \n\
break; \ break; \n\
\ \n\
case NOERROR: \ case NOERROR: \n\
set ddns-rev-name = \ set ddns-rev-name = \n\
concat (binary-to-ascii (10, 8, \".\", \ concat (binary-to-ascii (10, 8, \".\", \n\
reverse (1, leased-address)), \".\", \ reverse (1, \n\
pick (config-option server.ddns-rev-domainname, \ leased-address)), \".\", \n\
\".in-addr.arpa.\")); \ pick (config-option server.ddns-rev-domainname, \n\
switch (ns-update (delete (IN, PTR, ddns-rev-name, null), \ \n\".in-addr.arpa.\")); \n\
add (IN, PTR, ddns-rev-name, ddns-fwd-name, \ switch (ns-update (delete (IN, PTR, ddns-rev-name, null), \n\
lease-time / 2))) \ add (IN, PTR, ddns-rev-name, ddns-fwd-name, \n\
{ \ lease-time / 2))) \n\
default: \ { \n\
unset ddns-rev-name; \ default: \n\
on release or expiry { \ unset ddns-rev-name; \n\
eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \ on release or expiry { \n\
unset ddns-fwd-name; \ eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \n\
on release or expiry; \ unset ddns-fwd-name; \n\
} \ on release or expiry; \n\
break; \ } \n\
\ break; \n\
case NOERROR: \ \n\
on release or expiry { \ case NOERROR: \n\
eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \ on release or expiry { \n\
eval ns-update (delete (IN, PTR, ddns-rev-name, null)); \ eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \n\
unset ddns-rev-name; \ eval ns-update (delete (IN, PTR, ddns-rev-name, null)); \n\
unset ddns-fwd-name; \ unset ddns-rev-name; \n\
on release or expiry; \ unset ddns-fwd-name; \n\
} \ on release or expiry; \n\
} \ } \n\
} \ } \n\
} \ } \n\
} \ } \n\
} \n\
}"; }";
#endif /* NSUPDATE */ #endif /* NSUPDATE */

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: stables.c,v 1.9 2000/03/18 02:15:52 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: stables.c,v 1.10 2000/03/18 03:34:11 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -748,10 +748,10 @@ void initialize_server_option_spaces()
} }
/* Add the server and agent option spaces to the option space hash. */ /* Add the server and agent option spaces to the option space hash. */
add_hash (&universe_hash, add_hash (universe_hash,
(const unsigned char *)agent_universe.name, 0, (const unsigned char *)agent_universe.name, 0,
(unsigned char *)&agent_universe); (unsigned char *)&agent_universe);
add_hash (&universe_hash, add_hash (universe_hash,
(const unsigned char *)server_universe.name, 0, (const unsigned char *)server_universe.name, 0,
(unsigned char *)&server_universe); (unsigned char *)&server_universe);