SEDMANPAGES = dhcp-options.man5 dhcp-contrib.man5 dhcp-eval.man5
SRC = raw.c parse.c nit.c icmp.c dispatch.c conflex.c upf.c bpf.c socket.c \
lpf.c dlpi.c packet.c tr.c ethernet.c memory.c print.c options.c \
- inet.c tree.c tables.c hash.c alloc.c fddi.c \
+ inet.c tree.c tables.c alloc.c fddi.c \
inet_addr.c dns.c resolv.c execute.c discover.c comapi.c
OBJ = raw.o parse.o nit.o icmp.o dispatch.o conflex.o upf.o bpf.o socket.o \
lpf.o dlpi.o packet.o tr.o ethernet.o memory.o print.o options.o \
- inet.o tree.o tables.o hash.o alloc.o fddi.o \
+ inet.o tree.o tables.o alloc.o fddi.o \
inet_addr.o dns.o resolv.o execute.o discover.o comapi.o
MAN = dhcp-options.5 dhcp-contrib.5 dhcp-eval.5
#ifndef lint
static char copyright[] =
-"$Id: alloc.c,v 1.50 2000/08/01 21:54:01 neild Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: alloc.c,v 1.51 2000/08/01 22:54:47 neild Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
return rval;
}
-struct hash_table *new_hash_table (count, file, line)
- int count;
- const char *file;
- int line;
-{
- struct hash_table *rval = dmalloc (sizeof (struct hash_table)
- - (DEFAULT_HASH_SIZE
- * sizeof (struct hash_bucket *))
- + (count
- * sizeof (struct hash_bucket *)),
- file, line);
- rval -> hash_count = count;
- return rval;
-}
-
-struct hash_bucket *free_hash_buckets;
-
-struct hash_bucket *new_hash_bucket (file, line)
- const char *file;
- int line;
-{
- struct hash_bucket *rval;
- int i;
- if (!free_hash_buckets) {
- rval = dmalloc (127 * sizeof (struct hash_bucket),
- file, line);
- if (!rval)
- return rval;
- for (i = 0; i < 127; i++) {
- rval -> next = free_hash_buckets;
- free_hash_buckets = rval;
- rval++;
- }
- }
- rval = free_hash_buckets;
- free_hash_buckets = rval -> next;
- return rval;
-}
-
-void free_hash_bucket (ptr, file, line)
- struct hash_bucket *ptr;
- const char *file;
- int line;
-{
- ptr -> next = free_hash_buckets;
- free_hash_buckets = ptr;
-}
-
struct protocol *new_protocol (file, line)
const char *file;
int line;
dfree ((VOIDPTR)ptr, file, line);
}
-void free_hash_table (ptr, file, line)
- struct hash_table *ptr;
- const char *file;
- int line;
-{
- dfree ((VOIDPTR)ptr, file, line);
-}
-
void free_dhcp_packet (ptr, file, line)
struct dhcp_packet *ptr;
const char *file;
#ifndef lint
static char copyright[] =
-"$Id: tables.c,v 1.42 2000/05/16 23:02:30 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: tables.c,v 1.43 2000/08/01 22:54:50 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
+/* XXXDPN: Moved here from hash.c, when it moved to libomapi. Not sure
+ where these really belong. */
+HASH_FUNCTIONS (group, const char *, struct group_object)
+HASH_FUNCTIONS (universe, const char *, struct universe)
+HASH_FUNCTIONS (option, const char *, struct option)
+
/* DHCP Option names, formats and codes, from RFC1533.
Format codes:
#include "dhcp.h"
#include "statement.h"
#include "tree.h"
-#include "hash.h"
#include "inet.h"
#include "auth.h"
#include "dhctoken.h"
int group_reference (struct group **, struct group *, const char *, int);
int group_dereference (struct group **, const char *, int);
struct dhcp_packet *new_dhcp_packet PROTO ((const char *, int));
-struct hash_table *new_hash_table PROTO ((int, const char *, int));
-struct hash_bucket *new_hash_bucket PROTO ((const char *, int));
struct protocol *new_protocol PROTO ((const char *, int));
struct lease_state *new_lease_state PROTO ((const char *, int));
struct domain_search_list *new_domain_search_list PROTO ((const char *, int));
const char *, int));
void free_lease_state PROTO ((struct lease_state *, const char *, int));
void free_protocol PROTO ((struct protocol *, const char *, int));
-void free_hash_bucket PROTO ((struct hash_bucket *, const char *, int));
-void free_hash_table PROTO ((struct hash_table *, const char *, int));
void free_dhcp_packet PROTO ((struct dhcp_packet *, const char *, int));
struct client_lease *new_client_lease PROTO ((const char *, int));
void free_client_lease PROTO ((struct client_lease *, const char *, int));
OMAPI_OBJECT_ALLOC_DECL (interface,
struct interface_info, dhcp_type_interface)
-/* hash.c */
-struct hash_table *new_hash PROTO ((hash_reference, hash_dereference, int));
-void add_hash PROTO ((struct hash_table *,
- const unsigned char *, unsigned, hashed_object_t *,
- const char *, int));
-void delete_hash_entry PROTO ((struct hash_table *, const unsigned char *,
- unsigned, const char *, int));
-int hash_lookup PROTO ((hashed_object_t **, struct hash_table *,
- const unsigned char *, unsigned, const char *, int));
-int hash_foreach (struct hash_table *, hash_foreach_func);
-int casecmp (const void *s, const void *t, unsigned long len);
-HASH_FUNCTIONS_DECL (group, const char *, struct group_object)
-HASH_FUNCTIONS_DECL (universe, const char *, struct universe)
-HASH_FUNCTIONS_DECL (option, const char *, struct option)
-
/* tables.c */
extern struct universe dhcp_universe;
extern struct universe nwip_universe;
extern struct hash_table *universe_hash;
void initialize_common_option_spaces PROTO ((void));
struct universe *config_universe;
+HASH_FUNCTIONS_DECL (group, const char *, struct group_object)
+HASH_FUNCTIONS_DECL (universe, const char *, struct universe)
+HASH_FUNCTIONS_DECL (option, const char *, struct option)
/* stables.c */
#if defined (FAILOVER_PROTOCOL)
Definitions for hashing... */
/*
- * Copyright (c) 1996-1999 Internet Software Consortium.
+ * Copyright (c) 1995-2000 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* ``http://www.nominum.com''.
*/
+#ifndef OMAPI_HASH_H
+#define OMAPI_HASH_H
+
#define DEFAULT_HASH_SIZE 9973
/* The purpose of the hashed_object_t struct is to not match anything else. */
return hash_foreach (table, (hash_foreach_func)func); \
}
-
+
+struct hash_table *new_hash_table (int, const char *, int);
+void free_hash_table (struct hash_table *, const char *, int);
+struct hash_bucket *new_hash_bucket (const char *, int);
+void free_hash_bucket (struct hash_bucket *, const char *, int);
+struct hash_table *new_hash (hash_reference, hash_dereference, int);
+void add_hash (struct hash_table *,
+ const unsigned char *, unsigned, hashed_object_t *,
+ const char *, int);
+void delete_hash_entry (struct hash_table *, const unsigned char *,
+ unsigned, const char *, int);
+int hash_lookup (hashed_object_t **, struct hash_table *,
+ const unsigned char *, unsigned, const char *, int);
+int hash_foreach (struct hash_table *, hash_foreach_func);
+int casecmp (const void *s, const void *t, unsigned long len);
+
+#endif /* OMAPI_HASH_H */
#include <isc/result.h>
#include <omapip/convert.h>
+#include <omapip/hash.h>
#include <omapip/omapip.h>
/* OMAPI protocol header, version 1.00 */
SEDMANPAGES = omapi.man3
SRC = protocol.c buffer.c alloc.c result.c connection.c errwarn.c \
listener.c dispatch.c generic.c support.c handle.c message.c \
- convert.c
+ convert.c hash.c
OBJ = protocol.o buffer.o alloc.o result.o connection.o errwarn.o \
listener.o dispatch.o generic.o support.o handle.o message.o \
- convert.o
+ convert.o hash.o
MAN = omapi.3
DEBUG = -g
#ifndef lint
static char copyright[] =
-"$Id: hash.c,v 1.25 2000/06/24 06:19:13 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: hash.c,v 1.1 2000/08/01 22:55:07 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
-#include "dhcpd.h"
+#include <omapip/omapip_p.h>
#include <ctype.h>
-static int do_hash PROTO ((const unsigned char *, unsigned, unsigned));
-static int do_case_hash PROTO ((const unsigned char *, unsigned, unsigned));
+static int do_hash (const unsigned char *, unsigned, unsigned);
+static int do_case_hash (const unsigned char *, unsigned, unsigned);
+
+struct hash_table *new_hash_table (count, file, line)
+ int count;
+ const char *file;
+ int line;
+{
+ struct hash_table *rval = dmalloc (sizeof (struct hash_table)
+ - (DEFAULT_HASH_SIZE
+ * sizeof (struct hash_bucket *))
+ + (count
+ * sizeof (struct hash_bucket *)),
+ file, line);
+ rval -> hash_count = count;
+ return rval;
+}
+
+void free_hash_table (ptr, file, line)
+ struct hash_table *ptr;
+ const char *file;
+ int line;
+{
+ dfree ((VOIDPTR)ptr, file, line);
+}
+
+struct hash_bucket *free_hash_buckets;
+
+struct hash_bucket *new_hash_bucket (file, line)
+ const char *file;
+ int line;
+{
+ struct hash_bucket *rval;
+ int i;
+ if (!free_hash_buckets) {
+ rval = dmalloc (127 * sizeof (struct hash_bucket),
+ file, line);
+ if (!rval)
+ return rval;
+ for (i = 0; i < 127; i++) {
+ rval -> next = free_hash_buckets;
+ free_hash_buckets = rval;
+ rval++;
+ }
+ }
+ rval = free_hash_buckets;
+ free_hash_buckets = rval -> next;
+ return rval;
+}
+
+void free_hash_bucket (ptr, file, line)
+ struct hash_bucket *ptr;
+ const char *file;
+ int line;
+{
+ ptr -> next = free_hash_buckets;
+ free_hash_buckets = ptr;
+}
struct hash_table *new_hash (hash_reference referencer,
hash_dereference dereferencer,
}
return 0;
}
-
-HASH_FUNCTIONS (group, const char *, struct group_object)
-HASH_FUNCTIONS (universe, const char *, struct universe)
-HASH_FUNCTIONS (option, const char *, struct option)