Commit 68f55908 authored by Ted Lemon's avatar Ted Lemon
Browse files

Make universe_hash using new_hash.

parent 0bcad761
......@@ -43,7 +43,7 @@
#ifndef lint
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 */
#define DHCP_OPTION_DATA
......@@ -1192,7 +1192,7 @@ int option_space_encapsulate (result, packet, lease,
{
struct universe *u;
u = (struct universe *)hash_lookup (&universe_hash,
u = (struct universe *)hash_lookup (universe_hash,
name -> data, name -> len);
if (!u) {
log_error ("unknown option space %s.", name -> data);
......
......@@ -43,7 +43,7 @@
#ifndef lint
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 */
#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
uname. */
universe = ((struct universe *)
hash_lookup (&universe_hash,
hash_lookup (universe_hash,
(unsigned char *)uname, 0));
/* If it's not there, we can't parse the rest of the
declaration. */
......@@ -907,7 +907,7 @@ void parse_option_space_decl (cfile)
nu -> hash = new_hash (0, 0, 1);
if (!nu -> hash)
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);
parse_semi (cfile);
}
......
......@@ -43,7 +43,7 @@
#ifndef lint
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 */
#include "dhcpd.h"
......@@ -846,7 +846,7 @@ const char *hardware_types [] = {
"unknown-254",
"unknown-255" };
struct hash_table universe_hash;
struct hash_table *universe_hash;
struct universe **universes;
int universe_count, universe_max;
......@@ -920,11 +920,11 @@ void initialize_common_option_spaces()
}
/* Set up the hash of universes. */
universe_hash.hash_count = DEFAULT_HASH_SIZE;
add_hash (&universe_hash,
universe_hash = new_hash (0, 0, 1);
add_hash (universe_hash,
(const unsigned char *)dhcp_universe.name, 0,
(unsigned char *)&dhcp_universe);
add_hash (&universe_hash,
add_hash (universe_hash,
(const unsigned char *)nwip_universe.name, 0,
(unsigned char *)&nwip_universe);
}
......@@ -1491,7 +1491,7 @@ extern int dhcp_option_default_priority_list_count;
extern const char *hardware_types [256];
int universe_count, universe_max;
struct universe **universes;
extern struct hash_table universe_hash;
extern struct hash_table *universe_hash;
void initialize_common_option_spaces PROTO ((void));
struct universe *config_universe;
......
......@@ -43,7 +43,7 @@
#ifndef lint
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 */
#include "dhcpd.h"
......@@ -726,7 +726,7 @@ void dhcpinform (packet, ms_nulltp)
const struct universe *u;
u = ((const struct universe *)
hash_lookup (&universe_hash, d1.data, d1.len));
hash_lookup (universe_hash, d1.data, d1.len));
if (!u) {
log_error ("unknown option space %s.", d1.data);
option_state_dereference (&options, MDL);
......@@ -1926,7 +1926,7 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
const struct universe *u;
u = ((const struct universe *)
hash_lookup (&universe_hash, d1.data, d1.len));
hash_lookup (universe_hash, d1.data, d1.len));
if (!u) {
log_error ("unknown option space %s.", d1.data);
return;
......
......@@ -43,7 +43,7 @@
#ifndef lint
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
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. */
#if defined (NSUPDATE)
char std_nsupdate [] = " \
on commit { \
if (not defined (ddns-fwd-name)) { \
set ddns-fwd-name = concat (pick (config-option server.ddns-hostname, \
option host-name), \".\", \
pick (config-option server.ddns-domainname, \
config-option domain-name)); \
if defined (ddns-fwd-name) { \
switch (ns-update (not exists (IN, A, ddns-fwd-name, null), \
add (IN, A, ddns-fwd-name, leased-address, \
lease-time / 2))) { \
default: \
unset ddns-fwd-name; \
break; \
\
case NOERROR: \
set ddns-rev-name = \
concat (binary-to-ascii (10, 8, \".\", \
reverse (1, leased-address)), \".\", \
pick (config-option server.ddns-rev-domainname, \
\".in-addr.arpa.\")); \
switch (ns-update (delete (IN, PTR, ddns-rev-name, null), \
add (IN, PTR, ddns-rev-name, ddns-fwd-name, \
lease-time / 2))) \
{ \
default: \
unset ddns-rev-name; \
on release or expiry { \
eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \
unset ddns-fwd-name; \
on release or expiry; \
} \
break; \
\
case NOERROR: \
on release or expiry { \
eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \
eval ns-update (delete (IN, PTR, ddns-rev-name, null)); \
unset ddns-rev-name; \
unset ddns-fwd-name; \
on release or expiry; \
} \
} \
} \
} \
} \
char std_nsupdate [] = " \n\
on commit { \n\
if (not defined (ddns-fwd-name)) { \n\
set ddns-fwd-name = concat (pick (config-option server.ddns-hostname, \n\
option host-name), \".\", \n\
pick (config-option server.ddns-domainname, \n\
config-option domain-name)); \n\
if defined (ddns-fwd-name) { \n\
switch (ns-update (not exists (IN, A, ddns-fwd-name, null), \n\
add (IN, A, ddns-fwd-name, leased-address, \n\
lease-time / 2))) { \n\
default: \n\
unset ddns-fwd-name; \n\
break; \n\
\n\
case NOERROR: \n\
set ddns-rev-name = \n\
concat (binary-to-ascii (10, 8, \".\", \n\
reverse (1, \n\
leased-address)), \".\", \n\
pick (config-option server.ddns-rev-domainname, \n\
\n\".in-addr.arpa.\")); \n\
switch (ns-update (delete (IN, PTR, ddns-rev-name, null), \n\
add (IN, PTR, ddns-rev-name, ddns-fwd-name, \n\
lease-time / 2))) \n\
{ \n\
default: \n\
unset ddns-rev-name; \n\
on release or expiry { \n\
eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \n\
unset ddns-fwd-name; \n\
on release or expiry; \n\
} \n\
break; \n\
\n\
case NOERROR: \n\
on release or expiry { \n\
eval ns-update (delete (IN, A, ddns-fwd-name, leased-address)); \n\
eval ns-update (delete (IN, PTR, ddns-rev-name, null)); \n\
unset ddns-rev-name; \n\
unset ddns-fwd-name; \n\
on release or expiry; \n\
} \n\
} \n\
} \n\
} \n\
} \n\
}";
#endif /* NSUPDATE */
......
......@@ -43,7 +43,7 @@
#ifndef lint
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 */
#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_hash (&universe_hash,
add_hash (universe_hash,
(const unsigned char *)agent_universe.name, 0,
(unsigned char *)&agent_universe);
add_hash (&universe_hash,
add_hash (universe_hash,
(const unsigned char *)server_universe.name, 0,
(unsigned char *)&server_universe);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment