diff options
Diffstat (limited to 'include/isc')
33 files changed, 95 insertions, 3864 deletions
diff --git a/include/isc/Makefile.am b/include/isc/Makefile.am index 3d8c2a47f90e..14aa70813e16 100644 --- a/include/isc/Makefile.am +++ b/include/isc/Makefile.am @@ -1,37 +1,7 @@ -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies -AUTOMAKE_OPTIONS = ../util/ansi2knr +NULL = +AUTOMAKE_OPTIONS = ETAGS_ARGS = $(srcdir)/Makefile.am -#EXTRA_DIST = TAGS -noinst_HEADERS = \ - app.h \ - assertions.h \ - boolean.h \ - buffer.h \ - error.h \ - formatcheck.h \ - int.h \ - interfaceiter.h \ - ipv6.h \ - lang.h \ - lib.h \ - list.h \ - magic.h \ - mem.h \ - msgcat.h \ - msgs.h \ - mutex.h \ - net.h \ - netaddr.h \ - netscope.h \ - offset.h \ - once.h \ - platform.h \ - print.h \ - result.h \ - region.h \ - sockaddr.h \ - strerror.h \ - string.h \ - types.h \ - util.h +noinst_HEADERS = \ + mem.h \ + $(NULL) diff --git a/include/isc/Makefile.in b/include/isc/Makefile.in index 531da09b454c..b792b24eb823 100644 --- a/include/isc/Makefile.in +++ b/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -38,9 +38,15 @@ subdir = include/isc DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \ - $(top_srcdir)/m4/define_dir.m4 \ - $(top_srcdir)/m4/hs_ulong_const.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \ + $(top_srcdir)/m4/define_dir.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/ntp_cacheversion.m4 \ + $(top_srcdir)/m4/ntp_dir_sep.m4 \ + $(top_srcdir)/m4/ntp_lineeditlibs.m4 \ + $(top_srcdir)/m4/ntp_openssl.m4 \ + $(top_srcdir)/m4/ntp_vpathhack.m4 \ $(top_srcdir)/m4/os_cflags.m4 $(top_srcdir)/version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -58,7 +64,6 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ -ARLIB_DIR = @ARLIB_DIR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -75,14 +80,18 @@ CYGPATH_W = @CYGPATH_W@ DCFD = @DCFD@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -ECHO = @ECHO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +EDITLINE_LIBS = @EDITLINE_LIBS@ EF_LIBS = @EF_LIBS@ EF_PROGS = @EF_PROGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +FGREP = @FGREP@ GREP = @GREP@ HAVE_INLINE = @HAVE_INLINE@ INSTALL = @INSTALL@ @@ -91,6 +100,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCRYPTO = @LCRYPTO@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@ @@ -99,6 +109,7 @@ LIBOPTS_LDADD = @LIBOPTS_LDADD@ LIBPARSE = @LIBPARSE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LSCF = @LSCF@ LTLIBOBJS = @LTLIBOBJS@ @@ -110,15 +121,22 @@ MAKE_LIBNTPSIM = @MAKE_LIBNTPSIM@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_NTPDSIM = @MAKE_NTPDSIM@ +MAKE_NTPSNMPD = @MAKE_NTPSNMPD@ MAKE_NTPTIME = @MAKE_NTPTIME@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ MAKE_TIMETRIM = @MAKE_TIMETRIM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL = @OPENSSL@ OPENSSL_INC = @OPENSSL_INC@ OPENSSL_LIB = @OPENSSL_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -126,23 +144,32 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_NET_SNMP_CONFIG = @PATH_NET_SNMP_CONFIG@ PATH_PERL = @PATH_PERL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SH = @PATH_SH@ +PATH_TEST = @PATH_TEST@ +POSIX_SHELL = @POSIX_SHELL@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SNMP_CFLAGS = @SNMP_CFLAGS@ +SNMP_CPPFLAGS = @SNMP_CPPFLAGS@ +SNMP_LIBS = @SNMP_LIBS@ STRIP = @STRIP@ TESTDCF = @TESTDCF@ -U = @U@ VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -189,43 +216,12 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ - -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies -AUTOMAKE_OPTIONS = ../util/ansi2knr +NULL = +AUTOMAKE_OPTIONS = ETAGS_ARGS = $(srcdir)/Makefile.am -#EXTRA_DIST = TAGS noinst_HEADERS = \ - app.h \ - assertions.h \ - boolean.h \ - buffer.h \ - error.h \ - formatcheck.h \ - int.h \ - interfaceiter.h \ - ipv6.h \ - lang.h \ - lib.h \ - list.h \ - magic.h \ - mem.h \ - msgcat.h \ - msgs.h \ - mutex.h \ - net.h \ - netaddr.h \ - netscope.h \ - offset.h \ - once.h \ - platform.h \ - print.h \ - result.h \ - region.h \ - sockaddr.h \ - strerror.h \ - string.h \ - types.h \ - util.h + mem.h \ + $(NULL) all: all-am diff --git a/include/isc/app.h b/include/isc/app.h deleted file mode 100644 index 5aa3d23acaca..000000000000 --- a/include/isc/app.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: app.h,v 1.1 2001/07/06 19:50:03 gson Exp $ */ - -#ifndef ISC_APP_H -#define ISC_APP_H 1 - -/***** - ***** Module Info - *****/ - -/* - * ISC Application Support - * - * Dealing with program termination can be difficult, especially in a - * multithreaded program. The routines in this module help coordinate - * the shutdown process. They are used as follows by the initial (main) - * thread of the application: - * - * isc_app_start(); Call very early in main(), before - * any other threads have been created. - * - * isc_app_run(); This will post any on-run events, - * and then block until application - * shutdown is requested. A shutdown - * request is made by calling - * isc_app_shutdown(), or by sending - * SIGINT or SIGTERM to the process. - * After isc_app_run() returns, the - * application should shutdown itself. - * - * isc_app_finish(); Call very late in main(). - * - * Applications that want to use SIGHUP/isc_app_reload() to trigger reloading - * should check the result of isc_app_run() and call the reload routine if - * the result is ISC_R_RELOAD. They should then call isc_app_run() again - * to resume waiting for reload or termination. - * - * Use of this module is not required. In particular, isc_app_start() is - * NOT an ISC library initialization routine. - * - * MP: - * Clients must ensure that isc_app_start(), isc_app_run(), and - * isc_app_finish() are called at most once. isc_app_shutdown() - * is safe to use by any thread (provided isc_app_start() has been - * called previously). - * - * Reliability: - * No anticipated impact. - * - * Resources: - * None. - * - * Security: - * No anticipated impact. - * - * Standards: - * None. - */ - -#include <isc/eventclass.h> -#include <isc/lang.h> -#include <isc/result.h> - -typedef isc_event_t isc_appevent_t; - -#define ISC_APPEVENT_FIRSTEVENT (ISC_EVENTCLASS_APP + 0) -#define ISC_APPEVENT_SHUTDOWN (ISC_EVENTCLASS_APP + 1) -#define ISC_APPEVENT_LASTEVENT (ISC_EVENTCLASS_APP + 65535) - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_app_start(void); -/* - * Start an ISC library application. - * - * Notes: - * This call should be made before any other ISC library call, and as - * close to the beginning of the application as possible. - */ - -isc_result_t -isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, - void *arg); -/* - * Request delivery of an event when the application is run. - * - * Requires: - * isc_app_start() has been called. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_NOMEMORY - */ - -isc_result_t -isc_app_run(void); -/* - * Run an ISC library application. - * - * Notes: - * The caller (typically the initial thread of an application) will - * block until shutdown is requested. When the call returns, the - * caller should start shutting down the application. - * - * Requires: - * isc_app_start() has been called. - * - * Ensures: - * Any events requested via isc_app_onrun() will have been posted (in - * FIFO order) before isc_app_run() blocks. - * - * Returns: - * ISC_R_SUCCESS Shutdown has been requested. - * ISC_R_RELOAD Reload has been requested. - */ - -isc_result_t -isc_app_shutdown(void); -/* - * Request application shutdown. - * - * Notes: - * It is safe to call isc_app_shutdown() multiple times. Shutdown will - * only be triggered once. - * - * Requires: - * isc_app_run() has been called. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_UNEXPECTED - */ - -isc_result_t -isc_app_reload(void); -/* - * Request application reload. - * - * Requires: - * isc_app_run() has been called. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_UNEXPECTED - */ - -void -isc_app_finish(void); -/* - * Finish an ISC library application. - * - * Notes: - * This call should be made at or near the end of main(). - * - * Requires: - * isc_app_start() has been called. - * - * Ensures: - * Any resources allocated by isc_app_start() have been released. - */ - -void -isc_app_block(void); -/* - * Indicate that a blocking operation will be performed. - * - * Notes: - * If a blocking operation is in process, a call to isc_app_shutdown() - * or an external signal will abort the program, rather than allowing - * clean shutdown. This is primarily useful for reading user input. - * - * Requires: - * isc_app_start() has been called. - * No other blocking operations are in progress. - */ - -void -isc_app_unblock(void); -/* - * Indicate that a blocking operation is complete. - * - * Notes: - * When a blocking operation has completed, return the program to a - * state where a call to isc_app_shutdown() or an external signal will - * shutdown normally. - * - * Requires: - * isc_app_start() has been called. - * isc_app_block() has been called by the same thread. - */ - - -ISC_LANG_ENDDECLS - -#endif /* ISC_APP_H */ diff --git a/include/isc/assertions.h b/include/isc/assertions.h deleted file mode 100644 index 45855c663180..000000000000 --- a/include/isc/assertions.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 1997-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * $Id: assertions.h,v 1.17 2001/07/12 05:58:21 mayer Exp $ - */ - -#ifndef ISC_ASSERTIONS_H -#define ISC_ASSERTIONS_H 1 - -#include <isc/lang.h> -#include <isc/platform.h> - -ISC_LANG_BEGINDECLS - -typedef enum { - isc_assertiontype_require, - isc_assertiontype_ensure, - isc_assertiontype_insist, - isc_assertiontype_invariant -} isc_assertiontype_t; - -typedef void (*isc_assertioncallback_t)(const char *, int, isc_assertiontype_t, - const char *); - -LIBISC_EXTERNAL_DATA extern isc_assertioncallback_t isc_assertion_failed; - -void -isc_assertion_setcallback(isc_assertioncallback_t); - -const char * -isc_assertion_typetotext(isc_assertiontype_t type); - -#ifdef ISC_CHECK_ALL -#define ISC_CHECK_REQUIRE 1 -#define ISC_CHECK_ENSURE 1 -#define ISC_CHECK_INSIST 1 -#define ISC_CHECK_INVARIANT 1 -#endif - -#ifdef ISC_CHECK_NONE -#define ISC_CHECK_REQUIRE 0 -#define ISC_CHECK_ENSURE 0 -#define ISC_CHECK_INSIST 0 -#define ISC_CHECK_INVARIANT 0 -#endif - -#ifndef ISC_CHECK_REQUIRE -#define ISC_CHECK_REQUIRE 1 -#endif - -#ifndef ISC_CHECK_ENSURE -#define ISC_CHECK_ENSURE 1 -#endif - -#ifndef ISC_CHECK_INSIST -#define ISC_CHECK_INSIST 1 -#endif - -#ifndef ISC_CHECK_INVARIANT -#define ISC_CHECK_INVARIANT 1 -#endif - -#if ISC_CHECK_REQUIRE != 0 -#define ISC_REQUIRE(cond) \ - ((void) ((cond) || \ - ((isc_assertion_failed)(__FILE__, __LINE__, \ - isc_assertiontype_require, \ - #cond), 0))) -#else -#define ISC_REQUIRE(cond) ((void) 0) -#endif /* ISC_CHECK_REQUIRE */ - -#if ISC_CHECK_ENSURE != 0 -#define ISC_ENSURE(cond) \ - ((void) ((cond) || \ - ((isc_assertion_failed)(__FILE__, __LINE__, \ - isc_assertiontype_ensure, \ - #cond), 0))) -#else -#define ISC_ENSURE(cond) ((void) 0) -#endif /* ISC_CHECK_ENSURE */ - -#if ISC_CHECK_INSIST != 0 -#define ISC_INSIST(cond) \ - ((void) ((cond) || \ - ((isc_assertion_failed)(__FILE__, __LINE__, \ - isc_assertiontype_insist, \ - #cond), 0))) -#else -#define ISC_INSIST(cond) ((void) 0) -#endif /* ISC_CHECK_INSIST */ - -#if ISC_CHECK_INVARIANT != 0 -#define ISC_INVARIANT(cond) \ - ((void) ((cond) || \ - ((isc_assertion_failed)(__FILE__, __LINE__, \ - isc_assertiontype_invariant, \ - #cond), 0))) -#else -#define ISC_INVARIANT(cond) ((void) 0) -#endif /* ISC_CHECK_INVARIANT */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_ASSERTIONS_H */ diff --git a/include/isc/boolean.h b/include/isc/boolean.h deleted file mode 100644 index d10007b5802a..000000000000 --- a/include/isc/boolean.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 1998-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: boolean.h,v 1.12 2001/01/09 21:56:45 bwelling Exp $ */ - -#ifndef ISC_BOOLEAN_H -#define ISC_BOOLEAN_H 1 - -typedef enum { isc_boolean_false = 0, isc_boolean_true = 1 } isc_boolean_t; - -#define ISC_FALSE isc_boolean_false -#define ISC_TRUE isc_boolean_true -#define ISC_TF(x) ((x) ? ISC_TRUE : ISC_FALSE) - -#endif /* ISC_BOOLEAN_H */ diff --git a/include/isc/buffer.h b/include/isc/buffer.h deleted file mode 100644 index 47c8f0c95d41..000000000000 --- a/include/isc/buffer.h +++ /dev/null @@ -1,800 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1998-2002 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: buffer.h,v 1.39.12.2 2004/03/08 09:04:51 marka Exp $ */ - -#ifndef ISC_BUFFER_H -#define ISC_BUFFER_H 1 - -/***** - ***** Module Info - *****/ - -/* - * Buffers - * - * A buffer is a region of memory, together with a set of related subregions. - * Buffers are used for parsing and I/O operations. - * - * The 'used region' and the 'available' region are disjoint, and their - * union is the buffer's region. The used region extends from the beginning - * of the buffer region to the last used byte. The available region - * extends from one byte greater than the last used byte to the end of the - * buffer's region. The size of the used region can be changed using various - * buffer commands. Initially, the used region is empty. - * - * The used region is further subdivided into two disjoint regions: the - * 'consumed region' and the 'remaining region'. The union of these two - * regions is the used region. The consumed region extends from the beginning - * of the used region to the byte before the 'current' offset (if any). The - * 'remaining' region the current pointer to the end of the used - * region. The size of the consumed region can be changed using various - * buffer commands. Initially, the consumed region is empty. - * - * The 'active region' is an (optional) subregion of the remaining region. - * It extends from the current offset to an offset in the remaining region - * that is selected with isc_buffer_setactive(). Initially, the active region - * is empty. If the current offset advances beyond the chosen offset, the - * active region will also be empty. - * - * /------------entire length---------------\ - * /----- used region -----\/-- available --\ - * +----------------------------------------+ - * | consumed | remaining | | - * +----------------------------------------+ - * a b c d e - * - * a == base of buffer. - * b == current pointer. Can be anywhere between a and d. - * c == active pointer. Meaningful between b and d. - * d == used pointer. - * e == length of buffer. - * - * a-e == entire length of buffer. - * a-d == used region. - * a-b == consumed region. - * b-d == remaining region. - * b-c == optional active region. - * - * The following invariants are maintained by all routines: - * - * length > 0 - * - * base is a valid pointer to length bytes of memory - * - * 0 <= used <= length - * - * 0 <= current <= used - * - * 0 <= active <= used - * (although active < current implies empty active region) - * - * MP: - * Buffers have no synchronization. Clients must ensure exclusive - * access. - * - * Reliability: - * No anticipated impact. - * - * Resources: - * Memory: 1 pointer + 6 unsigned integers per buffer. - * - * Security: - * No anticipated impact. - * - * Standards: - * None. - */ - -/*** - *** Imports - ***/ - -#include <isc/lang.h> -#include <isc/magic.h> -#include <isc/types.h> - -/* - * To make many functions be inline macros (via #define) define this. - * If it is undefined, a function will be used. - */ -#define ISC_BUFFER_USEINLINE - -ISC_LANG_BEGINDECLS - -/*** - *** Magic numbers - ***/ -#define ISC_BUFFER_MAGIC 0x42756621U /* Buf!. */ -#define ISC_BUFFER_VALID(b) ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC) - -/* - * The following macros MUST be used only on valid buffers. It is the - * caller's responsibility to ensure this by using the ISC_BUFFER_VALID - * check above, or by calling another isc_buffer_*() function (rather than - * another macro.) - */ - -/* - * Fundamental buffer elements. (A through E in the introductory comment.) - */ -#define isc_buffer_base(b) ((void *)(b)->base) /*a*/ -#define isc_buffer_current(b) \ - ((void *)((unsigned char *)(b)->base + (b)->current)) /*b*/ -#define isc_buffer_active(b) \ - ((void *)((unsigned char *)(b)->base + (b)->active)) /*c*/ -#define isc_buffer_used(b) \ - ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/ -#define isc_buffer_length(b) ((b)->length) /*e*/ - -/* - * Derived lengths. (Described in the introductory comment.) - */ -#define isc_buffer_usedlength(b) ((b)->used) /* d-a */ -#define isc_buffer_consumedlength(b) ((b)->current) /* b-a */ -#define isc_buffer_remaininglength(b) ((b)->used - (b)->current) /* d-b */ -#define isc_buffer_activelength(b) ((b)->active - (b)->current) /* c-b */ -#define isc_buffer_availablelength(b) ((b)->length - (b)->used) /* e-d */ - -/* - * Note that the buffer structure is public. This is principally so buffer - * operations can be implemented using macros. Applications are strongly - * discouraged from directly manipulating the structure. - */ - -struct isc_buffer { - unsigned int magic; - void *base; - /* The following integers are byte offsets from 'base'. */ - unsigned int length; - unsigned int used; - unsigned int current; - unsigned int active; - /* linkable */ - ISC_LINK(isc_buffer_t) link; - /* private internal elements */ - isc_mem_t *mctx; -}; - -/*** - *** Functions - ***/ - -isc_result_t -isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer, - unsigned int length); -/* - * Allocate a dynamic linkable buffer which has "length" bytes in the - * data region. - * - * Requires: - * "mctx" is valid. - * - * "dynbuffer" is non-NULL, and "*dynbuffer" is NULL. - * - * Returns: - * ISC_R_SUCCESS - success - * ISC_R_NOMEMORY - no memory available - * - * Note: - * Changing the buffer's length field is not permitted. - */ - -void -isc_buffer_free(isc_buffer_t **dynbuffer); -/* - * Release resources allocated for a dynamic buffer. - * - * Requires: - * "dynbuffer" is not NULL. - * - * "*dynbuffer" is a valid dynamic buffer. - * - * Ensures: - * "*dynbuffer" will be NULL on return, and all memory associated with - * the dynamic buffer is returned to the memory context used in - * isc_buffer_allocate(). - */ - -void -isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length); -/* - * Make 'b' refer to the 'length'-byte region starting at base. - * - * Requires: - * - * 'length' > 0 - * - * 'base' is a pointer to a sequence of 'length' bytes. - * - */ - -void -isc__buffer_invalidate(isc_buffer_t *b); -/* - * Make 'b' an invalid buffer. - * - * Requires: - * 'b' is a valid buffer. - * - * Ensures: - * If assertion checking is enabled, future attempts to use 'b' without - * calling isc_buffer_init() on it will cause an assertion failure. - */ - -void -isc__buffer_region(isc_buffer_t *b, isc_region_t *r); -/* - * Make 'r' refer to the region of 'b'. - * - * Requires: - * - * 'b' is a valid buffer. - * - * 'r' points to a region structure. - */ - -void -isc__buffer_usedregion(isc_buffer_t *b, isc_region_t *r); -/* - * Make 'r' refer to the used region of 'b'. - * - * Requires: - * - * 'b' is a valid buffer. - * - * 'r' points to a region structure. - */ - -void -isc__buffer_availableregion(isc_buffer_t *b, isc_region_t *r); -/* - * Make 'r' refer to the available region of 'b'. - * - * Requires: - * - * 'b' is a valid buffer. - * - * 'r' points to a region structure. - */ - -void -isc__buffer_add(isc_buffer_t *b, unsigned int n); -/* - * Increase the 'used' region of 'b' by 'n' bytes. - * - * Requires: - * - * 'b' is a valid buffer - * - * used + n <= length - * - */ - -void -isc__buffer_subtract(isc_buffer_t *b, unsigned int n); -/* - * Decrease the 'used' region of 'b' by 'n' bytes. - * - * Requires: - * - * 'b' is a valid buffer - * - * used >= n - * - */ - -void -isc__buffer_clear(isc_buffer_t *b); -/* - * Make the used region empty. - * - * Requires: - * - * 'b' is a valid buffer - * - * Ensures: - * - * used = 0 - * - */ - -void -isc__buffer_consumedregion(isc_buffer_t *b, isc_region_t *r); -/* - * Make 'r' refer to the consumed region of 'b'. - * - * Requires: - * - * 'b' is a valid buffer. - * - * 'r' points to a region structure. - */ - -void -isc__buffer_remainingregion(isc_buffer_t *b, isc_region_t *r); -/* - * Make 'r' refer to the remaining region of 'b'. - * - * Requires: - * - * 'b' is a valid buffer. - * - * 'r' points to a region structure. - */ - -void -isc__buffer_activeregion(isc_buffer_t *b, isc_region_t *r); -/* - * Make 'r' refer to the active region of 'b'. - * - * Requires: - * - * 'b' is a valid buffer. - * - * 'r' points to a region structure. - */ - -void -isc__buffer_setactive(isc_buffer_t *b, unsigned int n); -/* - * Sets the end of the active region 'n' bytes after current. - * - * Requires: - * - * 'b' is a valid buffer. - * - * current + n <= used - */ - -void -isc__buffer_first(isc_buffer_t *b); -/* - * Make the consumed region empty. - * - * Requires: - * - * 'b' is a valid buffer - * - * Ensures: - * - * current == 0 - * - */ - -void -isc__buffer_forward(isc_buffer_t *b, unsigned int n); -/* - * Increase the 'consumed' region of 'b' by 'n' bytes. - * - * Requires: - * - * 'b' is a valid buffer - * - * current + n <= used - * - */ - -void -isc__buffer_back(isc_buffer_t *b, unsigned int n); -/* - * Decrease the 'consumed' region of 'b' by 'n' bytes. - * - * Requires: - * - * 'b' is a valid buffer - * - * n <= current - * - */ - -void -isc_buffer_compact(isc_buffer_t *b); -/* - * Compact the used region by moving the remaining region so it occurs - * at the start of the buffer. The used region is shrunk by the size of - * the consumed region, and the consumed region is then made empty. - * - * Requires: - * - * 'b' is a valid buffer - * - * Ensures: - * - * current == 0 - * - * The size of the used region is now equal to the size of the remaining - * region (as it was before the call). The contents of the used region - * are those of the remaining region (as it was before the call). - */ - -isc_uint8_t -isc_buffer_getuint8(isc_buffer_t *b); -/* - * Read an unsigned 8-bit integer from 'b' and return it. - * - * Requires: - * - * 'b' is a valid buffer. - * - * The length of the available region of 'b' is at least 1. - * - * Ensures: - * - * The current pointer in 'b' is advanced by 1. - * - * Returns: - * - * A 8-bit unsigned integer. - */ - -void -isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val); -/* - * Store an unsigned 8-bit integer from 'val' into 'b'. - * - * Requires: - * 'b' is a valid buffer. - * - * The length of the unused region of 'b' is at least 1. - * - * Ensures: - * The used pointer in 'b' is advanced by 1. - */ - -isc_uint16_t -isc_buffer_getuint16(isc_buffer_t *b); -/* - * Read an unsigned 16-bit integer in network byte order from 'b', convert - * it to host byte order, and return it. - * - * Requires: - * - * 'b' is a valid buffer. - * - * The length of the available region of 'b' is at least 2. - * - * Ensures: - * - * The current pointer in 'b' is advanced by 2. - * - * Returns: - * - * A 16-bit unsigned integer. - */ - -void -isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val); -/* - * Store an unsigned 16-bit integer in host byte order from 'val' - * into 'b' in network byte order. - * - * Requires: - * 'b' is a valid buffer. - * - * The length of the unused region of 'b' is at least 2. - * - * Ensures: - * The used pointer in 'b' is advanced by 2. - */ - -isc_uint32_t -isc_buffer_getuint32(isc_buffer_t *b); -/* - * Read an unsigned 32-bit integer in network byte order from 'b', convert - * it to host byte order, and return it. - * - * Requires: - * - * 'b' is a valid buffer. - * - * The length of the available region of 'b' is at least 4. - * - * Ensures: - * - * The current pointer in 'b' is advanced by 4. - * - * Returns: - * - * A 32-bit unsigned integer. - */ - -void -isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val); -/* - * Store an unsigned 32-bit integer in host byte order from 'val' - * into 'b' in network byte order. - * - * Requires: - * 'b' is a valid buffer. - * - * The length of the unused region of 'b' is at least 4. - * - * Ensures: - * The used pointer in 'b' is advanced by 4. - */ - -void -isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base, - unsigned int length); -/* - * Copy 'length' bytes of memory at 'base' into 'b'. - * - * Requires: - * 'b' is a valid buffer. - * - * 'base' points to 'length' bytes of valid memory. - * - */ - -void -isc__buffer_putstr(isc_buffer_t *b, const char *source); -/* - * Copy 'source' into 'b', not including terminating NUL. - * - * Requires: - * 'b' is a valid buffer. - * - * 'source' to be a valid NULL terminated string. - * - * strlen(source) <= isc_buffer_available(b) - */ - -isc_result_t -isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r); -/* - * Copy the contents of 'r' into 'b'. - * - * Requires: - * 'b' is a valid buffer. - * - * 'r' is a valid region. - * - * Returns: - * - * ISC_R_SUCCESS - * ISC_R_NOSPACE The available region of 'b' is not - * big enough. - */ - -ISC_LANG_ENDDECLS - -/* - * Inline macro versions of the functions. These should never be called - * directly by an application, but will be used by the functions within - * buffer.c. The callers should always use "isc_buffer_*()" names, never - * ones beginning with "isc__" - */ - -/* - * XXXDCL Something more could be done with initializing buffers that - * point to const data. For example, a new function, isc_buffer_initconst, - * could be used, and a new boolean flag in the buffer structure could - * indicate whether the buffer was initialized with that function. - * (isc_bufer_init itself would be reprototyped to *not* have its "base" - * parameter be const.) Then if the boolean were true, the isc_buffer_put* - * functions could assert a contractual requirement for a non-const buffer. - * One drawback is that the isc_buffer_* functions (macros) that return - * pointers would still need to return non-const pointers to avoid compiler - * warnings, so it would be up to code that uses them to have to deal - * with the possibility that the buffer was initialized as const -- - * a problem that they *already* have to deal with but have absolutely - * no ability to. With a new isc_buffer_isconst() function returning - * true/false, they could at least assert a contractual requirement for - * non-const buffers when needed. - */ -#define ISC__BUFFER_INIT(_b, _base, _length) \ - do { \ - union { \ - const void * konst; \ - void * var; \ - } _u; \ - _u.konst = (_base); \ - (_b)->base = _u.var; \ - (_b)->length = (_length); \ - (_b)->used = 0; \ - (_b)->current = 0; \ - (_b)->active = 0; \ - (_b)->mctx = NULL; \ - ISC_LINK_INIT(_b, link); \ - (_b)->magic = ISC_BUFFER_MAGIC; \ - } while (0) - -#define ISC__BUFFER_INVALIDATE(_b) \ - do { \ - (_b)->magic = 0; \ - (_b)->base = NULL; \ - (_b)->length = 0; \ - (_b)->used = 0; \ - (_b)->current = 0; \ - (_b)->active = 0; \ - } while (0) - -#define ISC__BUFFER_REGION(_b, _r) \ - do { \ - (_r)->base = (_b)->base; \ - (_r)->length = (_b)->length; \ - } while (0) - -#define ISC__BUFFER_USEDREGION(_b, _r) \ - do { \ - (_r)->base = (_b)->base; \ - (_r)->length = (_b)->used; \ - } while (0) - -#define ISC__BUFFER_AVAILABLEREGION(_b, _r) \ - do { \ - (_r)->base = isc_buffer_used(_b); \ - (_r)->length = isc_buffer_availablelength(_b); \ - } while (0) - -#define ISC__BUFFER_ADD(_b, _n) \ - do { \ - (_b)->used += (_n); \ - } while (0) - -#define ISC__BUFFER_SUBTRACT(_b, _n) \ - do { \ - (_b)->used -= (_n); \ - if ((_b)->current > (_b)->used) \ - (_b)->current = (_b)->used; \ - if ((_b)->active > (_b)->used) \ - (_b)->active = (_b)->used; \ - } while (0) - -#define ISC__BUFFER_CLEAR(_b) \ - do { \ - (_b)->used = 0; \ - (_b)->current = 0; \ - (_b)->active = 0; \ - } while (0) - -#define ISC__BUFFER_CONSUMEDREGION(_b, _r) \ - do { \ - (_r)->base = (_b)->base; \ - (_r)->length = (_b)->current; \ - } while (0) - -#define ISC__BUFFER_REMAININGREGION(_b, _r) \ - do { \ - (_r)->base = isc_buffer_current(_b); \ - (_r)->length = isc_buffer_remaininglength(_b); \ - } while (0) - -#define ISC__BUFFER_ACTIVEREGION(_b, _r) \ - do { \ - if ((_b)->current < (_b)->active) { \ - (_r)->base = isc_buffer_current(_b); \ - (_r)->length = isc_buffer_activelength(_b); \ - } else { \ - (_r)->base = NULL; \ - (_r)->length = 0; \ - } \ - } while (0) - -#define ISC__BUFFER_SETACTIVE(_b, _n) \ - do { \ - (_b)->active = (_b)->current + (_n); \ - } while (0) - -#define ISC__BUFFER_FIRST(_b) \ - do { \ - (_b)->current = 0; \ - } while (0) - -#define ISC__BUFFER_FORWARD(_b, _n) \ - do { \ - (_b)->current += (_n); \ - } while (0) - -#define ISC__BUFFER_BACK(_b, _n) \ - do { \ - (_b)->current -= (_n); \ - } while (0) - -#define ISC__BUFFER_PUTMEM(_b, _base, _length) \ - do { \ - memcpy(isc_buffer_used(_b), (_base), (_length)); \ - (_b)->used += (_length); \ - } while (0) - -#define ISC__BUFFER_PUTSTR(_b, _source) \ - do { \ - unsigned int _length; \ - unsigned char *_cp; \ - _length = strlen(_source); \ - _cp = isc_buffer_used(_b); \ - memcpy(_cp, (_source), _length); \ - (_b)->used += (_length); \ - } while (0) - -#define ISC__BUFFER_PUTUINT8(_b, _val) \ - do { \ - unsigned char *_cp; \ - isc_uint8_t _val2 = (_val); \ - _cp = isc_buffer_used(_b); \ - (_b)->used++; \ - _cp[0] = _val2 & 0x00ff; \ - } while (0) - -#define ISC__BUFFER_PUTUINT16(_b, _val) \ - do { \ - unsigned char *_cp; \ - isc_uint16_t _val2 = (_val); \ - _cp = isc_buffer_used(_b); \ - (_b)->used += 2; \ - _cp[0] = (unsigned char)((_val2 & 0xff00U) >> 8); \ - _cp[1] = (unsigned char)(_val2 & 0x00ffU); \ - } while (0) - -#define ISC__BUFFER_PUTUINT32(_b, _val) \ - do { \ - unsigned char *_cp; \ - isc_uint32_t _val2 = (_val); \ - _cp = isc_buffer_used(_b); \ - (_b)->used += 4; \ - _cp[0] = (unsigned char)((_val2 & 0xff000000) >> 24); \ - _cp[1] = (unsigned char)((_val2 & 0x00ff0000) >> 16); \ - _cp[2] = (unsigned char)((_val2 & 0x0000ff00) >> 8); \ - _cp[3] = (unsigned char)((_val2 & 0x000000ff)); \ - } while (0) - -#if defined(ISC_BUFFER_USEINLINE) -#define isc_buffer_init ISC__BUFFER_INIT -#define isc_buffer_invalidate ISC__BUFFER_INVALIDATE -#define isc_buffer_region ISC__BUFFER_REGION -#define isc_buffer_usedregion ISC__BUFFER_USEDREGION -#define isc_buffer_availableregion ISC__BUFFER_AVAILABLEREGION -#define isc_buffer_add ISC__BUFFER_ADD -#define isc_buffer_subtract ISC__BUFFER_SUBTRACT -#define isc_buffer_clear ISC__BUFFER_CLEAR -#define isc_buffer_consumedregion ISC__BUFFER_CONSUMEDREGION -#define isc_buffer_remainingregion ISC__BUFFER_REMAININGREGION -#define isc_buffer_activeregion ISC__BUFFER_ACTIVEREGION -#define isc_buffer_setactive ISC__BUFFER_SETACTIVE -#define isc_buffer_first ISC__BUFFER_FIRST -#define isc_buffer_forward ISC__BUFFER_FORWARD -#define isc_buffer_back ISC__BUFFER_BACK -#define isc_buffer_putmem ISC__BUFFER_PUTMEM -#define isc_buffer_putstr ISC__BUFFER_PUTSTR -#define isc_buffer_putuint8 ISC__BUFFER_PUTUINT8 -#define isc_buffer_putuint16 ISC__BUFFER_PUTUINT16 -#define isc_buffer_putuint32 ISC__BUFFER_PUTUINT32 -#else -#define isc_buffer_init isc__buffer_init -#define isc_buffer_invalidate isc__buffer_invalidate -#define isc_buffer_region isc__buffer_region -#define isc_buffer_usedregion isc__buffer_usedregion -#define isc_buffer_availableregion isc__buffer_availableregion -#define isc_buffer_add isc__buffer_add -#define isc_buffer_subtract isc__buffer_subtract -#define isc_buffer_clear isc__buffer_clear -#define isc_buffer_consumedregion isc__buffer_consumedregion -#define isc_buffer_remainingregion isc__buffer_remainingregion -#define isc_buffer_activeregion isc__buffer_activeregion -#define isc_buffer_setactive isc__buffer_setactive -#define isc_buffer_first isc__buffer_first -#define isc_buffer_forward isc__buffer_forward -#define isc_buffer_back isc__buffer_back -#define isc_buffer_putmem isc__buffer_putmem -#define isc_buffer_putstr isc__buffer_putstr -#define isc_buffer_putuint8 isc__buffer_putuint8 -#define isc_buffer_putuint16 isc__buffer_putuint16 -#define isc_buffer_putuint32 isc__buffer_putuint32 -#endif - -#endif /* ISC_BUFFER_H */ diff --git a/include/isc/error.h b/include/isc/error.h deleted file mode 100644 index 1dc07748c21d..000000000000 --- a/include/isc/error.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 1998-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: error.h,v 1.13 2001/01/09 21:56:51 bwelling Exp $ */ - -#ifndef ISC_ERROR_H -#define ISC_ERROR_H 1 - -#include <stdarg.h> - -#include <isc/formatcheck.h> -#include <isc/lang.h> - -ISC_LANG_BEGINDECLS - -typedef void (*isc_errorcallback_t)(const char *, int, const char *, va_list); - -void -isc_error_setunexpected(isc_errorcallback_t); - -void -isc_error_setfatal(isc_errorcallback_t); - -void -isc_error_unexpected(const char *, int, const char *, ...) - ISC_FORMAT_PRINTF(3, 4); - -void -isc_error_fatal(const char *, int, const char *, ...) - ISC_FORMAT_PRINTF(3, 4); - -void -isc_error_runtimecheck(const char *, int, const char *); - -#define ISC_ERROR_RUNTIMECHECK(cond) \ - ((void) ((cond) || \ - ((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0))) - -ISC_LANG_ENDDECLS - -#endif /* ISC_ERROR_H */ diff --git a/include/isc/formatcheck.h b/include/isc/formatcheck.h deleted file mode 100644 index e9b91698e979..000000000000 --- a/include/isc/formatcheck.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: formatcheck.h,v 1.6 2001/01/09 21:56:55 bwelling Exp $ */ - -#ifndef ISC_FORMATCHECK_H -#define ISC_FORMATCHECK_H 1 - -/* - * fmt is the location of the format string parameter. - * args is the location of the first argument (or 0 for no argument checking). - * Note: the first parameter is 1, not 0. - */ -#ifdef __GNUC__ -#define ISC_FORMAT_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args))) -#else -#define ISC_FORMAT_PRINTF(fmt, args) -#endif - -#endif /* ISC_FORMATCHECK_H */ diff --git a/include/isc/int.h b/include/isc/int.h deleted file mode 100644 index d30e6dcc6290..000000000000 --- a/include/isc/int.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: int.h,v 1.11 2001/01/09 21:58:39 bwelling Exp $ */ - -#ifndef ISC_INT_H -#define ISC_INT_H 1 - -typedef char isc_int8_t; -typedef unsigned char isc_uint8_t; -typedef short isc_int16_t; -typedef unsigned short isc_uint16_t; -typedef int isc_int32_t; -typedef unsigned int isc_uint32_t; -typedef long long isc_int64_t; -typedef unsigned long long isc_uint64_t; - -#define ISC_INT8_MIN -128 -#define ISC_INT8_MAX 127 -#define ISC_UINT8_MAX 255 - -#define ISC_INT16_MIN -32768 -#define ISC_INT16_MAX 32767 -#define ISC_UINT16_MAX 65535 - -/* - * Note that "int" is 32 bits on all currently supported Unix-like operating - * systems, but "long" can be either 32 bits or 64 bits, thus the 32 bit - * constants are not qualified with "L". - */ -#define ISC_INT32_MIN -2147483648 -#define ISC_INT32_MAX 2147483647 -#define ISC_UINT32_MAX 4294967295U - -#define ISC_INT64_MIN -9223372036854775808LL -#define ISC_INT64_MAX 9223372036854775807LL -#define ISC_UINT64_MAX 18446744073709551615ULL - -#endif /* ISC_INT_H */ diff --git a/include/isc/interfaceiter.h b/include/isc/interfaceiter.h deleted file mode 100644 index f2d11ba8a432..000000000000 --- a/include/isc/interfaceiter.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: interfaceiter.h,v 1.10 2001/01/09 21:57:01 bwelling Exp $ */ - -#ifndef ISC_INTERFACEITER_H -#define ISC_INTERFACEITER_H 1 - -/***** - ***** Module Info - *****/ - -/* - * Interface iterator - * - * Iterate over the list of network interfaces. - * - * Interfaces whose address family is not supported are ignored and never - * returned by the iterator. Interfaces whose netmask, interface flags, - * or similar cannot be obtained are also ignored, and the failure is logged. - * - * Standards: - * The API for scanning varies greatly among operating systems. - * This module attempts to hide the differences. - */ - -/*** - *** Imports - ***/ - -#include <isc/lang.h> -#include <isc/netaddr.h> -#include <isc/types.h> - -/* - * Public structure describing a network interface. - */ - -struct isc_interface { - char name[32]; /* Interface name, null-terminated. */ - unsigned int af; /* Address family. */ - isc_netaddr_t address; /* Local address. */ - isc_netaddr_t netmask; /* Network mask. */ - isc_netaddr_t broadcast; /* Broadcast address. */ - isc_netaddr_t dstaddress; /* Destination address - (point-to-point only). */ - isc_uint32_t flags; /* Flags; see below. */ - unsigned int ifindex; /* Interface Index */ - unsigned int scopeid; /* Scope id for Multicasting */ -}; - -/* Interface flags. */ - -#define INTERFACE_F_UP 0x00000001U /* Interface is up */ -#define INTERFACE_F_POINTTOPOINT 0x00000002U /*this is point-to-point interface*/ -#define INTERFACE_F_LOOPBACK 0x00000004U /* this is loopback interface */ -#define INTERFACE_F_BROADCAST 0x00000008U /* Broadcast is supported */ -#define INTERFACE_F_MULTICAST 0x00000010U /* multicast is supported */ - -/*** - *** Functions - ***/ - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp); -/* - * Create an iterator for traversing the operating system's list - * of network interfaces. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_NOMEMORY - * Various network-related errors - */ - -isc_result_t -isc_interfaceiter_first(isc_interfaceiter_t *iter); -/* - * Position the iterator on the first interface. - * - * Returns: - * ISC_R_SUCCESS Success. - * ISC_R_NOMORE There are no interfaces. - */ - -isc_result_t -isc_interfaceiter_current(isc_interfaceiter_t *iter, - isc_interface_t *ifdata); -/* - * Get information about the interface the iterator is currently - * positioned at and store it at *ifdata. - * - * Requires: - * The iterator has been successfully positioned using - * isc_interface_iter_first() / isc_interface_iter_next(). - * - * Returns: - * ISC_R_SUCCESS Success. - */ - -isc_result_t -isc_interfaceiter_next(isc_interfaceiter_t *iter); -/* - * Position the iterator on the next interface. - * - * Requires: - * The iterator has been successfully positioned using - * isc_interface_iter_first() / isc_interface_iter_next(). - * - * Returns: - * ISC_R_SUCCESS Success. - * ISC_R_NOMORE There are no more interfaces. - */ - -void -isc_interfaceiter_destroy(isc_interfaceiter_t **iterp); -/* - * Destroy the iterator. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_INTERFACEITER_H */ diff --git a/include/isc/ipv6.h b/include/isc/ipv6.h deleted file mode 100644 index 007de7c0dd37..000000000000 --- a/include/isc/ipv6.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1999-2002 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: ipv6.h,v 1.17.12.4 2004/03/09 05:21:09 marka Exp $ */ - -#ifndef ISC_IPV6_H -#define ISC_IPV6_H 1 - -/* - * Also define LWRES_IPV6_H to keep it from being included if liblwres is - * being used, or redefinition errors will occur. - */ -#define LWRES_IPV6_H 1 - -/***** - ***** Module Info - *****/ - -/* - * IPv6 definitions for systems which do not support IPv6. - * - * MP: - * No impact. - * - * Reliability: - * No anticipated impact. - * - * Resources: - * N/A. - * - * Security: - * No anticipated impact. - * - * Standards: - * RFC 2553. - */ - -/*** - *** Imports. - ***/ - -#include <isc/int.h> -#include <isc/platform.h> - -/* - * We probably don't need this on NTP - */ -#ifdef ISC_ONLY_IPV6 -/*** - *** Types. - ***/ - -struct in6_addr { - union { - isc_uint8_t _S6_u8[16]; - isc_uint16_t _S6_u16[8]; - isc_uint32_t _S6_u32[4]; - } _S6_un; -}; -#define s6_addr _S6_un._S6_u8 -#define s6_addr8 _S6_un._S6_u8 -#define s6_addr16 _S6_un._S6_u16 -#define s6_addr32 _S6_un._S6_u32 - -#define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }} -#define IN6ADDR_LOOPBACK_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }} - -LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_any; -LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback; - -struct sockaddr_in6 { -#ifdef ISC_PLATFORM_HAVESALEN - isc_uint8_t sin6_len; - isc_uint8_t sin6_family; -#else - isc_uint16_t sin6_family; -#endif - isc_uint16_t sin6_port; - isc_uint32_t sin6_flowinfo; - struct in6_addr sin6_addr; - isc_uint32_t sin6_scope_id; -}; - -#ifdef ISC_PLATFORM_HAVESALEN -#define SIN6_LEN 1 -#endif - -/* - * Unspecified - */ -#ifndef IN6_IS_ADDR_UNSPECIFIED -#define IN6_IS_ADDR_UNSPECIFIED(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == 0) && \ - ((a)->s6_addr32[3] == 0)) -#endif -/* - * Loopback - */ -#define IN6_IS_ADDR_LOOPBACK(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == 0) && \ - ((a)->s6_addr32[3] == htonl(1))) - -/* - * IPv4 compatible - */ -#define IN6_IS_ADDR_V4COMPAT(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == 0) && \ - ((a)->s6_addr32[3] != 0) && \ - ((a)->s6_addr32[3] != htonl(1))) - -/* - * Mapped - */ -#define IN6_IS_ADDR_V4MAPPED(a) \ - (((a)->s6_addr32[0] == 0) && \ - ((a)->s6_addr32[1] == 0) && \ - ((a)->s6_addr32[2] == htonl(0x0000ffff))) - -/* - * Multicast - */ -#ifndef IN6_IS_ADDR_MULTICAST -#define IN6_IS_ADDR_MULTICAST(a) \ - ((a)->s6_addr8[0] == 0xffU) -#endif -/* - * Unicast link / site local. - */ -#define IN6_IS_ADDR_LINKLOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) -#define IN6_IS_ADDR_SITELOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) - -#endif /* ISC_ONLY_IPV6 */ -#endif /* ISC_IPV6_H */ diff --git a/include/isc/lang.h b/include/isc/lang.h deleted file mode 100644 index b3ba5908fe14..000000000000 --- a/include/isc/lang.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: lang.h,v 1.6 2001/01/09 21:57:03 bwelling Exp $ */ - -#ifndef ISC_LANG_H -#define ISC_LANG_H 1 - -#ifdef __cplusplus -#define ISC_LANG_BEGINDECLS extern "C" { -#define ISC_LANG_ENDDECLS } -#else -#define ISC_LANG_BEGINDECLS -#define ISC_LANG_ENDDECLS -#endif - -#endif /* ISC_LANG_H */ diff --git a/include/isc/lib.h b/include/isc/lib.h deleted file mode 100644 index 7feef43c5ebe..000000000000 --- a/include/isc/lib.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: lib.h,v 1.7 2001/11/19 03:08:25 mayer Exp $ */ - -#ifndef ISC_LIB_H -#define ISC_LIB_H 1 - -#include <isc/types.h> -#include <isc/lang.h> - -ISC_LANG_BEGINDECLS - -LIBISC_EXTERNAL_DATA extern isc_msgcat_t *isc_msgcat; - -void -isc_lib_initmsgcat(void); -/* - * Initialize the ISC library's message catalog, isc_msgcat, if it - * has not already been initialized. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_LIB_H */ diff --git a/include/isc/list.h b/include/isc/list.h deleted file mode 100644 index d0ae7a91a6f3..000000000000 --- a/include/isc/list.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 1997-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: list.h,v 1.19 2002/05/09 07:09:30 marka Exp $ */ - -#ifndef ISC_LIST_H -#define ISC_LIST_H 1 -#include <isc/boolean.h> -#include <isc/assertions.h> - -#ifdef ISC_LIST_CHECKINIT -#define ISC_LINK_INSIST(x) ISC_INSIST(x) -#else -#define ISC_LINK_INSIST(x) -#endif - -#define ISC_LIST(type) struct { type *head, *tail; } -#define ISC_LIST_INIT(list) \ - do { (list).head = NULL; (list).tail = NULL; } while (0) - -#define ISC_LINK(type) struct { type *prev, *next; } -#define ISC_LINK_INIT_TYPE(elt, link, type) \ - do { \ - (elt)->link.prev = (type *)(-1); \ - (elt)->link.next = (type *)(-1); \ - } while (0) -#define ISC_LINK_INIT(elt, link) \ - ISC_LINK_INIT_TYPE(elt, link, void) -#define ISC_LINK_LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1)) - -#define ISC_LIST_HEAD(list) ((list).head) -#define ISC_LIST_TAIL(list) ((list).tail) -#define ISC_LIST_EMPTY(list) ISC_TF((list).head == NULL) - -#define __ISC_LIST_PREPENDUNSAFE(list, elt, link) \ - do { \ - if ((list).head != NULL) \ - (list).head->link.prev = (elt); \ - else \ - (list).tail = (elt); \ - (elt)->link.prev = NULL; \ - (elt)->link.next = (list).head; \ - (list).head = (elt); \ - } while (0) - -#define ISC_LIST_PREPEND(list, elt, link) \ - do { \ - ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ - __ISC_LIST_PREPENDUNSAFE(list, elt, link); \ - } while (0) - -#define ISC_LIST_INITANDPREPEND(list, elt, link) \ - __ISC_LIST_PREPENDUNSAFE(list, elt, link) - -#define __ISC_LIST_APPENDUNSAFE(list, elt, link) \ - do { \ - if ((list).tail != NULL) \ - (list).tail->link.next = (elt); \ - else \ - (list).head = (elt); \ - (elt)->link.prev = (list).tail; \ - (elt)->link.next = NULL; \ - (list).tail = (elt); \ - } while (0) - -#define ISC_LIST_APPEND(list, elt, link) \ - do { \ - ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ - __ISC_LIST_APPENDUNSAFE(list, elt, link); \ - } while (0) - -#define ISC_LIST_INITANDAPPEND(list, elt, link) \ - __ISC_LIST_APPENDUNSAFE(list, elt, link) - -#define __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type) \ - do { \ - if ((elt)->link.next != NULL) \ - (elt)->link.next->link.prev = (elt)->link.prev; \ - else \ - (list).tail = (elt)->link.prev; \ - if ((elt)->link.prev != NULL) \ - (elt)->link.prev->link.next = (elt)->link.next; \ - else \ - (list).head = (elt)->link.next; \ - (elt)->link.prev = (type *)(-1); \ - (elt)->link.next = (type *)(-1); \ - } while (0) - -#define __ISC_LIST_UNLINKUNSAFE(list, elt, link) \ - __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, void) - -#define ISC_LIST_UNLINK_TYPE(list, elt, link, type) \ - do { \ - ISC_LINK_INSIST(ISC_LINK_LINKED(elt, link)); \ - __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type); \ - } while (0) -#define ISC_LIST_UNLINK(list, elt, link) \ - ISC_LIST_UNLINK_TYPE(list, elt, link, void) - -#define ISC_LIST_PREV(elt, link) ((elt)->link.prev) -#define ISC_LIST_NEXT(elt, link) ((elt)->link.next) - -#define __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link) \ - do { \ - if ((before)->link.prev == NULL) \ - ISC_LIST_PREPEND(list, elt, link); \ - else { \ - (elt)->link.prev = (before)->link.prev; \ - (before)->link.prev = (elt); \ - (elt)->link.prev->link.next = (elt); \ - (elt)->link.next = (before); \ - } \ - } while (0) - -#define ISC_LIST_INSERTBEFORE(list, before, elt, link) \ - do { \ - ISC_LINK_INSIST(ISC_LINK_LINKED(before, link)); \ - ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ - __ISC_LIST_INSERTBEFOREUNSAFE(list, before, elt, link); \ - } while (0) - -#define __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link) \ - do { \ - if ((after)->link.next == NULL) \ - ISC_LIST_APPEND(list, elt, link); \ - else { \ - (elt)->link.next = (after)->link.next; \ - (after)->link.next = (elt); \ - (elt)->link.next->link.prev = (elt); \ - (elt)->link.prev = (after); \ - } \ - } while (0) - -#define ISC_LIST_INSERTAFTER(list, after, elt, link) \ - do { \ - ISC_LINK_INSIST(ISC_LINK_LINKED(after, link)); \ - ISC_LINK_INSIST(!ISC_LINK_LINKED(elt, link)); \ - __ISC_LIST_INSERTAFTERUNSAFE(list, after, elt, link); \ - } while (0) - -#define ISC_LIST_APPENDLIST(list1, list2, link) \ - do { \ - if (ISC_LIST_EMPTY(list1)) \ - (list1) = (list2); \ - else if (!ISC_LIST_EMPTY(list2)) { \ - (list1).tail->link.next = (list2).head; \ - (list2).head->link.prev = (list1).tail; \ - (list1).tail = (list2).tail; \ - } \ - (list2).head = NULL; \ - (list2).tail = NULL; \ - } while (0) - -#define ISC_LIST_ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link) -#define __ISC_LIST_ENQUEUEUNSAFE(list, elt, link) \ - __ISC_LIST_APPENDUNSAFE(list, elt, link) -#define ISC_LIST_DEQUEUE(list, elt, link) \ - ISC_LIST_UNLINK_TYPE(list, elt, link, void) -#define ISC_LIST_DEQUEUE_TYPE(list, elt, link, type) \ - ISC_LIST_UNLINK_TYPE(list, elt, link, type) -#define __ISC_LIST_DEQUEUEUNSAFE(list, elt, link) \ - __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, void) -#define __ISC_LIST_DEQUEUEUNSAFE_TYPE(list, elt, link, type) \ - __ISC_LIST_UNLINKUNSAFE_TYPE(list, elt, link, type) - -#endif /* ISC_LIST_H */ diff --git a/include/isc/magic.h b/include/isc/magic.h deleted file mode 100644 index ff3df24bdfc8..000000000000 --- a/include/isc/magic.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: magic.h,v 1.11 2001/01/09 21:57:10 bwelling Exp $ */ - -#ifndef ISC_MAGIC_H -#define ISC_MAGIC_H 1 - -typedef struct { - unsigned int magic; -} isc__magic_t; - - -/* - * To use this macro the magic number MUST be the first thing in the - * structure, and MUST be of type "unsigned int". - * - * The intent of this is to allow magic numbers to be checked even though - * the object is otherwise opaque. - */ -#define ISC_MAGIC_VALID(a,b) (((a) != NULL) && \ - (((const isc__magic_t *)(a))->magic == (b))) - -#define ISC_MAGIC(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d)) - -#endif /* ISC_MAGIC_H */ diff --git a/include/isc/mem.h b/include/isc/mem.h index f8e73d0e73d8..f5cf9ec57fff 100644 --- a/include/isc/mem.h +++ b/include/isc/mem.h @@ -1,31 +1,68 @@ /* + * libntp local override of isc/mem.h to stub it out. + * + * include/isc is searched before any of the lib/isc include + * directories and should be used only for replacement NTP headers + * overriding headers of the same name under lib/isc. + * + * NOTE: this assumes the system malloc is thread-safe and does + * not use any normal lib/isc locking. + */ + +/* + * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1997-2001 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mem.h,v 1.58 2001/09/07 00:51:51 marka Exp $ */ +/* $Id: mem.h,v 1.78.120.3 2009/02/11 03:07:01 jinmei Exp $ */ #ifndef ISC_MEM_H #define ISC_MEM_H 1 #include <stdio.h> + +#include <isc/lang.h> +#include <isc/mutex.h> +#include <isc/platform.h> #include <isc/types.h> +#include <isc/xml.h> + +#include <ntp_stdlib.h> + + +#define ISC_MEM_UNUSED_ARG(a) ((void)(a)) + +#define isc_mem_allocate(c, cnt) isc_mem_get(c, cnt) +#define isc_mem_get(c, cnt) \ + ( ISC_MEM_UNUSED_ARG(c), emalloc(cnt) ) + +#define isc_mem_reallocate(c, mem, cnt) \ + ( ISC_MEM_UNUSED_ARG(c), erealloc((mem), cnt) ) + +#define isc_mem_put(c, mem, cnt) \ + ( ISC_MEM_UNUSED_ARG(cnt), isc_mem_free(c, (mem)) ) + +#define isc_mem_free(c, mem) \ + ( ISC_MEM_UNUSED_ARG(c), free(mem) ) + +#define isc_mem_strdup(c, str) \ + ( ISC_MEM_UNUSED_ARG(c), estrdup(str) ) -void * -isc_mem_get(isc_mem_t *, size_t); -void -isc_mem_put(isc_mem_t *, void *, size_t); +#define isc_mem_attach(src, ptgt) do { *(ptgt) = (src); } while (0) +#define isc_mem_detach(c) ISC_MEM_UNUSED_ARG(c) +#define isc_mem_printallactive(s) fprintf((s), \ + "isc_mem_printallactive() stubbed.\n") #endif /* ISC_MEM_H */ diff --git a/include/isc/msgcat.h b/include/isc/msgcat.h deleted file mode 100644 index d2bf1e1622d9..000000000000 --- a/include/isc/msgcat.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: msgcat.h,v 1.8 2001/01/09 21:57:13 bwelling Exp $ */ - -#ifndef ISC_MSGCAT_H -#define ISC_MSGCAT_H 1 - -/***** - ***** Module Info - *****/ - -/* - * ISC Message Catalog - * - * Message catalogs aid internationalization of applications by allowing - * messages to be retrieved from locale-specific files instead of - * hardwiring them into the application. This allows translations of - * messages appropriate to the locale to be supplied without recompiling - * the application. - * - * Notes: - * It's very important that message catalogs work, even if only the - * default_text can be used. - * - * MP: - * The caller must ensure appropriate synchronization of - * isc_msgcat_open() and isc_msgcat_close(). isc_msgcat_get() - * ensures appropriate synchronization. - * - * Reliability: - * No anticipated impact. - * - * Resources: - * <TBS> - * - * Security: - * No anticipated impact. - * - * Standards: - * None. - */ - -/***** - ***** Imports - *****/ - -#include <isc/lang.h> -#include <isc/types.h> - -ISC_LANG_BEGINDECLS - -/***** - ***** Methods - *****/ - -void -isc_msgcat_open(const char *name, isc_msgcat_t **msgcatp); -/* - * Open a message catalog. - * - * Notes: - * - * If memory cannot be allocated or other failures occur, *msgcatp - * will be set to NULL. If a NULL msgcat is given to isc_msgcat_get(), - * the default_text will be returned, ensuring that some message text - * will be available, no matter what's going wrong. - * - * Requires: - * - * 'name' is a valid string. - * - * msgcatp != NULL && *msgcatp == NULL - */ - -void -isc_msgcat_close(isc_msgcat_t **msgcatp); -/* - * Close a message catalog. - * - * Notes: - * - * Any string pointers returned by prior calls to isc_msgcat_get() are - * invalid after isc_msgcat_close() has been called and must not be - * used. - * - * Requires: - * - * *msgcatp is a valid message catalog or is NULL. - * - * Ensures: - * - * All resources associated with the message catalog are released. - * - * *msgcatp == NULL - */ - -const char * -isc_msgcat_get(isc_msgcat_t *msgcat, int set, int message, - const char *default_text); -/* - * Get message 'message' from message set 'set' in 'msgcat'. If it - * is not available, use 'default_text'. - * - * Requires: - * - * 'msgcat' is a valid message catalog or is NULL. - * - * set > 0 - * - * message > 0 - * - * 'default_text' is a valid string. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_MSGCAT_H */ diff --git a/include/isc/msgs.h b/include/isc/msgs.h deleted file mode 100644 index 967005bf3531..000000000000 --- a/include/isc/msgs.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 2000-2003 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: msgs.h,v 1.5.2.2.8.3 2004/03/06 08:14:44 marka Exp $ */ - -#ifndef ISC_MSGS_H -#define ISC_MSGS_H 1 - -#include <isc/lib.h> /* Provide isc_msgcat global variable. */ -#include <isc/msgcat.h> /* Provide isc_msgcat_*() functions. */ - -/* - * Message sets, named per source file, excepting "GENERAL". - * IMPORTANT: The original list is alphabetical, but any new sets must - * be added to the end. - */ -#define ISC_MSGSET_GENERAL 1 -/* ISC_RESULT_RESULTSET 2 */ /* XXX */ -/* ISC_RESULT_UNAVAILABLESET 3 */ /* XXX */ -#define ISC_MSGSET_APP 4 -#define ISC_MSGSET_COMMANDLINE 5 -#define ISC_MSGSET_ENTROPY 6 -#define ISC_MSGSET_IFITERIOCTL 7 -#define ISC_MSGSET_IFITERSYSCTL 8 -#define ISC_MSGSET_LEX 9 -#define ISC_MSGSET_LOG 10 -#define ISC_MSGSET_MEM 11 -#define ISC_MSGSET_NETADDR 12 -#define ISC_MSGSET_PRINT 13 -#define ISC_MSGSET_RESULT 14 -#define ISC_MSGSET_RWLOCK 15 -#define ISC_MSGSET_SOCKADDR 16 -#define ISC_MSGSET_SOCKET 17 -#define ISC_MSGSET_TASK 18 -#define ISC_MSGSET_TIMER 19 -#define ISC_MSGSET_UTIL 20 -#define ISC_MSGSET_IFITERGETIFADDRS 21 - -/* - * Message numbers. They are only required to be unique per message set, - * but are unique throughout the entire catalog to not be as confusing when - * debugging. - * - * The initial numbering was done by multiply by 100 the set number the - * message appears in then adding the incremental message number. - */ -#define ISC_MSG_FAILED 101 /* "failed" */ -#define ISC_MSG_SUCCEEDED 102 /* Compatible with "failed" */ -#define ISC_MSG_SUCCESS 103 /* More usual way to say "success" */ -#define ISC_MSG_STARTING 104 /* As in "daemon: starting" */ -#define ISC_MSG_STOPING 105 /* As in "daemon: stopping" */ -#define ISC_MSG_ENTERING 106 /* As in "some_subr: entering" */ -#define ISC_MSG_EXITING 107 /* As in "some_subr: exiting" */ -#define ISC_MSG_CALLING 108 /* As in "calling some_subr()" */ -#define ISC_MSG_RETURNED 109 /* As in "some_subr: returned <foo>" */ -#define ISC_MSG_FATALERROR 110 /* "fatal error" */ -#define ISC_MSG_SHUTTINGDOWN 111 /* "shutting down" */ -#define ISC_MSG_RUNNING 112 /* "running" */ -#define ISC_MSG_WAIT 113 /* "wait" */ -#define ISC_MSG_WAITUNTIL 114 /* "waituntil" */ - -#define ISC_MSG_SIGNALSETUP 201 /* "handle_signal() %d setup: %s" */ - -#define ISC_MSG_ILLEGALOPT 301 /* "illegal option" */ -#define ISC_MSG_OPTNEEDARG 302 /* "option requires an argument" */ - -#define ISC_MSG_ENTROPYSTATS 401 /* "Entropy pool %p: refcnt %u ..." */ - -#define ISC_MSG_MAKESCANSOCKET 501 /* "making interface scan socket: %s" */ -#define ISC_MSG_GETIFCONFIG 502 /* "get interface configuration: %s" */ -#define ISC_MSG_BUFFERMAX 503 /* "... maximum buffer size exceeded" */ -#define ISC_MSG_GETDESTADDR 504 /* "%s: getting destination address: %s" */ -#define ISC_MSG_GETNETMASK 505 /* "%s: getting netmask: %s" */ - -#define ISC_MSG_GETIFLISTSIZE 601 /* "getting interface list size: ..." */ -#define ISC_MSG_GETIFLIST 602 /* "getting interface list: ..." */ -#define ISC_MSG_UNEXPECTEDTYPE 603 /* "... unexpected ... message type" */ - -#define ISC_MSG_UNEXPECTEDSTATE 701 /* "Unexpected state %d" */ - -#define ISC_MSG_BADTIME 801 /* "Bad 00 99:99:99.999 " */ -#define ISC_MSG_LEVEL 802 /* "level %d: " */ - -#define ISC_MSG_ADDTRACE 901 /* "add %p size %u " */ -#define ISC_MSG_DELTRACE 902 /* "del %p size %u " */ -#define ISC_MSG_POOLSTATS 903 /* "[Pool statistics]\n" */ -#define ISC_MSG_POOLNAME 904 /* "name" */ -#define ISC_MSG_POOLSIZE 905 /* "size" */ -#define ISC_MSG_POOLMAXALLOC 906 /* "maxalloc" */ -#define ISC_MSG_POOLALLOCATED 907 /* "allocated" */ -#define ISC_MSG_POOLFREECOUNT 908 /* "freecount" */ -#define ISC_MSG_POOLFREEMAX 909 /* "freemax" */ -#define ISC_MSG_POOLFILLCOUNT 910 /* "fillcount" */ -#define ISC_MSG_POOLGETS 911 /* "gets" */ -#define ISC_MSG_DUMPALLOC 912 /* "DUMP OF ALL OUTSTANDING MEMORY ..." */ -#define ISC_MSG_NONE 913 /* "\tNone.\n" */ -#define ISC_MSG_PTRFILELINE 914 /* "\tptr %p file %s line %u\n" */ - -#define ISC_MSG_UNKNOWNADDR 1001 /* "<unknown address, family %u>" */ - -#define ISC_MSG_NOLONGDBL 1104 /* "long doubles are not supported" */ - -#define ISC_MSG_PRINTLOCK 1201 /* "rwlock %p thread %lu ..." */ -#define ISC_MSG_READ 1202 /* "read" */ -#define ISC_MSG_WRITE 1203 /* "write" */ -#define ISC_MSG_READING 1204 /* "reading" */ -#define ISC_MSG_WRITING 1205 /* "writing" */ -#define ISC_MSG_PRELOCK 1206 /* "prelock" */ -#define ISC_MSG_POSTLOCK 1207 /* "postlock" */ -#define ISC_MSG_PREUNLOCK 1208 /* "preunlock" */ -#define ISC_MSG_POSTUNLOCK 1209 /* "postunlock" */ - -#define ISC_MSG_UNKNOWNFAMILY 1301 /* "unknown address family: %d" */ - -#define ISC_MSG_WRITEFAILED 1401 /* "write() failed during watcher ..." */ -#define ISC_MSG_READFAILED 1402 /* "read() failed during watcher ... " */ -#define ISC_MSG_PROCESSCMSG 1403 /* "processing cmsg %p" */ -#define ISC_MSG_IFRECEIVED 1404 /* "interface received on ifindex %u" */ -#define ISC_MSG_SENDTODATA 1405 /* "sendto pktinfo data, ifindex %u" */ -#define ISC_MSG_DOIORECV 1406 /* "doio_recv: recvmsg(%d) %d bytes ..." */ -#define ISC_MSG_PKTRECV 1407 /* "packet received correctly" */ -#define ISC_MSG_DESTROYING 1408 /* "destroying" */ -#define ISC_MSG_CREATED 1409 /* "created" */ -#define ISC_MSG_ACCEPTLOCK 1410 /* "internal_accept called, locked ..." */ -#define ISC_MSG_ACCEPTEDCXN 1411 /* "accepted connection, new socket %p" */ -#define ISC_MSG_INTERNALRECV 1412 /* "internal_recv: task %p got event %p" */ -#define ISC_MSG_INTERNALSEND 1413 /* "internal_send: task %p got event %p" */ -#define ISC_MSG_WATCHERMSG 1414 /* "watcher got message %d" */ -#define ISC_MSG_SOCKETSREMAIN 1415 /* "sockets exist" */ -#define ISC_MSG_PKTINFOPROVIDED 1416 /* "pktinfo structure provided, ..." */ -#define ISC_MSG_BOUND 1417 /* "bound" */ -#define ISC_MSG_ACCEPTRETURNED 1418 /* accept() returned %d/%s */ -#define ISC_MSG_TOOMANYFDS 1419 /* %s: too many open file descriptors */ -#define ISC_MSG_ZEROPORT 1420 /* dropping source port zero packet */ -#define ISC_MSG_FILTER 1420 /* setsockopt(SO_ACCEPTFILTER): %s */ - -#define ISC_MSG_AWAKE 1502 /* "awake" */ -#define ISC_MSG_WORKING 1503 /* "working" */ -#define ISC_MSG_EXECUTE 1504 /* "execute action" */ -#define ISC_MSG_EMPTY 1505 /* "empty" */ -#define ISC_MSG_DONE 1506 /* "done" */ -#define ISC_MSG_QUANTUM 1507 /* "quantum" */ - -#define ISC_MSG_SCHEDULE 1601 /* "schedule" */ -#define ISC_MSG_SIGNALSCHED 1602 /* "signal (schedule)" */ -#define ISC_MSG_SIGNALDESCHED 1603 /* "signal (deschedule)" */ -#define ISC_MSG_SIGNALDESTROY 1604 /* "signal (destroy)" */ -#define ISC_MSG_IDLERESCHED 1605 /* "idle reschedule" */ -#define ISC_MSG_EVENTNOTALLOC 1606 /* "couldn't allocate event" */ -#define ISC_MSG_SCHEDFAIL 1607 /* "couldn't schedule timer: %u" */ -#define ISC_MSG_POSTING 1608 /* "posting" */ -#define ISC_MSG_WAKEUP 1609 /* "wakeup" */ - -#define ISC_MSG_LOCK 1701 /* "LOCK" */ -#define ISC_MSG_LOCKING 1702 /* "LOCKING" */ -#define ISC_MSG_LOCKED 1703 /* "LOCKED" */ -#define ISC_MSG_UNLOCKED 1704 /* "UNLOCKED" */ -#define ISC_MSG_RWLOCK 1705 /* "RWLOCK" */ -#define ISC_MSG_RWLOCKED 1706 /* "RWLOCKED" */ -#define ISC_MSG_RWUNLOCK 1707 /* "RWUNLOCK" */ -#define ISC_MSG_BROADCAST 1708 /* "BROADCAST" */ -#define ISC_MSG_SIGNAL 1709 /* "SIGNAL" */ -#define ISC_MSG_UTILWAIT 1710 /* "WAIT" */ -#define ISC_MSG_WAITED 1711 /* "WAITED" */ - -#define ISC_MSG_GETIFADDRS 1801 /* "getting interface addresses: ..." */ - - -#endif /* ISC_MSGS_H */ diff --git a/include/isc/mutex.h b/include/isc/mutex.h deleted file mode 100644 index fd6f3ec5ea1a..000000000000 --- a/include/isc/mutex.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: mutex.h,v 1.3 2001/01/09 21:57:55 bwelling Exp $ */ - -#ifndef ISC_MUTEX_H -#define ISC_MUTEX_H 1 - -#include <isc/result.h> /* for ISC_R_ codes */ - -typedef int isc_mutex_t; - -#define isc_mutex_init(mp) \ - (*(mp) = 0, ISC_R_SUCCESS) -#define isc_mutex_lock(mp) \ - ((*(mp))++ == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED) -#define isc_mutex_unlock(mp) \ - (--(*(mp)) == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED) -#define isc_mutex_trylock(mp) \ - (*(mp) == 0 ? ((*(mp))++, ISC_R_SUCCESS) : ISC_R_LOCKBUSY) -#define isc_mutex_destroy(mp) \ - (*(mp) == 0 ? (*(mp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED) -#define isc_mutex_stats(fp) - -#endif /* ISC_MUTEX_H */ diff --git a/include/isc/net.h b/include/isc/net.h deleted file mode 100644 index dae59780b69b..000000000000 --- a/include/isc/net.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1999-2003 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: net.h,v 1.31.2.2.10.8 2004/04/29 01:31:23 marka Exp $ */ - -#ifndef ISC_NET_H -#define ISC_NET_H 1 - -/***** - ***** Module Info - *****/ - -/* - * Basic Networking Types - * - * This module is responsible for defining the following basic networking - * types: - * - * struct in_addr - * struct in6_addr - * struct in6_pktinfo - * struct sockaddr - * struct sockaddr_in - * struct sockaddr_in6 - * in_port_t - * - * It ensures that the AF_ and PF_ macros are defined. - * - * It declares ntoh[sl]() and hton[sl](). - * - * It declares inet_aton(), inet_ntop(), and inet_pton(). - * - * It ensures that INADDR_LOOPBACK, INADDR_ANY, IN6ADDR_ANY_INIT, - * in6addr_any, and in6addr_loopback are available. - * - * It ensures that IN_MULTICAST() is available to check for multicast - * addresses. - * - * MP: - * No impact. - * - * Reliability: - * No anticipated impact. - * - * Resources: - * N/A. - * - * Security: - * No anticipated impact. - * - * Standards: - * BSD Socket API - * RFC 2553 - */ - -/*** - *** Imports. - ***/ -#include <isc/platform.h> - -#include <sys/types.h> -#include <sys/socket.h> /* Contractual promise. */ - -#include <net/if.h> - -#include <netinet/in.h> /* Contractual promise. */ -#include <arpa/inet.h> /* Contractual promise. */ -#ifdef ISC_PLATFORM_NEEDNETINETIN6H -#include <netinet/in6.h> /* Required on UnixWare. */ -#endif -#ifdef ISC_PLATFORM_NEEDNETINET6IN6H -#include <netinet6/in6.h> /* Required on BSD/OS for in6_pktinfo. */ -#endif - -#ifndef ISC_PLATFORM_HAVEIPV6 -#include <isc/ipv6.h> /* Contractual promise. */ -#endif - -#include <isc/lang.h> -#include <isc/types.h> - -#ifdef ISC_PLATFORM_HAVEINADDR6 -#define in6_addr in_addr6 /* Required for pre RFC2133 implementations. */ -#endif - -#ifdef ISC_PLATFORM_HAVEIPV6 -/* - * Required for some pre RFC2133 implementations. - * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in - * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt. - * If 's6_addr' is defined then assume that there is a union and three - * levels otherwise assume two levels required. - */ -#ifndef IN6ADDR_ANY_INIT -#ifdef s6_addr -#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } -#else -#define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } -#endif -#endif - -#ifndef IN6ADDR_LOOPBACK_INIT -#ifdef s6_addr -#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } -#else -#define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } -#endif -#endif - -#ifndef IN6_IS_ADDR_V4MAPPED -#define IN6_IS_ADDR_V4MAPPED(x) \ - (memcmp((x)->s6_addr, in6addr_any.s6_addr, 10) == 0 && \ - (x)->s6_addr[10] == 0xff && (x)->s6_addr[11] == 0xff) -#endif - -#ifndef IN6_IS_ADDR_V4COMPAT -#define IN6_IS_ADDR_V4COMPAT(x) \ - (memcmp((x)->s6_addr, in6addr_any.s6_addr, 12) == 0 && \ - ((x)->s6_addr[12] != 0 || (x)->s6_addr[13] != 0 || \ - (x)->s6_addr[14] != 0 || \ - ((x)->s6_addr[15] != 0 && (x)->s6_addr[15] != 1))) -#endif - -#ifndef IN6_IS_ADDR_MULTICAST -#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) -#endif - -#ifndef IN6_IS_ADDR_LINKLOCAL -#define IN6_IS_ADDR_LINKLOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) -#endif - -#ifndef IN6_IS_ADDR_SITELOCAL -#define IN6_IS_ADDR_SITELOCAL(a) \ - (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) -#endif - - -#ifndef IN6_IS_ADDR_LOOPBACK -#define IN6_IS_ADDR_LOOPBACK(x) \ - (memcmp((x)->s6_addr, in6addr_loopback.s6_addr, 16) == 0) -#endif -#endif - -#ifndef AF_INET6 -#define AF_INET6 99 -#endif - -#ifndef PF_INET6 -#define PF_INET6 AF_INET6 -#endif - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK 0x7f000001UL -#endif - -#if 0 -#ifndef ISC_PLATFORM_HAVEIN6PKTINFO -struct in6_pktinfo { - struct in6_addr ipi6_addr; /* src/dst IPv6 address */ - unsigned int ipi6_ifindex; /* send/recv interface index */ -}; -#endif -#endif - -/* - * Cope with a missing in6addr_any and in6addr_loopback. - */ -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) -extern const struct in6_addr isc_net_in6addrany; -#define in6addr_any isc_net_in6addrany -#endif - -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK) -extern const struct in6_addr isc_net_in6addrloop; -#define in6addr_loopback isc_net_in6addrloop -#endif - -/* - * Fix UnixWare 7.1.1's broken IN6_IS_ADDR_* definitions. - */ -#ifdef ISC_PLATFORM_FIXIN6ISADDR -#undef IN6_IS_ADDR_GEOGRAPHIC -#define IN6_IS_ADDR_GEOGRAPHIC(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x80) -#undef IN6_IS_ADDR_IPX -#define IN6_IS_ADDR_IPX(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x04) -#undef IN6_IS_ADDR_LINKLOCAL -#define IN6_IS_ADDR_LINKLOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0x80FE) -#undef IN6_IS_ADDR_MULTICAST -#define IN6_IS_ADDR_MULTICAST(a) (((a)->S6_un.S6_l[0] & 0xFF) == 0xFF) -#undef IN6_IS_ADDR_NSAP -#define IN6_IS_ADDR_NSAP(a) (((a)->S6_un.S6_l[0] & 0xFE) == 0x02) -#undef IN6_IS_ADDR_PROVIDER -#define IN6_IS_ADDR_PROVIDER(a) (((a)->S6_un.S6_l[0] & 0xE0) == 0x40) -#undef IN6_IS_ADDR_SITELOCAL -#define IN6_IS_ADDR_SITELOCAL(a) (((a)->S6_un.S6_l[0] & 0xC0FF) == 0xC0FE) -#endif /* ISC_PLATFORM_FIXIN6ISADDR */ - -/* - * Ensure type in_port_t is defined. - */ -#ifdef ISC_PLATFORM_NEEDPORTT -typedef isc_uint16_t in_port_t; -#endif - -/* - * If this system does not have MSG_TRUNC (as returned from recvmsg()) - * ISC_PLATFORM_RECVOVERFLOW will be defined. This will enable the MSG_TRUNC - * faking code in socket.c. - */ -#ifndef MSG_TRUNC -#define ISC_PLATFORM_RECVOVERFLOW -#endif - -#define ISC__IPADDR(x) ((isc_uint32_t)htonl((isc_uint32_t)(x))) - -#define ISC_IPADDR_ISMULTICAST(i) \ - (((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \ - == ISC__IPADDR(0xe0000000)) - -#define ISC_IPADDR_ISEXPERIMENTAL(i) \ - (((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \ - == ISC__IPADDR(0xf0000000)) - -/*** - *** Functions. - ***/ - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_net_probeipv4(void); -/* - * Check if the system's kernel supports IPv4. - * - * Returns: - * - * ISC_R_SUCCESS IPv4 is supported. - * ISC_R_NOTFOUND IPv4 is not supported. - * ISC_R_DISABLED IPv4 is disabled. - * ISC_R_UNEXPECTED - */ - -isc_result_t -isc_net_probeipv6(void); -/* - * Check if the system's kernel supports IPv6. - * - * Returns: - * - * ISC_R_SUCCESS IPv6 is supported. - * ISC_R_NOTFOUND IPv6 is not supported. - * ISC_R_DISABLED IPv6 is disabled. - * ISC_R_UNEXPECTED - */ - -isc_result_t -isc_net_probe_ipv6only(void); -/* - * Check if the system's kernel supports the IPV6_V6ONLY socket option. - * - * Returns: - * - * ISC_R_SUCCESS the option is supported for both TCP and UDP. - * ISC_R_NOTFOUND IPv6 itself or the option is not supported. - * ISC_R_UNEXPECTED - */ - -isc_result_t -isc_net_probe_ipv6pktinfo(void); -/* - * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option - * for UDP sockets. - * - * Returns: - * - * ISC_R_SUCCESS the option is supported. - * ISC_R_NOTFOUND IPv6 itself or the option is not supported. - * ISC_R_UNEXPECTED - */ - -void -isc_net_disableipv4(void); - -void -isc_net_disableipv6(void); - -void -isc_net_enableipv4(void); - -void -isc_net_enableipv6(void); - -#ifdef ISC_PLATFORM_NEEDNTOP -const char * -isc_net_ntop(int af, const void *src, char *dst, size_t size); -#define inet_ntop isc_net_ntop -#endif - -#ifdef ISC_PLATFORM_NEEDPTON -int -isc_net_pton(int af, const char *src, void *dst); -#undef inet_pton -#define inet_pton isc_net_pton -#endif - -#ifdef ISC_PLATFORM_NEEDATON -int -isc_net_aton(const char *cp, struct in_addr *addr); -#define inet_aton isc_net_aton -#endif - -ISC_LANG_ENDDECLS - -#endif /* ISC_NET_H */ diff --git a/include/isc/netaddr.h b/include/isc/netaddr.h deleted file mode 100644 index e209a9fa7749..000000000000 --- a/include/isc/netaddr.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1998-2002 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: netaddr.h,v 1.18.12.7 2004/03/08 09:04:52 marka Exp $ */ - -#ifndef ISC_NETADDR_H -#define ISC_NETADDR_H 1 - -#include <isc/lang.h> -#include <isc/net.h> -#include <isc/types.h> - -ISC_LANG_BEGINDECLS - -struct isc_netaddr { - unsigned int family; - union { - struct in_addr in; - struct in6_addr in6; - } type; - isc_uint32_t zone; -}; - -isc_boolean_t -isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b); - -isc_boolean_t -isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, - unsigned int prefixlen); -/* - * Compare the 'prefixlen' most significant bits of the network - * addresses 'a' and 'b'. Return ISC_TRUE if they are equal, - * ISC_FALSE if not. - */ - -isc_result_t -isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp); -/* - * Convert a netmask in 's' into a prefix length in '*lenp'. - * The mask should consist of zero or more '1' bits in the most - * most significant part of the address, followed by '0' bits. - * If this is not the case, ISC_R_MASKNONCONTIG is returned. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_MASKNONCONTIG - */ - -isc_result_t -isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target); -/* - * Append a text representation of 'sockaddr' to the buffer 'target'. - * The text is NOT null terminated. Handles IPv4 and IPv6 addresses. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_NOSPACE The text or the null termination did not fit. - * ISC_R_FAILURE Unspecified failure - */ - -void -isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size); -/* - * Format a human-readable representation of the network address '*na' - * into the character array 'array', which is of size 'size'. - * The resulting string is guaranteed to be null-terminated. - */ - -#define ISC_NETADDR_FORMATSIZE \ - sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX") -/* - * Minimum size of array to pass to isc_netaddr_format(). - */ - -void -isc_netaddr_fromsockaddr(isc_netaddr_t *netaddr, const isc_sockaddr_t *source); - -void -isc_netaddr_fromin(isc_netaddr_t *netaddr, const struct in_addr *ina); - -void -isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6); - -void -isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone); - -isc_uint32_t -isc_netaddr_getzone(const isc_netaddr_t *netaddr); - -void -isc_netaddr_any(isc_netaddr_t *netaddr); -/* - * Return the IPv4 wildcard address. - */ - -void -isc_netaddr_any6(isc_netaddr_t *netaddr); -/* - * Return the IPv6 wildcard address. - */ - -isc_boolean_t -isc_netaddr_ismulticast(isc_netaddr_t *na); -/* - * Returns ISC_TRUE if the address is a multicast address. - */ - -isc_boolean_t -isc_netaddr_isexperimental(isc_netaddr_t *na); -/* - * Returns ISC_TRUE if the address is a experimental (CLASS E) address. - */ - -isc_boolean_t -isc_netaddr_islinklocal(isc_netaddr_t *na); -/* - * Returns ISC_TRUE if the address is a link local address. - */ - -isc_boolean_t -isc_netaddr_issitelocal(isc_netaddr_t *na); -/* - * Returns ISC_TRUE if the address is a site local address. - */ - -void -isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s); -/* - * Convert an IPv6 v4mapped address into an IPv4 address. - */ - - -ISC_LANG_ENDDECLS - -#endif /* ISC_NETADDR_H */ diff --git a/include/isc/netscope.h b/include/isc/netscope.h deleted file mode 100644 index 7cc0f182d742..000000000000 --- a/include/isc/netscope.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 2002 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: netscope.h,v 1.4.142.5 2004/03/08 09:04:52 marka Exp $ */ - -#ifndef ISC_NETSCOPE_H -#define ISC_NETSCOPE_H 1 - -ISC_LANG_BEGINDECLS - -/* - * Convert a string of an IPv6 scope zone to zone index. If the conversion - * succeeds, 'zoneid' will store the index value. - * XXXJT: when a standard interface for this purpose is defined, - * we should use it. - * - * Returns: - * ISC_R_SUCCESS: conversion succeeds - * ISC_R_FAILURE: conversion fails - */ -isc_result_t -isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid); - -ISC_LANG_ENDDECLS - -#endif /* ISC_NETADDR_H */ diff --git a/include/isc/offset.h b/include/isc/offset.h deleted file mode 100644 index 709bde4e07be..000000000000 --- a/include/isc/offset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: offset.h,v 1.10 2001/01/09 21:58:43 bwelling Exp $ */ - -#ifndef ISC_OFFSET_H -#define ISC_OFFSET_H 1 - -/* - * File offsets are operating-system dependent. - */ -#include <limits.h> /* Required for CHAR_BIT. */ -#include <sys/types.h> - -typedef off_t isc_offset_t; - -/* - * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral - * types", so the maximum value is all 1s except for the high bit. - * This definition is more complex than it really needs to be because it was - * crafted to keep both the SunOS 5.6 and the HP/UX 11 compilers quiet about - * integer overflow. For example, though this is equivalent to just left - * shifting 1 to the high bit and then inverting the bits, the SunOS compiler - * is unhappy about shifting a positive "1" to negative in a signed integer. - */ -#define ISC_OFFSET_MAXIMUM \ - (~(((off_t)-1 >> (sizeof(off_t) * CHAR_BIT - 1)) \ - << (sizeof(off_t) * CHAR_BIT - 1))) - -#endif /* ISC_OFFSET_H */ diff --git a/include/isc/once.h b/include/isc/once.h deleted file mode 100644 index f57d6215fe3e..000000000000 --- a/include/isc/once.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: once.h,v 1.3 2001/01/09 21:57:56 bwelling Exp $ */ - -#ifndef ISC_ONCE_H -#define ISC_ONCE_H 1 - -#include <isc/result.h> - -typedef isc_boolean_t isc_once_t; - -#define ISC_ONCE_INIT ISC_FALSE - -#define isc_once_do(op, f) \ - (!*(op) ? (f(), *(op) = ISC_TRUE, ISC_R_SUCCESS) : ISC_R_SUCCESS) - -#endif /* ISC_ONCE_H */ diff --git a/include/isc/platform.h b/include/isc/platform.h deleted file mode 100644 index bd11a25503a5..000000000000 --- a/include/isc/platform.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: platform.h.in,v 1.28 2001/11/19 03:08:26 mayer Exp $ */ - -#ifndef ISC_PLATFORM_H -#define ISC_PLATFORM_H 1 - - -#ifndef ISC_PLATFORM_USEDECLSPEC -#define LIBISC_EXTERNAL_DATA -#define LIBDNS_EXTERNAL_DATA -#define LIBISCCC_EXTERNAL_DATA -#define LIBISCCFG_EXTERNAL_DATA -#define LIBBIND9_EXTERNAL_DATA -#endif /* ISC_PLATFORM_USEDECLSPEC */ - -/* - * Tell emacs to use C mode for this file. - * - * Local Variables: - * mode: c - * End: - */ - -#endif /* ISC_PLATFORM_H */ diff --git a/include/isc/print.h b/include/isc/print.h deleted file mode 100644 index 7a1bc83b6741..000000000000 --- a/include/isc/print.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: print.h,v 1.17 2001/02/27 02:19:33 gson Exp $ */ - -#ifndef ISC_PRINT_H -#define ISC_PRINT_H 1 - -/*** - *** Imports - ***/ - -#include <isc/formatcheck.h> /* Required for ISC_FORMAT_PRINTF() macro. */ -#include <isc/lang.h> -#include <isc/platform.h> - -/* - * This block allows lib/isc/print.c to be cleanly compiled even if - * the platform does not need it. The standard Makefile will still - * not compile print.c or archive print.o, so this is just to make test - * compilation ("make print.o") easier. - */ -#if !defined(ISC_PLATFORM_NEEDVSNPRINTF) && defined(ISC__PRINT_SOURCE) -#define ISC_PLATFORM_NEEDVSNPRINTF -#endif - -/*** - *** Macros - ***/ -#define ISC_PRINT_QUADFORMAT ISC_PLATFORM_QUADFORMAT - -/*** - *** Functions - ***/ - -#ifdef ISC_PLATFORM_NEEDVSNPRINTF -#include <stdarg.h> -#include <stddef.h> - -ISC_LANG_BEGINDECLS - -int -isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap) - ISC_FORMAT_PRINTF(3, 0); -#define vsnprintf isc_print_vsnprintf - -int -isc_print_snprintf(char *str, size_t size, const char *format, ...) - ISC_FORMAT_PRINTF(3, 4); -#define snprintf isc_print_snprintf - -ISC_LANG_ENDDECLS -#endif /* ISC_PLATFORM_NEEDVSNPRINTF */ - -#endif /* ISC_PRINT_H */ diff --git a/include/isc/region.h b/include/isc/region.h deleted file mode 100644 index 5622394aaf43..000000000000 --- a/include/isc/region.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1998-2002 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: region.h,v 1.16.12.3 2004/03/08 09:04:53 marka Exp $ */ - -#ifndef ISC_REGION_H -#define ISC_REGION_H 1 - -#include <isc/types.h> - -struct isc_region { - unsigned char * base; - unsigned int length; -}; - -struct isc_textregion { - char * base; - unsigned int length; -}; - -/* XXXDCL questionable ... bears discussion. we have been putting off - * discussing the region api. - */ -struct isc_constregion { - const void * base; - unsigned int length; -}; - -struct isc_consttextregion { - const char * base; - unsigned int length; -}; - -/* - * The region structure is not opaque, and is usually directly manipulated. - * Some macros are defined below for convenience. - */ - -#define isc_region_consume(r,l) \ - do { \ - isc_region_t *_r = (r); \ - unsigned int _l = (l); \ - INSIST(_r->length >= _l); \ - _r->base += _l; \ - _r->length -= _l; \ - } while (0) - -#define isc_textregion_consume(r,l) \ - do { \ - isc_textregion_t *_r = (r); \ - unsigned int _l = (l); \ - INSIST(_r->length >= _l); \ - _r->base += _l; \ - _r->length -= _l; \ - } while (0) - -#define isc_constregion_consume(r,l) \ - do { \ - isc_constregion_t *_r = (r); \ - unsigned int _l = (l); \ - INSIST(_r->length >= _l); \ - _r->base += _l; \ - _r->length -= _l; \ - } while (0) - -int -isc_region_compare(isc_region_t *r1, isc_region_t *r2); -/* - * Compares the contents of two regions - * - * Requires: - * 'r1' is a valid region - * 'r2' is a valid region - * - * Returns: - * < 0 if r1 is lexicographically less than r2 - * = 0 if r1 is lexicographically identical to r2 - * > 0 if r1 is lexicographically greater than r2 - */ - -#endif /* ISC_REGION_H */ diff --git a/include/isc/result.h b/include/isc/result.h deleted file mode 100644 index 93f7cefbd658..000000000000 --- a/include/isc/result.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1998-2001, 2003 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: result.h,v 1.57.2.2.8.5 2004/05/15 03:46:13 jinmei Exp $ */ - -#ifndef ISC_RESULT_H -#define ISC_RESULT_H 1 - -#include <isc/lang.h> -#include <isc/types.h> - -#define ISC_R_SUCCESS 0 /* success */ -#define ISC_R_NOMEMORY 1 /* out of memory */ -#define ISC_R_TIMEDOUT 2 /* timed out */ -#define ISC_R_NOTHREADS 3 /* no available threads */ -#define ISC_R_ADDRNOTAVAIL 4 /* address not available */ -#define ISC_R_ADDRINUSE 5 /* address in use */ -#define ISC_R_NOPERM 6 /* permission denied */ -#define ISC_R_NOCONN 7 /* no pending connections */ -#define ISC_R_NETUNREACH 8 /* network unreachable */ -#define ISC_R_HOSTUNREACH 9 /* host unreachable */ -#define ISC_R_NETDOWN 10 /* network down */ -#define ISC_R_HOSTDOWN 11 /* host down */ -#define ISC_R_CONNREFUSED 12 /* connection refused */ -#define ISC_R_NORESOURCES 13 /* not enough free resources */ -#define ISC_R_EOF 14 /* end of file */ -#define ISC_R_BOUND 15 /* socket already bound */ -#define ISC_R_RELOAD 16 /* reload */ -#define ISC_R_LOCKBUSY 17 /* lock busy */ -#define ISC_R_EXISTS 18 /* already exists */ -#define ISC_R_NOSPACE 19 /* ran out of space */ -#define ISC_R_CANCELED 20 /* operation canceled */ -#define ISC_R_NOTBOUND 21 /* socket is not bound */ -#define ISC_R_SHUTTINGDOWN 22 /* shutting down */ -#define ISC_R_NOTFOUND 23 /* not found */ -#define ISC_R_UNEXPECTEDEND 24 /* unexpected end of input */ -#define ISC_R_FAILURE 25 /* generic failure */ -#define ISC_R_IOERROR 26 /* I/O error */ -#define ISC_R_NOTIMPLEMENTED 27 /* not implemented */ -#define ISC_R_UNBALANCED 28 /* unbalanced parentheses */ -#define ISC_R_NOMORE 29 /* no more */ -#define ISC_R_INVALIDFILE 30 /* invalid file */ -#define ISC_R_BADBASE64 31 /* bad base64 encoding */ -#define ISC_R_UNEXPECTEDTOKEN 32 /* unexpected token */ -#define ISC_R_QUOTA 33 /* quota reached */ -#define ISC_R_UNEXPECTED 34 /* unexpected error */ -#define ISC_R_ALREADYRUNNING 35 /* already running */ -#define ISC_R_IGNORE 36 /* ignore */ -#define ISC_R_MASKNONCONTIG 37 /* addr mask not contiguous */ -#define ISC_R_FILENOTFOUND 38 /* file not found */ -#define ISC_R_FILEEXISTS 39 /* file already exists */ -#define ISC_R_NOTCONNECTED 40 /* socket is not connected */ -#define ISC_R_RANGE 41 /* out of range */ -#define ISC_R_NOENTROPY 42 /* out of entropy */ -#define ISC_R_MULTICAST 43 /* invalid use of multicast */ -#define ISC_R_NOTFILE 44 /* not a file */ -#define ISC_R_NOTDIRECTORY 45 /* not a directory */ -#define ISC_R_QUEUEFULL 46 /* queue is full */ -#define ISC_R_FAMILYMISMATCH 47 /* address family mismatch */ -#define ISC_R_FAMILYNOSUPPORT 48 /* AF not supported */ -#define ISC_R_BADHEX 49 /* bad hex encoding */ -#define ISC_R_TOOMANYOPENFILES 50 /* too many open files */ -#define ISC_R_NOTBLOCKING 51 /* not blocking */ -#define ISC_R_UNBALANCEDQUOTES 52 /* unbalanced quotes */ -#define ISC_R_INPROGRESS 53 /* operation in progress */ -#define ISC_R_CONNECTIONRESET 54 /* connection reset */ -#define ISC_R_SOFTQUOTA 55 /* soft quota reached */ -#define ISC_R_BADNUMBER 56 /* not a valid number */ -#define ISC_R_DISABLED 57 /* disabled */ -#define ISC_R_MAXSIZE 58 /* max size */ -#define ISC_R_BADADDRESSFORM 59 /* invalid address format */ - -/* - * Not a result code: the number of results. - */ -#define ISC_R_NRESULTS 60 - -ISC_LANG_BEGINDECLS - -const char * -isc_result_totext(isc_result_t); -/* - * Convert an isc_result_t into a string message describing the result. - */ - -isc_result_t -isc_result_register(unsigned int base, unsigned int nresults, - const char **text, isc_msgcat_t *msgcat, int set); - -ISC_LANG_ENDDECLS - -#endif /* ISC_RESULT_H */ diff --git a/include/isc/sockaddr.h b/include/isc/sockaddr.h deleted file mode 100644 index 635af38117bf..000000000000 --- a/include/isc/sockaddr.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 1998-2002 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: sockaddr.h,v 1.39 2002/04/03 06:38:36 marka Exp $ */ - -#ifndef ISC_SOCKADDR_H -#define ISC_SOCKADDR_H 1 - -#include <isc/lang.h> -#include <isc/net.h> -#include <isc/types.h> - -struct isc_sockaddr { - union { - struct sockaddr sa; - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - } type; - unsigned int length; /* XXXRTH beginning? */ - ISC_LINK(struct isc_sockaddr) link; -}; - -typedef ISC_LIST(struct isc_sockaddr) isc_sockaddrlist_t; - -ISC_LANG_BEGINDECLS - -isc_boolean_t -isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b); -/* - * Return ISC_TRUE iff the socket addresses 'a' and 'b' are equal. - */ - -isc_boolean_t -isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b); -/* - * Return ISC_TRUE iff the address parts of the socket addresses - * 'a' and 'b' are equal, ignoring the ports. - */ - -isc_boolean_t -isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b, - unsigned int prefixlen); -/* - * Return ISC_TRUE iff the most significant 'prefixlen' bits of the - * socket addresses 'a' and 'b' are equal, ignoring the ports. - */ - -unsigned int -isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only); -/* - * Return a hash value for the socket address 'sockaddr'. If 'address_only' - * is ISC_TRUE, the hash value will not depend on the port. - * - * IPv6 addresses containing mapped IPv4 addresses generate the same hash - * value as the equivalent IPv4 address. - */ - -void -isc_sockaddr_any(isc_sockaddr_t *sockaddr); -/* - * Return the IPv4 wildcard address. - */ - -void -isc_sockaddr_any6(isc_sockaddr_t *sockaddr); -/* - * Return the IPv6 wildcard address. - */ - -void -isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int family); -/* - * Set '*sockaddr' to the wildcard address of protocol family - * 'family'. - * - * Requires: - * 'family' is AF_INET or AF_INET6. - */ - -void -isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, - in_port_t port); -/* - * Construct an isc_sockaddr_t from an IPv4 address and port. - */ - -void -isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6, - in_port_t port); -/* - * Construct an isc_sockaddr_t from an IPv6 address and port. - */ - -void -isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina, - in_port_t port); -/* - * Construct an IPv6 isc_sockaddr_t representing a mapped IPv4 address. - */ - -void -isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, - in_port_t port); -/* - * Construct an isc_sockaddr_t from an isc_netaddr_t and port. - */ - -int -isc_sockaddr_pf(const isc_sockaddr_t *sockaddr); -/* - * Get the protocol family of 'sockaddr'. - * - * Requires: - * - * 'sockaddr' is a valid sockaddr with an address family of AF_INET - * or AF_INET6. - * - * Returns: - * - * The protocol family of 'sockaddr', e.g. PF_INET or PF_INET6. - */ - -void -isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port); -/* - * Set the port of 'sockaddr' to 'port'. - */ - -in_port_t -isc_sockaddr_getport(isc_sockaddr_t *sockaddr); -/* - * Get the port stored in 'sockaddr'. - */ - -isc_result_t -isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target); -/* - * Append a text representation of 'sockaddr' to the buffer 'target'. - * The text will include both the IP address (v4 or v6) and the port. - * The text is null terminated, but the terminating null is not - * part of the buffer's used region. - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_NOSPACE The text or the null termination did not fit. - */ - -void -isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size); -/* - * Format a human-readable representation of the socket address '*sa' - * into the character array 'array', which is of size 'size'. - * The resulting string is guaranteed to be null-terminated. - */ - -isc_boolean_t -isc_sockaddr_ismulticast(isc_sockaddr_t *sa); -/* - * Returns ISC_TRUE if the address is a multicast address. - */ - -isc_boolean_t -isc_sockaddr_isexperimental(isc_sockaddr_t *sa); -/* - * Returns ISC_TRUE if the address is a experimental (CLASS E) address. - */ - -isc_boolean_t -isc_sockaddr_islinklocal(isc_sockaddr_t *sa); -/* - * Returns ISC_TRUE if the address is a link local addresss. - */ - -isc_boolean_t -isc_sockaddr_issitelocal(isc_sockaddr_t *sa); -/* - * Returns ISC_TRUE if the address is a sitelocal address. - */ - -#define ISC_SOCKADDR_FORMATSIZE \ - sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX#YYYYY") -/* - * Minimum size of array to pass to isc_sockaddr_format(). - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_SOCKADDR_H */ diff --git a/include/isc/strerror.h b/include/isc/strerror.h deleted file mode 100644 index ca428af9553f..000000000000 --- a/include/isc/strerror.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: strerror.h,v 1.3 2001/11/20 01:45:47 gson Exp $ */ - -#ifndef ISC_STRERROR_H -#define ISC_STRERROR_H - -#include <sys/types.h> - -#include <isc/lang.h> - -ISC_LANG_BEGINDECLS - -#define ISC_STRERRORSIZE 128 - -/* - * Provide a thread safe wrapper to strerrror(). - * - * Requires: - * 'buf' to be non NULL. - */ -void -isc__strerror(int num, char *buf, size_t bufsize); - -ISC_LANG_ENDDECLS - -#endif /* ISC_STRERROR_H */ diff --git a/include/isc/string.h b/include/isc/string.h deleted file mode 100644 index e16219fdaad0..000000000000 --- a/include/isc/string.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: string.h,v 1.9 2001/01/09 21:57:37 bwelling Exp $ */ - -#ifndef ISC_STRING_H -#define ISC_STRING_H 1 - -#include <string.h> - -#include <isc/int.h> -#include <isc/lang.h> -#include <isc/platform.h> - -ISC_LANG_BEGINDECLS - -isc_uint64_t -isc_string_touint64(char *source, char **endp, int base); -/* - * Convert the string pointed to by 'source' to isc_uint64_t. - * - * On successful conversion 'endp' points to the first character - * after conversion is complete. - * - * 'base': 0 or 2..36 - * - * If base is 0 the base is computed from the string type. - * - * On error 'endp' points to 'source'. - */ - - -char * -isc_string_separate(char **stringp, const char *delim); - -#ifdef ISC_PLATFORM_NEEDSTRSEP -#define strsep isc_string_separate -#endif - -ISC_LANG_ENDDECLS - -#endif /* ISC_STRING_H */ diff --git a/include/isc/types.h b/include/isc/types.h deleted file mode 100644 index b30f55ee7fe9..000000000000 --- a/include/isc/types.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: types.h,v 1.33 2002/07/19 03:39:44 marka Exp $ */ - -#ifndef ISC_TYPES_H -#define ISC_TYPES_H 1 - -/* - * OS-specific types, from the OS-specific include directories. - */ -#include <isc/int.h> -#include <isc/offset.h> - -/* - * XXXDCL should isc_boolean_t be moved here, requiring an explicit include - * of <isc/boolean.h> when ISC_TRUE/ISC_FALSE/ISC_TF() are desired? - */ -#include <isc/boolean.h> -/* - * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other - * list macros too. - */ -#include <isc/list.h> - -/*** - *** Core Types. Alphabetized by defined type. - ***/ - -typedef struct isc_bitstring isc_bitstring_t; -typedef struct isc_buffer isc_buffer_t; -typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; -typedef struct isc_constregion isc_constregion_t; -typedef struct isc_consttextregion isc_consttextregion_t; -typedef struct isc_entropy isc_entropy_t; -typedef struct isc_entropysource isc_entropysource_t; -typedef struct isc_event isc_event_t; -typedef ISC_LIST(isc_event_t) isc_eventlist_t; -typedef unsigned int isc_eventtype_t; -typedef isc_uint32_t isc_fsaccess_t; -typedef struct isc_interface isc_interface_t; -typedef struct isc_interfaceiter isc_interfaceiter_t; -typedef struct isc_interval isc_interval_t; -typedef struct isc_lex isc_lex_t; -typedef struct isc_log isc_log_t; -typedef struct isc_logcategory isc_logcategory_t; -typedef struct isc_logconfig isc_logconfig_t; -typedef struct isc_logmodule isc_logmodule_t; -typedef struct isc_mem isc_mem_t; -typedef struct isc_mempool isc_mempool_t; -typedef struct isc_msgcat isc_msgcat_t; -typedef struct isc_ondestroy isc_ondestroy_t; -typedef struct isc_netaddr isc_netaddr_t; -typedef struct isc_quota isc_quota_t; -typedef struct isc_random isc_random_t; -typedef struct isc_ratelimiter isc_ratelimiter_t; -typedef struct isc_region isc_region_t; -typedef isc_uint64_t isc_resourcevalue_t; -typedef unsigned int isc_result_t; -typedef struct isc_rwlock isc_rwlock_t; -typedef struct isc_sockaddr isc_sockaddr_t; -typedef struct isc_socket isc_socket_t; -typedef struct isc_socketevent isc_socketevent_t; -typedef struct isc_socketmgr isc_socketmgr_t; -typedef struct isc_symtab isc_symtab_t; -typedef struct isc_task isc_task_t; -typedef ISC_LIST(isc_task_t) isc_tasklist_t; -typedef struct isc_taskmgr isc_taskmgr_t; -typedef struct isc_textregion isc_textregion_t; -typedef struct isc_time isc_time_t; -typedef struct isc_timer isc_timer_t; -typedef struct isc_timermgr isc_timermgr_t; - -typedef void (*isc_taskaction_t)(isc_task_t *, isc_event_t *); - -typedef enum { - isc_resource_coresize = 1, - isc_resource_cputime, - isc_resource_datasize, - isc_resource_filesize, - isc_resource_lockedmemory, - isc_resource_openfiles, - isc_resource_processes, - isc_resource_residentsize, - isc_resource_stacksize -} isc_resource_t; - -#endif /* ISC_TYPES_H */ diff --git a/include/isc/util.h b/include/isc/util.h deleted file mode 100644 index 6144e11ba863..000000000000 --- a/include/isc/util.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (C) 1998-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: util.h,v 1.23 2001/11/30 01:59:38 gson Exp $ */ - -#ifndef ISC_UTIL_H -#define ISC_UTIL_H 1 - -/* - * NOTE: - * - * This file is not to be included from any <isc/???.h> (or other) library - * files. - * - * Including this file puts several macros in your name space that are - * not protected (as all the other ISC functions/macros do) by prepending - * ISC_ or isc_ to the name. - */ - -/*** - *** General Macros. - ***/ - -/* - * Use this to hide unused function arguments. - * - * int - * foo(char *bar) - * { - * UNUSED(bar); - * } - */ -#define UNUSED(x) (void)(x) - -#define ISC_MAX(a, b) ((a) > (b) ? (a) : (b)) -#define ISC_MIN(a, b) ((a) < (b) ? (a) : (b)) - -/* - * Use this to remove the const qualifier of a variable to assign it to - * a non-const variable or pass it as a non-const function argument ... - * but only when you are sure it won't then be changed! - * This is necessary to sometimes shut up some compilers - * (as with gcc -Wcast-qual) when there is just no other good way to avoid the - * situation. - */ -#define DE_CONST(konst, var) \ - do { \ - union { const void *k; void *v; } _u; \ - _u.k = konst; \ - var = _u.v; \ - } while (0) - -/* - * Use this in translation units that would otherwise be empty, to - * suppress compiler warnings. - */ -#define EMPTY_TRANSLATION_UNIT static void isc__empty(void) { isc__empty(); } - -/* - * We use macros instead of calling the routines directly because - * the capital letters make the locking stand out. - * - * We RUNTIME_CHECK for success since in general there's no way - * for us to continue if they fail. - */ - -#ifdef ISC_UTIL_TRACEON -#define ISC_UTIL_TRACE(a) a -#include <stdio.h> /* Required for fprintf/stderr when tracing. */ -#include <isc/msgs.h> /* Required for isc_msgcat when tracing. */ -#else -#define ISC_UTIL_TRACE(a) -#endif - -#include <isc/result.h> /* Contractual promise. */ - -#define LOCK(lp) do { \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_LOCKING, "LOCKING"), \ - (lp), __FILE__, __LINE__)); \ - RUNTIME_CHECK(isc_mutex_lock((lp)) == ISC_R_SUCCESS); \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_LOCKED, "LOCKED"), \ - (lp), __FILE__, __LINE__)); \ - } while (0) -#define UNLOCK(lp) do { \ - RUNTIME_CHECK(isc_mutex_unlock((lp)) == ISC_R_SUCCESS); \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_UNLOCKED, "UNLOCKED"), \ - (lp), __FILE__, __LINE__)); \ - } while (0) -#define ISLOCKED(lp) (1) -#define DESTROYLOCK(lp) \ - RUNTIME_CHECK(isc_mutex_destroy((lp)) == ISC_R_SUCCESS) - - -#define BROADCAST(cvp) do { \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_BROADCAST, "BROADCAST"),\ - (cvp), __FILE__, __LINE__)); \ - RUNTIME_CHECK(isc_condition_broadcast((cvp)) == ISC_R_SUCCESS); \ - } while (0) -#define SIGNAL(cvp) do { \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_SIGNAL, "SIGNAL"), \ - (cvp), __FILE__, __LINE__)); \ - RUNTIME_CHECK(isc_condition_signal((cvp)) == ISC_R_SUCCESS); \ - } while (0) -#define WAIT(cvp, lp) do { \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_UTILWAIT, "WAIT"), \ - (cvp), \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_LOCK, "LOCK"), \ - (lp), __FILE__, __LINE__)); \ - RUNTIME_CHECK(isc_condition_wait((cvp), (lp)) == ISC_R_SUCCESS); \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p %s %p %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_WAITED, "WAITED"), \ - (cvp), \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_LOCKED, "LOCKED"), \ - (lp), __FILE__, __LINE__)); \ - } while (0) - -/* - * isc_condition_waituntil can return ISC_R_TIMEDOUT, so we - * don't RUNTIME_CHECK the result. - * - * XXX Also, can't really debug this then... - */ - -#define WAITUNTIL(cvp, lp, tp) \ - isc_condition_waituntil((cvp), (lp), (tp)) - -#define RWLOCK(lp, t) do { \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_RWLOCK, "RWLOCK"), \ - (lp), (t), __FILE__, __LINE__)); \ - RUNTIME_CHECK(isc_rwlock_lock((lp), (t)) == ISC_R_SUCCESS); \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_RWLOCKED, "RWLOCKED"), \ - (lp), (t), __FILE__, __LINE__)); \ - } while (0) -#define RWUNLOCK(lp, t) do { \ - ISC_UTIL_TRACE(fprintf(stderr, "%s %p, %d %s %d\n", \ - isc_msgcat_get(isc_msgcat, ISC_MSGSET_UTIL, \ - ISC_MSG_RWUNLOCK, "RWUNLOCK"), \ - (lp), (t), __FILE__, __LINE__)); \ - RUNTIME_CHECK(isc_rwlock_unlock((lp), (t)) == ISC_R_SUCCESS); \ - } while (0) - -#define DESTROYMUTEXBLOCK(bp, n) \ - RUNTIME_CHECK(isc_mutexblock_destroy((bp), (n)) == ISC_R_SUCCESS) - -/* - * List Macros. - */ -#include <isc/list.h> /* Contractual promise. */ - -#define LIST(type) ISC_LIST(type) -#define INIT_LIST(type) ISC_LIST_INIT(type) -#define LINK(type) ISC_LINK(type) -#define INIT_LINK(elt, link) ISC_LINK_INIT(elt, link) -#define HEAD(list) ISC_LIST_HEAD(list) -#define TAIL(list) ISC_LIST_TAIL(list) -#define EMPTY(list) ISC_LIST_EMPTY(list) -#define PREV(elt, link) ISC_LIST_PREV(elt, link) -#define NEXT(elt, link) ISC_LIST_NEXT(elt, link) -#define APPEND(list, elt, link) ISC_LIST_APPEND(list, elt, link) -#define PREPEND(list, elt, link) ISC_LIST_PREPEND(list, elt, link) -#define UNLINK(list, elt, link) ISC_LIST_UNLINK(list, elt, link) -#define ENQUEUE(list, elt, link) ISC_LIST_APPEND(list, elt, link) -#define DEQUEUE(list, elt, link) ISC_LIST_UNLINK(list, elt, link) -#define INSERTBEFORE(li, b, e, ln) ISC_LIST_INSERTBEFORE(li, b, e, ln) -#define INSERTAFTER(li, a, e, ln) ISC_LIST_INSERTAFTER(li, a, e, ln) -#define APPENDLIST(list1, list2, link) ISC_LIST_APPENDLIST(list1, list2, link) - -/* - * Assertions - */ -#include <isc/assertions.h> /* Contractual promise. */ - -#define REQUIRE(e) ISC_REQUIRE(e) -#define ENSURE(e) ISC_ENSURE(e) -#define INSIST(e) ISC_INSIST(e) -#define INVARIANT(e) ISC_INVARIANT(e) - -/* - * Errors - */ -#include <isc/error.h> /* Contractual promise. */ - -#define UNEXPECTED_ERROR isc_error_unexpected -#define FATAL_ERROR isc_error_fatal -#define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond) - -/* - * Time - */ -#define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS) - -#endif /* ISC_UTIL_H */ |