Remove files which have been removed in the 3.01RC12 release
of isc-dhcpd.
This commit is contained in:
parent
5948092ae2
commit
27471cd774
@ -1,118 +0,0 @@
|
||||
/* convert.c
|
||||
|
||||
Safe copying of option values into and out of the option buffer, which
|
||||
can't be assumed to be aligned. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 The Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of The Internet Software Consortium nor the names
|
||||
* of its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This software has been written for the Internet Software Consortium
|
||||
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
|
||||
* Enterprises. To learn more about the Internet Software Consortium,
|
||||
* see ``http://www.vix.com/isc''. To learn more about Vixie
|
||||
* Enterprises, see ``http://www.vix.com''.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: convert.c,v 1.4.2.1 1998/06/25 21:11:28 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
u_int32_t getULong (buf)
|
||||
unsigned char *buf;
|
||||
{
|
||||
unsigned long ibuf;
|
||||
|
||||
memcpy (&ibuf, buf, sizeof (u_int32_t));
|
||||
return ntohl (ibuf);
|
||||
}
|
||||
|
||||
int32_t getLong (buf)
|
||||
unsigned char *buf;
|
||||
{
|
||||
long ibuf;
|
||||
|
||||
memcpy (&ibuf, buf, sizeof (int32_t));
|
||||
return ntohl (ibuf);
|
||||
}
|
||||
|
||||
u_int16_t getUShort (buf)
|
||||
unsigned char *buf;
|
||||
{
|
||||
unsigned short ibuf;
|
||||
|
||||
memcpy (&ibuf, buf, sizeof (u_int16_t));
|
||||
return ntohs (ibuf);
|
||||
}
|
||||
|
||||
int16_t getShort (buf)
|
||||
unsigned char *buf;
|
||||
{
|
||||
short ibuf;
|
||||
|
||||
memcpy (&ibuf, buf, sizeof (int16_t));
|
||||
return ntohs (ibuf);
|
||||
}
|
||||
|
||||
void putULong (obuf, val)
|
||||
unsigned char *obuf;
|
||||
u_int32_t val;
|
||||
{
|
||||
u_int32_t tmp = htonl (val);
|
||||
memcpy (obuf, &tmp, sizeof tmp);
|
||||
}
|
||||
|
||||
void putLong (obuf, val)
|
||||
unsigned char *obuf;
|
||||
int32_t val;
|
||||
{
|
||||
int32_t tmp = htonl (val);
|
||||
memcpy (obuf, &tmp, sizeof tmp);
|
||||
}
|
||||
|
||||
void putUShort (obuf, val)
|
||||
unsigned char *obuf;
|
||||
unsigned int val;
|
||||
{
|
||||
u_int16_t tmp = htons (val);
|
||||
memcpy (obuf, &tmp, sizeof tmp);
|
||||
}
|
||||
|
||||
void putShort (obuf, val)
|
||||
unsigned char *obuf;
|
||||
int val;
|
||||
{
|
||||
int16_t tmp = htons (val);
|
||||
memcpy (obuf, &tmp, sizeof tmp);
|
||||
}
|
||||
|
@ -1,391 +0,0 @@
|
||||
/* errwarn.c
|
||||
|
||||
Errors and warnings... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 The Internet Software Consortium.
|
||||
* All Rights Reserved.
|
||||
* Copyright (c) 1995 RadioMail Corporation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of RadioMail Corporation, the Internet Software
|
||||
* Consortium nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY RADIOMAIL CORPORATION, THE INTERNET
|
||||
* SOFTWARE CONSORTIUM AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL RADIOMAIL CORPORATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software was written for RadioMail Corporation by Ted Lemon
|
||||
* under a contract with Vixie Enterprises. Further modifications have
|
||||
* been made for the Internet Software Consortium under a contract
|
||||
* with Vixie Laboratories.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: errwarn.c,v 1.15 1997/05/09 08:03:44 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
#include <errno.h>
|
||||
|
||||
static void do_percentm PROTO ((char *obuf, char *ibuf));
|
||||
|
||||
static char mbuf [1024];
|
||||
static char fbuf [1024];
|
||||
|
||||
int warnings_occurred;
|
||||
|
||||
/* Log an error message, then exit... */
|
||||
|
||||
void error (ANSI_DECL(char *) fmt, VA_DOTDOTDOT)
|
||||
KandR (char *fmt;)
|
||||
va_dcl
|
||||
{
|
||||
va_list list;
|
||||
extern int logged_in;
|
||||
|
||||
do_percentm (fbuf, fmt);
|
||||
|
||||
VA_start (list, fmt);
|
||||
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
|
||||
va_end (list);
|
||||
|
||||
#ifndef DEBUG
|
||||
syslog (log_priority | LOG_ERR, mbuf);
|
||||
#endif
|
||||
|
||||
/* Also log it to stderr? */
|
||||
if (log_perror) {
|
||||
write (2, mbuf, strlen (mbuf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
syslog (LOG_CRIT, "exiting.");
|
||||
if (log_perror) {
|
||||
fprintf (stderr, "exiting.\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
cleanup ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Log a warning message... */
|
||||
|
||||
int warn (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
|
||||
KandR (char *fmt;)
|
||||
va_dcl
|
||||
{
|
||||
va_list list;
|
||||
|
||||
do_percentm (fbuf, fmt);
|
||||
|
||||
VA_start (list, fmt);
|
||||
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
|
||||
va_end (list);
|
||||
|
||||
#ifndef DEBUG
|
||||
syslog (log_priority | LOG_ERR, mbuf);
|
||||
#endif
|
||||
|
||||
if (log_perror) {
|
||||
write (2, mbuf, strlen (mbuf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Log a note... */
|
||||
|
||||
int note (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
|
||||
KandR (char *fmt;)
|
||||
va_dcl
|
||||
{
|
||||
va_list list;
|
||||
|
||||
do_percentm (fbuf, fmt);
|
||||
|
||||
VA_start (list, fmt);
|
||||
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
|
||||
va_end (list);
|
||||
|
||||
#ifndef DEBUG
|
||||
syslog (log_priority | LOG_INFO, mbuf);
|
||||
#endif
|
||||
|
||||
if (log_perror) {
|
||||
write (2, mbuf, strlen (mbuf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Log a debug message... */
|
||||
|
||||
int debug (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
|
||||
KandR (char *fmt;)
|
||||
va_dcl
|
||||
{
|
||||
va_list list;
|
||||
|
||||
do_percentm (fbuf, fmt);
|
||||
|
||||
VA_start (list, fmt);
|
||||
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
|
||||
va_end (list);
|
||||
|
||||
#ifndef DEBUG
|
||||
syslog (log_priority | LOG_DEBUG, mbuf);
|
||||
#endif
|
||||
|
||||
if (log_perror) {
|
||||
write (2, mbuf, strlen (mbuf));
|
||||
write (2, "\n", 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find %m in the input string and substitute an error message string. */
|
||||
|
||||
static void do_percentm (obuf, ibuf)
|
||||
char *obuf;
|
||||
char *ibuf;
|
||||
{
|
||||
char *s = ibuf;
|
||||
char *p = obuf;
|
||||
int infmt = 0;
|
||||
char *m;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
if (infmt)
|
||||
{
|
||||
if (*s == 'm')
|
||||
{
|
||||
#ifndef __CYGWIN32__
|
||||
m = strerror (errno);
|
||||
#else
|
||||
m = pWSAError ();
|
||||
#endif
|
||||
if (!m)
|
||||
m = "<unknown error>";
|
||||
strcpy (p - 1, m);
|
||||
p += strlen (p);
|
||||
++s;
|
||||
}
|
||||
else
|
||||
*p++ = *s++;
|
||||
infmt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*s == '%')
|
||||
infmt = 1;
|
||||
*p++ = *s++;
|
||||
}
|
||||
}
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
|
||||
int parse_warn (ANSI_DECL (char *) fmt, VA_DOTDOTDOT)
|
||||
KandR (char *fmt;)
|
||||
va_dcl
|
||||
{
|
||||
va_list list;
|
||||
static char spaces [] = " ";
|
||||
|
||||
do_percentm (mbuf, fmt);
|
||||
#ifndef NO_SNPRINTF
|
||||
snprintf (fbuf, sizeof fbuf, "%s line %d: %s",
|
||||
tlname, lexline, mbuf);
|
||||
#else
|
||||
sprintf (fbuf, "%s line %d: %s",
|
||||
tlname, lexline, mbuf);
|
||||
#endif
|
||||
|
||||
VA_start (list, fmt);
|
||||
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
|
||||
va_end (list);
|
||||
|
||||
#ifndef DEBUG
|
||||
syslog (log_priority | LOG_ERR, mbuf);
|
||||
syslog (log_priority | LOG_ERR, token_line);
|
||||
if (lexline < 81)
|
||||
syslog (log_priority | LOG_ERR,
|
||||
"%s^", &spaces [sizeof spaces - lexchar]);
|
||||
#endif
|
||||
|
||||
if (log_perror) {
|
||||
write (2, mbuf, strlen (mbuf));
|
||||
write (2, "\n", 1);
|
||||
write (2, token_line, strlen (token_line));
|
||||
write (2, "\n", 1);
|
||||
write (2, spaces, lexchar - 1);
|
||||
write (2, "^\n", 2);
|
||||
}
|
||||
|
||||
warnings_occurred = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NO_STRERROR
|
||||
char *strerror (err)
|
||||
int err;
|
||||
{
|
||||
extern char *sys_errlist [];
|
||||
extern int sys_nerr;
|
||||
static char errbuf [128];
|
||||
|
||||
if (err < 0 || err >= sys_nerr) {
|
||||
sprintf (errbuf, "Error %d", err);
|
||||
return errbuf;
|
||||
}
|
||||
return sys_errlist [err];
|
||||
}
|
||||
#endif /* NO_STRERROR */
|
||||
|
||||
#ifdef _WIN32
|
||||
char *pWSAError ()
|
||||
{
|
||||
int err = WSAGetLastError ();
|
||||
|
||||
switch (err)
|
||||
{
|
||||
case WSAEACCES:
|
||||
return "Permission denied";
|
||||
case WSAEADDRINUSE:
|
||||
return "Address already in use";
|
||||
case WSAEADDRNOTAVAIL:
|
||||
return "Cannot assign requested address";
|
||||
case WSAEAFNOSUPPORT:
|
||||
return "Address family not supported by protocol family";
|
||||
case WSAEALREADY:
|
||||
return "Operation already in progress";
|
||||
case WSAECONNABORTED:
|
||||
return "Software caused connection abort";
|
||||
case WSAECONNREFUSED:
|
||||
return "Connection refused";
|
||||
case WSAECONNRESET:
|
||||
return "Connection reset by peer";
|
||||
case WSAEDESTADDRREQ:
|
||||
return "Destination address required";
|
||||
case WSAEFAULT:
|
||||
return "Bad address";
|
||||
case WSAEHOSTDOWN:
|
||||
return "Host is down";
|
||||
case WSAEHOSTUNREACH:
|
||||
return "No route to host";
|
||||
case WSAEINPROGRESS:
|
||||
return "Operation now in progress";
|
||||
case WSAEINTR:
|
||||
return "Interrupted function call";
|
||||
case WSAEINVAL:
|
||||
return "Invalid argument";
|
||||
case WSAEISCONN:
|
||||
return "Socket is already connected";
|
||||
case WSAEMFILE:
|
||||
return "Too many open files";
|
||||
case WSAEMSGSIZE:
|
||||
return "Message too long";
|
||||
case WSAENETDOWN:
|
||||
return "Network is down";
|
||||
case WSAENETRESET:
|
||||
return "Network dropped connection on reset";
|
||||
case WSAENETUNREACH:
|
||||
return "Network is unreachable";
|
||||
case WSAENOBUFS:
|
||||
return "No buffer space available";
|
||||
case WSAENOPROTOOPT:
|
||||
return "Bad protocol option";
|
||||
case WSAENOTCONN:
|
||||
return "Socket is not connected";
|
||||
case WSAENOTSOCK:
|
||||
return "Socket operation on non-socket";
|
||||
case WSAEOPNOTSUPP:
|
||||
return "Operation not supported";
|
||||
case WSAEPFNOSUPPORT:
|
||||
return "Protocol family not supported";
|
||||
case WSAEPROCLIM:
|
||||
return "Too many processes";
|
||||
case WSAEPROTONOSUPPORT:
|
||||
return "Protocol not supported";
|
||||
case WSAEPROTOTYPE:
|
||||
return "Protocol wrong type for socket";
|
||||
case WSAESHUTDOWN:
|
||||
return "Cannot send after socket shutdown";
|
||||
case WSAESOCKTNOSUPPORT:
|
||||
return "Socket type not supported";
|
||||
case WSAETIMEDOUT:
|
||||
return "Connection timed out";
|
||||
case WSAEWOULDBLOCK:
|
||||
return "Resource temporarily unavailable";
|
||||
case WSAHOST_NOT_FOUND:
|
||||
return "Host not found";
|
||||
#if 0
|
||||
case WSA_INVALID_HANDLE:
|
||||
return "Specified event object handle is invalid";
|
||||
case WSA_INVALID_PARAMETER:
|
||||
return "One or more parameters are invalid";
|
||||
case WSAINVALIDPROCTABLE:
|
||||
return "Invalid procedure table from service provider";
|
||||
case WSAINVALIDPROVIDER:
|
||||
return "Invalid service provider version number";
|
||||
case WSA_IO_PENDING:
|
||||
return "Overlapped operations will complete later";
|
||||
case WSA_IO_INCOMPLETE:
|
||||
return "Overlapped I/O event object not in signaled state";
|
||||
case WSA_NOT_ENOUGH_MEMORY:
|
||||
return "Insufficient memory available";
|
||||
#endif
|
||||
case WSANOTINITIALISED:
|
||||
return "Successful WSAStartup not yet performer";
|
||||
case WSANO_DATA:
|
||||
return "Valid name, no data record of requested type";
|
||||
case WSANO_RECOVERY:
|
||||
return "This is a non-recoverable error";
|
||||
#if 0
|
||||
case WSAPROVIDERFAILEDINIT:
|
||||
return "Unable to initialize a service provider";
|
||||
case WSASYSCALLFAILURE:
|
||||
return "System call failure";
|
||||
#endif
|
||||
case WSASYSNOTREADY:
|
||||
return "Network subsystem is unavailable";
|
||||
case WSATRY_AGAIN:
|
||||
return "Non-authoritative host not found";
|
||||
case WSAVERNOTSUPPORTED:
|
||||
return "WINSOCK.DLL version out of range";
|
||||
case WSAEDISCON:
|
||||
return "Graceful shutdown in progress";
|
||||
#if 0
|
||||
case WSA_OPERATION_ABORTED:
|
||||
return "Overlapped operation aborted";
|
||||
#endif
|
||||
}
|
||||
return "Unknown WinSock error";
|
||||
}
|
||||
#endif /* _WIN32 */
|
@ -1,164 +0,0 @@
|
||||
/* hash.c
|
||||
|
||||
Routines for manipulating hash tables... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of The Internet Software Consortium nor the names
|
||||
* of its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This software has been written for the Internet Software Consortium
|
||||
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
|
||||
* Enterprises. To learn more about the Internet Software Consortium,
|
||||
* see ``http://www.vix.com/isc''. To learn more about Vixie
|
||||
* Enterprises, see ``http://www.vix.com''.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
static INLINE int do_hash PROTO ((unsigned char *, int, int));
|
||||
|
||||
struct hash_table *new_hash ()
|
||||
{
|
||||
struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE, "new_hash");
|
||||
if (!rv)
|
||||
return rv;
|
||||
memset (&rv -> buckets [0], 0,
|
||||
DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *));
|
||||
return rv;
|
||||
}
|
||||
|
||||
static INLINE int do_hash (name, len, size)
|
||||
unsigned char *name;
|
||||
int len;
|
||||
int size;
|
||||
{
|
||||
register int accum = 0;
|
||||
register unsigned char *s = name;
|
||||
int i = len;
|
||||
while (i--) {
|
||||
/* Add the character in... */
|
||||
accum += *s++;
|
||||
/* Add carry back in... */
|
||||
while (accum > 255) {
|
||||
accum = (accum & 255) + (accum >> 8);
|
||||
}
|
||||
}
|
||||
return accum % size;
|
||||
}
|
||||
|
||||
void add_hash (table, name, len, pointer)
|
||||
struct hash_table *table;
|
||||
int len;
|
||||
unsigned char *name;
|
||||
unsigned char *pointer;
|
||||
{
|
||||
int hashno;
|
||||
struct hash_bucket *bp;
|
||||
|
||||
if (!table)
|
||||
return;
|
||||
if (!len)
|
||||
len = strlen ((char *)name);
|
||||
|
||||
hashno = do_hash (name, len, table -> hash_count);
|
||||
bp = new_hash_bucket ("add_hash");
|
||||
|
||||
if (!bp) {
|
||||
warn ("Can't add %s to hash table.", name);
|
||||
return;
|
||||
}
|
||||
bp -> name = name;
|
||||
bp -> value = pointer;
|
||||
bp -> next = table -> buckets [hashno];
|
||||
bp -> len = len;
|
||||
table -> buckets [hashno] = bp;
|
||||
}
|
||||
|
||||
void delete_hash_entry (table, name, len)
|
||||
struct hash_table *table;
|
||||
int len;
|
||||
unsigned char *name;
|
||||
{
|
||||
int hashno;
|
||||
struct hash_bucket *bp, *pbp = (struct hash_bucket *)0;
|
||||
|
||||
if (!table)
|
||||
return;
|
||||
if (!len)
|
||||
len = strlen ((char *)name);
|
||||
|
||||
hashno = do_hash (name, len, table -> hash_count);
|
||||
|
||||
/* Go through the list looking for an entry that matches;
|
||||
if we find it, delete it. */
|
||||
for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
|
||||
if ((!bp -> len &&
|
||||
!strcmp ((char *)bp -> name, (char *)name)) ||
|
||||
(bp -> len == len &&
|
||||
!memcmp (bp -> name, name, len))) {
|
||||
if (pbp) {
|
||||
pbp -> next = bp -> next;
|
||||
} else {
|
||||
table -> buckets [hashno] = bp -> next;
|
||||
}
|
||||
free_hash_bucket (bp, "delete_hash_entry");
|
||||
break;
|
||||
}
|
||||
pbp = bp; /* jwg, 9/6/96 - nice catch! */
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char *hash_lookup (table, name, len)
|
||||
struct hash_table *table;
|
||||
unsigned char *name;
|
||||
int len;
|
||||
{
|
||||
int hashno;
|
||||
struct hash_bucket *bp;
|
||||
|
||||
if (!table)
|
||||
return (unsigned char *)0;
|
||||
|
||||
if (!len)
|
||||
len = strlen ((char *)name);
|
||||
|
||||
hashno = do_hash (name, len, table -> hash_count);
|
||||
|
||||
for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
|
||||
if (len == bp -> len && !memcmp (bp -> name, name, len))
|
||||
return bp -> value;
|
||||
}
|
||||
return (unsigned char *)0;
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/* $NetBSD: inet_addr.c,v 1.6 1996/02/02 15:22:23 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: inet_addr.c,v 1.6 1996/02/02 15:22:23 mrg Exp $";
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: inet_addr.c,v 1.2.2.1 1998/06/26 20:51:35 mellon Exp $ Copyright (c) 1983, 1990, 1993 The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
||||
#ifdef NEED_INET_ATON
|
||||
/*
|
||||
* Check whether "cp" is a valid ascii representation
|
||||
* of an Internet address and convert to a binary address.
|
||||
* Returns 1 if the address is valid, 0 if not.
|
||||
* This replaces inet_addr, the return value from which
|
||||
* cannot distinguish between failure and a local broadcast address.
|
||||
*/
|
||||
int
|
||||
inet_aton(cp, addr)
|
||||
const char *cp;
|
||||
struct in_addr *addr;
|
||||
{
|
||||
register u_long val;
|
||||
register int base, n;
|
||||
register char c;
|
||||
u_int parts[4];
|
||||
register u_int *pp = parts;
|
||||
|
||||
for (;;) {
|
||||
/*
|
||||
* Collect number up to ``.''.
|
||||
* Values are specified as for C:
|
||||
* 0x=hex, 0=octal, other=decimal.
|
||||
*/
|
||||
val = 0; base = 10;
|
||||
if (*cp == '0') {
|
||||
if (*++cp == 'x' || *cp == 'X')
|
||||
base = 16, cp++;
|
||||
else
|
||||
base = 8;
|
||||
}
|
||||
while ((c = *cp) != '\0') {
|
||||
if (isascii(c) && isdigit(c)) {
|
||||
val = (val * base) + (c - '0');
|
||||
cp++;
|
||||
continue;
|
||||
}
|
||||
if (base == 16 && isascii(c) && isxdigit(c)) {
|
||||
val = (val << 4) +
|
||||
(c + 10 - (islower(c) ? 'a' : 'A'));
|
||||
cp++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (*cp == '.') {
|
||||
/*
|
||||
* Internet format:
|
||||
* a.b.c.d
|
||||
* a.b.c (with c treated as 16-bits)
|
||||
* a.b (with b treated as 24 bits)
|
||||
*/
|
||||
if (pp >= parts + 3 || val > 0xff)
|
||||
return (0);
|
||||
*pp++ = val, cp++;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Check for trailing characters.
|
||||
*/
|
||||
if (*cp && (!isascii(*cp) || !isspace(*cp)))
|
||||
return (0);
|
||||
/*
|
||||
* Concoct the address according to
|
||||
* the number of parts specified.
|
||||
*/
|
||||
n = pp - parts + 1;
|
||||
switch (n) {
|
||||
|
||||
case 0:
|
||||
return (0); /* initial nondigit */
|
||||
|
||||
case 1: /* a -- 32 bits */
|
||||
break;
|
||||
|
||||
case 2: /* a.b -- 8.24 bits */
|
||||
if (val > 0xffffff)
|
||||
return (0);
|
||||
val |= parts[0] << 24;
|
||||
break;
|
||||
|
||||
case 3: /* a.b.c -- 8.8.16 bits */
|
||||
if (val > 0xffff)
|
||||
return (0);
|
||||
val |= (parts[0] << 24) | (parts[1] << 16);
|
||||
break;
|
||||
|
||||
case 4: /* a.b.c.d -- 8.8.8.8 bits */
|
||||
if (val > 0xff)
|
||||
return (0);
|
||||
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
|
||||
break;
|
||||
}
|
||||
if (addr)
|
||||
addr->s_addr = htonl(val);
|
||||
return (1);
|
||||
}
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/* hash.h
|
||||
|
||||
Definitions for hashing... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 The Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of The Internet Software Consortium nor the names
|
||||
* of its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This software has been written for the Internet Software Consortium
|
||||
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
|
||||
* Enterprises. To learn more about the Internet Software Consortium,
|
||||
* see ``http://www.vix.com/isc''. To learn more about Vixie
|
||||
* Enterprises, see ``http://www.vix.com''.
|
||||
*/
|
||||
|
||||
#define DEFAULT_HASH_SIZE 97
|
||||
|
||||
struct hash_bucket {
|
||||
struct hash_bucket *next;
|
||||
unsigned char *name;
|
||||
int len;
|
||||
unsigned char *value;
|
||||
};
|
||||
|
||||
struct hash_table {
|
||||
int hash_count;
|
||||
struct hash_bucket *buckets [DEFAULT_HASH_SIZE];
|
||||
};
|
||||
|
@ -1,52 +0,0 @@
|
||||
/* systat.h
|
||||
|
||||
Definitions for systat protocol... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 The Internet Software Consortium.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of The Internet Software Consortium nor the names
|
||||
* of its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
|
||||
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This software has been written for the Internet Software Consortium
|
||||
* by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
|
||||
* Enterprises. To learn more about the Internet Software Consortium,
|
||||
* see ``http://www.vix.com/isc''. To learn more about Vixie
|
||||
* Enterprises, see ``http://www.vix.com''.
|
||||
*/
|
||||
|
||||
#define SYSCONF_SOCKET "/var/run/sysconf"
|
||||
|
||||
struct sysconf_header {
|
||||
u_int32_t type; /* Type of status message... */
|
||||
u_int32_t length; /* Length of message. */
|
||||
};
|
||||
|
||||
/* Message types... */
|
||||
#define NETWORK_LOCATION_CHANGED 1
|
||||
|
Loading…
Reference in New Issue
Block a user