diff options
author | Jakob Schlyter <jakob@cvs.openbsd.org> | 2003-11-16 12:18:34 +0000 |
---|---|---|
committer | Jakob Schlyter <jakob@cvs.openbsd.org> | 2003-11-16 12:18:34 +0000 |
commit | cbb413dd8b6a464005115f1b3667f99c98a59e2d (patch) | |
tree | 61a86a3e1c4f6450ae1289c0678e90c0795410c2 /usr.sbin/bind/lib/isc/win32 | |
parent | 379d842cfffc09e7842744a0eb3a326684ad35fe (diff) |
remove win32 files
Diffstat (limited to 'usr.sbin/bind/lib/isc/win32')
56 files changed, 0 insertions, 12306 deletions
diff --git a/usr.sbin/bind/lib/isc/win32/DLLMain.c b/usr.sbin/bind/lib/isc/win32/DLLMain.c deleted file mode 100644 index b0a96a384a6..00000000000 --- a/usr.sbin/bind/lib/isc/win32/DLLMain.c +++ /dev/null @@ -1,62 +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. - */ - -/* $ISC: DLLMain.c,v 1.3.2.1 2001/09/05 00:38:08 gson Exp $ */ - -#include <windows.h> -#include <stdio.h> - -BOOL InitSockets(void); - -/* - * Called when we enter the DLL - */ -__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, - DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) - { - /* - * The DLL is loading due to process - * initialization or a call to LoadLibrary. - */ - case DLL_PROCESS_ATTACH: - if (!InitSockets()) - return (FALSE); - break; - - /* The attached process creates a new thread. */ - case DLL_THREAD_ATTACH: - break; - - /* The thread of the attached process terminates. */ - case DLL_THREAD_DETACH: - break; - - /* - * The DLL is unloading from a process due to - * process termination or a call to FreeLibrary. - */ - case DLL_PROCESS_DETACH: - break; - - default: - break; - } - return (TRUE); -} - diff --git a/usr.sbin/bind/lib/isc/win32/Makefile.in b/usr.sbin/bind/lib/isc/win32/Makefile.in deleted file mode 100644 index df92f631e05..00000000000 --- a/usr.sbin/bind/lib/isc/win32/Makefile.in +++ /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. - -# $ISC: Makefile.in,v 1.8 2001/01/09 21:58:47 bwelling Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -CINCLUDES = -I${srcdir}/.. \ - -I./include \ - -I${srcdir}/include \ - -I${srcdir}/../include -CDEFINES = -CWARNINGS = - -# Alphabetically -OBJS = condition.@O@ dir.@O@ file.@O@ fsaccess.@O@ once.@O@ \ - stdtime.@O@ thread.@O@ time.@O@ - -# Alphabetically -SRCS = condition.c dir.c file.c once.c fsaccess.c \ - stdtime.c thread.c time.c - -SUBDIRS = include -TARGETS = ${OBJS} - -@BIND9_MAKE_RULES@ diff --git a/usr.sbin/bind/lib/isc/win32/app.c b/usr.sbin/bind/lib/isc/win32/app.c deleted file mode 100644 index b44c1b5768e..00000000000 --- a/usr.sbin/bind/lib/isc/win32/app.c +++ /dev/null @@ -1,260 +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. - */ - -/* $ISC: app.c,v 1.3 2001/07/09 21:06:03 gson Exp $ */ - -#include <config.h> - -#include <sys/types.h> - -#include <stddef.h> -#include <stdlib.h> -#include <errno.h> -#include <unistd.h> -#include <process.h> - -#include <isc/app.h> -#include <isc/boolean.h> -#include <isc/condition.h> -#include <isc/msgs.h> -#include <isc/mutex.h> -#include <isc/event.h> -#include <isc/platform.h> -#include <isc/string.h> -#include <isc/task.h> -#include <isc/time.h> -#include <isc/util.h> -#include <isc/thread.h> - -static isc_eventlist_t on_run; -static isc_mutex_t lock; -static isc_boolean_t shutdown_requested = ISC_FALSE; -static isc_boolean_t running = ISC_FALSE; -/* - * We assume that 'want_shutdown' can be read and written atomically. - */ -static isc_boolean_t want_shutdown = ISC_FALSE; -/* - * We assume that 'want_reload' can be read and written atomically. - */ -static isc_boolean_t want_reload = ISC_FALSE; - -static isc_boolean_t blocked = ISC_FALSE; - -static isc_thread_t blockedthread; - -/* Events to wait for */ - -#define NUM_EVENTS 2 - -enum { - RELOAD_EVENT, - SHUTDOWN_EVENT -}; - -static HANDLE hEvents[NUM_EVENTS]; -DWORD dwWaitResult; - -/* - * We need to remember which thread is the main thread... - */ -static isc_thread_t main_thread; - -isc_result_t -isc_app_start(void) { - isc_result_t result; - - /* - * Start an ISC library application. - */ - - main_thread = GetCurrentThread(); - - result = isc_mutex_init(&lock); - if (result != ISC_R_SUCCESS) - return (result); - - /* Create the reload event in a non-signaled state */ - hEvents[RELOAD_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL); - - /* Create the shutdown event in a non-signaled state */ - hEvents[SHUTDOWN_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL); - - ISC_LIST_INIT(on_run); - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, - void *arg) { - isc_event_t *event; - isc_task_t *cloned_task = NULL; - isc_result_t result; - - - LOCK(&lock); - if (running) { - result = ISC_R_ALREADYRUNNING; - goto unlock; - } - - /* - * Note that we store the task to which we're going to send the event - * in the event's "sender" field. - */ - isc_task_attach(task, &cloned_task); - event = isc_event_allocate(mctx, cloned_task, ISC_APPEVENT_SHUTDOWN, - action, arg, sizeof *event); - if (event == NULL) { - result = ISC_R_NOMEMORY; - goto unlock; - } - - ISC_LIST_APPEND(on_run, event, ev_link); - result = ISC_R_SUCCESS; - - unlock: - UNLOCK(&lock); - return (result); -} - -isc_result_t -isc_app_run(void) { - isc_event_t *event, *next_event; - isc_task_t *task; - HANDLE *pHandles = NULL; - - REQUIRE(main_thread == GetCurrentThread()); - LOCK(&lock); - if (!running) { - running = ISC_TRUE; - - /* - * Post any on-run events (in FIFO order). - */ - for (event = ISC_LIST_HEAD(on_run); - event != NULL; - event = next_event) { - next_event = ISC_LIST_NEXT(event, ev_link); - ISC_LIST_UNLINK(on_run, event, ev_link); - task = event->ev_sender; - event->ev_sender = NULL; - isc_task_sendanddetach(&task, &event); - } - - } - - UNLOCK(&lock); - - /* - * There is no danger if isc_app_shutdown() is called before we wait - * for events. - */ - - while (!want_shutdown) { - dwWaitResult = WaitForMultipleObjects(NUM_EVENTS, hEvents, - FALSE, INFINITE); - - /* See why we returned */ - - if (WaitSucceeded(dwWaitResult, NUM_EVENTS)) { - /* - * The return was due to one of the events - * being signaled - */ - switch (WaitSucceededIndex(dwWaitResult)) { - case RELOAD_EVENT: - want_reload = ISC_TRUE; - break; - - case SHUTDOWN_EVENT: - want_shutdown = ISC_TRUE; - break; - } - } - if (want_reload) { - want_reload = ISC_FALSE; - return (ISC_R_RELOAD); - } - - if (want_shutdown && blocked) - exit(-1); - } - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_app_shutdown(void) { - isc_boolean_t want_kill = ISC_TRUE; - - LOCK(&lock); - REQUIRE(running); - - if (shutdown_requested) - want_kill = ISC_FALSE; /* We're only signaling once */ - else - shutdown_requested = ISC_TRUE; - - UNLOCK(&lock); - if (want_kill) - SetEvent(hEvents[SHUTDOWN_EVENT]); - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_app_reload(void) { - isc_boolean_t want_reload = ISC_TRUE; - - LOCK(&lock); - REQUIRE(running); - - /* - * Don't send the reload signal if we're shutting down. - */ - if (shutdown_requested) - want_reload = ISC_FALSE; - - UNLOCK(&lock); - if (want_reload) - SetEvent(hEvents[RELOAD_EVENT]); - - return (ISC_R_SUCCESS); -} - -void -isc_app_finish(void) { - DESTROYLOCK(&lock); -} - -void -isc_app_block(void) { - REQUIRE(running); - REQUIRE(!blocked); - - blocked = ISC_TRUE; - blockedthread = GetCurrentThread(); -} - -void -isc_app_unblock(void) { - REQUIRE(running); - REQUIRE(blocked); - blocked = ISC_FALSE; - REQUIRE(blockedthread == GetCurrentThread()); -} diff --git a/usr.sbin/bind/lib/isc/win32/condition.c b/usr.sbin/bind/lib/isc/win32/condition.c deleted file mode 100644 index 11783269d81..00000000000 --- a/usr.sbin/bind/lib/isc/win32/condition.c +++ /dev/null @@ -1,151 +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. - */ - -/* $ISC: condition.c,v 1.17 2001/07/08 05:08:56 mayer Exp $ */ - -#include <config.h> - -#include <isc/condition.h> -#include <isc/assertions.h> -#include <isc/util.h> -#include <isc/time.h> - -#define LSIGNAL 0 -#define LBROADCAST 1 - -isc_result_t -isc_condition_init(isc_condition_t *cond) { - HANDLE h; - - REQUIRE(cond != NULL); - - cond->waiters = 0; - h = CreateEvent(NULL, FALSE, FALSE, NULL); - if (h == NULL) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - cond->events[LSIGNAL] = h; - h = CreateEvent(NULL, TRUE, FALSE, NULL); - if (h == NULL) { - (void)CloseHandle(cond->events[LSIGNAL]); - /* XXX */ - return (ISC_R_UNEXPECTED); - } - cond->events[LBROADCAST] = h; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_condition_signal(isc_condition_t *cond) { - - /* - * Unlike pthreads, the caller MUST hold the lock associated with - * the condition variable when calling us. - */ - REQUIRE(cond != NULL); - - if (cond->waiters > 0 && - !SetEvent(cond->events[LSIGNAL])) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_condition_broadcast(isc_condition_t *cond) { - - /* - * Unlike pthreads, the caller MUST hold the lock associated with - * the condition variable when calling us. - */ - REQUIRE(cond != NULL); - - if (cond->waiters > 0 && - !SetEvent(cond->events[LBROADCAST])) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_condition_destroy(isc_condition_t *cond) { - - REQUIRE(cond != NULL); - - (void)CloseHandle(cond->events[LSIGNAL]); - (void)CloseHandle(cond->events[LBROADCAST]); - - return (ISC_R_SUCCESS); -} - -static isc_result_t -wait(isc_condition_t *cond, isc_mutex_t *mutex, DWORD milliseconds) { - DWORD result; - - cond->waiters++; - LeaveCriticalSection(mutex); - result = WaitForMultipleObjects(2, cond->events, FALSE, milliseconds); - if (result == WAIT_FAILED) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - EnterCriticalSection(mutex); - cond->waiters--; - if (cond->waiters == 0 && - !ResetEvent(cond->events[LBROADCAST])) { - /* XXX */ - LeaveCriticalSection(mutex); - return (ISC_R_UNEXPECTED); - } - - if (result == WAIT_TIMEOUT) - return (ISC_R_TIMEDOUT); - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_condition_wait(isc_condition_t *cond, isc_mutex_t *mutex) { - return (wait(cond, mutex, INFINITE)); -} - -isc_result_t -isc_condition_waituntil(isc_condition_t *cond, isc_mutex_t *mutex, - isc_time_t *t) { - DWORD milliseconds; - isc_uint64_t microseconds; - isc_time_t now; - - if (isc_time_now(&now) != ISC_R_SUCCESS) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - - microseconds = isc_time_microdiff(t, &now); - if (microseconds > 0xFFFFFFFFi64 * 1000) - milliseconds = 0xFFFFFFFF; - else - milliseconds = (DWORD)(microseconds / 1000); - - return (wait(cond, mutex, milliseconds)); -} diff --git a/usr.sbin/bind/lib/isc/win32/dir.c b/usr.sbin/bind/lib/isc/win32/dir.c deleted file mode 100644 index 5ab5db752db..00000000000 --- a/usr.sbin/bind/lib/isc/win32/dir.c +++ /dev/null @@ -1,345 +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. - */ - -/* $ISC: dir.c,v 1.10 2001/07/06 21:47:15 gson Exp $ */ - -/* Principal Authors: DCL */ - -/* - * isc_dir_chroot is currently stubbed out for Win32 - * This will need to be revisited - */ - -#include <config.h> - -#include <string.h> -#include <direct.h> -#include <process.h> -#include <io.h> - -#include <sys/stat.h> - -#include <isc/dir.h> -#include <isc/magic.h> -#include <isc/assertions.h> -#include <isc/util.h> - -#include "errno2result.h" - -#define ISC_DIR_MAGIC ISC_MAGIC('D', 'I', 'R', '*') -#define VALID_DIR(dir) ISC_MAGIC_VALID(dir, ISC_DIR_MAGIC) - -static isc_result_t -start_directory(isc_dir_t *p); - -void -isc_dir_init(isc_dir_t *dir) { - REQUIRE(dir != NULL); - - dir->dirname[0] = '\0'; - - dir->entry.name[0] = '\0'; - dir->entry.length = 0; - memset(&(dir->entry.find_data), 0, sizeof(dir->entry.find_data)); - - dir->entry_filled = ISC_FALSE; - dir->search_handle = INVALID_HANDLE_VALUE; - - dir->magic = ISC_DIR_MAGIC; -} - -/* - * Allocate workspace and open directory stream. If either one fails, - * NULL will be returned. - */ -isc_result_t -isc_dir_open(isc_dir_t *dir, const char *dirname) { - char *p; - isc_result_t result; - - REQUIRE(dirname != NULL); - REQUIRE(VALID_DIR(dir) && dir->search_handle == INVALID_HANDLE_VALUE); - - /* - * Copy directory name. Need to have enough space for the name, - * a possible path separator, the wildcard, and the final NUL. - */ - if (strlen(dirname) + 3 > sizeof(dir->dirname)) - /* XXXDCL ? */ - return (ISC_R_NOSPACE); - strcpy(dir->dirname, dirname); - - /* - * Append path separator, if needed, and "*". - */ - p = dir->dirname + strlen(dir->dirname); - if (dir->dirname < p && *(p - 1) != '\\' && *(p - 1) != ':') - *p++ = '\\'; - *p++ = '*'; - *p++ = '\0'; - - /* - * Open stream. - */ - result = start_directory(dir); - - return (result); -} - -/* - * Return previously retrieved file or get next one. Unix's dirent has - * separate open and read functions, but the Win32 and DOS interfaces open - * the dir stream and reads the first file in one operation. - */ -isc_result_t -isc_dir_read(isc_dir_t *dir) { - REQUIRE(VALID_DIR(dir) && dir->search_handle != INVALID_HANDLE_VALUE); - - if (dir->entry_filled) - /* - * start_directory() already filled in the first entry. - */ - dir->entry_filled = ISC_FALSE; - - else { - /* - * Fetch next file in directory. - */ - if (FindNextFile(dir->search_handle, - &dir->entry.find_data) == FALSE) - /* - * Either the last file has been processed or - * an error has occured. The former is not - * really an error, but the latter is. - */ - if (GetLastError() == ERROR_NO_MORE_FILES) - return (ISC_R_NOMORE); - else - return (ISC_R_UNEXPECTED); - } - - /* - * Make sure that the space for the name is long enough. - */ - strcpy(dir->entry.name, dir->entry.find_data.cFileName); - dir->entry.length = strlen(dir->entry.name); - - return (ISC_R_SUCCESS); -} - -/* - * Close directory stream. - */ -void -isc_dir_close(isc_dir_t *dir) { - REQUIRE(VALID_DIR(dir) && dir->search_handle != INVALID_HANDLE_VALUE); - - FindClose(dir->search_handle); - dir->search_handle = INVALID_HANDLE_VALUE; -} - -/* - * Reposition directory stream at start. - */ -isc_result_t -isc_dir_reset(isc_dir_t *dir) { - isc_result_t result; - - REQUIRE(VALID_DIR(dir) && dir->search_handle != INVALID_HANDLE_VALUE); - REQUIRE(dir->dirname != NULL); - - /* - * NT cannot reposition the seek pointer to the beginning of the - * the directory stream, but rather the directory needs to be - * closed and reopened. The latter might fail. - */ - - isc_dir_close(dir); - - result = start_directory(dir); - - return (result); -} - -/* - * Initialize isc_dir_t structure with new directory. The function - * returns 0 on failure and nonzero on success. - * - * Note: - * - Be sure to close previous stream before opening new one - */ -static isc_result_t -start_directory(isc_dir_t *dir) -{ - REQUIRE(VALID_DIR(dir)); - REQUIRE(dir->search_handle == INVALID_HANDLE_VALUE); - - dir->entry_filled = ISC_FALSE; - - /* - * Open stream and retrieve first file. - */ - dir->search_handle = FindFirstFile(dir->dirname, - &dir->entry.find_data); - - if (dir->search_handle == INVALID_HANDLE_VALUE) { - /* - * Something went wrong but we don't know what. GetLastError() - * could give us more information about the error, but the - * MSDN documentation is frustratingly thin about what - * possible errors could have resulted. (Score one for - * the Unix manual pages.) So there is just this lame error - * instead of being able to differentiate ISC_R_NOTFOUND - * from ISC_R_UNEXPECTED. - */ - return (ISC_R_FAILURE); - } - - /* - * Make sure that the space for the name is long enough. - */ - INSIST(sizeof(dir->entry.name) > - strlen(dir->entry.find_data.cFileName)); - - /* - * Fill in the data for the first entry of the directory. - */ - strcpy(dir->entry.name, dir->entry.find_data.cFileName); - dir->entry.length = strlen(dir->entry.name); - - dir->entry_filled = ISC_TRUE; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_dir_chdir(const char *dirname) { - /* - * Change the current directory to 'dirname'. - */ - - REQUIRE(dirname != NULL); - - if (chdir(dirname) < 0) - return (isc__errno2result(errno)); - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_dir_chroot(const char *dirname) { - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep) { - char *cwd; - isc_result_t result = ISC_R_SUCCESS; - - /* - * XXXDCL Could automatically allocate memory if dirname == NULL. - */ - REQUIRE(dirname != NULL); - REQUIRE(length > 0); - - cwd = getcwd(dirname, length); - - if (cwd == NULL) { - if (errno == ERANGE) - result = ISC_R_NOSPACE; - else - result = isc__errno2result(errno); - } else if (end_sep) { - if (strlen(dirname) + 1 == length) - result = ISC_R_NOSPACE; - else if (dirname[1] != '\0') - strcat(dirname, "/"); - } - - return (result); -} - -isc_result_t -isc_dir_createunique(char *templet) { - isc_result_t result; - char *x; - char *p; - int i; - int pid; - - REQUIRE(templet != NULL); - - /* - * mkdtemp is not portable, so this emulates it. - */ - - pid = getpid(); - - /* - * Replace trailing Xs with the process-id, zero-filled. - */ - for (x = templet + strlen(templet) - 1; *x == 'X' && x >= templet; - x--, pid /= 10) - *x = pid % 10 + '0'; - - x++; /* Set x to start of ex-Xs. */ - - do { - i = mkdir(templet); - i = chmod(templet, 0700); - - if (i == 0 || errno != EEXIST) - break; - - /* - * The BSD algorithm. - */ - p = x; - while (*p != '\0') { - if (isdigit(*p & 0xff)) - *p = 'a'; - else if (*p != 'z') - ++*p; - else { - /* - * Reset character and move to next. - */ - *p++ = 'a'; - continue; - } - - break; - } - - if (*p == '\0') { - /* - * Tried all combinations. errno should already - * be EEXIST, but ensure it is anyway for - * isc__errno2result(). - */ - errno = EEXIST; - break; - } - } while (1); - - if (i == -1) - result = isc__errno2result(errno); - else - result = ISC_R_SUCCESS; - - return (result); -} diff --git a/usr.sbin/bind/lib/isc/win32/entropy.c b/usr.sbin/bind/lib/isc/win32/entropy.c deleted file mode 100644 index d211deeb853..00000000000 --- a/usr.sbin/bind/lib/isc/win32/entropy.c +++ /dev/null @@ -1,298 +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. - */ - -/* $ISC: entropy.c,v 1.3 2001/07/08 05:08:57 mayer Exp $ */ - -/* - * This is the system depenedent part of the ISC entropy API. - */ - -#include <config.h> - -#include <windows.h> -#include <wincrypt.h> - -#include <process.h> -#include <io.h> -#include <share.h> - -/* - * There is only one variable in the entropy data structures that is not - * system independent, but pulling the structure that uses it into this file - * ultimately means pulling several other independent structures here also to - * resolve their interdependencies. Thus only the problem variable's type - * is defined here. - */ -#define FILESOURCE_HANDLE_TYPE HCRYPTPROV - -#include "../entropy.c" - -static unsigned int -get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) { - isc_entropy_t *ent = source->ent; - unsigned char buf[128]; - HCRYPTPROV hcryptprov = source->sources.file.handle; - ssize_t ndesired; - unsigned int added; - - if (source->bad) - return (0); - - desired = desired / 8 + (((desired & 0x07) > 0) ? 1 : 0); - - added = 0; - while (desired > 0) { - ndesired = ISC_MIN(desired, sizeof(buf)); - if (!CryptGenRandom(hcryptprov, ndesired, buf)) { - CryptReleaseContext(hcryptprov, 0); - source->bad = ISC_TRUE; - goto out; - } - - entropypool_adddata(ent, buf, ndesired, ndesired * 8); - added += ndesired * 8; - desired -= ndesired; - } - - out: - return (added); -} - -/* - * Poll each source, trying to get data from it to stuff into the entropy - * pool. - */ -static void -fillpool(isc_entropy_t *ent, unsigned int desired, isc_boolean_t blocking) { - unsigned int added; - unsigned int remaining; - unsigned int needed; - unsigned int nsource; - isc_entropysource_t *source; - isc_entropysource_t *firstsource; - - REQUIRE(VALID_ENTROPY(ent)); - - needed = desired; - - /* - * This logic is a little strange, so an explanation is in order. - * - * If needed is 0, it means we are being asked to "fill to whatever - * we think is best." This means that if we have at least a - * partially full pool (say, > 1/4th of the pool) we probably don't - * need to add anything. - * - * Also, we will check to see if the "pseudo" count is too high. - * If it is, try to mix in better data. Too high is currently - * defined as 1/4th of the pool. - * - * Next, if we are asked to add a specific bit of entropy, make - * certain that we will do so. Clamp how much we try to add to - * (DIGEST_SIZE * 8 < needed < POOLBITS - entropy). - * - * Note that if we are in a blocking mode, we will only try to - * get as much data as we need, not as much as we might want - * to build up. - */ - if (needed == 0) { - REQUIRE(!blocking); - - if ((ent->pool.entropy >= RND_POOLBITS / 4) - && (ent->pool.pseudo <= RND_POOLBITS / 4)) - return; - - needed = THRESHOLD_BITS * 4; - } else { - needed = ISC_MAX(needed, THRESHOLD_BITS); - needed = ISC_MIN(needed, RND_POOLBITS); - } - - /* - * In any case, clamp how much we need to how much we can add. - */ - needed = ISC_MIN(needed, RND_POOLBITS - ent->pool.entropy); - - /* - * But wait! If we're not yet initialized, we need at least - * THRESHOLD_BITS - * of randomness. - */ - if (ent->initialized < THRESHOLD_BITS) - needed = ISC_MAX(needed, THRESHOLD_BITS - ent->initialized); - - /* - * Poll each file source to see if we can read anything useful from - * it. XXXMLG When where are multiple sources, we should keep a - * record of which one we last used so we can start from it (or the - * next one) to avoid letting some sources build up entropy while - * others are always drained. - */ - - added = 0; - remaining = needed; - if (ent->nextsource == NULL) { - ent->nextsource = ISC_LIST_HEAD(ent->sources); - if (ent->nextsource == NULL) - return; - } - source = ent->nextsource; - /* - * Remember the first source so we can break if we have looped back to - * the beginning and still have nothing - */ - firstsource = source; - again_file: - for (nsource = 0 ; nsource < ent->nsources ; nsource++) { - unsigned int got; - - if (remaining == 0) - break; - - got = 0; - - if (source->type == ENTROPY_SOURCETYPE_FILE) - got = get_from_filesource(source, remaining); - - added += got; - - remaining -= ISC_MIN(remaining, got); - - source = ISC_LIST_NEXT(source, link); - if (source == NULL) - source = ISC_LIST_HEAD(ent->sources); - } - ent->nextsource = source; - - /* - * Go again only if there's been progress and we've not - * gone back to the beginning - */ - if (!(ent->nextsource == firstsource && added == 0)) { - if (blocking && remaining != 0) { - goto again_file; - } - } - - /* - * Here, if there are bits remaining to be had and we can block, - * check to see if we have a callback source. If so, call them. - */ - source = ISC_LIST_HEAD(ent->sources); - while ((remaining != 0) && (source != NULL)) { - unsigned int got; - - got = 0; - - if (source->type == ENTROPY_SOURCETYPE_CALLBACK) - got = get_from_callback(source, remaining, blocking); - - added += got; - remaining -= ISC_MIN(remaining, got); - - if (added >= needed) - break; - - source = ISC_LIST_NEXT(source, link); - } - - /* - * Mark as initialized if we've added enough data. - */ - if (ent->initialized < THRESHOLD_BITS) - ent->initialized += added; -} - - - -/* - * Requires "ent" be locked. - */ -static void -destroyfilesource(isc_entropyfilesource_t *source) { - CryptReleaseContext(source->handle, 0); -} - - -isc_result_t -isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { - isc_result_t ret; - isc_entropysource_t *source; - HCRYPTPROV hcryptprov; - DWORD errval; - BOOL err; - - REQUIRE(VALID_ENTROPY(ent)); - REQUIRE(fname != NULL); - - LOCK(&ent->lock); - - source = NULL; - - /* - * The first time we just try to acquire the context - */ - err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT); - if (!err){ - errval = GetLastError(); - ret = ISC_R_IOERROR; - goto errout; - } - - source = isc_mem_get(ent->mctx, sizeof(isc_entropysource_t)); - if (source == NULL) { - ret = ISC_R_NOMEMORY; - goto closecontext; - } - - /* - * From here down, no failures can occur. - */ - source->magic = SOURCE_MAGIC; - source->type = ENTROPY_SOURCETYPE_FILE; - source->ent = ent; - source->total = 0; - source->bad = ISC_FALSE; - memset(source->name, 0, sizeof(source->name)); - ISC_LINK_INIT(source, link); - source->sources.file.handle = hcryptprov; - - /* - * Hook it into the entropy system. - */ - ISC_LIST_APPEND(ent->sources, source, link); - ent->nsources++; - - UNLOCK(&ent->lock); - return (ISC_R_SUCCESS); - - closecontext: - CryptReleaseContext(hcryptprov, 0); - - errout: - if (source != NULL) - isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t)); - - UNLOCK(&ent->lock); - - return (ret); -} - - - - diff --git a/usr.sbin/bind/lib/isc/win32/errno2result.c b/usr.sbin/bind/lib/isc/win32/errno2result.c deleted file mode 100644 index 2d9f3dce291..00000000000 --- a/usr.sbin/bind/lib/isc/win32/errno2result.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (C) 2000-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. - */ - -/* $ISC: errno2result.c,v 1.4.2.2 2002/02/20 02:17:28 marka Exp $ */ - -#include <config.h> - -#include <winsock2.h> -#include "errno2result.h" -#include <isc/result.h> -#include <isc/strerror.h> -#include <isc/util.h> - -/* - * Convert a POSIX errno value into an isc_result_t. The - * list of supported errno values is not complete; new users - * of this function should add any expected errors that are - * not already there. - */ -isc_result_t -isc__errno2result(int posixerrno) { - char strbuf[ISC_STRERRORSIZE]; - - switch (posixerrno) { - case ENOTDIR: - case WSAELOOP: - case EINVAL: /* XXX sometimes this is not for files */ - case ENAMETOOLONG: - case EBADF: - return (ISC_R_INVALIDFILE); - case ENOENT: - return (ISC_R_FILENOTFOUND); - case EACCES: - case EPERM: - return (ISC_R_NOPERM); - case EEXIST: - return (ISC_R_FILEEXISTS); - case EIO: - return (ISC_R_IOERROR); - case ENOMEM: - return (ISC_R_NOMEMORY); - case ENFILE: - case EMFILE: - return (ISC_R_TOOMANYOPENFILES); - default: - isc__strerror(posixerrno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "unable to convert errno " - "to isc_result: %d: %s", - posixerrno, strbuf); - /* - * XXXDCL would be nice if perhaps this function could - * return the system's error string, so the caller - * might have something more descriptive than "unexpected - * error" to log with. - */ - return (ISC_R_UNEXPECTED); - } -} - -/* - * Note this will cause a memory leak unless the memory allocated here - * is freed by calling LocalFree - */ -char * -FormatError(int error) { - LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - error, - /* Default language */ - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, - NULL); - - return (lpMsgBuf); -} - -char * __cdecl -NTstrMessage(int err) { - char *retmsg = NULL; - - /* Copy the error value first in case of other errors */ - DWORD errval = err; - - /* Get the Winsock2 error messages */ - if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) { - retmsg = GetWSAErrorMessage(errval); - if (retmsg != NULL) - return (retmsg); - } - /* - * If it's not one of the standard Unix error codes, - * try a system error message - */ - if (errval > (DWORD) _sys_nerr) { - return (FormatError(errval)); - } else { - return (strerror(errval)); - } -} - -char * __cdecl -NTstrerror(int err) { - /* Copy the error value first in case of other errors */ - DWORD errval = err; - - return (NTstrMessage(errval)); -} - -/* - * This is a replacement for perror, but it also reports the error value. - */ -void __cdecl -NTperror(char *errmsg) { - /* Copy the error value first in case of other errors */ - int errval = errno; - - fprintf(stderr, "%s: %s\n", errmsg, NTstrMessage(errval)); -} - -/* - * Return the error string related to Winsock2 errors. - * This function is necessary since FormatMessage knows nothing about them - * and there is no function to get them. - */ -char * -GetWSAErrorMessage(int errval) { - char *msg; - - switch (errval) { - - case WSAEINTR: - msg = "Interrupted system call"; - break; - - case WSAEBADF: - msg = "Bad file number"; - break; - - case WSAEACCES: - msg = "Permission denied"; - break; - - case WSAEFAULT: - msg = "Bad address"; - break; - - case WSAEINVAL: - msg = "Invalid argument"; - break; - - case WSAEMFILE: - msg = "Too many open sockets"; - break; - - case WSAEWOULDBLOCK: - msg = "Operation would block"; - break; - - case WSAEINPROGRESS: - msg = "Operation now in progress"; - break; - - case WSAEALREADY: - msg = "Operation already in progress"; - break; - - case WSAENOTSOCK: - msg = "Socket operation on non-socket"; - break; - - case WSAEDESTADDRREQ: - msg = "Destination address required"; - break; - - case WSAEMSGSIZE: - msg = "Message too long"; - break; - - case WSAEPROTOTYPE: - msg = "Protocol wrong type for socket"; - break; - - case WSAENOPROTOOPT: - msg = "Bad protocol option"; - break; - - case WSAEPROTONOSUPPORT: - msg = "Protocol not supported"; - break; - - case WSAESOCKTNOSUPPORT: - msg = "Socket type not supported"; - break; - - case WSAEOPNOTSUPP: - msg = "Operation not supported on socket"; - break; - - case WSAEPFNOSUPPORT: - msg = "Protocol family not supported"; - break; - - case WSAEAFNOSUPPORT: - msg = "Address family not supported"; - break; - - case WSAEADDRINUSE: - msg = "Address already in use"; - break; - - case WSAEADDRNOTAVAIL: - msg = "Can't assign requested address"; - break; - - case WSAENETDOWN: - msg = "Network is down"; - break; - - case WSAENETUNREACH: - msg = "Network is unreachable"; - break; - - case WSAENETRESET: - msg = "Net connection reset"; - break; - - case WSAECONNABORTED: - msg = "Software caused connection abort"; - break; - - case WSAECONNRESET: - msg = "Connection reset by peer"; - break; - - case WSAENOBUFS: - msg = "No buffer space available"; - break; - - case WSAEISCONN: - msg = "Socket is already connected"; - break; - - case WSAENOTCONN: - msg = "Socket is not connected"; - break; - - case WSAESHUTDOWN: - msg = "Can't send after socket shutdown"; - break; - - case WSAETOOMANYREFS: - msg = "Too many references: can't splice"; - break; - - case WSAETIMEDOUT: - msg = "Connection timed out"; - break; - - case WSAECONNREFUSED: - msg = "Connection refused"; - break; - - case WSAELOOP: - msg = "Too many levels of symbolic links"; - break; - - case WSAENAMETOOLONG: - msg = "File name too long"; - break; - - case WSAEHOSTDOWN: - msg = "Host is down"; - break; - - case WSAEHOSTUNREACH: - msg = "No route to host"; - break; - - case WSAENOTEMPTY: - msg = "Directory not empty"; - break; - - case WSAEPROCLIM: - msg = "Too many processes"; - break; - - case WSAEUSERS: - msg = "Too many users"; - break; - - case WSAEDQUOT: - msg = "Disc quota exceeded"; - break; - - case WSAESTALE: - msg = "Stale NFS file handle"; - break; - - case WSAEREMOTE: - msg = "Too many levels of remote in path"; - break; - - case WSASYSNOTREADY: - msg = "Network system is unavailable"; - break; - - case WSAVERNOTSUPPORTED: - msg = "Winsock version out of range"; - break; - - case WSANOTINITIALISED: - msg = "WSAStartup not yet called"; - break; - - case WSAEDISCON: - msg = "Graceful shutdown in progress"; - break; -/* - case WSAHOST_NOT_FOUND: - msg = "Host not found"; - break; - - case WSANO_DATA: - msg = "No host data of that type was found"; - break; -*/ - default: - msg = NULL; - break; - } - return (msg); -} - -/* - * These error messages are more informative about CryptAPI Errors than the - * standard error messages - */ - -char * -GetCryptErrorMessage(int errval) { - char *msg; - - switch (errval) { - - case NTE_BAD_FLAGS: - msg = "The dwFlags parameter has an illegal value."; - break; - case NTE_BAD_KEYSET: - msg = "The Registry entry for the key container " - "could not be opened and may not exist."; - break; - case NTE_BAD_KEYSET_PARAM: - msg = "The pszContainer or pszProvider parameter " - "is set to an illegal value."; - break; - case NTE_BAD_PROV_TYPE: - msg = "The value of the dwProvType parameter is out " - "of range. All provider types must be from " - "1 to 999, inclusive."; - break; - case NTE_BAD_SIGNATURE: - msg = "The provider DLL signature did not verify " - "correctly. Either the DLL or the digital " - "signature has been tampered with."; - break; - case NTE_EXISTS: - msg = "The dwFlags parameter is CRYPT_NEWKEYSET, but the key" - " container already exists."; - break; - case NTE_KEYSET_ENTRY_BAD: - msg = "The Registry entry for the pszContainer key container " - "was found (in the HKEY_CURRENT_USER window), but is " - "corrupt. See the section System Administration for " - " etails about CryptoAPI's Registry usage."; - break; - case NTE_KEYSET_NOT_DEF: - msg = "No Registry entry exists in the HKEY_CURRENT_USER " - "window for the key container specified by " - "pszContainer."; - break; - case NTE_NO_MEMORY: - msg = "The CSP ran out of memory during the operation."; - break; - case NTE_PROV_DLL_NOT_FOUND: - msg = "The provider DLL file does not exist or is not on the " - "current path."; - break; - case NTE_PROV_TYPE_ENTRY_BAD: - msg = "The Registry entry for the provider type specified by " - "dwProvType is corrupt. This error may relate to " - "either the user default CSP list or the machine " - "default CSP list. See the section System " - "Administration for details about CryptoAPI's " - "Registry usage."; - break; - case NTE_PROV_TYPE_NO_MATCH: - msg = "The provider type specified by dwProvType does not " - "match the provider type found in the Registry. Note " - "that this error can only occur when pszProvider " - "specifies an actual CSP name."; - break; - case NTE_PROV_TYPE_NOT_DEF: - msg = "No Registry entry exists for the provider type " - "specified by dwProvType."; - break; - case NTE_PROVIDER_DLL_FAIL: - msg = "The provider DLL file could not be loaded, and " - "may not exist. If it exists, then the file is " - "not a valid DLL."; - break; - case NTE_SIGNATURE_FILE_BAD: - msg = "An error occurred while loading the DLL file image, " - "prior to verifying its signature."; - break; - - default: - msg = NULL; - break; - } - return msg; -} - diff --git a/usr.sbin/bind/lib/isc/win32/errno2result.h b/usr.sbin/bind/lib/isc/win32/errno2result.h deleted file mode 100644 index 0690f45cfd7..00000000000 --- a/usr.sbin/bind/lib/isc/win32/errno2result.h +++ /dev/null @@ -1,46 +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. - */ - -/* $ISC: errno2result.h,v 1.4 2001/07/17 20:29:25 gson Exp $ */ - -#ifndef UNIX_ERRNO2RESULT_H -#define UNIX_ERRNO2RESULT_H 1 - -/* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */ - -#include <errno.h> /* Provides errno. */ - -#include <isc/lang.h> -#include <isc/types.h> - -ISC_LANG_BEGINDECLS - -isc_result_t -isc__errno2result(int posixerrno); - -char * -isc_FormatError(int error); - -char * -GetWSAErrorMessage(int errval); - -char * __cdecl -NTstrerror(int err); - -ISC_LANG_ENDDECLS - -#endif /* UNIX_ERRNO2RESULT_H */ diff --git a/usr.sbin/bind/lib/isc/win32/file.c b/usr.sbin/bind/lib/isc/win32/file.c deleted file mode 100644 index 0c7f9525309..00000000000 --- a/usr.sbin/bind/lib/isc/win32/file.c +++ /dev/null @@ -1,490 +0,0 @@ -/* - * Copyright (C) 2000-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. - */ - -/* $ISC: file.c,v 1.20.2.4 2002/03/26 00:55:11 marka Exp $ */ - -#include <config.h> - -#undef rename -#include <errno.h> -#include <limits.h> -#include <stdlib.h> -#include <io.h> -#include <process.h> - -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/utime.h> - -#include <isc/file.h> -#include <isc/result.h> -#include <isc/time.h> -#include <isc/util.h> -#include <isc/stat.h> - -#include "errno2result.h" - -/* - * Emulate UNIX mkstemp, which returns an open FD to the new file - * - */ -static int -gettemp(char *path, int *doopen) { - char *start, *trv; - struct stat sbuf; - int pid; - - trv = strrchr(path, 'X'); - trv++; - pid = getpid(); - /* extra X's get set to 0's */ - while (*--trv == 'X') { - *trv = (pid % 10) + '0'; - pid /= 10; - } - /* - * check the target directory; if you have six X's and it - * doesn't exist this runs for a *very* long time. - */ - for (start = trv + 1;; --trv) { - if (trv <= path) - break; - if (*trv == '\\') { - *trv = '\0'; - if (stat(path, &sbuf)) - return (0); - if (!S_ISDIR(sbuf.st_mode)) { - errno = ENOTDIR; - return (0); - } - *trv = '\\'; - break; - } - } - - for (;;) { - if (doopen) { - if ((*doopen = - open(path, O_CREAT|O_EXCL|O_RDWR, - _S_IREAD | _S_IWRITE)) >= 0) - return (1); - if (errno != EEXIST) - return (0); - } else if (stat(path, &sbuf)) - return (errno == ENOENT ? 1 : 0); - - /* tricky little algorithm for backward compatibility */ - for (trv = start;;) { - if (!*trv) - return (0); - if (*trv == 'z') - *trv++ = 'a'; - else { - if (isdigit(*trv)) - *trv = 'a'; - else - ++*trv; - break; - } - } - } - /*NOTREACHED*/ -} - -static int -mkstemp(char *path) { - int fd; - - return (gettemp(path, &fd) ? fd : -1); -} - -/* - * XXXDCL As the API for accessing file statistics undoubtedly gets expanded, - * it might be good to provide a mechanism that allows for the results - * of a previous stat() to be used again without having to do another stat, - * such as perl's mechanism of using "_" in place of a file name to indicate - * that the results of the last stat should be used. But then you get into - * annoying MP issues. BTW, Win32 has stat(). - */ -static isc_result_t -file_stats(const char *file, struct stat *stats) { - isc_result_t result = ISC_R_SUCCESS; - - REQUIRE(file != NULL); - REQUIRE(stats != NULL); - - if (stat(file, stats) != 0) - result = isc__errno2result(errno); - - return (result); -} - -/* - * isc_file_safemovefile is needed to be defined here to ensure that - * any file with the new name is renamed to a backup name and then the - * rename is done. If all goes well then the backup can be deleted, - * otherwise it gets renamed back. - */ - -int -isc_file_safemovefile(const char *oldname, const char *newname) { - BOOL filestatus; - char buf[512]; - struct stat sbuf; - BOOL exists = FALSE; - int tmpfd; - - /* - * Make sure we have something to do - */ - if (stat(oldname, &sbuf) != 0) { - errno = ENOENT; - return (-1); - } - - /* - * Rename to a backup the new file if it still exists - */ - if (stat(newname, &sbuf) == 0) { - exists = TRUE; - strcpy(buf, newname); - strcat(buf, ".XXXXX"); - tmpfd = mkstemp(buf); - if (tmpfd > 0) - _close(tmpfd); - DeleteFile(buf); - _chmod(newname, _S_IREAD | _S_IWRITE); - - filestatus = MoveFile(newname, buf); - } - /* Now rename the file to the new name - */ - _chmod(oldname, _S_IREAD | _S_IWRITE); - - filestatus = MoveFile(oldname, newname); - if (filestatus == 0) { - /* - * Try to rename the backup back to the original name - * if the backup got created - */ - if (exists == TRUE) { - filestatus = MoveFile(buf, newname); - if (filestatus == 0) { - errno = EACCES; - } - } - return (-1); - } - - /* - * Delete the backup file if it got created - */ - if (exists == TRUE) - filestatus = DeleteFile(buf); - return (0); -} - -isc_result_t -isc_file_getmodtime(const char *file, isc_time_t *time) { - int fh; - - REQUIRE(file != NULL); - REQUIRE(time != NULL); - - if ((fh = open(file, _O_RDONLY | _O_BINARY)) < 0) - return (isc__errno2result(errno)); - - if (!GetFileTime((HANDLE) _get_osfhandle(fh), - NULL, - NULL, - &time->absolute)) - { - close(fh); - errno = EINVAL; - return (isc__errno2result(errno)); - } - close(fh); - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_file_settime(const char *file, isc_time_t *time) { - int fh; - - REQUIRE(file != NULL && time != NULL); - - if ((fh = open(file, _O_RDWR | _O_BINARY)) < 0) - return (isc__errno2result(errno)); - - /* - * Set the date via the filedate system call and return. Failing - * this call implies the new file times are not supported by the - * underlying file system. - */ - if (!SetFileTime((HANDLE) _get_osfhandle(fh), - NULL, - &time->absolute, - &time->absolute)) - { - close(fh); - errno = EINVAL; - return (isc__errno2result(errno)); - } - - close(fh); - return (ISC_R_SUCCESS); - -} - -#undef TEMPLATE -#define TEMPLATE "XXXXXXXXXX.tmp" /* 14 characters. */ - -isc_result_t -isc_file_mktemplate(const char *path, char *buf, size_t buflen) { - return (isc_file_template(path, TEMPLATE, buf, buflen)); -} - -isc_result_t -isc_file_template(const char *path, const char *templet, char *buf, - size_t buflen) { - char *s; - - REQUIRE(path != NULL); - REQUIRE(templet != NULL); - REQUIRE(buf != NULL); - - s = strrchr(templet, '\\'); - if (s != NULL) - templet = s + 1; - - s = strrchr(path, '\\'); - - if (s != NULL) { - if ((s - path + 1 + strlen(templet) + 1) > buflen) - return (ISC_R_NOSPACE); - - strncpy(buf, path, s - path + 1); - buf[s - path + 1] = '\0'; - strcat(buf, templet); - } else { - if ((strlen(templet) + 1) > buflen) - return (ISC_R_NOSPACE); - - strcpy(buf, templet); - } - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_file_renameunique(const char *file, char *templet) { - int fd = -1; - int res = 0; - isc_result_t result = ISC_R_SUCCESS; - - REQUIRE(file != NULL); - REQUIRE(templet != NULL); - - fd = mkstemp(templet); - if (fd == -1) - result = isc__errno2result(errno); - else - close(fd); - - if (result == ISC_R_SUCCESS) { - res = isc_file_safemovefile(file, templet); - if (res != 0) { - result = isc__errno2result(errno); - (void)unlink(templet); - } - } - return (result); -} - -isc_result_t -isc_file_openunique(char *templet, FILE **fp) { - int fd; - FILE *f; - isc_result_t result = ISC_R_SUCCESS; - - REQUIRE(templet != NULL); - REQUIRE(fp != NULL && *fp == NULL); - - /* - * Win32 does not have mkstemp. Using emulation above. - */ - fd = mkstemp(templet); - - if (fd == -1) - result = isc__errno2result(errno); - if (result == ISC_R_SUCCESS) { - f = fdopen(fd, "w+"); - if (f == NULL) { - result = isc__errno2result(errno); - (void)remove(templet); - (void)close(fd); - } else - *fp = f; - } - - return (result); -} - -isc_result_t -isc_file_remove(const char *filename) { - int r; - - REQUIRE(filename != NULL); - - r = unlink(filename); - if (r == 0) - return (ISC_R_SUCCESS); - else - return (isc__errno2result(errno)); -} - -isc_result_t -isc_file_rename(const char *oldname, const char *newname) { - int r; - - REQUIRE(oldname != NULL); - REQUIRE(newname != NULL); - - r = isc_file_safemovefile(oldname, newname); - if (r == 0) - return (ISC_R_SUCCESS); - else - return (isc__errno2result(errno)); -} - -isc_boolean_t -isc_file_exists(const char *pathname) { - struct stat stats; - - REQUIRE(pathname != NULL); - - return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS)); -} - -isc_boolean_t -isc_file_isabsolute(const char *filename) { - REQUIRE(filename != NULL); - /* - * Look for c:\path\... style, c:/path/... or \\computer\shar\path... - * the UNC style file specs - */ - if ((filename[0] == '\\') && (filename[1] == '\\')) - return (ISC_TRUE); - if (isalpha(filename[0]) && filename[1] == ':' && filename[2] == '\\') - return (ISC_TRUE); - if (isalpha(filename[0]) && filename[1] == ':' && filename[2] == '/') - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t -isc_file_iscurrentdir(const char *filename) { - REQUIRE(filename != NULL); - return (ISC_TF(filename[0] == '.' && filename[1] == '\0')); -} - -isc_boolean_t -isc_file_ischdiridempotent(const char *filename) { - REQUIRE(filename != NULL); - - if (isc_file_isabsolute(filename)) - return (ISC_TRUE); - if (filename[0] == '\\') - return (ISC_TRUE); - if (filename[0] == '/') - return (ISC_TRUE); - if (isc_file_iscurrentdir(filename)) - return (ISC_TRUE); - return (ISC_FALSE); -} - -const char * -isc_file_basename(const char *filename) { - char *s; - - REQUIRE(filename != NULL); - - s = strrchr(filename, '\\'); - if (s == NULL) - return (filename); - return (s + 1); -} - -isc_result_t -isc_file_progname(const char *filename, char *progname, size_t namelen) { - const char *s; - char *p; - size_t len; - - REQUIRE(filename != NULL); - REQUIRE(progname != NULL); - - /* - * Strip the path from the name - */ - s = isc_file_basename(filename); - if (s == NULL) { - return (ISC_R_NOSPACE); - } - - /* - * Strip any and all suffixes - */ - p = strchr(s, '.'); - if (p == NULL) { - if (namelen <= strlen(s)) - return (ISC_R_NOSPACE); - - strcpy(progname, s); - return (ISC_R_SUCCESS); - } - - /* - * Copy the result to the buffer - */ - len = p - s; - if (len >= namelen) - return (ISC_R_NOSPACE); - - strncpy(progname, s, len); - progname[len] = '\0'; - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_file_absolutepath(const char *filename, char *path, size_t pathlen) { - char *ptrname; - DWORD retval; - - REQUIRE(filename != NULL); - REQUIRE(path != NULL); - - retval = GetFullPathName(filename, pathlen, path, &ptrname); - - /* Something went wrong in getting the path */ - if (retval == 0) - return (ISC_R_NOTFOUND); - /* Caller needs to provide a larger buffer to contain the string */ - if (retval >= pathlen) - return (ISC_R_NOSPACE); - return (ISC_R_SUCCESS); -} diff --git a/usr.sbin/bind/lib/isc/win32/fsaccess.c b/usr.sbin/bind/lib/isc/win32/fsaccess.c deleted file mode 100644 index afd6b43f200..00000000000 --- a/usr.sbin/bind/lib/isc/win32/fsaccess.c +++ /dev/null @@ -1,109 +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. - */ - -/* $ISC: fsaccess.c,v 1.9 2001/07/09 21:06:07 gson Exp $ */ - -/* - * Note that Win32 does not have the concept of files having access - * and ownership bits. The FAT File system only has a readonly flag - * for everyone and that's all. NTFS uses ACL's which is a totally - * different concept of controlling access. - * - * This code needs to be revisited to set up proper access control for - * NTFS file systems. Nothing can be done for FAT file systems. - */ - -#include <config.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <io.h> -#include <errno.h> - -#include <isc/stat.h> - -#include "errno2result.h" - -/* - * The OS-independent part of the API is in lib/isc. - */ -#include "../fsaccess.c" - -isc_result_t -isc_fsaccess_set(const char *path, isc_fsaccess_t access) { - struct stat statb; - int mode; - isc_boolean_t is_dir = ISC_FALSE; - isc_fsaccess_t bits; - isc_result_t result; - - if (stat(path, &statb) != 0) - return (isc__errno2result(errno)); - - if ((statb.st_mode & S_IFDIR) != 0) - is_dir = ISC_TRUE; - else if ((statb.st_mode & S_IFREG) == 0) - return (ISC_R_INVALIDFILE); - - result = check_bad_bits(access, is_dir); - if (result != ISC_R_SUCCESS) - return (result); - - /* - * Done with checking bad bits. Set mode_t. - */ - mode = 0; - -#define SET_AND_CLEAR1(modebit) \ - if ((access & bits) != 0) { \ - mode |= modebit; \ - access &= ~bits; \ - } -#define SET_AND_CLEAR(user, group, other) \ - SET_AND_CLEAR1(user); \ - bits <<= STEP; \ - SET_AND_CLEAR1(group); \ - bits <<= STEP; \ - SET_AND_CLEAR1(other); - - bits = ISC_FSACCESS_READ | ISC_FSACCESS_LISTDIRECTORY; - - SET_AND_CLEAR(S_IRUSR, S_IRGRP, S_IROTH); - - bits = ISC_FSACCESS_WRITE | - ISC_FSACCESS_CREATECHILD | - ISC_FSACCESS_DELETECHILD; - - SET_AND_CLEAR(S_IWUSR, S_IWGRP, S_IWOTH); - -#ifdef notyet - /* - * WIN32 doesn't have the concept of execute bits. We leave this here - * for when we review this module. - */ - bits = ISC_FSACCESS_EXECUTE | - ISC_FSACCESS_ACCESSCHILD; - - SET_AND_CLEAR(S_IXUSR, S_IXGRP, S_IXOTH); -#endif - INSIST(access == 0); - - if (_chmod(path, mode) < 0) - return (isc__errno2result(errno)); - - return (ISC_R_SUCCESS); -} diff --git a/usr.sbin/bind/lib/isc/win32/include/Makefile.in b/usr.sbin/bind/lib/isc/win32/include/Makefile.in deleted file mode 100644 index efb3e97e4b3..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/Makefile.in +++ /dev/null @@ -1,25 +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. - -# $ISC: Makefile.in,v 1.6 2001/01/09 21:58:57 bwelling Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/Makefile.in b/usr.sbin/bind/lib/isc/win32/include/isc/Makefile.in deleted file mode 100644 index a9bb0cafc83..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/Makefile.in +++ /dev/null @@ -1,38 +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. - -# $ISC: Makefile.in,v 1.8 2001/01/09 21:58:58 bwelling Exp $ - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -HEADERS = dir.h int.h mutex.h net.h netdb.h once.h \ - stdtime.h thread.h time.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}\isc - -install:: installdirs - for i in $(HEADERS); do \ - $(INSTALL_DATA) $(srcdir)\$$i $(includedir)\isc ; \ - done diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/bind_registry.h b/usr.sbin/bind/lib/isc/win32/include/isc/bind_registry.h deleted file mode 100644 index eac8d0aaf8e..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/bind_registry.h +++ /dev/null @@ -1,46 +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. - */ - -/* $ISC: bind_registry.h,v 1.4 2001/07/09 21:34:41 gson Exp $ */ - -#ifndef ISC_BINDREGISTRY_H -#define ISC_BINDREGISTRY_H - -/* - * BIND makes use of the following Registry keys in various places, especially - * during startup and installation - */ - -#define BIND_SUBKEY "Software\\ISC\\BIND" -#define BIND_SESSION "CurrentSession" -#define BIND_SESSION_SUBKEY "Software\\ISC\\BIND\\CurrentSession" -#define BIND_UNINSTALL_SUBKEY \ - "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ISC BIND" - -#define EVENTLOG_APP_SUBKEY \ - "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application" -#define BIND_MESSAGE_SUBKEY \ - "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\named" -#define BIND_MESSAGE_NAME "named" - -#define BIND_CONFIGFILE 0 -#define BIND_DEBUGLEVEL 1 -#define BIND_QUERYLOG 2 -#define BIND_FOREGROUND 3 -#define BIND_PORT 4 - -#endif /* ISC_BINDREGISTRY_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/bindevt.h b/usr.sbin/bind/lib/isc/win32/include/isc/bindevt.h deleted file mode 100644 index ea4efbebcc8..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/bindevt.h +++ /dev/null @@ -1,91 +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. - */ - -/* $ISC: bindevt.h,v 1.3 2001/07/09 21:34:42 gson Exp $ */ - -#ifndef ISC_BINDEVT_H -#define ISC_BINDEVT_H 1 - -/* - * This is used for the event log for both logging the messages and - * later on by the event viewer when looking at the events - */ - -/* - * Values are 32 bit values layed out as follows: - * - * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+-+-+-----------------------+-------------------------------+ - * |Sev|C|R| Facility | Code | - * +---+-+-+-----------------------+-------------------------------+ - * - * where - * - * Sev - is the severity code - * - * 00 - Success - * 01 - Informational - * 10 - Warning - * 11 - Error - * - * C - is the Customer code flag - * - * R - is a reserved bit - * - * Facility - is the facility code - * - * Code - is the facility's status code - * - * - * Define the facility codes - */ - - -/* - * Define the severity codes - */ - - -/* - * MessageId: BIND_ERR_MSG - * - * MessageText: - * - * %1 - */ -#define BIND_ERR_MSG ((DWORD)0xC0000001L) - -/* - * MessageId: BIND_WARN_MSG - * - * MessageText: - * - * %1 - */ -#define BIND_WARN_MSG ((DWORD)0x80000002L) - -/* - * MessageId: BIND_INFO_MSG - * - * MessageText: - * - * %1 - */ -#define BIND_INFO_MSG ((DWORD)0x40000003L) - -#endif /* ISC_BINDEVT_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/condition.h b/usr.sbin/bind/lib/isc/win32/include/isc/condition.h deleted file mode 100644 index 9feb5d416c7..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/condition.h +++ /dev/null @@ -1,56 +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. - */ - -/* $ISC: condition.h,v 1.13 2001/01/09 21:58:59 bwelling Exp $ */ - -#ifndef ISC_CONDITION_H -#define ISC_CONDITION_H 1 - -#include <windows.h> - -#include <isc/lang.h> -#include <isc/mutex.h> -#include <isc/types.h> - -typedef struct isc_condition { - HANDLE events[2]; - unsigned int waiters; -} isc_condition_t; - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_condition_init(isc_condition_t *); - -isc_result_t -isc_condition_wait(isc_condition_t *, isc_mutex_t *); - -isc_result_t -isc_condition_signal(isc_condition_t *); - -isc_result_t -isc_condition_broadcast(isc_condition_t *); - -isc_result_t -isc_condition_destroy(isc_condition_t *); - -isc_result_t -isc_condition_waituntil(isc_condition_t *, isc_mutex_t *, isc_time_t *); - -ISC_LANG_ENDDECLS - -#endif /* ISC_CONDITION_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/dir.h b/usr.sbin/bind/lib/isc/win32/include/isc/dir.h deleted file mode 100644 index dd5e620deb8..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/dir.h +++ /dev/null @@ -1,93 +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. - */ - -/* $ISC: dir.h,v 1.11 2001/08/28 03:58:29 marka Exp $ */ - -/* Principal Authors: DCL */ - -#ifndef ISC_DIR_H -#define ISC_DIR_H 1 - -#include <windows.h> -#include <stdlib.h> - -#include <isc/lang.h> -#include <isc/boolean.h> -#include <isc/result.h> - -#define ISC_DIR_NAMEMAX _MAX_FNAME -#define ISC_DIR_PATHMAX _MAX_PATH - -typedef struct { - char name[ISC_DIR_NAMEMAX]; - unsigned int length; - WIN32_FIND_DATA find_data; -} isc_direntry_t; - -typedef struct { - unsigned int magic; - char dirname[ISC_DIR_PATHMAX]; - isc_direntry_t entry; - isc_boolean_t entry_filled; - HANDLE search_handle; -} isc_dir_t; - -ISC_LANG_BEGINDECLS - -void -isc_dir_init(isc_dir_t *dir); - -isc_result_t -isc_dir_open(isc_dir_t *dir, const char *dirname); - -isc_result_t -isc_dir_read(isc_dir_t *dir); - -isc_result_t -isc_dir_reset(isc_dir_t *dir); - -void -isc_dir_close(isc_dir_t *dir); - -isc_result_t -isc_dir_chdir(const char *dirname); - -isc_result_t -isc_dir_chroot(const char *dirname); - -isc_result_t -isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep); -/* - * Put the absolute name of the current directory into 'dirname', which is a - * buffer of at least 'length' characters. If 'end_sep' is true, end the - * string with the appropriate path separator, such that the final product - * could be concatenated with a relative pathname to make a valid pathname - * string. - */ - -isc_result_t -isc_dir_createunique(char *templet); -/* - * Use a templet (such as from isc_file_mktemplate()) to create a uniquely - * named, empty directory. The templet string is modified in place. - * If result == ISC_R_SUCCESS, it is the name of the directory that was - * created. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_DIR_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/int.h b/usr.sbin/bind/lib/isc/win32/include/isc/int.h deleted file mode 100644 index 6463d083116..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/int.h +++ /dev/null @@ -1,56 +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. - */ - -/* $ISC: int.h,v 1.10 2001/07/09 21:06:26 gson Exp $ */ - -#ifndef ISC_INT_H -#define ISC_INT_H 1 - -#define _INTEGRAL_MAX_BITS 64 -#include <limits.h> - -typedef __int8 isc_int8_t; -typedef unsigned __int8 isc_uint8_t; -typedef __int16 isc_int16_t; -typedef unsigned __int16 isc_uint16_t; -typedef __int32 isc_int32_t; -typedef unsigned __int32 isc_uint32_t; -typedef __int64 isc_int64_t; -typedef unsigned __int64 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 _I32_MIN -#define ISC_INT32_MAX _I32_MAX -#define ISC_UINT32_MAX _UI32_MAX - -#define ISC_INT64_MIN _I64_MIN -#define ISC_INT64_MAX _I64_MAX -#define ISC_UINT64_MAX _UI64_MAX - -#endif /* ISC_INT_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/ipv6.h b/usr.sbin/bind/lib/isc/win32/include/isc/ipv6.h deleted file mode 100644 index 5998ef96d68..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/ipv6.h +++ /dev/null @@ -1,103 +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. - */ - -/* $ISC: ipv6.h,v 1.9 2001/07/17 20:29:33 gson Exp $ */ - -#ifndef ISC_IPV6_H -#define ISC_IPV6_H 1 - -/***** - ***** Module Info - *****/ - -/* - * This file defines additional information necessary for IP v6 support - */ - -#ifndef AF_INET6 -#define AF_INET6 99 -#endif - -#ifndef PF_INET6 -#define PF_INET6 AF_INET6 -#endif - -#define s6_addr8 s6_addr -#define in6_addr in_addr6 - -#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 in_addr6 in6addr_any; -LIBISC_EXTERNAL_DATA extern const struct in_addr6 in6addr_loopback; - -#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 - -/* - * Unspecified - */ - -#define IN6_IS_ADDR_UNSPECIFIED(x) \ -*((u_long *)((x)->s6_addr) ) == 0 && \ -*((u_long *)((x)->s6_addr) + 1) == 0 && \ -*((u_long *)((x)->s6_addr) + 2) == 0 && \ -*((u_long *)((x)->s6_addr) + 3) == 1 \ -) - -/* - * Loopback - */ -#define IN6_IS_ADDR_LOOPBACK(x) (\ -*((u_long *)((x)->s6_addr) ) == 0 && \ -*((u_long *)((x)->s6_addr) + 1) == 0 && \ -*((u_long *)((x)->s6_addr) + 2) == 0 && \ -*((u_long *)((x)->s6_addr) + 3) == 1 \ -) - -/* - * IPv4 compatible - */ -#define IN6_IS_ADDR_V4COMPAT(x) (\ -*((u_long *)((x)->s6_addr) ) == 0 && \ -*((u_long *)((x)->s6_addr) + 1) == 0 && \ -*((u_long *)((x)->s6_addr) + 2) == 0 && \ -*((u_long *)((x)->s6_addr) + 3) != 0 && \ -*((u_long *)((x)->s6_addr) + 3) != htonl(1) \ -) - -/* - * Mapped - */ -#define IN6_IS_ADDR_V4MAPPED(x) (\ -*((u_long *)((x)->s6_addr) ) == 0 && \ -*((u_long *)((x)->s6_addr) + 1) == 0 && \ -*((u_long *)((x)->s6_addr) + 2) == htonl(0x0000ffff)) - -/* - * Multicast - */ -#define IN6_IS_ADDR_MULTICAST(a) \ - ((a)->s6_addr8[0] == 0xffU) - -ISC_LANG_ENDDECLS - -#endif /* ISC_IPV6_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/keyboard.h b/usr.sbin/bind/lib/isc/win32/include/isc/keyboard.h deleted file mode 100644 index fd70c964964..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/keyboard.h +++ /dev/null @@ -1,47 +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. - */ - -/* $ISC: keyboard.h,v 1.3 2001/07/17 20:29:34 gson Exp $ */ - -#ifndef ISC_KEYBOARD_H -#define ISC_KEYBOARD_H 1 - -#include <isc/lang.h> -#include <isc/result.h> - -ISC_LANG_BEGINDECLS - -typedef struct { - int fd; - isc_result_t result; -} isc_keyboard_t; - -isc_result_t -isc_keyboard_open(isc_keyboard_t *keyboard); - -isc_result_t -isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds); - -isc_result_t -isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); - -isc_boolean_t -isc_keyboard_canceled(isc_keyboard_t *keyboard); - -ISC_LANG_ENDDECLS - -#endif /* ISC_KEYBOARD_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/mutex.h b/usr.sbin/bind/lib/isc/win32/include/isc/mutex.h deleted file mode 100644 index c69e9712a75..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/mutex.h +++ /dev/null @@ -1,51 +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. - */ - -/* $ISC: mutex.h,v 1.16 2001/07/09 21:06:27 gson Exp $ */ - -#ifndef ISC_MUTEX_H -#define ISC_MUTEX_H 1 - -#include <isc/net.h> -#include <windows.h> - -#include <isc/result.h> - -typedef CRITICAL_SECTION isc_mutex_t; - -/* This definition is here since WINBASE.H omits it for some reason */ - -WINBASEAPI BOOL WINAPI -TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - -#define isc_mutex_init(mp) \ - (InitializeCriticalSection((mp)), ISC_R_SUCCESS) -#define isc_mutex_lock(mp) \ - (EnterCriticalSection((mp)), ISC_R_SUCCESS) -#define isc_mutex_unlock(mp) \ - (LeaveCriticalSection((mp)), ISC_R_SUCCESS) -#define isc_mutex_trylock(mp) \ - (TryEnterCriticalSection((mp)) ? ISC_R_SUCCESS : ISC_R_LOCKBUSY) -#define isc_mutex_destroy(mp) \ - (DeleteCriticalSection((mp)), ISC_R_SUCCESS) - -/* - * This is a placeholder for now since we are not keeping any mutex stats - */ -#define isc_mutex_stats(fp) - -#endif /* ISC_MUTEX_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/net.h b/usr.sbin/bind/lib/isc/win32/include/isc/net.h deleted file mode 100644 index e8b67f801e1..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/net.h +++ /dev/null @@ -1,258 +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. - */ - -/* $ISC: net.h,v 1.15 2001/07/16 03:52:13 mayer Exp $ */ - -#ifndef ISC_NET_H -#define ISC_NET_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 - *****/ - -/* - * 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_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> - -/* - * Because of some sort of problem in the MS header files, this cannot - * be simple "#include <winsock2.h>", because winsock2.h tries to include - * windows.h, which then generates an error out of mswsock.h. _You_ - * figure it out. - */ -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ -#endif - -#include <winsock2.h> - -#include <sys/types.h> - -#include <isc/lang.h> -#include <isc/types.h> - -#include <ws2tcpip.h> -#include <isc/ipv6.h> - -/* - * This is here because named client, interfacemgr.c, etc. use the name as - * a variable - */ -#undef interface -/* - * 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)) - -/* - * Fix the FD_SET and FD_CLR Macros to properly cast - */ -#undef FD_CLR -#define FD_CLR(fd, set) do { \ - u_int __i; \ - for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \ - if (((fd_set FAR *)(set))->fd_array[__i] == (SOCKET) fd) { \ - while (__i < ((fd_set FAR *)(set))->fd_count-1) { \ - ((fd_set FAR *)(set))->fd_array[__i] = \ - ((fd_set FAR *)(set))->fd_array[__i+1]; \ - __i++; \ - } \ - ((fd_set FAR *)(set))->fd_count--; \ - break; \ - } \ - } \ -} while (0) - -#undef FD_SET -#define FD_SET(fd, set) do { \ - u_int __i; \ - for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \ - if (((fd_set FAR *)(set))->fd_array[__i] == (SOCKET)(fd)) { \ - break; \ - } \ - } \ - if (__i == ((fd_set FAR *)(set))->fd_count) { \ - if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \ - ((fd_set FAR *)(set))->fd_array[__i] = (SOCKET)(fd); \ - ((fd_set FAR *)(set))->fd_count++; \ - } \ - } \ -} while (0) - -/* - * Windows Sockets errors redefined as regular Berkeley error constants. - * These are usually commented out in Windows NT to avoid conflicts with errno.h. - * Use the WSA constants instead. - */ - -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EINPROGRESS WSAEINPROGRESS -#define EALREADY WSAEALREADY -#define ENOTSOCK WSAENOTSOCK -#define EDESTADDRREQ WSAEDESTADDRREQ -#define EMSGSIZE WSAEMSGSIZE -#define EPROTOTYPE WSAEPROTOTYPE -#define ENOPROTOOPT WSAENOPROTOOPT -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -#define EOPNOTSUPP WSAEOPNOTSUPP -#define EPFNOSUPPORT WSAEPFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define EADDRINUSE WSAEADDRINUSE -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#define ENETDOWN WSAENETDOWN -#define ENETUNREACH WSAENETUNREACH -#define ENETRESET WSAENETRESET -#define ECONNABORTED WSAECONNABORTED -#define ECONNRESET WSAECONNRESET -#define ENOBUFS WSAENOBUFS -#define EISCONN WSAEISCONN -#define ENOTCONN WSAENOTCONN -#define ESHUTDOWN WSAESHUTDOWN -#define ETOOMANYREFS WSAETOOMANYREFS -#define ETIMEDOUT WSAETIMEDOUT -#define ECONNREFUSED WSAECONNREFUSED -#define ELOOP WSAELOOP -#define EHOSTDOWN WSAEHOSTDOWN -#define EHOSTUNREACH WSAEHOSTUNREACH -#define EPROCLIM WSAEPROCLIM -#define EUSERS WSAEUSERS -#define EDQUOT WSAEDQUOT -#define ESTALE WSAESTALE -#define EREMOTE WSAEREMOTE - - -/*** - *** 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_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_UNEXPECTED - */ - -#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); -#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/usr.sbin/bind/lib/isc/win32/include/isc/netdb.h b/usr.sbin/bind/lib/isc/win32/include/isc/netdb.h deleted file mode 100644 index acf7c33e35e..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/netdb.h +++ /dev/null @@ -1,54 +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. - */ - -/* $ISC: netdb.h,v 1.6 2001/01/09 21:59:05 bwelling Exp $ */ - -#ifndef ISC_NETDB_H -#define ISC_NETDB_H 1 - -/***** - ***** Module Info - *****/ - -/* - * Portable netdb.h support. - * - * This module is responsible for defining the get<x>by<y> APIs. - * - * MP: - * No impact. - * - * Reliability: - * No anticipated impact. - * - * Resources: - * N/A. - * - * Security: - * No anticipated impact. - * - * Standards: - * BSD API - */ - -/*** - *** Imports. - ***/ - -#include <isc/net.h> - -#endif /* ISC_NETDB_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/ntfile.h b/usr.sbin/bind/lib/isc/win32/include/isc/ntfile.h deleted file mode 100644 index 9af46370757..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/ntfile.h +++ /dev/null @@ -1,145 +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. - */ - -/* $ISC: ntfile.h,v 1.5 2001/07/16 03:52:14 mayer Exp $ */ - -#ifndef ISC_NTFILE_H -#define ISC_NTFILE_H 1 - -/* - * This file has been necessitated by the fact that the iov array is local - * to the module, so passing the FILE ptr to a file I/O function in a - * different module or DLL will cause the application to fail to find the - * I/O channel and the application will terminate. The standard file I/O - * functions are redefined to call these routines instead and there will - * be just the one iov to deal with. - */ - -/* - * Outside of lib isc we need to redefine these functions - * This is due to the way _iob is set up. - * liblwres should not use this. - */ - -#if !defined(LIBISC_EXPORTS) && !defined(LIBLWRES_EXPORTS) - -#undef fdopen -#undef getc - -#define fopen isc_ntfile_fopen -#define fclose isc_ntfile_fclose -#define fwrite isc_ntfile_fwrite -#define fread isc_ntfile_fread -#define fseek isc_ntfile_fseek -#define fflush isc_ntfile_flush -#define fsync isc_ntfile_sync -#define printf isc_ntfile_printf -#define fprintf isc_ntfile_fprintf -#define vfprintf isc_ntfile_vfprintf -#define getc isc_ntfile_getc -#define fgetc isc_ntfile_fgetc -#define fgets isc_ntfile_fgets -#define fputc isc_ntfile_fputc -#define fputs isc_ntfile_fputs -#define fgetpos isc_ntfile_fgetpos -#define freopen isc_ntfile_freopen -#define fdopen isc_ntfile_fdopen -#define open isc_ntfile_open -#define close isc_ntfile_close -#define read isc_ntfile_read -#define write isc_ntfile_write - -#undef stdin -#undef stdout -#undef stderr - -#define stdin isc_ntfile_getaddress(0) -#define stdout isc_ntfile_getaddress(1) -#define stderr isc_ntfile_getaddress(2) - -#endif - -FILE* -isc_ntfile_fopen(const char *filename, const char *mode); - -int -isc_ntfile_fclose(FILE *f); - -int -isc_ntfile_fseek(FILE *f, long offset, int whence); - -size_t -isc_ntfile_fread(void *ptr, size_t size, size_t nmemb, FILE *f); - -size_t -isc_ntfile_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f); - -int -isc_ntfile_flush(FILE *f); - -int -isc_ntfile_sync(FILE *f); - -FILE* -isc_ntfile_getaddress(int r); - -int -isc_ntfile_printf(const char *format, ...); - -int -isc_ntfile_fprintf(FILE *fp, const char *format, ...); - -int -isc_ntfile_vfprintf(FILE *, const char *, va_list); - -int -isc_ntfile_fputc(int iv, FILE *fp); - -int -isc_ntfile_fputs(const char *bf, FILE *fp); - -int -isc_ntfile_fgetc(FILE *fp); - -int -isc_ntfile_fgetpos(FILE *, fpos_t *pos); - -char * -isc_ntfile_fgets(char *ch, int r, FILE *fp); - -int -isc_ntfile_getc(FILE *fp); - -FILE * -isc_ntfile_freopen(const char *path, const char *mode, FILE *fp); - -FILE * -isc_ntfile_fdopen(int handle, const char *mode); - -int -isc_ntfile_open(const char *fn, int flags, ...); - -int -isc_ntfile_close(int fd); - -int -isc_ntfile_read(int fd, char *buf, int len); - -int -isc_ntfile_write(int fd, char *buf, int len); - -#endif /* ISC_NTFILE_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/ntpaths.h b/usr.sbin/bind/lib/isc/win32/include/isc/ntpaths.h deleted file mode 100644 index 1ba8eb40ffe..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/ntpaths.h +++ /dev/null @@ -1,71 +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. - */ - -/* $ISC: ntpaths.h,v 1.12.2.1 2001/09/04 19:36:33 gson Exp $ */ - -/* - * Windows-specific path definitions - * These routines are used to set up and return system-specific path - * information about the files enumerated in NtPaths - */ - -#ifndef ISC_NTPATHS_H -#define ISC_NTPATHS_H - -#include <isc/lang.h> - -/* - * Index of paths needed - */ -enum NtPaths { - NAMED_CONF_PATH, - LWRES_CONF_PATH, - RESOLV_CONF_PATH, - RNDC_CONF_PATH, - NAMED_PID_PATH, - LWRESD_PID_PATH, - LOCAL_STATE_DIR, - SYS_CONF_DIR, - RNDC_KEY_PATH -}; - -/* - * Define macros to get the path of the config files - */ -#define NAMED_CONFFILE isc_ntpaths_get(NAMED_CONF_PATH) -#define RNDC_CONFFILE isc_ntpaths_get(RNDC_CONF_PATH) -#define RNDC_KEYFILE isc_ntpaths_get(RNDC_KEY_PATH) -#define RESOLV_CONF isc_ntpaths_get(RESOLV_CONF_PATH) - - -/* - * Information about where the files are on disk - */ -#define NS_LOCALSTATEDIR "/dns/bin" -#define NS_SYSCONFDIR "/dns/etc" - -ISC_LANG_BEGINDECLS - -void -isc_ntpaths_init(void); - -char * -isc_ntpaths_get(int); - -ISC_LANG_ENDDECLS - -#endif /* ISC_NTPATHS_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/offset.h b/usr.sbin/bind/lib/isc/win32/include/isc/offset.h deleted file mode 100644 index 589a27e62ad..00000000000 --- a/usr.sbin/bind/lib/isc/win32/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. - */ - -/* $ISC: offset.h,v 1.2 2001/07/08 05:09:32 mayer 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/usr.sbin/bind/lib/isc/win32/include/isc/once.h b/usr.sbin/bind/lib/isc/win32/include/isc/once.h deleted file mode 100644 index 38a9827b982..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/once.h +++ /dev/null @@ -1,43 +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. - */ - -/* $ISC: once.h,v 1.6 2001/01/09 21:59:06 bwelling Exp $ */ - -#ifndef ISC_ONCE_H -#define ISC_ONCE_H 1 - -#include <isc/lang.h> -#include <isc/result.h> - -ISC_LANG_BEGINDECLS - -typedef struct { - int status; - int counter; -} isc_once_t; - -#define ISC_ONCE_INIT_NEEDED 0 -#define ISC_ONCE_INIT_DONE 1 - -#define ISC_ONCE_INIT { ISC_ONCE_INIT_NEEDED, 1 } - -isc_result_t -isc_once_do(isc_once_t *controller, void(*function)(void)); - -ISC_LANG_ENDDECLS - -#endif /* ISC_ONCE_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/platform.h b/usr.sbin/bind/lib/isc/win32/include/isc/platform.h deleted file mode 100644 index a4f23431291..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/platform.h +++ /dev/null @@ -1,82 +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. - */ - -/* $ISC: platform.h,v 1.5 2001/07/26 03:15:15 mayer Exp $ */ - -#ifndef ISC_PLATFORM_H -#define ISC_PLATFORM_H 1 - -/***** - ***** Platform-dependent defines. - *****/ - -#define ISC_PLATFORM_USETHREADS - -/*** - *** Network. - ***/ - -#define ISC_PLATFORM_HAVEIPV6 -#define ISC_PLATFORM_NEEDPORTT -#undef MSG_TRUNC -#define ISC_PLATFORM_NEEDNTOP -#define ISC_PLATFORM_NEEDPTON -#define ISC_PLATFORM_NEEDATON - -#define ISC_PLATFORM_QUADFORMAT "I64" - -#define ISC_PLATFORM_NEEDSTRSEP - -/* - * Used to control how extern data is linked; needed for Win32 platforms. - */ -#define ISC_PLATFORM_USEDECLSPEC 1 - -/* - * Define this here for now as winsock2.h defines h_errno - * and we don't want to redeclare it. - */ -#define ISC_PLATFORM_NONSTDHERRNO - /* - * Set up a macro for importing and exporting from the DLL - */ - -#ifdef LIBISC_EXPORTS -#define LIBISC_EXTERNAL_DATA __declspec( dllexport ) -#else -#define LIBISC_EXTERNAL_DATA __declspec( dllimport ) -#endif - -#ifdef LIBISCCFG_EXPORTS -#define LIBISCCFG_EXTERNAL_DATA __declspec( dllexport ) -#else -#define LIBISCCFG_EXTERNAL_DATA __declspec( dllimport ) -#endif - -#ifdef LIBISCCC_EXPORTS -#define LIBISCCC_EXTERNAL_DATA __declspec( dllexport ) -#else -#define LIBISCCC_EXTERNAL_DATA __declspec( dllimport ) -#endif - -#ifdef LIBDNS_EXPORTS -#define LIBDNS_EXTERNAL_DATA __declspec( dllexport ) -#else -#define LIBDNS_EXTERNAL_DATA __declspec( dllimport ) -#endif - -#endif /* ISC_PLATFORM_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/stat.h b/usr.sbin/bind/lib/isc/win32/include/isc/stat.h deleted file mode 100644 index a62d1693e00..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/stat.h +++ /dev/null @@ -1,43 +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. - */ - -/* $ISC: stat.h,v 1.3 2001/07/09 21:06:30 gson Exp $ */ - -#ifndef ISC_STAT_H -#define ISC_STAT_H 1 - -#include <sys/stat.h> - -/* open() under unix allows setting of read/write permissions - * at the owner, group and other levels. These don't exist in NT - * We'll just map them all to the NT equivalent - */ - -#define S_IREAD _S_IREAD /* read permission, owner */ -#define S_IWRITE _S_IWRITE /* write permission, owner */ -#define S_IRUSR _S_IREAD /* Owner read permission */ -#define S_IWUSR _S_IWRITE /* Owner write permission */ -#define S_IRGRP _S_IREAD /* Group read permission */ -#define S_IWGRP _S_IWRITE /* Group write permission */ -#define S_IROTH _S_IREAD /* Other read permission */ -#define S_IWOTH _S_IWRITE /* Other write permission */ - -#ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) -#endif - -#endif /* ISC_STAT_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/stdtime.h b/usr.sbin/bind/lib/isc/win32/include/isc/stdtime.h deleted file mode 100644 index ad20e3d8e0d..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/stdtime.h +++ /dev/null @@ -1,47 +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. - */ - -/* $ISC: stdtime.h,v 1.7 2001/01/09 21:59:07 bwelling Exp $ */ - -#ifndef ISC_STDTIME_H -#define ISC_STDTIME_H 1 - -#include <isc/lang.h> -#include <isc/int.h> - -/* - * It's public information that 'isc_stdtime_t' is an unsigned integral type. - * Applications that want maximum portability should not assume anything - * about its size. - */ -typedef isc_uint32_t isc_stdtime_t; - -ISC_LANG_BEGINDECLS - -void -isc_stdtime_get(isc_stdtime_t *t); -/* - * Set 't' to the number of seconds since 00:00:00 UTC, January 1, 1970. - * - * Requires: - * - * 't' is a valid pointer. - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_STDTIME_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/strerror.h b/usr.sbin/bind/lib/isc/win32/include/isc/strerror.h deleted file mode 100644 index 6d92e706836..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/strerror.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 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. - */ - -/* $ISC: strerror.h,v 1.2.2.2 2002/03/26 00:55:12 marka 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/usr.sbin/bind/lib/isc/win32/include/isc/syslog.h b/usr.sbin/bind/lib/isc/win32/include/isc/syslog.h deleted file mode 100644 index 60876c8620a..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/syslog.h +++ /dev/null @@ -1,45 +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. - */ - -/* $ISC: syslog.h,v 1.2 2001/08/20 23:56:25 marka Exp $ */ - -#ifndef ISC_SYSLOG_H -#define ISC_SYSLOG_H 1 - -#include <isc/lang.h> -#include <isc/types.h> - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_syslog_facilityfromstring(const char *str, int *facilityp); -/* - * Convert 'str' to the appropriate syslog facility constant. - * - * Requires: - * - * 'str' is not NULL - * 'facilityp' is not NULL - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_NOTFOUND - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_SYSLOG_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/thread.h b/usr.sbin/bind/lib/isc/win32/include/isc/thread.h deleted file mode 100644 index 2ccd7746ae6..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/thread.h +++ /dev/null @@ -1,87 +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. - */ - -/* $ISC: thread.h,v 1.15 2001/07/08 05:09:35 mayer Exp $ */ - -#ifndef ISC_THREAD_H -#define ISC_THREAD_H 1 - -#include <windows.h> - -#include <isc/lang.h> -#include <isc/result.h> - -/* - * Inlines to help with wait retrun checking - */ - -/* check handle for NULL and INVALID_HANDLE */ -inline BOOL IsValidHandle( HANDLE hHandle) { - return ((hHandle != NULL) && (hHandle != INVALID_HANDLE_VALUE)); -} - -/* validate wait return codes... */ -inline BOOL WaitSucceeded( DWORD dwWaitResult, DWORD dwHandleCount) { - return ((dwWaitResult >= WAIT_OBJECT_0) && - (dwWaitResult < WAIT_OBJECT_0 + dwHandleCount)); -} - -inline BOOL WaitAbandoned( DWORD dwWaitResult, DWORD dwHandleCount) { - return ((dwWaitResult >= WAIT_ABANDONED_0) && - (dwWaitResult < WAIT_ABANDONED_0 + dwHandleCount)); -} - -inline BOOL WaitTimeout( DWORD dwWaitResult) { - return (dwWaitResult == WAIT_TIMEOUT); -} - -inline BOOL WaitFailed( DWORD dwWaitResult) { - return (dwWaitResult == WAIT_FAILED); -} - -/* compute object indices for waits... */ -inline DWORD WaitSucceededIndex( DWORD dwWaitResult) { - return (dwWaitResult - WAIT_OBJECT_0); -} - -inline DWORD WaitAbandonedIndex( DWORD dwWaitResult) { - return (dwWaitResult - WAIT_ABANDONED_0); -} - - - -typedef HANDLE isc_thread_t; -typedef unsigned int isc_threadresult_t; -typedef void * isc_threadarg_t; -typedef isc_threadresult_t (WINAPI *isc_threadfunc_t)(isc_threadarg_t); - -#define isc_thread_self (unsigned long)GetCurrentThreadId - -ISC_LANG_BEGINDECLS - -isc_result_t -isc_thread_create(isc_threadfunc_t, isc_threadarg_t, isc_thread_t *); - -isc_result_t -isc_thread_join(isc_thread_t, isc_threadresult_t *); - -void -isc_thread_setconcurrency(unsigned int level); - -ISC_LANG_ENDDECLS - -#endif /* ISC_THREAD_H */ diff --git a/usr.sbin/bind/lib/isc/win32/include/isc/time.h b/usr.sbin/bind/lib/isc/win32/include/isc/time.h deleted file mode 100644 index aab48f01b4f..00000000000 --- a/usr.sbin/bind/lib/isc/win32/include/isc/time.h +++ /dev/null @@ -1,248 +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. - */ - -/* $ISC: time.h,v 1.19.2.1 2001/09/05 00:38:13 gson Exp $ */ - -#ifndef ISC_TIME_H -#define ISC_TIME_H 1 - -#include <windows.h> - -#include <isc/lang.h> -#include <isc/types.h> - -/*** - *** Intervals - ***/ - -/* - * The contents of this structure are private, and MUST NOT be accessed - * directly by callers. - * - * The contents are exposed only to allow callers to avoid dynamic allocation. - */ -struct isc_interval { - isc_int64_t interval; -}; - -extern isc_interval_t *isc_interval_zero; - -ISC_LANG_BEGINDECLS - -void -isc_interval_set(isc_interval_t *i, - unsigned int seconds, unsigned int nanoseconds); -/* - * Set 'i' to a value representing an interval of 'seconds' seconds and - * 'nanoseconds' nanoseconds, suitable for use in isc_time_add() and - * isc_time_subtract(). - * - * Requires: - * - * 't' is a valid pointer. - * nanoseconds < 1000000000. - */ - -isc_boolean_t -isc_interval_iszero(isc_interval_t *i); -/* - * Returns ISC_TRUE iff. 'i' is the zero interval. - * - * Requires: - * - * 'i' is a valid pointer. - */ - -/*** - *** Absolute Times - ***/ - -/* - * The contents of this structure are private, and MUST NOT be accessed - * directly by callers. - * - * The contents are exposed only to allow callers to avoid dynamic allocation. - */ - -struct isc_time { - FILETIME absolute; -}; - -extern isc_time_t *isc_time_epoch; - -void -isc_time_settoepoch(isc_time_t *t); -/* - * Set 't' to the time of the epoch. - * - * Notes: - * The date of the epoch is platform-dependent. - * - * Requires: - * - * 't' is a valid pointer. - */ - -isc_boolean_t -isc_time_isepoch(isc_time_t *t); -/* - * Returns ISC_TRUE iff. 't' is the epoch ("time zero"). - * - * Requires: - * - * 't' is a valid pointer. - */ - -isc_result_t -isc_time_now(isc_time_t *t); -/* - * Set 't' to the current absolute time. - * - * Requires: - * - * 't' is a valid pointer. - * - * Returns: - * - * Success - * Unexpected error - * Getting the time from the system failed. - * Out of range - * The time from the system is too large to be represented - * in the current definition of isc_time_t. - */ - -isc_result_t -isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i); -/* - * Set *t to the current absolute time + i. - * - * Note: - * This call is equivalent to: - * - * isc_time_now(t); - * isc_time_add(t, i, t); - * - * Requires: - * - * 't' and 'i' are valid pointers. - * - * Returns: - * - * Success - * Unexpected error - * Getting the time from the system failed. - * Out of range - * The interval added to the time from the system is too large to - * be represented in the current definition of isc_time_t. - */ - -int -isc_time_compare(isc_time_t *t1, isc_time_t *t2); -/* - * Compare the times referenced by 't1' and 't2' - * - * Requires: - * - * 't1' and 't2' are valid pointers. - * - * Returns: - * - * -1 t1 < t2 (comparing times, not pointers) - * 0 t1 = t2 - * 1 t1 > t2 - */ - -isc_result_t -isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result); -/* - * Add 'i' to 't', storing the result in 'result'. - * - * Requires: - * - * 't', 'i', and 'result' are valid pointers. - * - * Returns: - * Success - * Out of range - * The interval added to the time is too large to - * be represented in the current definition of isc_time_t. - */ - -isc_result_t -isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result); -/* - * Subtract 'i' from 't', storing the result in 'result'. - * - * Requires: - * - * 't', 'i', and 'result' are valid pointers. - * - * Returns: - * Success - * Out of range - * The interval is larger than the time since the epoch. - */ - -isc_uint64_t -isc_time_microdiff(isc_time_t *t1, isc_time_t *t2); -/* - * Find the difference in milliseconds between time t1 and time t2. - * t2 is the subtrahend of t1; ie, difference = t1 - t2. - * - * Requires: - * - * 't1' and 't2' are valid pointers. - * - * Returns: - * The difference of t1 - t2, or 0 if t1 <= t2. - */ - -isc_uint32_t -isc_time_nanoseconds(isc_time_t *t); -/* - * Return the number of nanoseconds stored in a time structure. - * - * Notes: - * This is the number of nanoseconds in excess of the the number - * of seconds since the epoch; it will always be less than one - * full second. - * - * Requires: - * 't' is a valid pointer. - * - * Ensures: - * The returned value is less than 1*10^9. - */ - -void -isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len); -/* - * Format the time 't' into the buffer 'buf' of length 'len', - * using a format like "Aug 30 04:06:47.997" and the local time zone. - * If the text does not fit in the buffer, the result is indeterminate, - * but is always guaranteed to be null terminated. - * - * Requires: - * 'len' > 0 - * 'buf' points to an array of at least len chars - * - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_TIME_H */ diff --git a/usr.sbin/bind/lib/isc/win32/interfaceiter.c b/usr.sbin/bind/lib/isc/win32/interfaceiter.c deleted file mode 100644 index 9c373c8165d..00000000000 --- a/usr.sbin/bind/lib/isc/win32/interfaceiter.c +++ /dev/null @@ -1,377 +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. - */ - -/* $ISC: interfaceiter.c,v 1.4 2001/07/17 20:29:27 gson Exp $ */ - -/* - * Note that this code will need to be revisited to support IPv6 Interfaces. - * For now we just iterate through IPv4 interfaces. - */ - -#include <config.h> -#include <winsock2.h> -#include <ws2tcpip.h> -#include <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> - -#include <isc/interfaceiter.h> -#include <isc/mem.h> -#include <isc/result.h> -#include <isc/string.h> -#include <isc/types.h> -#include <isc/util.h> -#include "errno2result.h" - -/* Common utility functions */ - -/* - * Extract the network address part from a "struct sockaddr". - * - * The address family is given explicity - * instead of using src->sa_family, because the latter does not work - * for copying a network mask obtained by SIOCGIFNETMASK (it does - * not have a valid address family). - */ - - -#define IFITER_MAGIC 0x49464954U /* IFIT. */ -#define VALID_IFITER(t) ((t) != NULL && (t)->magic == IFITER_MAGIC) - -struct isc_interfaceiter { - unsigned int magic; /* Magic number. */ - isc_mem_t *mctx; - int socket; - INTERFACE_INFO IFData; /* Current Interface Info */ - int numIF; /* Current Interface count */ - int totalIF; /* Total Number - of Interfaces */ - INTERFACE_INFO *buf; /* Buffer for WSAIoctl data. */ - unsigned int bufsize; /* Bytes allocated. */ - INTERFACE_INFO *pos; /* Current offset in IF List */ - isc_interface_t current; /* Current interface data. */ - isc_result_t result; /* Last result code. */ -}; - - -/* - * Size of buffer for SIO_GET_INTERFACE_LIST, in number of interfaces. - * We assume no sane system will have more than than 1K of IP addresses on - * all of its adapters. - */ -#define IFCONF_SIZE_INITIAL 16 -#define IFCONF_SIZE_INCREMENT 64 -#define IFCONF_SIZE_MAX 1040 - -static void -get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) { - dst->family = family; - switch (family) { - case AF_INET: - memcpy(&dst->type.in, - &((struct sockaddr_in *) src)->sin_addr, - sizeof(struct in_addr)); - break; - case AF_INET6: - memcpy(&dst->type.in6, - &((struct sockaddr_in6 *) src)->sin6_addr, - sizeof(struct in6_addr)); - break; - default: - INSIST(0); - break; - } -} - -isc_result_t -isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { - isc_interfaceiter_t *iter; - isc_result_t result; - int error; - unsigned long bytesReturned = 0; - - REQUIRE(mctx != NULL); - REQUIRE(iterp != NULL); - REQUIRE(*iterp == NULL); - - iter = isc_mem_get(mctx, sizeof(*iter)); - if (iter == NULL) - return (ISC_R_NOMEMORY); - - iter->mctx = mctx; - iter->buf = NULL; - - /* - * Create an unbound datagram socket to do the - * SIO_GET_INTERFACE_LIST WSAIoctl on. - */ - if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "making interface scan socket: %s", - strerror(errno)); - result = ISC_R_UNEXPECTED; - goto socket_failure; - } - - /* - * Get the interface configuration, allocating more memory if - * necessary. - */ - iter->bufsize = IFCONF_SIZE_INITIAL*sizeof(INTERFACE_INFO); - - for (;;) { - iter->buf = isc_mem_get(mctx, iter->bufsize); - if (iter->buf == NULL) { - result = ISC_R_NOMEMORY; - goto alloc_failure; - } - - if (WSAIoctl(iter->socket, SIO_GET_INTERFACE_LIST, - 0, 0, iter->buf, iter->bufsize, - &bytesReturned, 0, 0) - == SOCKET_ERROR) - { - error = WSAGetLastError(); - if (error != WSAEFAULT && error != WSAENOBUFS) { - errno = error; - UNEXPECTED_ERROR(__FILE__, __LINE__, - "get interface configuration: %s", - NTstrerror(error)); - result = ISC_R_UNEXPECTED; - goto ioctl_failure; - } - /* - * EINVAL. Retry with a bigger buffer. - */ - } else { - /* - * The WSAIoctl succeeded. - * If the number of the returned bytes is the same - * as the buffer size, we will grow it just in - * case and retry. - */ - if (bytesReturned > 0 && - (bytesReturned < iter->bufsize)) - break; - } - if (iter->bufsize >= IFCONF_SIZE_MAX*sizeof(INTERFACE_INFO)) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "get interface configuration: " - "maximum buffer size exceeded"); - result = ISC_R_UNEXPECTED; - goto ioctl_failure; - } - isc_mem_put(mctx, iter->buf, iter->bufsize); - - iter->bufsize += IFCONF_SIZE_INCREMENT * - sizeof(INTERFACE_INFO); - } - - /* - * A newly created iterator has an undefined position - * until isc_interfaceiter_first() is called. - */ - iter->pos = NULL; - iter->result = ISC_R_FAILURE; - iter->numIF = 0; - iter->totalIF = bytesReturned/sizeof(INTERFACE_INFO); - - - iter->magic = IFITER_MAGIC; - *iterp = iter; - /* We don't need the socket any more, so close it */ - closesocket(iter->socket); - return (ISC_R_SUCCESS); - - ioctl_failure: - isc_mem_put(mctx, iter->buf, iter->bufsize); - - alloc_failure: - (void) closesocket(iter->socket); - - socket_failure: - isc_mem_put(mctx, iter, sizeof *iter); - return (result); -} - -/* - * Get information about the current interface to iter->current. - * If successful, return ISC_R_SUCCESS. - * If the interface has an unsupported address family, or if - * some operation on it fails, return ISC_R_IGNORE to make - * the higher-level iterator code ignore it. - */ - -static isc_result_t -internal_current(isc_interfaceiter_t *iter, int family) { - BOOL ifNamed = FALSE; - unsigned long flags; - - REQUIRE(VALID_IFITER(iter)); - REQUIRE(iter->numIF >= 0); - - memset(&iter->current, 0, sizeof(iter->current)); - iter->current.af = family; - - get_addr(family, &iter->current.address, - (struct sockaddr *)&(iter->IFData.iiAddress)); - - /* - * Get interface flags. - */ - - iter->current.flags = 0; - flags = iter->IFData.iiFlags; - - if ((flags & IFF_UP) != 0) - iter->current.flags |= INTERFACE_F_UP; - - if ((flags & IFF_POINTTOPOINT) != 0) { - iter->current.flags |= INTERFACE_F_POINTTOPOINT; - sprintf(iter->current.name, "PPP Interface %d", iter->numIF); - ifNamed = TRUE; - } - - if ((flags & IFF_LOOPBACK) != 0) { - iter->current.flags |= INTERFACE_F_LOOPBACK; - sprintf(iter->current.name, "Loopback Interface %d", - iter->numIF); - ifNamed = TRUE; - } - - /* - * If the interface is point-to-point, get the destination address. - */ - if ((iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0) { - get_addr(family, &iter->current.dstaddress, - (struct sockaddr *)&(iter->IFData.iiBroadcastAddress)); - } - - if (ifNamed == FALSE) - sprintf(iter->current.name, - "TCP/IP Interface %d", iter->numIF); - - /* - * Get the network mask. - */ - switch (family) { - case AF_INET: - get_addr(family, &iter->current.netmask, - (struct sockaddr *)&(iter->IFData.iiNetmask)); - break; - case AF_INET6: - break; - } - - return (ISC_R_SUCCESS); -} - -/* - * Step the iterator to the next interface. Unlike - * isc_interfaceiter_next(), this may leave the iterator - * positioned on an interface that will ultimately - * be ignored. Return ISC_R_NOMORE if there are no more - * interfaces, otherwise ISC_R_SUCCESS. - */ -static isc_result_t -internal_next(isc_interfaceiter_t *iter) { - if (iter->numIF >= iter->totalIF) - return (ISC_R_NOMORE); - - /* - * The first one needs to be set up to point to the last - * Element of the array. Go to the end and back up - * Microsoft's implementation is peculiar for returning - * the list in reverse order - */ - - if (iter->numIF == 0) - iter->pos = (INTERFACE_INFO *)(iter->buf + (iter->totalIF)); - - iter->pos--; - if (&(iter->pos) < &(iter->buf)) - return (ISC_R_NOMORE); - - memset(&(iter->IFData), 0, sizeof(INTERFACE_INFO)); - memcpy(&(iter->IFData), iter->pos, sizeof(INTERFACE_INFO)); - iter->numIF++; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_interfaceiter_current(isc_interfaceiter_t *iter, - isc_interface_t *ifdata) { - REQUIRE(iter->result == ISC_R_SUCCESS); - memcpy(ifdata, &iter->current, sizeof(*ifdata)); - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_interfaceiter_first(isc_interfaceiter_t *iter) { - isc_result_t result; - - REQUIRE(VALID_IFITER(iter)); - - iter->numIF = 0; - for (;;) { - result = internal_next(iter); - if (result != ISC_R_SUCCESS) - break; - result = internal_current(iter, AF_INET); - if (result != ISC_R_IGNORE) - break; - } - iter->result = result; - return (result); -} - -isc_result_t -isc_interfaceiter_next(isc_interfaceiter_t *iter) { - isc_result_t result; - - REQUIRE(VALID_IFITER(iter)); - REQUIRE(iter->result == ISC_R_SUCCESS); - - for (;;) { - result = internal_next(iter); - if (result != ISC_R_SUCCESS) - break; - result = internal_current(iter,AF_INET); - if (result != ISC_R_IGNORE) - break; - } - iter->result = result; - return (result); -} - -void -isc_interfaceiter_destroy(isc_interfaceiter_t **iterp) { - isc_interfaceiter_t *iter; - REQUIRE(iterp != NULL); - iter = *iterp; - REQUIRE(VALID_IFITER(iter)); - - isc_mem_put(iter->mctx, iter->buf, iter->bufsize); - - iter->magic = 0; - isc_mem_put(iter->mctx, iter, sizeof *iter); - *iterp = NULL; -} - diff --git a/usr.sbin/bind/lib/isc/win32/ipv6.c b/usr.sbin/bind/lib/isc/win32/ipv6.c deleted file mode 100644 index a7719371134..00000000000 --- a/usr.sbin/bind/lib/isc/win32/ipv6.c +++ /dev/null @@ -1,29 +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. - */ - -/* $ISC: ipv6.c,v 1.4 2001/07/12 05:58:27 mayer Exp $ */ - -#define off_t _off_t - -#include <isc/net.h> -#include <isc/platform.h> - -LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_any = - IN6ADDR_ANY_INIT; - -LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_loopback = - IN6ADDR_LOOPBACK_INIT; diff --git a/usr.sbin/bind/lib/isc/win32/keyboard.c b/usr.sbin/bind/lib/isc/win32/keyboard.c deleted file mode 100644 index 3add3ff009a..00000000000 --- a/usr.sbin/bind/lib/isc/win32/keyboard.c +++ /dev/null @@ -1,89 +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. - */ - -/* $ISC: keyboard.c,v 1.4 2001/07/17 20:29:28 gson Exp $ */ - -#include <config.h> - -#include <sys/types.h> - -#include <windows.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <unistd.h> -#include <fcntl.h> - -#include <io.h> - -#include <isc/keyboard.h> -#include <isc/util.h> - -isc_result_t -isc_keyboard_open(isc_keyboard_t *keyboard) { - int fd; - - REQUIRE(keyboard != NULL); - - fd = _fileno(stdin); - if (fd < 0) - return (ISC_R_IOERROR); - - keyboard->fd = fd; - - keyboard->result = ISC_R_SUCCESS; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) { - REQUIRE(keyboard != NULL); - - if (sleeptime > 0 && keyboard->result != ISC_R_CANCELED) - (void)Sleep(sleeptime*1000); - - keyboard->fd = -1; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) { - ssize_t cc; - unsigned char c; - - REQUIRE(keyboard != NULL); - REQUIRE(cp != NULL); - - cc = read(keyboard->fd, &c, 1); - if (cc < 0) { - keyboard->result = ISC_R_IOERROR; - return (keyboard->result); - } - - *cp = c; - - return (ISC_R_SUCCESS); -} - -isc_boolean_t -isc_keyboard_canceled(isc_keyboard_t *keyboard) { - return (ISC_TF(keyboard->result == ISC_R_CANCELED)); -} - diff --git a/usr.sbin/bind/lib/isc/win32/libisc.def b/usr.sbin/bind/lib/isc/win32/libisc.def deleted file mode 100644 index f0bbf5d4811..00000000000 --- a/usr.sbin/bind/lib/isc/win32/libisc.def +++ /dev/null @@ -1,442 +0,0 @@ -LIBRARY libisc - -; Exported Functions -EXPORTS - -isc_assertion_setcallback -isc_assertion_typetotext -isc_base64_totext -isc_base64_decodestring -isc_base64_tobuffer -isc_bitstring_init -isc_bitstring_invalidate -isc_bitstring_copy -isc_buffer_allocate -isc_buffer_free -isc__buffer_init -isc__buffer_invalidate -isc__buffer_region -isc__buffer_usedregion -isc__buffer_availableregion -isc__buffer_add -isc__buffer_subtract -isc__buffer_clear -isc__buffer_consumedregion -isc__buffer_remainingregion -isc__buffer_activeregion -isc__buffer_setactive -isc__buffer_first -isc__buffer_forward -isc__buffer_back -isc_buffer_compact -isc_buffer_getuint8 -isc__buffer_putuint8 -isc_buffer_getuint16 -isc__buffer_putuint16 -isc_buffer_getuint32 -isc__buffer_putuint32 -isc__buffer_putmem -isc__buffer_putstr -isc_buffer_copyregion -isc_bufferlist_usedcount -isc_bufferlist_availablecount -isc_commandline_parse - - -isc_entropy_create -isc_entropy_attach -isc_entropy_detach -isc_entropy_createfilesource -isc_entropy_destroysource -isc_entropy_createsamplesource -isc_entropy_createcallbacksource -isc_entropy_stopcallbacksources -isc_entropy_addcallbacksample -isc_entropy_addsample -isc_entropy_getdata -isc_entropy_putdata -isc_entropy_stats -isc_entropy_usebestsource -isc_error_setunexpected -isc_error_setfatal -isc_error_unexpected -isc_error_fatal -isc_error_runtimecheck -isc_event_allocate -isc_event_free -isc_file_settime -isc_file_getmodtime -isc_file_mktemplate -isc_file_openunique -isc_file_remove -isc_file_rename -isc_file_exists -isc_file_ischdiridempotent -isc_file_isabsolute -isc_file_iscurrentdir -isc_file_template -isc_file_renameunique -isc_file_basename -isc_file_progname -isc_file_safemovefile -isc_file_absolutepath -isc_fsaccess_add -isc_fsaccess_remove -isc_fsaccess_set -isc_hex_totext -isc_hex_decodestring -isc_hex_tobuffer -isc_hmacmd5_init -isc_hmacmd5_invalidate -isc_hmacmd5_update -isc_hmacmd5_sign -isc_hmacmd5_verify -isc_interfaceiter_create -isc_interfaceiter_first -isc_interfaceiter_current -isc_interfaceiter_next -isc_interfaceiter_destroy -isc_lex_setcomments -isc_lex_create -isc_lex_destroy -isc_lex_getcomments -isc_lex_setcomments -isc_lex_getspecials -isc_lex_setspecials -isc_lex_openfile -isc_lex_openstream -isc_lex_openbuffer -isc_lex_close -isc_lex_gettoken -isc_lex_getmastertoken -isc_lex_ungettoken -isc_lex_getlasttokentext -isc_lex_getsourcename -isc_lex_getsourceline -isc_lex_isfile -isc_lfsr_init -isc_lfsr_generate -isc_lfsr_skip -isc_lfsr_generate32 -isc_lib_initmsgcat -isc_log_createchannel -isc_log_createchannel -isc_log_create -isc_logconfig_create -isc_logconfig_get -isc_logconfig_use -isc_log_destroy -isc_logconfig_destroy -isc_log_registercategories -isc_log_registermodules -isc_log_createchannel -isc_log_usechannel -isc_log_write -isc_log_vwrite -isc_log_write1 -isc_log_vwrite1 -isc_log_iwrite -isc_log_ivwrite -isc_log_iwrite1 -isc_log_ivwrite1 -isc_log_setdebuglevel -isc_log_getdebuglevel -isc_log_wouldlog -isc_log_write -isc_log_setduplicateinterval -isc_log_getduplicateinterval -isc_log_settag -isc_log_gettag -isc_log_opensyslog -isc_log_closefilelogs -isc_log_categorybyname -isc_log_modulebyname -isc_log_setcontext -isc_md5_init -isc_md5_invalidate -isc_md5_update -isc_md5_final -isc_mem_attach -isc_mem_detach -isc_mem_detach -isc_mem_create -isc_mem_createx -isc_mem_attach -isc_mem_detach -isc_mem_destroy -isc_mem_ondestroy -isc_mem_stats -isc_mem_setdestroycheck -isc_mem_setquota -isc_mem_getquota -isc_mem_inuse -isc_mem_setwater -isc_mempool_create -isc_mempool_destroy -isc_mempool_setname -isc_mempool_associatelock -isc_mempool_getfreemax -isc_mempool_setfreemax -isc_mempool_getfreecount -isc_mempool_getmaxalloc -isc_mempool_setmaxalloc -isc_mempool_getallocated -isc_mempool_getfillcount -isc_mempool_setfillcount -isc__mem_get -isc__mem_putanddetach -isc__mem_put -isc__mem_allocate -isc__mem_free -isc__mem_strdup -isc__mempool_get -isc__mempool_put -isc_msgcat_open -isc_msgcat_close -isc_msgcat_get -isc_mutexblock_init -isc_mutexblock_destroy -isc_netaddr_equal -isc_netaddr_eqprefix -isc_netaddr_masktoprefixlen -isc_netaddr_totext -isc_netaddr_format -isc_netaddr_fromsockaddr -isc_netaddr_fromin -isc_netaddr_fromin6 -isc_netaddr_any -isc_netaddr_any6 -isc_netaddr_ismulticast -isc_netaddr_fromv4mapped -isc_ntpaths_init -isc_ntpaths_get -isc_ondestroy_init -isc_ondestroy_register -isc_ondestroy_notify -isc_task_sendanddetach -isc_os_ncpus -isc_quota_init -isc_quota_destroy -isc_quota_reserve -isc_quota_release -isc_quota_attach -isc_quota_detach -isc_random_seed -isc_random_get -isc_random_jitter -isc_ratelimiter_create -isc_ratelimiter_setinterval -isc_ratelimiter_setpertic -isc_ratelimiter_enqueue -isc_ratelimiter_shutdown -isc_ratelimiter_attach -isc_ratelimiter_detach -isc_resource_setlimit -isc_resource_getlimit -isc_result_totext -isc_result_register -isc_rwlock_init -isc_rwlock_lock -isc_rwlock_trylock -isc_rwlock_unlock -isc_rwlock_destroy -isc_serial_lt -isc_serial_gt -isc_serial_le -isc_serial_ge -isc_serial_eq -isc_serial_ne -isc_sha1_init -isc_sha1_invalidate -isc_sha1_update -isc_sha1_final -isc_sockaddr_equal -isc_sockaddr_eqaddr -isc_sockaddr_eqaddrprefix -isc_sockaddr_hash -isc_sockaddr_any -isc_sockaddr_any6 -isc_sockaddr_anyofpf -isc_sockaddr_fromin -isc_sockaddr_fromin6 -isc_sockaddr_v6fromin -isc_sockaddr_fromnetaddr -isc_sockaddr_pf -isc_sockaddr_setport -isc_sockaddr_getport -isc_sockaddr_totext -isc_sockaddr_format -isc_sockaddr_ismulticast -isc_socket_create -isc_socket_cancel -;isc_socket_shutdown -isc_socket_attach -isc_socket_detach -isc_socket_bind -isc_socket_listen -isc_socket_accept -isc_socket_connect -isc_socket_getpeername -isc_socket_getsockname -isc_socket_recv -isc_socket_recvv -isc_socket_recv2 -isc_socket_send -isc_socket_sendto -isc_socket_sendv -isc_socket_sendtov -isc_socket_sendto2 -isc_socketmgr_create -isc_socketmgr_destroy -isc_socket_gettype -isc_socket_isbound -isc_stdio_open -isc_stdio_close -isc_stdio_seek -isc_stdio_read -isc_stdio_write -isc_stdio_flush -isc_stdio_sync -isc_string_touint64 -isc_string_separate -isc_symtab_create -isc_symtab_destroy -isc_symtab_lookup -isc_symtab_define -isc_symtab_undefine -isc_task_create -isc_task_attach -isc_task_detach -isc_task_send -isc_task_sendanddetach -isc_task_purgerange -isc_task_purge -isc_task_purgeevent -isc_task_unsendrange -isc_task_unsend -isc_task_onshutdown -isc_task_shutdown -isc_task_destroy -isc_task_setname -isc_task_getname -isc_task_gettag -isc_task_beginexclusive -isc_task_endexclusive -isc_task_endexclusive -isc_taskmgr_create -isc_taskmgr_destroy -isc_taskpool_create -isc_taskpool_gettask -isc_taskpool_destroy -isc_timer_create -isc_timer_reset -isc_timer_touch -isc_timer_attach -isc_timer_detach -isc_timermgr_create -isc_timermgr_destroy -isc_condition_init -isc_condition_wait -isc_condition_signal -isc_condition_broadcast -isc_condition_destroy -isc_condition_waituntil -isc_dir_init -isc_dir_open -isc_dir_read -isc_dir_reset -isc_dir_close -isc_dir_chdir -isc_dir_chroot -isc_dir_current -isc_net_probeipv4 -isc_net_probeipv6 -isc_net_ntop -isc_net_pton -isc_net_aton -isc_once_do -isc_stdtime_get - -isc_thread_create -isc_thread_join -isc_thread_setconcurrency -isc_interval_set -isc_time_subtract -isc_interval_iszero -isc_time_settoepoch -isc_time_isepoch -isc_time_now -isc_time_nowplusinterval -isc_time_compare -isc_time_add -isc_time_subtract -isc_time_microdiff -isc_time_nanoseconds -isc_keyboard_open -isc_keyboard_close -isc_keyboard_getchar -isc_keyboard_canceled -isc_app_start -isc_app_onrun -isc_app_run -isc_app_shutdown -isc_app_reload -isc_app_finish -isc_app_block -isc_app_unblock -isc_thread_create -isc_thread_join -isc_thread_setconcurrency -isc_net_probeipv4 -isc_net_probeipv6 -isc_net_ntop -isc_net_pton -isc_net_aton -openlog -syslog -closelog -isc_syslog_facilityfromstring -isc_ntfile_fopen -isc_ntfile_fclose -isc_ntfile_fwrite -isc_ntfile_fread -isc_ntfile_fseek -isc_ntfile_flush -isc_ntfile_sync -isc_ntfile_printf -isc_ntfile_fprintf -isc_ntfile_vfprintf -isc_ntfile_getaddress -isc_ntfile_getc -isc_ntfile_fgetc -isc_ntfile_fgets -isc_ntfile_fputc -isc_ntfile_fputs -isc_ntfile_fgetpos -isc_ntfile_freopen -isc_ntfile_fdopen -isc_ntfile_open -isc_ntfile_close -isc_ntfile_read -isc_ntfile_write - - -; Exported Data - -EXPORTS - -;isc_categories -;isc_lctx -;isc_modules - -isc_mem_debugging DATA - -isc_commandline_index -isc_commandline_option DATA -isc_commandline_argument DATA -isc_commandline_progname DATA -isc_commandline_errprint DATA -isc_commandline_reset DATA -isc_assertion_failed DATA -_iob DATA - diff --git a/usr.sbin/bind/lib/isc/win32/libisc.dsp b/usr.sbin/bind/lib/isc/win32/libisc.dsp deleted file mode 100644 index a9a4b465458..00000000000 --- a/usr.sbin/bind/lib/isc/win32/libisc.dsp +++ /dev/null @@ -1,676 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libisc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libisc - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libisc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libisc.mak" CFG="libisc - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libisc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libisc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libisc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "NDEBUG" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:"../../../Build/Release/libisc.dll" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 user32.lib advapi32.lib ws2_32.lib /nologo /dll /map /debug /machine:I386 /out:"../../../Build/Debug/libisc.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "libisc - Win32 Release" -# Name "libisc - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\app.c -# End Source File -# Begin Source File - -SOURCE=.\condition.c -# End Source File -# Begin Source File - -SOURCE=.\dir.c -# End Source File -# Begin Source File - -SOURCE=.\DLLMain.c -# End Source File -# Begin Source File - -SOURCE=.\entropy.c -# End Source File -# Begin Source File - -SOURCE=.\errno2result.c -# End Source File -# Begin Source File - -SOURCE=.\file.c -# End Source File -# Begin Source File - -SOURCE=.\fsaccess.c -# End Source File -# Begin Source File - -SOURCE=.\interfaceiter.c -# End Source File -# Begin Source File - -SOURCE=.\ipv6.c -# End Source File -# Begin Source File - -SOURCE=.\keyboard.c -# End Source File -# Begin Source File - -SOURCE=.\net.c -# End Source File -# Begin Source File - -SOURCE=.\ntfile.c -# End Source File -# Begin Source File - -SOURCE=.\ntpaths.c -# End Source File -# Begin Source File - -SOURCE=.\once.c -# End Source File -# Begin Source File - -SOURCE=.\os.c -# End Source File -# Begin Source File - -SOURCE=.\resource.c -# End Source File -# Begin Source File - -SOURCE=.\socket.c -# End Source File -# Begin Source File - -SOURCE=.\stdio.c -# End Source File -# Begin Source File - -SOURCE=.\stdtime.c -# End Source File -# Begin Source File - -SOURCE=.\syslog.c -# End Source File -# Begin Source File - -SOURCE=.\thread.c -# End Source File -# Begin Source File - -SOURCE=.\time.c -# End Source File -# Begin Source File - -SOURCE=.\version.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\include\isc\app.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\assertions.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\base64.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\bind_registry.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\bindevt.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\bitstring.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\boolean.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\buffer.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\bufferlist.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\commandline.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\condition.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\config.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\dir.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\entropy.h -# End Source File -# Begin Source File - -SOURCE=.\errno2result.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\error.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\event.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\eventclass.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\file.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\formatcheck.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\fsaccess.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\heap.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\hex.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\hmacmd5.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\int.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\interfaceiter.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\ipv6.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\keyboard.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\lang.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\lex.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\lfsr.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\lib.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\list.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\log.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\magic.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\md5.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\mem.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\msgcat.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\msioctl.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\mutex.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\mutexblock.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\net.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\netaddr.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\netdb.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\ntfile.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\ntpaths.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\offset.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\once.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\ondestroy.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\os.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\platform.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\print.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\quota.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\random.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\ratelimiter.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\region.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\resource.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\result.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\resultclass.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\rwlock.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\serial.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\sha1.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\sockaddr.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\socket.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\stat.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\stdio.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\stdtime.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\string.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\symtab.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\syslog.h -# End Source File -# Begin Source File - -SOURCE=.\syslog.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\task.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\taskpool.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\thread.h -# End Source File -# Begin Source File - -SOURCE=.\include\isc\time.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\timer.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\types.h -# End Source File -# Begin Source File - -SOURCE=.\unistd.h -# End Source File -# Begin Source File - -SOURCE=..\include\isc\util.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\versions.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Group "Main Isc Lib" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=..\assertions.c -# End Source File -# Begin Source File - -SOURCE=..\base64.c -# End Source File -# Begin Source File - -SOURCE=..\bitstring.c -# End Source File -# Begin Source File - -SOURCE=..\buffer.c -# End Source File -# Begin Source File - -SOURCE=..\bufferlist.c -# End Source File -# Begin Source File - -SOURCE=..\commandline.c -# End Source File -# Begin Source File - -SOURCE=..\error.c -# End Source File -# Begin Source File - -SOURCE=..\event.c -# End Source File -# Begin Source File - -SOURCE=..\heap.c -# End Source File -# Begin Source File - -SOURCE=..\hex.c -# End Source File -# Begin Source File - -SOURCE=..\hmacmd5.c -# End Source File -# Begin Source File - -SOURCE=..\inet_aton.c -# End Source File -# Begin Source File - -SOURCE=..\inet_ntop.c -# End Source File -# Begin Source File - -SOURCE=..\inet_pton.c -# End Source File -# Begin Source File - -SOURCE=..\lex.c -# End Source File -# Begin Source File - -SOURCE=..\lfsr.c -# End Source File -# Begin Source File - -SOURCE=..\lib.c -# End Source File -# Begin Source File - -SOURCE=..\log.c -# End Source File -# Begin Source File - -SOURCE=..\md5.c -# End Source File -# Begin Source File - -SOURCE=..\mem.c -# End Source File -# Begin Source File - -SOURCE=..\nls\msgcat.c -# End Source File -# Begin Source File - -SOURCE=..\mutexblock.c -# End Source File -# Begin Source File - -SOURCE=..\netaddr.c -# End Source File -# Begin Source File - -SOURCE=..\ondestroy.c -# End Source File -# Begin Source File - -SOURCE=..\quota.c -# End Source File -# Begin Source File - -SOURCE=..\random.c -# End Source File -# Begin Source File - -SOURCE=..\ratelimiter.c -# End Source File -# Begin Source File - -SOURCE=..\result.c -# End Source File -# Begin Source File - -SOURCE=..\rwlock.c -# End Source File -# Begin Source File - -SOURCE=..\serial.c -# End Source File -# Begin Source File - -SOURCE=..\sha1.c -# End Source File -# Begin Source File - -SOURCE=..\sockaddr.c -# End Source File -# Begin Source File - -SOURCE=..\string.c -# End Source File -# Begin Source File - -SOURCE=..\symtab.c -# End Source File -# Begin Source File - -SOURCE=..\task.c -# End Source File -# Begin Source File - -SOURCE=..\taskpool.c -# End Source File -# Begin Source File - -SOURCE=..\timer.c -# End Source File -# End Group -# Begin Source File - -SOURCE=.\libisc.def -# End Source File -# End Target -# End Project diff --git a/usr.sbin/bind/lib/isc/win32/libisc.dsw b/usr.sbin/bind/lib/isc/win32/libisc.dsw deleted file mode 100644 index c66c56e531d..00000000000 --- a/usr.sbin/bind/lib/isc/win32/libisc.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "libisc"=".\libisc.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/usr.sbin/bind/lib/isc/win32/libisc.mak b/usr.sbin/bind/lib/isc/win32/libisc.mak deleted file mode 100644 index aa366c2d432..00000000000 --- a/usr.sbin/bind/lib/isc/win32/libisc.mak +++ /dev/null @@ -1,1608 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on libisc.dsp -!IF "$(CFG)" == "" -CFG=libisc - Win32 Debug -!MESSAGE No configuration specified. Defaulting to libisc - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "libisc - Win32 Release" && "$(CFG)" != "libisc - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libisc.mak" CFG="libisc - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libisc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libisc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "libisc - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release - -ALL : "..\..\..\Build\Release\libisc.dll" - - -CLEAN : - -@erase "$(INTDIR)\app.obj" - -@erase "$(INTDIR)\assertions.obj" - -@erase "$(INTDIR)\base64.obj" - -@erase "$(INTDIR)\bitstring.obj" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\bufferlist.obj" - -@erase "$(INTDIR)\commandline.obj" - -@erase "$(INTDIR)\condition.obj" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\DLLMain.obj" - -@erase "$(INTDIR)\entropy.obj" - -@erase "$(INTDIR)\errno2result.obj" - -@erase "$(INTDIR)\error.obj" - -@erase "$(INTDIR)\event.obj" - -@erase "$(INTDIR)\file.obj" - -@erase "$(INTDIR)\fsaccess.obj" - -@erase "$(INTDIR)\heap.obj" - -@erase "$(INTDIR)\hex.obj" - -@erase "$(INTDIR)\hmacmd5.obj" - -@erase "$(INTDIR)\inet_aton.obj" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\interfaceiter.obj" - -@erase "$(INTDIR)\ipv6.obj" - -@erase "$(INTDIR)\keyboard.obj" - -@erase "$(INTDIR)\lex.obj" - -@erase "$(INTDIR)\lfsr.obj" - -@erase "$(INTDIR)\lib.obj" - -@erase "$(INTDIR)\log.obj" - -@erase "$(INTDIR)\md5.obj" - -@erase "$(INTDIR)\mem.obj" - -@erase "$(INTDIR)\msgcat.obj" - -@erase "$(INTDIR)\mutexblock.obj" - -@erase "$(INTDIR)\net.obj" - -@erase "$(INTDIR)\netaddr.obj" - -@erase "$(INTDIR)\ntfile.obj" - -@erase "$(INTDIR)\ntpaths.obj" - -@erase "$(INTDIR)\once.obj" - -@erase "$(INTDIR)\ondestroy.obj" - -@erase "$(INTDIR)\os.obj" - -@erase "$(INTDIR)\quota.obj" - -@erase "$(INTDIR)\random.obj" - -@erase "$(INTDIR)\ratelimiter.obj" - -@erase "$(INTDIR)\resource.obj" - -@erase "$(INTDIR)\result.obj" - -@erase "$(INTDIR)\rwlock.obj" - -@erase "$(INTDIR)\serial.obj" - -@erase "$(INTDIR)\sha1.obj" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\socket.obj" - -@erase "$(INTDIR)\stdio.obj" - -@erase "$(INTDIR)\stdtime.obj" - -@erase "$(INTDIR)\string.obj" - -@erase "$(INTDIR)\symtab.obj" - -@erase "$(INTDIR)\syslog.obj" - -@erase "$(INTDIR)\task.obj" - -@erase "$(INTDIR)\taskpool.obj" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\timer.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\version.obj" - -@erase "$(OUTDIR)\libisc.exp" - -@erase "$(OUTDIR)\libisc.lib" - -@erase "..\..\..\Build\Release\libisc.dll" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "NDEBUG" /D "__STDC__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /Fp"$(INTDIR)\libisc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\libisc.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\libisc.pdb" /machine:I386 /def:".\libisc.def" /out:"../../../Build/Release/libisc.dll" /implib:"$(OUTDIR)\libisc.lib" -DEF_FILE= \ - ".\libisc.def" -LINK32_OBJS= \ - "$(INTDIR)\app.obj" \ - "$(INTDIR)\condition.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\DLLMain.obj" \ - "$(INTDIR)\entropy.obj" \ - "$(INTDIR)\errno2result.obj" \ - "$(INTDIR)\file.obj" \ - "$(INTDIR)\fsaccess.obj" \ - "$(INTDIR)\interfaceiter.obj" \ - "$(INTDIR)\ipv6.obj" \ - "$(INTDIR)\keyboard.obj" \ - "$(INTDIR)\net.obj" \ - "$(INTDIR)\ntfile.obj" \ - "$(INTDIR)\ntpaths.obj" \ - "$(INTDIR)\once.obj" \ - "$(INTDIR)\os.obj" \ - "$(INTDIR)\resource.obj" \ - "$(INTDIR)\socket.obj" \ - "$(INTDIR)\stdio.obj" \ - "$(INTDIR)\stdtime.obj" \ - "$(INTDIR)\syslog.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\assertions.obj" \ - "$(INTDIR)\base64.obj" \ - "$(INTDIR)\bitstring.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\bufferlist.obj" \ - "$(INTDIR)\commandline.obj" \ - "$(INTDIR)\error.obj" \ - "$(INTDIR)\event.obj" \ - "$(INTDIR)\heap.obj" \ - "$(INTDIR)\hex.obj" \ - "$(INTDIR)\hmacmd5.obj" \ - "$(INTDIR)\inet_aton.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\lex.obj" \ - "$(INTDIR)\lfsr.obj" \ - "$(INTDIR)\lib.obj" \ - "$(INTDIR)\log.obj" \ - "$(INTDIR)\md5.obj" \ - "$(INTDIR)\mem.obj" \ - "$(INTDIR)\msgcat.obj" \ - "$(INTDIR)\mutexblock.obj" \ - "$(INTDIR)\netaddr.obj" \ - "$(INTDIR)\ondestroy.obj" \ - "$(INTDIR)\quota.obj" \ - "$(INTDIR)\random.obj" \ - "$(INTDIR)\ratelimiter.obj" \ - "$(INTDIR)\result.obj" \ - "$(INTDIR)\rwlock.obj" \ - "$(INTDIR)\serial.obj" \ - "$(INTDIR)\sha1.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\string.obj" \ - "$(INTDIR)\symtab.obj" \ - "$(INTDIR)\task.obj" \ - "$(INTDIR)\taskpool.obj" \ - "$(INTDIR)\timer.obj" - -"..\..\..\Build\Release\libisc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -ALL : "..\..\..\Build\Debug\libisc.dll" "$(OUTDIR)\libisc.bsc" - - -CLEAN : - -@erase "$(INTDIR)\app.obj" - -@erase "$(INTDIR)\app.sbr" - -@erase "$(INTDIR)\assertions.obj" - -@erase "$(INTDIR)\assertions.sbr" - -@erase "$(INTDIR)\base64.obj" - -@erase "$(INTDIR)\base64.sbr" - -@erase "$(INTDIR)\bitstring.obj" - -@erase "$(INTDIR)\bitstring.sbr" - -@erase "$(INTDIR)\buffer.obj" - -@erase "$(INTDIR)\buffer.sbr" - -@erase "$(INTDIR)\bufferlist.obj" - -@erase "$(INTDIR)\bufferlist.sbr" - -@erase "$(INTDIR)\commandline.obj" - -@erase "$(INTDIR)\commandline.sbr" - -@erase "$(INTDIR)\condition.obj" - -@erase "$(INTDIR)\condition.sbr" - -@erase "$(INTDIR)\dir.obj" - -@erase "$(INTDIR)\dir.sbr" - -@erase "$(INTDIR)\DLLMain.obj" - -@erase "$(INTDIR)\DLLMain.sbr" - -@erase "$(INTDIR)\entropy.obj" - -@erase "$(INTDIR)\entropy.sbr" - -@erase "$(INTDIR)\errno2result.obj" - -@erase "$(INTDIR)\errno2result.sbr" - -@erase "$(INTDIR)\error.obj" - -@erase "$(INTDIR)\error.sbr" - -@erase "$(INTDIR)\event.obj" - -@erase "$(INTDIR)\event.sbr" - -@erase "$(INTDIR)\file.obj" - -@erase "$(INTDIR)\file.sbr" - -@erase "$(INTDIR)\fsaccess.obj" - -@erase "$(INTDIR)\fsaccess.sbr" - -@erase "$(INTDIR)\heap.obj" - -@erase "$(INTDIR)\heap.sbr" - -@erase "$(INTDIR)\hex.obj" - -@erase "$(INTDIR)\hex.sbr" - -@erase "$(INTDIR)\hmacmd5.obj" - -@erase "$(INTDIR)\hmacmd5.sbr" - -@erase "$(INTDIR)\inet_aton.obj" - -@erase "$(INTDIR)\inet_aton.sbr" - -@erase "$(INTDIR)\inet_ntop.obj" - -@erase "$(INTDIR)\inet_ntop.sbr" - -@erase "$(INTDIR)\inet_pton.obj" - -@erase "$(INTDIR)\inet_pton.sbr" - -@erase "$(INTDIR)\interfaceiter.obj" - -@erase "$(INTDIR)\interfaceiter.sbr" - -@erase "$(INTDIR)\ipv6.obj" - -@erase "$(INTDIR)\ipv6.sbr" - -@erase "$(INTDIR)\keyboard.obj" - -@erase "$(INTDIR)\keyboard.sbr" - -@erase "$(INTDIR)\lex.obj" - -@erase "$(INTDIR)\lex.sbr" - -@erase "$(INTDIR)\lfsr.obj" - -@erase "$(INTDIR)\lfsr.sbr" - -@erase "$(INTDIR)\lib.obj" - -@erase "$(INTDIR)\lib.sbr" - -@erase "$(INTDIR)\log.obj" - -@erase "$(INTDIR)\log.sbr" - -@erase "$(INTDIR)\md5.obj" - -@erase "$(INTDIR)\md5.sbr" - -@erase "$(INTDIR)\mem.obj" - -@erase "$(INTDIR)\mem.sbr" - -@erase "$(INTDIR)\msgcat.obj" - -@erase "$(INTDIR)\msgcat.sbr" - -@erase "$(INTDIR)\mutexblock.obj" - -@erase "$(INTDIR)\mutexblock.sbr" - -@erase "$(INTDIR)\net.obj" - -@erase "$(INTDIR)\net.sbr" - -@erase "$(INTDIR)\netaddr.obj" - -@erase "$(INTDIR)\netaddr.sbr" - -@erase "$(INTDIR)\ntfile.obj" - -@erase "$(INTDIR)\ntfile.sbr" - -@erase "$(INTDIR)\ntpaths.obj" - -@erase "$(INTDIR)\ntpaths.sbr" - -@erase "$(INTDIR)\once.obj" - -@erase "$(INTDIR)\once.sbr" - -@erase "$(INTDIR)\ondestroy.obj" - -@erase "$(INTDIR)\ondestroy.sbr" - -@erase "$(INTDIR)\os.obj" - -@erase "$(INTDIR)\os.sbr" - -@erase "$(INTDIR)\quota.obj" - -@erase "$(INTDIR)\quota.sbr" - -@erase "$(INTDIR)\random.obj" - -@erase "$(INTDIR)\random.sbr" - -@erase "$(INTDIR)\ratelimiter.obj" - -@erase "$(INTDIR)\ratelimiter.sbr" - -@erase "$(INTDIR)\resource.obj" - -@erase "$(INTDIR)\resource.sbr" - -@erase "$(INTDIR)\result.obj" - -@erase "$(INTDIR)\result.sbr" - -@erase "$(INTDIR)\rwlock.obj" - -@erase "$(INTDIR)\rwlock.sbr" - -@erase "$(INTDIR)\serial.obj" - -@erase "$(INTDIR)\serial.sbr" - -@erase "$(INTDIR)\sha1.obj" - -@erase "$(INTDIR)\sha1.sbr" - -@erase "$(INTDIR)\sockaddr.obj" - -@erase "$(INTDIR)\sockaddr.sbr" - -@erase "$(INTDIR)\socket.obj" - -@erase "$(INTDIR)\socket.sbr" - -@erase "$(INTDIR)\stdio.obj" - -@erase "$(INTDIR)\stdio.sbr" - -@erase "$(INTDIR)\stdtime.obj" - -@erase "$(INTDIR)\stdtime.sbr" - -@erase "$(INTDIR)\string.obj" - -@erase "$(INTDIR)\string.sbr" - -@erase "$(INTDIR)\symtab.obj" - -@erase "$(INTDIR)\symtab.sbr" - -@erase "$(INTDIR)\syslog.obj" - -@erase "$(INTDIR)\syslog.sbr" - -@erase "$(INTDIR)\task.obj" - -@erase "$(INTDIR)\task.sbr" - -@erase "$(INTDIR)\taskpool.obj" - -@erase "$(INTDIR)\taskpool.sbr" - -@erase "$(INTDIR)\thread.obj" - -@erase "$(INTDIR)\thread.sbr" - -@erase "$(INTDIR)\time.obj" - -@erase "$(INTDIR)\time.sbr" - -@erase "$(INTDIR)\timer.obj" - -@erase "$(INTDIR)\timer.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(INTDIR)\version.obj" - -@erase "$(INTDIR)\version.sbr" - -@erase "$(OUTDIR)\libisc.bsc" - -@erase "$(OUTDIR)\libisc.exp" - -@erase "$(OUTDIR)\libisc.lib" - -@erase "$(OUTDIR)\libisc.map" - -@erase "$(OUTDIR)\libisc.pdb" - -@erase "..\..\..\Build\Debug\libisc.dll" - -@erase "..\..\..\Build\Debug\libisc.ilk" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../../../" /I "include" /I "../include" /I "win32" /I "../../isccfg/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__STDC__" /D "_MBCS" /D "_USRDLL" /D "LIBISC_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libisc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\libisc.bsc" -BSC32_SBRS= \ - "$(INTDIR)\app.sbr" \ - "$(INTDIR)\condition.sbr" \ - "$(INTDIR)\dir.sbr" \ - "$(INTDIR)\DLLMain.sbr" \ - "$(INTDIR)\entropy.sbr" \ - "$(INTDIR)\errno2result.sbr" \ - "$(INTDIR)\file.sbr" \ - "$(INTDIR)\fsaccess.sbr" \ - "$(INTDIR)\interfaceiter.sbr" \ - "$(INTDIR)\ipv6.sbr" \ - "$(INTDIR)\keyboard.sbr" \ - "$(INTDIR)\net.sbr" \ - "$(INTDIR)\ntfile.sbr" \ - "$(INTDIR)\ntpaths.sbr" \ - "$(INTDIR)\once.sbr" \ - "$(INTDIR)\os.sbr" \ - "$(INTDIR)\resource.sbr" \ - "$(INTDIR)\socket.sbr" \ - "$(INTDIR)\stdio.sbr" \ - "$(INTDIR)\stdtime.sbr" \ - "$(INTDIR)\syslog.sbr" \ - "$(INTDIR)\thread.sbr" \ - "$(INTDIR)\time.sbr" \ - "$(INTDIR)\version.sbr" \ - "$(INTDIR)\assertions.sbr" \ - "$(INTDIR)\base64.sbr" \ - "$(INTDIR)\bitstring.sbr" \ - "$(INTDIR)\buffer.sbr" \ - "$(INTDIR)\bufferlist.sbr" \ - "$(INTDIR)\commandline.sbr" \ - "$(INTDIR)\error.sbr" \ - "$(INTDIR)\event.sbr" \ - "$(INTDIR)\heap.sbr" \ - "$(INTDIR)\hex.sbr" \ - "$(INTDIR)\hmacmd5.sbr" \ - "$(INTDIR)\inet_aton.sbr" \ - "$(INTDIR)\inet_ntop.sbr" \ - "$(INTDIR)\inet_pton.sbr" \ - "$(INTDIR)\lex.sbr" \ - "$(INTDIR)\lfsr.sbr" \ - "$(INTDIR)\lib.sbr" \ - "$(INTDIR)\log.sbr" \ - "$(INTDIR)\md5.sbr" \ - "$(INTDIR)\mem.sbr" \ - "$(INTDIR)\msgcat.sbr" \ - "$(INTDIR)\mutexblock.sbr" \ - "$(INTDIR)\netaddr.sbr" \ - "$(INTDIR)\ondestroy.sbr" \ - "$(INTDIR)\quota.sbr" \ - "$(INTDIR)\random.sbr" \ - "$(INTDIR)\ratelimiter.sbr" \ - "$(INTDIR)\result.sbr" \ - "$(INTDIR)\rwlock.sbr" \ - "$(INTDIR)\serial.sbr" \ - "$(INTDIR)\sha1.sbr" \ - "$(INTDIR)\sockaddr.sbr" \ - "$(INTDIR)\string.sbr" \ - "$(INTDIR)\symtab.sbr" \ - "$(INTDIR)\task.sbr" \ - "$(INTDIR)\taskpool.sbr" \ - "$(INTDIR)\timer.sbr" - -"$(OUTDIR)\libisc.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=user32.lib advapi32.lib ws2_32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\libisc.pdb" /map:"$(INTDIR)\libisc.map" /debug /machine:I386 /def:".\libisc.def" /out:"../../../Build/Debug/libisc.dll" /implib:"$(OUTDIR)\libisc.lib" /pdbtype:sept -DEF_FILE= \ - ".\libisc.def" -LINK32_OBJS= \ - "$(INTDIR)\app.obj" \ - "$(INTDIR)\condition.obj" \ - "$(INTDIR)\dir.obj" \ - "$(INTDIR)\DLLMain.obj" \ - "$(INTDIR)\entropy.obj" \ - "$(INTDIR)\errno2result.obj" \ - "$(INTDIR)\file.obj" \ - "$(INTDIR)\fsaccess.obj" \ - "$(INTDIR)\interfaceiter.obj" \ - "$(INTDIR)\ipv6.obj" \ - "$(INTDIR)\keyboard.obj" \ - "$(INTDIR)\net.obj" \ - "$(INTDIR)\ntfile.obj" \ - "$(INTDIR)\ntpaths.obj" \ - "$(INTDIR)\once.obj" \ - "$(INTDIR)\os.obj" \ - "$(INTDIR)\resource.obj" \ - "$(INTDIR)\socket.obj" \ - "$(INTDIR)\stdio.obj" \ - "$(INTDIR)\stdtime.obj" \ - "$(INTDIR)\syslog.obj" \ - "$(INTDIR)\thread.obj" \ - "$(INTDIR)\time.obj" \ - "$(INTDIR)\version.obj" \ - "$(INTDIR)\assertions.obj" \ - "$(INTDIR)\base64.obj" \ - "$(INTDIR)\bitstring.obj" \ - "$(INTDIR)\buffer.obj" \ - "$(INTDIR)\bufferlist.obj" \ - "$(INTDIR)\commandline.obj" \ - "$(INTDIR)\error.obj" \ - "$(INTDIR)\event.obj" \ - "$(INTDIR)\heap.obj" \ - "$(INTDIR)\hex.obj" \ - "$(INTDIR)\hmacmd5.obj" \ - "$(INTDIR)\inet_aton.obj" \ - "$(INTDIR)\inet_ntop.obj" \ - "$(INTDIR)\inet_pton.obj" \ - "$(INTDIR)\lex.obj" \ - "$(INTDIR)\lfsr.obj" \ - "$(INTDIR)\lib.obj" \ - "$(INTDIR)\log.obj" \ - "$(INTDIR)\md5.obj" \ - "$(INTDIR)\mem.obj" \ - "$(INTDIR)\msgcat.obj" \ - "$(INTDIR)\mutexblock.obj" \ - "$(INTDIR)\netaddr.obj" \ - "$(INTDIR)\ondestroy.obj" \ - "$(INTDIR)\quota.obj" \ - "$(INTDIR)\random.obj" \ - "$(INTDIR)\ratelimiter.obj" \ - "$(INTDIR)\result.obj" \ - "$(INTDIR)\rwlock.obj" \ - "$(INTDIR)\serial.obj" \ - "$(INTDIR)\sha1.obj" \ - "$(INTDIR)\sockaddr.obj" \ - "$(INTDIR)\string.obj" \ - "$(INTDIR)\symtab.obj" \ - "$(INTDIR)\task.obj" \ - "$(INTDIR)\taskpool.obj" \ - "$(INTDIR)\timer.obj" - -"..\..\..\Build\Debug\libisc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("libisc.dep") -!INCLUDE "libisc.dep" -!ELSE -!MESSAGE Warning: cannot find "libisc.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "libisc - Win32 Release" || "$(CFG)" == "libisc - Win32 Debug" -SOURCE=.\app.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\app.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\app.obj" "$(INTDIR)\app.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\condition.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\condition.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\condition.obj" "$(INTDIR)\condition.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\dir.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\dir.obj" "$(INTDIR)\dir.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\DLLMain.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\DLLMain.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\DLLMain.obj" "$(INTDIR)\DLLMain.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\entropy.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\entropy.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\entropy.obj" "$(INTDIR)\entropy.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\errno2result.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\errno2result.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\errno2result.obj" "$(INTDIR)\errno2result.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\file.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\file.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\file.obj" "$(INTDIR)\file.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\fsaccess.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\fsaccess.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\fsaccess.obj" "$(INTDIR)\fsaccess.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\interfaceiter.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\interfaceiter.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\interfaceiter.obj" "$(INTDIR)\interfaceiter.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\ipv6.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\ipv6.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\ipv6.obj" "$(INTDIR)\ipv6.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\keyboard.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\keyboard.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\keyboard.obj" "$(INTDIR)\keyboard.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\net.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\net.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\net.obj" "$(INTDIR)\net.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\ntfile.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\ntfile.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\ntfile.obj" "$(INTDIR)\ntfile.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\ntpaths.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\ntpaths.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\ntpaths.obj" "$(INTDIR)\ntpaths.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\once.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\once.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\once.obj" "$(INTDIR)\once.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\os.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\os.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\os.obj" "$(INTDIR)\os.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\resource.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\resource.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\resource.obj" "$(INTDIR)\resource.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\socket.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\socket.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\socket.obj" "$(INTDIR)\socket.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\stdio.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\stdio.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\stdio.obj" "$(INTDIR)\stdio.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\stdtime.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\stdtime.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\stdtime.obj" "$(INTDIR)\stdtime.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\syslog.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\syslog.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\syslog.obj" "$(INTDIR)\syslog.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\thread.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\thread.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\thread.obj" "$(INTDIR)\thread.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\time.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\time.obj" "$(INTDIR)\time.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=.\version.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\version.obj" "$(INTDIR)\version.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -SOURCE=..\assertions.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\assertions.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\assertions.obj" "$(INTDIR)\assertions.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\base64.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\base64.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\base64.obj" "$(INTDIR)\base64.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\bitstring.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\bitstring.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\bitstring.obj" "$(INTDIR)\bitstring.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\buffer.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\buffer.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\buffer.obj" "$(INTDIR)\buffer.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\bufferlist.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\bufferlist.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\bufferlist.obj" "$(INTDIR)\bufferlist.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\commandline.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\commandline.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\commandline.obj" "$(INTDIR)\commandline.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\error.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\error.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\error.obj" "$(INTDIR)\error.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\event.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\event.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\event.obj" "$(INTDIR)\event.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\heap.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\heap.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\heap.obj" "$(INTDIR)\heap.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\hex.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\hex.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\hex.obj" "$(INTDIR)\hex.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\hmacmd5.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\hmacmd5.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\hmacmd5.obj" "$(INTDIR)\hmacmd5.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\inet_aton.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\inet_aton.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\inet_aton.obj" "$(INTDIR)\inet_aton.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\inet_ntop.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\inet_ntop.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\inet_ntop.obj" "$(INTDIR)\inet_ntop.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\inet_pton.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\inet_pton.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\inet_pton.obj" "$(INTDIR)\inet_pton.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\lex.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\lex.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\lex.obj" "$(INTDIR)\lex.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\lfsr.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\lfsr.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\lfsr.obj" "$(INTDIR)\lfsr.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\lib.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\lib.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\lib.obj" "$(INTDIR)\lib.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\log.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\log.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\log.obj" "$(INTDIR)\log.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\md5.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\md5.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\md5.obj" "$(INTDIR)\md5.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\mem.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\mem.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\mem.obj" "$(INTDIR)\mem.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\nls\msgcat.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\msgcat.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\msgcat.obj" "$(INTDIR)\msgcat.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\mutexblock.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\mutexblock.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\mutexblock.obj" "$(INTDIR)\mutexblock.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\netaddr.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\netaddr.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\netaddr.obj" "$(INTDIR)\netaddr.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\ondestroy.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\ondestroy.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\ondestroy.obj" "$(INTDIR)\ondestroy.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\quota.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\quota.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\quota.obj" "$(INTDIR)\quota.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\random.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\random.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\random.obj" "$(INTDIR)\random.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\ratelimiter.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\ratelimiter.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\ratelimiter.obj" "$(INTDIR)\ratelimiter.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\result.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\result.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\result.obj" "$(INTDIR)\result.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\rwlock.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\rwlock.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\rwlock.obj" "$(INTDIR)\rwlock.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\serial.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\serial.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\serial.obj" "$(INTDIR)\serial.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\sha1.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\sha1.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\sha1.obj" "$(INTDIR)\sha1.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\sockaddr.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\sockaddr.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\sockaddr.obj" "$(INTDIR)\sockaddr.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\string.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\string.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\string.obj" "$(INTDIR)\string.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\symtab.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\symtab.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\symtab.obj" "$(INTDIR)\symtab.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\task.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\task.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\task.obj" "$(INTDIR)\task.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\taskpool.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\taskpool.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\taskpool.obj" "$(INTDIR)\taskpool.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\timer.c - -!IF "$(CFG)" == "libisc - Win32 Release" - - -"$(INTDIR)\timer.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - Win32 Debug" - - -"$(INTDIR)\timer.obj" "$(INTDIR)\timer.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - - -!ENDIF - diff --git a/usr.sbin/bind/lib/isc/win32/net.c b/usr.sbin/bind/lib/isc/win32/net.c deleted file mode 100644 index 061c0aee56c..00000000000 --- a/usr.sbin/bind/lib/isc/win32/net.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 1999-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 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. - */ - -/* $ISC: net.c,v 1.3.8.2 2003/02/17 07:05:10 marka Exp $ */ - -#include <config.h> - -#include <errno.h> -#include <unistd.h> - -#include <isc/log.h> -#include <isc/msgs.h> -#include <isc/net.h> -#include <isc/once.h> -#include <isc/string.h> -#include <isc/util.h> - -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY) -const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT; -#endif - -static isc_once_t once = ISC_ONCE_INIT; -static isc_result_t ipv4_result = ISC_R_NOTFOUND; -static isc_result_t ipv6_result = ISC_R_NOTFOUND; - -static isc_result_t -try_proto(int domain) { - SOCKET s; - isc_result_t result = ISC_R_SUCCESS; - - s = socket(domain, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) { - switch (WSAGetLastError()) { - case WSAEAFNOSUPPORT: - case WSAEPROTONOSUPPORT: - case WSAEINVAL: - return (ISC_R_NOTFOUND); - default: - UNEXPECTED_ERROR(__FILE__, __LINE__, - "socket() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strerror(errno)); - return (ISC_R_UNEXPECTED); - } - } - -#ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO - if (domain == PF_INET6) { - struct sockaddr_in6 sin6; - unsigned int len; - - /* - * Check to see if IPv6 is broken, as is common on Linux. - */ - len = sizeof(sin6); - if (getsockname(s, (struct sockaddr *)&sin6, (void *)&len) < 0) - { - isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - "retrieving the address of an IPv6 " - "socket from the kernel failed."); - isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - "IPv6 support is disabled."); - result = ISC_R_NOTFOUND; - } else { - if (len == sizeof(struct sockaddr_in6)) - result = ISC_R_SUCCESS; - else { - isc_log_write(isc_lctx, - ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_SOCKET, - ISC_LOG_ERROR, - "IPv6 structures in kernel and " - "user space do not match."); - isc_log_write(isc_lctx, - ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_SOCKET, - ISC_LOG_ERROR, - "IPv6 support is disabled."); - result = ISC_R_NOTFOUND; - } - } - } -#endif -#endif -#endif - - closesocket(s); - - return (result); -} - -static void -initialize_action(void) { - ipv4_result = try_proto(PF_INET); -#ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 -#ifdef ISC_PLATFORM_HAVEIN6PKTINFO - ipv6_result = try_proto(PF_INET6); -#endif -#endif -#endif -} - -static void -initialize(void) { - RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); -} - -isc_result_t -isc_net_probeipv4(void) { - initialize(); - return (ipv4_result); -} - -isc_result_t -isc_net_probeipv6(void) { - initialize(); - return (ipv6_result); -} diff --git a/usr.sbin/bind/lib/isc/win32/netdb.h b/usr.sbin/bind/lib/isc/win32/netdb.h deleted file mode 100644 index 43fef06cae3..00000000000 --- a/usr.sbin/bind/lib/isc/win32/netdb.h +++ /dev/null @@ -1,187 +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. - */ - -/* $ISC: netdb.h,v 1.2 2001/07/08 05:09:07 mayer Exp $ */ - -#ifndef NETDB_H -#define NETDB_H 1 - -#include <stddef.h> -#include <winsock2.h> - -/* - * Define if <netdb.h> does not declare struct addrinfo. - */ - -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* Length of ai_addr */ - char *ai_canonname; /* Canonical name for hostname */ - struct sockaddr *ai_addr; /* Binary address */ - struct addrinfo *ai_next; /* Next structure in linked list */ -}; - - -/* - * Undefine all #defines we are interested in as <netdb.h> may or may not have - * defined them. - */ - -/* - * Error return codes from gethostbyname() and gethostbyaddr() - * (left in extern int h_errno). - */ - -#undef NETDB_INTERNAL -#undef NETDB_SUCCESS -#undef HOST_NOT_FOUND -#undef TRY_AGAIN -#undef NO_RECOVERY -#undef NO_DATA -#undef NO_ADDRESS - -#define NETDB_INTERNAL -1 /* see errno */ -#define NETDB_SUCCESS 0 /* no problem */ -#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ -#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ -#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ -#define NO_DATA 4 /* Valid name, no data record of requested type */ -#define NO_ADDRESS NO_DATA /* no address, look for MX record */ - -/* - * Error return codes from getaddrinfo() - */ - -#undef EAI_ADDRFAMILY -#undef EAI_AGAIN -#undef EAI_BADFLAGS -#undef EAI_FAIL -#undef EAI_FAMILY -#undef EAI_MEMORY -#undef EAI_NODATA -#undef EAI_NONAME -#undef EAI_SERVICE -#undef EAI_SOCKTYPE -#undef EAI_SYSTEM -#undef EAI_BADHINTS -#undef EAI_PROTOCOL -#undef EAI_MAX - -#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with hostname */ -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_BADHINTS 12 -#define EAI_PROTOCOL 13 -#define EAI_MAX 14 - -/* - * Flag values for getaddrinfo() - */ -#undef AI_PASSIVE -#undef AI_CANONNAME -#undef AI_NUMERICHOST - -#define AI_PASSIVE 0x00000001 -#define AI_CANONNAME 0x00000002 -#define AI_NUMERICHOST 0x00000004 - -/* - * Flag values for getipnodebyname() - */ -#undef AI_V4MAPPED -#undef AI_ALL -#undef AI_ADDRCONFIG -#undef AI_DEFAULT - -#define AI_V4MAPPED 0x00000008 -#define AI_ALL 0x00000010 -#define AI_ADDRCONFIG 0x00000020 -#define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG) - -/* - * Constants for getnameinfo() - */ -#undef NI_MAXHOST -#undef NI_MAXSERV - -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 - -/* - * Flag values for getnameinfo() - */ -#undef NI_NOFQDN -#undef NI_NUMERICHOST -#undef NI_NAMEREQD -#undef NI_NUMERICSERV -#undef NI_DGRAM -#undef NI_NUMERICSCOPE - -#define NI_NOFQDN 0x00000001 -#define NI_NUMERICHOST 0x00000002 -#define NI_NAMEREQD 0x00000004 -#define NI_NUMERICSERV 0x00000008 -#define NI_DGRAM 0x00000010 -#define NI_NUMERICSCOPE 0x00000020 /*2553bis-00*/ - -/* - * Structures for getrrsetbyname() - */ -struct rdatainfo { - unsigned int rdi_length; - unsigned char *rdi_data; -}; - -struct rrsetinfo { - unsigned int rri_flags; - int rri_rdclass; - int rri_rdtype; - unsigned int rri_ttl; - unsigned int rri_nrdatas; - unsigned int rri_nsigs; - char *rri_name; - struct rdatainfo *rri_rdatas; - struct rdatainfo *rri_sigs; -}; - -/* - * Flags for getrrsetbyname() - */ -#define RRSET_VALIDATED 0x00000001 - /* Set was dnssec validated */ - -/* - * Return codes for getrrsetbyname() - */ -#define ERRSET_SUCCESS 0 -#define ERRSET_NOMEMORY 1 -#define ERRSET_FAIL 2 -#define ERRSET_INVAL 3 - - -#endif /* NETDB_H */ diff --git a/usr.sbin/bind/lib/isc/win32/ntfile.c b/usr.sbin/bind/lib/isc/win32/ntfile.c deleted file mode 100644 index 3ab2ff2baaf..00000000000 --- a/usr.sbin/bind/lib/isc/win32/ntfile.c +++ /dev/null @@ -1,190 +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. - */ - -/* $ISC: ntfile.c,v 1.5 2001/07/16 04:09:45 gson Exp $ */ - -/* - * This file has been necessitated by the fact that the iov array is local - * to the module, so passing the FILE ptr to a file I/O function in a - * different module or DLL will cause the application to fail to find the - * I/O channel and the application will terminate. The standard file I/O - * functions are redefined to call these routines instead and there will - * be just the one iov to deal with. - */ - -#include <config.h> - -#include <io.h> - -#include <isc/ntfile.h> - -FILE * -isc_ntfile_fopen(const char *filename, const char *mode) { - return (fopen(filename, mode)); -} - -int -isc_ntfile_fclose(FILE *f) { - return (fclose(f)); -} - -int -isc_ntfile_fseek(FILE *f, long offset, int whence) { - return (fseek(f, offset, whence)); -} - -size_t -isc_ntfile_fread(void *ptr, size_t size, size_t nmemb, FILE *f) { - return (fread(ptr, size, nmemb, f)); -} - -size_t -isc_ntfile_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f) { - int r; - r = fwrite(ptr, size, nmemb, f); - fflush(f); - return (r); -} - -int -isc_ntfile_flush(FILE *f) { - return (fflush(f)); -} - -int -isc_ntfile_sync(FILE *f) { - return (_commit(_fileno(f))); -} - -FILE * -isc_ntfile_getaddress(int r) { - return (&_iob[r]); -} - -int -isc_ntfile_printf(const char *format, ...) { - int r; - FILE *fp = stdout; - va_list ap; - va_start(ap, format); - r = vfprintf(fp, format, ap); - va_end(ap); - fflush(fp); - return (r); -} - -int -isc_ntfile_fprintf(FILE *fp, const char *format, ...) { - int r; - va_list ap; - va_start(ap, format); - r = vfprintf(fp, format, ap); - va_end(ap); - fflush(fp); - return (r); -} - -int -isc_ntfile_vfprintf(FILE *fp, const char *format, va_list alist) { - int r; - r = vfprintf(fp, format, alist); - fflush(fp); - return (r); -} - -int -isc_ntfile_fputc(int iv, FILE *fp) { - int r; - r = fputc(iv, fp); - fflush(fp); - return (r); -} - -int -isc_ntfile_fputs(const char *bf, FILE *fp) { - int r; - r = fputs(bf, fp); - fflush(fp); - return (r); -} - -int -isc_ntfile_fgetc(FILE *fp) { - return (fgetc(fp)); -} - -int -isc_ntfile_fgetpos(FILE *fp, fpos_t *pos) { - return (fgetpos(fp, pos)); -} - -char * -isc_ntfile_fgets(char *ch, int r, FILE *fp) { - return (fgets(ch,r, fp)); -} - -int -isc_ntfile_getc(FILE *fp) { - return (getc(fp)); -} - -FILE * -isc_ntfile_freopen(const char *path, const char *mode, FILE *fp) { - return (freopen(path, mode,fp)); -} - -FILE * -isc_ntfile_fdopen(int handle, const char *mode) { - return (fdopen(handle, mode)); -} - -/* - * open(), close(), read(), write(), fsync() - * sockets are file descriptors in UNIX. This is not so in NT - * We keep track of what is a socket and what is an FD to - * make everything flow right. - */ -int -isc_ntfile_open(const char *fn, int flags, ...){ - va_list args; - int pmode; - int fd; - - /* Extract the cmd parameter */ - va_start(args, flags); - pmode = va_arg(args, int); - fd = _open(fn, flags, pmode); - return fd; -} - -int -isc_ntfile_close(int fd){ - return (_close(fd)); -} - -int -isc_ntfile_read(int fd, char *buf, int len) { - return (_read(fd, buf, len)); -} - -int -isc_ntfile_write(int fd, char *buf, int len){ - int r; - r = _write(fd, buf, len); - _commit(fd); - return (r); -} diff --git a/usr.sbin/bind/lib/isc/win32/ntpaths.c b/usr.sbin/bind/lib/isc/win32/ntpaths.c deleted file mode 100644 index c6ad3e0a0e7..00000000000 --- a/usr.sbin/bind/lib/isc/win32/ntpaths.c +++ /dev/null @@ -1,141 +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. - */ - -/* $ISC: ntpaths.c,v 1.6.2.2 2001/09/04 19:36:31 gson Exp $ */ - -/* - * This module fetches the required path information that is specific - * to NT systems which can have its configuration and system files - * almost anywhere. It can be used to override whatever the application - * had previously assigned to the pointer. Basic information about the - * file locations are stored in the registry. - */ - -#include <config.h> -#include <isc/bind_registry.h> -#include <isc/ntpaths.h> - -/* - * Module Variables - */ - -static char systemDir[MAX_PATH]; -static char namedBase[MAX_PATH]; -static char ns_confFile[MAX_PATH]; -static char lwresd_confFile[MAX_PATH]; -static char lwresd_resolvconfFile[MAX_PATH]; -static char rndc_confFile[MAX_PATH]; -static char ns_defaultpidfile[MAX_PATH]; -static char lwresd_defaultpidfile[MAX_PATH]; -static char local_state_dir[MAX_PATH]; -static char sys_conf_dir[MAX_PATH]; -static char rndc_keyFile[MAX_PATH]; - -static DWORD baseLen = MAX_PATH; -static BOOL Initialized = FALSE; - -void -isc_ntpaths_init() { - HKEY hKey; - BOOL keyFound = TRUE; - - memset(namedBase, 0, MAX_PATH); - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey) - != ERROR_SUCCESS) - keyFound = FALSE; - - if (keyFound == TRUE) { - /* Get the named directory */ - if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL, - (LPBYTE)namedBase, &baseLen) != ERROR_SUCCESS) - keyFound = FALSE; - } - - RegCloseKey(hKey); - - GetSystemDirectory(systemDir, MAX_PATH); - - if (keyFound == FALSE) - /* Use the System Directory as a default */ - strcpy(namedBase, systemDir); - - strcpy(ns_confFile, namedBase); - strcat(ns_confFile, "\\etc\\named.conf"); - - strcpy(lwresd_confFile, namedBase); - strcat(lwresd_confFile, "\\etc\\lwresd.conf"); - - strcpy(lwresd_resolvconfFile, systemDir); - strcat(lwresd_resolvconfFile, "\\Drivers\\etc\\resolv.conf"); - - strcpy(rndc_keyFile, namedBase); - strcat(rndc_keyFile, "\\etc\\rndc.key"); - - strcpy(rndc_confFile, namedBase); - strcat(rndc_confFile, "\\etc\\rndc.conf"); - strcpy(ns_defaultpidfile, namedBase); - strcat(ns_defaultpidfile, "\\etc\\named.pid"); - - strcpy(lwresd_defaultpidfile, namedBase); - strcat(lwresd_defaultpidfile, "\\etc\\lwresd.pid"); - - strcpy(local_state_dir, namedBase); - strcat(local_state_dir, "\\bin"); - - strcpy(sys_conf_dir, namedBase); - strcat(sys_conf_dir, "\\etc"); - - Initialized = TRUE; -} - -char * -isc_ntpaths_get(int ind) { - if (!Initialized) - isc_ntpaths_init(); - - switch (ind) { - case NAMED_CONF_PATH: - return (ns_confFile); - break; - case LWRES_CONF_PATH: - return (lwresd_confFile); - break; - case RESOLV_CONF_PATH: - return (lwresd_resolvconfFile); - break; - case RNDC_CONF_PATH: - return (rndc_confFile); - break; - case NAMED_PID_PATH: - return (ns_defaultpidfile); - break; - case LWRESD_PID_PATH: - return (lwresd_defaultpidfile); - break; - case LOCAL_STATE_DIR: - return (local_state_dir); - break; - case SYS_CONF_DIR: - return (sys_conf_dir); - break; - case RNDC_KEY_PATH: - return (rndc_keyFile); - break; - default: - return (NULL); - } -} diff --git a/usr.sbin/bind/lib/isc/win32/once.c b/usr.sbin/bind/lib/isc/win32/once.c deleted file mode 100644 index 29a09f7866d..00000000000 --- a/usr.sbin/bind/lib/isc/win32/once.c +++ /dev/null @@ -1,51 +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. - */ - -/* $ISC: once.c,v 1.9 2001/07/09 21:06:16 gson Exp $ */ - -/* Principal Authors: DCL */ - -#include <config.h> - -#include <windows.h> - -#include <isc/once.h> -#include <isc/assertions.h> -#include <isc/util.h> - -isc_result_t -isc_once_do(isc_once_t *controller, void(*function)(void)) { - REQUIRE(controller != NULL && function != NULL); - - if (controller->status == ISC_ONCE_INIT_NEEDED) { - - if (InterlockedDecrement(&controller->counter) == 0) { - if (controller->status == ISC_ONCE_INIT_NEEDED) { - function(); - controller->status = ISC_ONCE_INIT_DONE; - } - } else { - while (controller->status == ISC_ONCE_INIT_NEEDED) { - /* - * Spin wait. - */ - } - } - } - - return (ISC_R_SUCCESS); -} diff --git a/usr.sbin/bind/lib/isc/win32/os.c b/usr.sbin/bind/lib/isc/win32/os.c deleted file mode 100644 index a31551327f2..00000000000 --- a/usr.sbin/bind/lib/isc/win32/os.c +++ /dev/null @@ -1,60 +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. - */ - -/* $ISC: os.c,v 1.4 2001/07/17 20:29:30 gson Exp $ */ - -#include <windows.h> - -static BOOL bInit = FALSE; -static SYSTEM_INFO SystemInfo; -static OSVERSIONINFO osVer; - -static void -initialize_action(void) { - BOOL bSuccess; - - if (bInit) - return; - - GetSystemInfo(&SystemInfo); - osVer.dwOSVersionInfoSize = sizeof(osVer); - bSuccess = GetVersionEx(&osVer); - bInit = TRUE; -} - -unsigned int -isc_os_ncpus(void) { - long ncpus = 1; - initialize_action(); - ncpus = SystemInfo.dwNumberOfProcessors; - if (ncpus <= 0) - ncpus = 1; - - return ((unsigned int)ncpus); -} - -unsigned int -isc_os_majorversion(void) { - initialize_action(); - return ((unsigned int)osVer.dwMajorVersion); -} - -unsigned int -isc_os_minorversion(void) { - initialize_action(); - return ((unsigned int)osVer.dwMinorVersion); -} diff --git a/usr.sbin/bind/lib/isc/win32/resource.c b/usr.sbin/bind/lib/isc/win32/resource.c deleted file mode 100644 index 78abc14d2d0..00000000000 --- a/usr.sbin/bind/lib/isc/win32/resource.c +++ /dev/null @@ -1,38 +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. - */ - -/* $ISC: resource.c,v 1.2 2001/07/06 19:40:33 gson Exp $ */ - -#include <config.h> - -#include <isc/platform.h> -#include <isc/resource.h> -#include <isc/result.h> -#include <isc/util.h> - -#include "errno2result.h" - -isc_result_t -isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) { - return (ISC_R_NOTIMPLEMENTED); - -} - -isc_result_t -isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value) { - return (ISC_R_NOTIMPLEMENTED); -} diff --git a/usr.sbin/bind/lib/isc/win32/socket.c b/usr.sbin/bind/lib/isc/win32/socket.c deleted file mode 100644 index fa5e8cb5dd2..00000000000 --- a/usr.sbin/bind/lib/isc/win32/socket.c +++ /dev/null @@ -1,3434 +0,0 @@ -/* - * Copyright (C) 2000-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. - */ - -/* $ISC: socket.c,v 1.5.2.7 2002/07/31 03:10:58 mayer Exp $ */ - - -#define MAKE_EXTERNAL 1 -#include <config.h> - -#include <sys/types.h> - -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ -#endif - -#include <errno.h> -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <io.h> -#include <fcntl.h> - -#include <isc/buffer.h> -#include <isc/bufferlist.h> -#include <isc/condition.h> -#include <isc/list.h> -#include <isc/log.h> -#include <isc/mem.h> -#include <isc/msgs.h> -#include <isc/mutex.h> -#include <isc/net.h> -#include <isc/platform.h> -#include <isc/print.h> -#include <isc/region.h> -#include <isc/socket.h> -#include <isc/task.h> -#include <isc/thread.h> -#include <isc/util.h> - -#include "errno2result.h" - -#define MAX_SELECT_SECONDS 0 -#define MAX_SELECT_MILLISECONDS 40 -/* - * Some systems define the socket length argument as an int, some as size_t, - * some as socklen_t. This is here so it can be easily changed if needed. - */ -#ifndef ISC_SOCKADDR_LEN_T -#define ISC_SOCKADDR_LEN_T unsigned int -#endif - -/* - * Define what the possible "soft" errors can be. These are non-fatal returns - * of various network related functions, like recv() and so on. - * - * For some reason, BSDI (and perhaps others) will sometimes return <0 - * from recv() but will have errno==0. This is broken, but we have to - * work around it here. - */ -#define SOFT_ERROR(e) ((e) == WSAEINTR || \ - (e) == WSAEWOULDBLOCK || \ - (e) == EWOULDBLOCK || \ - (e) == EINTR || \ - (e) == EAGAIN || \ - (e) == 0) - -#define DLVL(x) ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(x) - -/* - * DLVL(90) -- Function entry/exit and other tracing. - * DLVL(70) -- Socket "correctness" -- including returning of events, etc. - * DLVL(60) -- Socket data send/receive - * DLVL(50) -- Event tracing, including receiving/sending completion events. - * DLVL(20) -- Socket creation/destruction. - */ -#define TRACE_LEVEL 90 -#define CORRECTNESS_LEVEL 70 -#define IOEVENT_LEVEL 60 -#define EVENT_LEVEL 50 -#define CREATION_LEVEL 20 - -#define TRACE DLVL(TRACE_LEVEL) -#define CORRECTNESS DLVL(CORRECTNESS_LEVEL) -#define IOEVENT DLVL(IOEVENT_LEVEL) -#define EVENT DLVL(EVENT_LEVEL) -#define CREATION DLVL(CREATION_LEVEL) - -typedef isc_event_t intev_t; - -#define SOCKET_MAGIC ISC_MAGIC('I', 'O', 'i', 'o') -#define VALID_SOCKET(t) ISC_MAGIC_VALID(t, SOCKET_MAGIC) - -/* - * IPv6 control information. If the socket is an IPv6 socket we want - * to collect the destination address and interface so the client can - * set them on outgoing packets. - */ -#ifdef ISC_PLATFORM_HAVEIPV6 -#ifndef USE_CMSG -#define USE_CMSG 1 -#endif -#endif - -/* - * NetBSD and FreeBSD can timestamp packets. XXXMLG Should we have - * a setsockopt() like interface to request timestamps, and if the OS - * doesn't do it for us, call gettimeofday() on every UDP receive? - */ -#ifdef SO_TIMESTAMP -#ifndef USE_CMSG -#define USE_CMSG 1 -#endif -#endif - -/* - * Check to see if we have even basic support for cracking messages from - * the control data returned from/sent via recvmsg()/sendmsg(). - */ -#if defined(USE_CMSG) && (!defined(CMSG_LEN) || !defined(CMSG_SPACE)) -#undef USE_CMSG -#endif - -/* - * We really don't want to try and use these control messages. Win32 - * doesn't have this mechanism - */ -#undef USE_CMSG - -/* - * Message header for recvmsg and sendmsg calls. - * Used value-result for recvmsg, value only for sendmsg. - */ -struct iovec { - void *iov_base; /* starting address of buffer */ - size_t iov_len; /* size of buffer */ -}; - -struct msghdr { - void *msg_name; /* optional address */ - u_int msg_namelen; /* size of address */ - WSABUF *msg_iov; /* scatter/gather array */ - u_int msg_iovlen; /* # elements in msg_iov */ - void *msg_control; /* ancillary data, see below */ - u_int msg_controllen; /* ancillary data buffer len */ - int msg_flags; /* flags on received message */ -} msghdr; - -/* - * The number of times a send operation is repeated if the result is EINTR. - */ -#define NRETRIES 10 - -struct isc_socket { - /* Not locked. */ - unsigned int magic; - isc_socketmgr_t *manager; - isc_mutex_t lock; - isc_sockettype_t type; - - /* Locked by socket lock. */ - ISC_LINK(isc_socket_t) link; - unsigned int references; - int fd; - int pf; - - ISC_LIST(isc_socketevent_t) send_list; - ISC_LIST(isc_socketevent_t) recv_list; - ISC_LIST(isc_socket_newconnev_t) accept_list; - isc_socket_connev_t *connect_ev; - - /* - * Internal events. Posted when a descriptor is readable or - * writable. These are statically allocated and never freed. - * They will be set to non-purgable before use. - */ - intev_t readable_ev; - intev_t writable_ev; - - isc_sockaddr_t address; /* remote address */ - - unsigned int pending_recv : 1, - pending_send : 1, - pending_accept : 1, - listener : 1, /* listener socket */ - connected : 1, - connecting : 1, /* connect pending */ - bound : 1; /* bound to local addr */ - -#ifdef ISC_NET_RECVOVERFLOW - unsigned char overflow; /* used for MSG_TRUNC fake */ -#endif -}; - -#define SOCKET_MANAGER_MAGIC ISC_MAGIC('I', 'O', 'm', 'g') -#define VALID_MANAGER(m) ISC_MAGIC_VALID(m, SOCKET_MANAGER_MAGIC) - -struct isc_socketmgr { - /* Not locked. */ - unsigned int magic; - isc_mem_t *mctx; - isc_mutex_t lock; - /* Locked by manager lock. */ - ISC_LIST(isc_socket_t) socklist; - fd_set read_fds; - fd_set write_fds; - fd_set except_fds; - isc_socket_t *fds[FD_SETSIZE]; - int fdstate[FD_SETSIZE]; - int maxfd; - int minfd; - isc_thread_t watcher; - isc_condition_t shutdown_ok; - int pipe_fds[2]; -}; - -#define CLOSED 0 /* this one must be zero */ -#define MANAGED 1 -#define CLOSE_PENDING 2 - -/* - * send() and recv() iovec counts - */ -#define MAXSCATTERGATHER_SEND (ISC_SOCKET_MAXSCATTERGATHER) -#ifdef ISC_NET_RECVOVERFLOW -# define MAXSCATTERGATHER_RECV (ISC_SOCKET_MAXSCATTERGATHER + 1) -#else -# define MAXSCATTERGATHER_RECV (ISC_SOCKET_MAXSCATTERGATHER) -#endif - -static void send_recvdone_event(isc_socket_t *, isc_socketevent_t **); -static void send_senddone_event(isc_socket_t *, isc_socketevent_t **); -static void free_socket(isc_socket_t **); -static isc_result_t allocate_socket(isc_socketmgr_t *, isc_sockettype_t, - isc_socket_t **); -static void destroy(isc_socket_t **); -static void internal_accept(isc_task_t *, isc_event_t *); -static void internal_connect(isc_task_t *, isc_event_t *); -static void internal_recv(isc_task_t *, isc_event_t *); -static void internal_send(isc_task_t *, isc_event_t *); -static void process_cmsg(isc_socket_t *, struct msghdr *, isc_socketevent_t *); -static void build_msghdr_send(isc_socket_t *, isc_socketevent_t *, - struct msghdr *, char *cmsg, - WSABUF *, size_t *); -static void build_msghdr_recv(isc_socket_t *, isc_socketevent_t *, - struct msghdr *, char *cmsg, - WSABUF *, size_t *); - -#define SELECT_POKE_SHUTDOWN (-1) -#define SELECT_POKE_NOTHING (-2) -#define SELECT_POKE_READ (-3) -#define SELECT_POKE_ACCEPT (-3) /* Same as _READ */ -#define SELECT_POKE_WRITE (-4) -#define SELECT_POKE_CONNECT (-5) -#define SELECT_POKE_CLOSE (-6) - -long bpipe_written = 0; - -#define SOCK_DEAD(s) ((s)->references == 0) - -/* - * Routine to handle error messages - */ - -#define ISC_STRERRORSIZE 128 - -void -isc__strerror(int num, char *buf, size_t size) { - char *msg; - unsigned int unum = num; - - REQUIRE(buf != NULL); - - msg = NTstrerror(num); - if (msg != NULL) - snprintf(buf, size, "%s", msg); - else - snprintf(buf, size, "Unknown error: %u", unum); -} - - -/* - * The following routines are here to handle Unix emulation until we - * can rewrite the the routines in Winsock2 style. - */ - -/* - * Initialize socket services - */ -BOOL InitSockets() { - WORD wVersionRequested; - WSADATA wsaData; - int err; - - /* Need Winsock 2.0 or better */ - wVersionRequested = MAKEWORD(2, 0); - - err = WSAStartup(wVersionRequested, &wsaData); - if ( err != 0 ) { - /* Tell the user that we could not find a usable Winsock DLL */ - return (FALSE); - } - - return (TRUE); -} - -int -internal_pipe(int filedes[2]) { - int status; - unsigned int pipesize = 65535; - int mode = _O_TEXT; - - status = _pipe(filedes, pipesize, mode); - return (status); - InterlockedExchange(&bpipe_written, 0); -} - -int -internal_sendmsg(int sock, const struct msghdr *msg, int flags, int *merror) { - DWORD BytesSent; - DWORD Flags = flags; - - *merror = WSASendTo((SOCKET) sock, - msg->msg_iov, - msg->msg_iovlen, - &BytesSent, - Flags, - msg->msg_name, - msg->msg_namelen, - NULL, - NULL); - - if (*merror == SOCKET_ERROR) { - BytesSent = -1; - /* There is an error... */ - *merror = WSAGetLastError(); - if (*merror == WSA_IO_PENDING) { - /* Overlapped send successfully initiated. */ - errno = EAGAIN; - } else { - /* An unexpected error occurred. */ - errno = *merror; - } - } - - /* No error -- the I/O request was completed immediately... */ - return (BytesSent); -} - -int -internal_recvmsg(int sock, struct msghdr *msg, int flags, int *merror) { - DWORD Flags = flags; - DWORD NumBytes; - int Result; - - Result = WSARecvFrom((SOCKET) sock, - msg->msg_iov, - msg->msg_iovlen, - &NumBytes, - &Flags, - msg->msg_name, - (int *)&(msg->msg_namelen), - NULL, - NULL); - - - /* Check for errors. */ - if (Result == SOCKET_ERROR) { - *merror = WSAGetLastError(); - NumBytes = -1; - - switch (*merror) { - case WSAEWOULDBLOCK: - /* - * No data received; return to wait for another - * read event. - */ - errno = EAGAIN; - break; - - default: - /* Some other error... hit the panic button. */ - errno = *merror; - break; - } - } - msg->msg_flags = Flags; /* Return the flags received in header */ - - return (NumBytes); -} - -static void -manager_log(isc_socketmgr_t *sockmgr, - isc_logcategory_t *category, isc_logmodule_t *module, int level, - const char *fmt, ...) -{ - char msgbuf[2048]; - va_list ap; - - if (! isc_log_wouldlog(isc_lctx, level)) - return; - - va_start(ap, fmt); - vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); - va_end(ap); - - isc_log_write(isc_lctx, category, module, level, - "sockmgr %p: %s", sockmgr, msgbuf); -} - -static void -socket_log(isc_socket_t *sock, isc_sockaddr_t *address, - isc_logcategory_t *category, isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *fmt, ...) ISC_FORMAT_PRINTF(9, 10); -static void -socket_log(isc_socket_t *sock, isc_sockaddr_t *address, - isc_logcategory_t *category, isc_logmodule_t *module, int level, - isc_msgcat_t *msgcat, int msgset, int message, - const char *fmt, ...) -{ - char msgbuf[2048]; - char peerbuf[256]; - va_list ap; - - if (! isc_log_wouldlog(isc_lctx, level)) - return; - - va_start(ap, fmt); - vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); - va_end(ap); - - if (address == NULL) { - isc_log_iwrite(isc_lctx, category, module, level, - msgcat, msgset, message, - "socket %p: %s", sock, msgbuf); - } else { - isc_sockaddr_format(address, peerbuf, sizeof(peerbuf)); - isc_log_iwrite(isc_lctx, category, module, level, - msgcat, msgset, message, - "socket %p %s: %s", sock, peerbuf, msgbuf); - } -} - -static void -wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) { - isc_socket_t *sock; - - /* - * This is a wakeup on a socket. If the socket is not in the - * process of being closed, start watching it for either reads - * or writes. - */ - - INSIST(fd >= 0 && fd < FD_SETSIZE); - - if (manager->fdstate[fd] == CLOSE_PENDING) { - manager->fdstate[fd] = CLOSED; - FD_CLR(fd, &manager->read_fds); - FD_CLR(fd, &manager->write_fds); - FD_CLR(fd, &manager->except_fds); - closesocket(fd); - return; - } - if (manager->fdstate[fd] != MANAGED) - return; - - sock = manager->fds[fd]; - - /* - * If there are no events, or there is an event but we - * have already queued up the internal event on a task's - * queue, clear the bit. Otherwise, set it. - */ - if (msg == SELECT_POKE_READ) - FD_SET(sock->fd, &manager->read_fds); - if (msg == SELECT_POKE_WRITE) - FD_SET(sock->fd, &manager->write_fds); - if (msg == SELECT_POKE_CONNECT) { /* Need both here */ - FD_SET(sock->fd, &manager->write_fds); - FD_SET(sock->fd, &manager->except_fds); - } -} - -/* - * Poke the select loop when there is something for us to do. - * The write is required (by POSIX) to complete. That is, we - * will not get partial writes. - */ -static void -select_poke(isc_socketmgr_t *mgr, int fd, int msg) { - int cc; - int buf[2]; - char strbuf[ISC_STRERRORSIZE]; - - buf[0] = fd; - buf[1] = msg; - - if (msg == SELECT_POKE_SHUTDOWN) { - do { - cc = _write(mgr->pipe_fds[1], buf, sizeof(buf)); - } while (cc < 0 && SOFT_ERROR(errno)); - - if (cc < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - FATAL_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_WRITEFAILED, - "write() failed " - "during watcher poke: %s"), - strbuf); - } - - INSIST(cc == sizeof(buf)); - - InterlockedIncrement(&bpipe_written); - } else { - wakeup_socket(mgr, fd, msg); - } -} - -/* - * Read a message on the internal fd. - */ -static void -select_readmsg(isc_socketmgr_t *mgr, int *fd, int *msg) { - int buf[2]; - int cc; - char strbuf[ISC_STRERRORSIZE]; - - cc = _read(mgr->pipe_fds[0], buf, sizeof(buf)); - if (cc < 0) { - *msg = SELECT_POKE_NOTHING; - if (SOFT_ERROR(errno)) - return; - - isc__strerror(errno, strbuf, sizeof(strbuf)); - FATAL_ERROR(__FILE__, __LINE__, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_READFAILED, - "read() failed " - "during watcher poke: %s"), - strbuf); - - return; - } - INSIST(cc == sizeof(buf)); - *fd = buf[0]; - *msg = buf[1]; - -} -/* - * Make a fd non-blocking. - */ -static isc_result_t -make_nonblock(int fd) { - int ret; - unsigned long flags = 1; - char strbuf[ISC_STRERRORSIZE]; - - /* Set the socket to non-blocking */ - ret = ioctlsocket((SOCKET) fd, FIONBIO, &flags); - - if (ret == -1) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "ioctlsocket(%d, FIOBIO, %d): %s", - fd, flags, strbuf); - - return (ISC_R_UNEXPECTED); - } - - return (ISC_R_SUCCESS); -} - -/* - * Process control messages received on a socket. - */ -static void -process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) { -#ifdef USE_CMSG - struct cmsghdr *cmsgp; -#ifdef ISC_PLATFORM_HAVEIPV6 - struct in6_pktinfo *pktinfop; -#endif -#ifdef SO_TIMESTAMP - struct timeval *timevalp; -#endif -#endif - - /* - * sock is used only when ISC_NET_BSD44MSGHDR and USE_CMSG are defined. - * msg and dev are used only when ISC_NET_BSD44MSGHDR is defined. - * They are all here, outside of the CPP tests, because it is - * more consistent with the usual ISC coding style. - */ - UNUSED(sock); - UNUSED(msg); - UNUSED(dev); - -#ifndef ISC_NET_BSD44MSGHDR - return; - -#else /* defined ISC_NET_BSD44MSGHDR */ - -#ifdef MSG_TRUNC - if ((msg->msg_flags & MSG_TRUNC) == MSG_TRUNC) - dev->attributes |= ISC_SOCKEVENTATTR_TRUNC; -#endif - -#ifdef MSG_CTRUNC - if ((msg->msg_flags & MSG_CTRUNC) == MSG_CTRUNC) - dev->attributes |= ISC_SOCKEVENTATTR_CTRUNC; -#endif - -#ifndef USE_CMSG - return; -#else - if (msg->msg_controllen == 0 || msg->msg_control == NULL) - return; - -#ifdef SO_TIMESTAMP - timevalp = NULL; -#endif -#ifdef ISC_PLATFORM_HAVEIPV6 - pktinfop = NULL; -#endif - - cmsgp = CMSG_FIRSTHDR(msg); - while (cmsgp != NULL) { - socket_log(sock, NULL, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PROCESSCMSG, - "processing cmsg %p", cmsgp); - -#ifdef ISC_PLATFORM_HAVEIPV6 - if (cmsgp->cmsg_level == IPPROTO_IPV6 - && cmsgp->cmsg_type == IPV6_PKTINFO) { - - pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp); - memcpy(&dev->pktinfo, pktinfop, - sizeof(struct in6_pktinfo)); - dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO; - socket_log(sock, NULL, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_IFRECEIVED, - "interface received on ifindex %u", - dev->pktinfo.ipi6_ifindex); - if (IN6_IS_ADDR_MULTICAST(&pktinfop->ipi6_addr)) - dev->attributes |= ISC_SOCKEVENTATTR_MULTICAST; - goto next; - } -#endif - -#ifdef SO_TIMESTAMP - if (cmsgp->cmsg_level == SOL_SOCKET - && cmsgp->cmsg_type == SCM_TIMESTAMP) { - timevalp = (struct timeval *)CMSG_DATA(cmsgp); - dev->timestamp.seconds = timevalp->tv_sec; - dev->timestamp.nanoseconds = timevalp->tv_usec * 1000; - dev->attributes |= ISC_SOCKEVENTATTR_TIMESTAMP; - goto next; - } -#endif - - next: - cmsgp = CMSG_NXTHDR(msg, cmsgp); - } -#endif /* USE_CMSG */ - -#endif /* ISC_NET_BSD44MSGHDR */ - -} - -/* - * Construct an iov array and attach it to the msghdr passed in. This is - * the SEND constructor, which will use the used region of the buffer - * (if using a buffer list) or will use the internal region (if a single - * buffer I/O is requested). - * - * Nothing can be NULL, and the done event must list at least one buffer - * on the buffer linked list for this function to be meaningful. - * - * If write_countp != NULL, *write_countp will hold the number of bytes - * this transaction can send. - */ -static void -build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev, - struct msghdr *msg, char *cmsg, - WSABUF *iov, size_t *write_countp) -{ - unsigned int iovcount; - isc_buffer_t *buffer; - isc_region_t used; - size_t write_count; - size_t skip_count; - -#ifndef USE_CMSG - UNUSED(cmsg); -#endif - - memset(msg, 0, sizeof (*msg)); - - if (sock->type == isc_sockettype_udp) { - msg->msg_name = (void *)&dev->address.type.sa; - msg->msg_namelen = dev->address.length; - } else { - msg->msg_name = NULL; - msg->msg_namelen = 0; - } - - buffer = ISC_LIST_HEAD(dev->bufferlist); - write_count = 0; - iovcount = 0; - - /* - * Single buffer I/O? Skip what we've done so far in this region. - */ - if (buffer == NULL) { - write_count = dev->region.length - dev->n; - iov[0].buf = (void *)(dev->region.base + dev->n); - iov[0].len = write_count; - iovcount = 1; - - goto config; - } - - /* - * Multibuffer I/O. - * Skip the data in the buffer list that we have already written. - */ - skip_count = dev->n; - while (buffer != NULL) { - REQUIRE(ISC_BUFFER_VALID(buffer)); - if (skip_count < isc_buffer_usedlength(buffer)) - break; - skip_count -= isc_buffer_usedlength(buffer); - buffer = ISC_LIST_NEXT(buffer, link); - } - - while (buffer != NULL) { - INSIST(iovcount < MAXSCATTERGATHER_SEND); - - isc_buffer_usedregion(buffer, &used); - - if (used.length > 0) { - iov[iovcount].buf = (void *)(used.base - + skip_count); - iov[iovcount].len = used.length - skip_count; - write_count += (used.length - skip_count); - skip_count = 0; - iovcount++; - } - buffer = ISC_LIST_NEXT(buffer, link); - } - - INSIST(skip_count == 0); - - config: - msg->msg_iov = iov; - msg->msg_iovlen = iovcount; - -#ifdef ISC_NET_BSD44MSGHDR - msg->msg_control = NULL; - msg->msg_controllen = 0; - msg->msg_flags = 0; -#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIPV6) - if ((sock->type == isc_sockettype_udp) - && ((dev->attributes & ISC_SOCKEVENTATTR_PKTINFO) != 0)) { - struct cmsghdr *cmsgp; - struct in6_pktinfo *pktinfop; - - socket_log(sock, NULL, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_SENDTODATA, - "sendto pktinfo data, ifindex %u", - dev->pktinfo.ipi6_ifindex); - - msg->msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo)); - msg->msg_control = (void *)cmsg; - - cmsgp = (struct cmsghdr *)cmsg; - cmsgp->cmsg_level = IPPROTO_IPV6; - cmsgp->cmsg_type = IPV6_PKTINFO; - cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); - pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp); - memcpy(pktinfop, &dev->pktinfo, sizeof(struct in6_pktinfo)); - } -#endif /* USE_CMSG && ISC_PLATFORM_HAVEIPV6 */ -#endif /* ISC_NET_BSD44MSGHDR */ - - if (write_countp != NULL) - *write_countp = write_count; -} - -/* - * Construct an iov array and attach it to the msghdr passed in. This is - * the RECV constructor, which will use the available region of the buffer - * (if using a buffer list) or will use the internal region (if a single - * buffer I/O is requested). - * - * Nothing can be NULL, and the done event must list at least one buffer - * on the buffer linked list for this function to be meaningful. - * - * If read_countp != NULL, *read_countp will hold the number of bytes - * this transaction can receive. - */ -static void -build_msghdr_recv(isc_socket_t *sock, isc_socketevent_t *dev, - struct msghdr *msg, char *cmsg, - WSABUF *iov, size_t *read_countp) -{ - unsigned int iovcount; - isc_buffer_t *buffer; - isc_region_t available; - size_t read_count; - -#ifndef USE_CMSG - UNUSED(cmsg); -#endif - - memset(msg, 0, sizeof (struct msghdr)); - - if (sock->type == isc_sockettype_udp) { - memset(&dev->address, 0, sizeof(dev->address)); - msg->msg_name = (void *)&dev->address.type.sa; - msg->msg_namelen = sizeof(dev->address.type); -#ifdef ISC_NET_RECVOVERFLOW - /* If needed, steal one iovec for overflow detection. */ - maxiov--; -#endif - } else { /* TCP */ - msg->msg_name = NULL; - msg->msg_namelen = 0; - dev->address = sock->address; - } - - buffer = ISC_LIST_HEAD(dev->bufferlist); - read_count = 0; - - /* - * Single buffer I/O? Skip what we've done so far in this region. - */ - if (buffer == NULL) { - read_count = dev->region.length - dev->n; - iov[0].buf = (void *)(dev->region.base + dev->n); - iov[0].len = read_count; - iovcount = 1; - } else { - /* - * Multibuffer I/O. - * Skip empty buffers. - */ - while (buffer != NULL) { - REQUIRE(ISC_BUFFER_VALID(buffer)); - if (isc_buffer_availablelength(buffer) != 0) - break; - buffer = ISC_LIST_NEXT(buffer, link); - } - - iovcount = 0; - while (buffer != NULL) { - INSIST(iovcount < MAXSCATTERGATHER_RECV); - - isc_buffer_availableregion(buffer, &available); - - if (available.length > 0) { - iov[iovcount].buf = (void *)(available.base); - iov[iovcount].len = available.length; - read_count += available.length; - iovcount++; - } - buffer = ISC_LIST_NEXT(buffer, link); - } - } - - /* - * If needed, set up to receive that one extra byte. Note that - * we know there is at least one iov left, since we stole it - * at the top of this function. - */ -#ifdef ISC_NET_RECVOVERFLOW - if (sock->type == isc_sockettype_udp) { - iov[iovcount].iov_base = (void *)(&sock->overflow); - iov[iovcount].iov_len = 1; - iovcount++; - } -#endif - - msg->msg_iov = iov; - msg->msg_iovlen = iovcount; - -#ifdef ISC_NET_BSD44MSGHDR - msg->msg_control = NULL; - msg->msg_controllen = 0; - msg->msg_flags = 0; -#if defined(USE_CMSG) - if (sock->type == isc_sockettype_udp) { - msg->msg_control = cmsg; - msg->msg_controllen = CMSG_BUF_SIZE; - } -#endif /* USE_CMSG */ -#endif /* ISC_NET_BSD44MSGHDR */ - - if (read_countp != NULL) - *read_countp = read_count; -} - -static void -set_dev_address(isc_sockaddr_t *address, isc_socket_t *sock, - isc_socketevent_t *dev) -{ - if (sock->type == isc_sockettype_udp) { - if (address != NULL) - dev->address = *address; - else - dev->address = sock->address; - } else if (sock->type == isc_sockettype_tcp) { - INSIST(address == NULL); - dev->address = sock->address; - } -} - -static isc_socketevent_t * -allocate_socketevent(isc_socket_t *sock, isc_eventtype_t eventtype, - isc_taskaction_t action, const void *arg) -{ - isc_socketevent_t *ev; - - ev = (isc_socketevent_t *)isc_event_allocate(sock->manager->mctx, - sock, eventtype, - action, arg, - sizeof (*ev)); - - if (ev == NULL) - return (NULL); - - ev->result = ISC_R_UNEXPECTED; - ISC_LINK_INIT(ev, ev_link); - ISC_LIST_INIT(ev->bufferlist); - ev->region.base = NULL; - ev->n = 0; - ev->offset = 0; - ev->attributes = 0; - - return (ev); -} - -#if defined(ISC_SOCKET_DEBUG) -static void -dump_msg(struct msghdr *msg, isc_socket_t *sock) { - unsigned int i; - - printf("MSGHDR %p, Socket #: %d\n", msg, sock->fd); - printf("\tname %p, namelen %d\n", msg->msg_name, msg->msg_namelen); - printf("\tiov %p, iovlen %d\n", msg->msg_iov, msg->msg_iovlen); - for (i = 0 ; i < (unsigned int)msg->msg_iovlen ; i++) - printf("\t\t%d\tbase %p, len %d\n", i, - msg->msg_iov[i].buf, - msg->msg_iov[i].len); -#ifdef ISC_NET_BSD44MSGHDR - printf("\tcontrol %p, controllen %d\n", msg->msg_control, - msg->msg_controllen); -#endif -} -#endif - -#define DOIO_SUCCESS 0 /* i/o ok, event sent */ -#define DOIO_SOFT 1 /* i/o ok, soft error, no event sent */ -#define DOIO_HARD 2 /* i/o error, event sent */ -#define DOIO_EOF 3 /* EOF, no event sent */ - -static int -doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) { - int cc; - WSABUF iov[MAXSCATTERGATHER_RECV]; - size_t read_count; - size_t actual_count; - struct msghdr msghdr; - isc_buffer_t *buffer; - int recv_errno = 0; -#if USE_CMSG - char cmsg[CMSG_BUF_SIZE]; -#else - char *cmsg = NULL; -#endif - char strbuf[ISC_STRERRORSIZE]; - - build_msghdr_recv(sock, dev, &msghdr, cmsg, iov, &read_count); - -#if defined(ISC_SOCKET_DEBUG) - dump_msg(&msghdr,sock); -#endif - - cc = internal_recvmsg(sock->fd, &msghdr, 0, &recv_errno); - - if (cc < 0) { - if (SOFT_ERROR(recv_errno)) - return (DOIO_SOFT); - - if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) { - isc__strerror(recv_errno, strbuf, sizeof(strbuf)); - socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_DOIORECV, - "doio_recv: recvmsg(%d) %d bytes, err %d/%s", - sock->fd, cc, recv_errno, strbuf); - } - -#define SOFT_OR_HARD(_system, _isc) \ - if (recv_errno == _system) { \ - if (sock->connected) { \ - dev->result = _isc; \ - return (DOIO_HARD); \ - } \ - return (DOIO_SOFT); \ - } -#define ALWAYS_HARD(_system, _isc) \ - if (recv_errno == _system) { \ - dev->result = _isc; \ - return (DOIO_HARD); \ - } - - SOFT_OR_HARD(WSAECONNREFUSED, ISC_R_CONNREFUSED); - SOFT_OR_HARD(WSAENETUNREACH, ISC_R_NETUNREACH); - SOFT_OR_HARD(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH); - SOFT_OR_HARD(WSAECONNRESET, ISC_R_CONNECTIONRESET); - SOFT_OR_HARD(WSAENETRESET, ISC_R_CONNECTIONRESET); - SOFT_OR_HARD(WSAEDISCON, ISC_R_CONNECTIONRESET); - SOFT_OR_HARD(WSAENETDOWN, ISC_R_NETDOWN); - ALWAYS_HARD(WSAENOBUFS, ISC_R_NORESOURCES); - -#undef SOFT_OR_HARD -#undef ALWAYS_HARD - - dev->result = isc__errno2result(recv_errno); - return (DOIO_HARD); - } - - /* - * On TCP, zero length reads indicate EOF, while on - * UDP, zero length reads are perfectly valid, although - * strange. - */ - if ((sock->type == isc_sockettype_tcp) && (cc == 0)) - return (DOIO_EOF); - - if (sock->type == isc_sockettype_udp) { - dev->address.length = msghdr.msg_namelen; - if (isc_sockaddr_getport(&dev->address) == 0) { - if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) { - socket_log(sock, &dev->address, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_ZEROPORT, - "dropping source port zero packet"); - } - return (DOIO_SOFT); - } - } - - socket_log(sock, &dev->address, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PKTRECV, - "packet received correctly"); - - /* - * Overflow bit detection. If we received MORE bytes than we should, - * this indicates an overflow situation. Set the flag in the - * dev entry and adjust how much we read by one. - */ -#ifdef ISC_NET_RECVOVERFLOW - if ((sock->type == isc_sockettype_udp) && ((size_t)cc > read_count)) { - dev->attributes |= ISC_SOCKEVENTATTR_TRUNC; - cc--; - } -#endif - - /* - * If there are control messages attached, run through them and pull - * out the interesting bits. - */ - if (sock->type == isc_sockettype_udp) - process_cmsg(sock, &msghdr, dev); - - /* - * update the buffers (if any) and the i/o count - */ - dev->n += cc; - actual_count = cc; - buffer = ISC_LIST_HEAD(dev->bufferlist); - while (buffer != NULL && actual_count > 0) { - REQUIRE(ISC_BUFFER_VALID(buffer)); - if (isc_buffer_availablelength(buffer) <= actual_count) { - actual_count -= isc_buffer_availablelength(buffer); - isc_buffer_add(buffer, - isc_buffer_availablelength(buffer)); - } else { - isc_buffer_add(buffer, actual_count); - actual_count = 0; - break; - } - buffer = ISC_LIST_NEXT(buffer, link); - if (buffer == NULL) { - INSIST(actual_count == 0); - } - } - - /* - * If we read less than we expected, update counters, - * and let the upper layer poke the descriptor. - */ - if (((size_t)cc != read_count) && (dev->n < dev->minimum)) - return (DOIO_SOFT); - - /* - * Full reads are posted, or partials if partials are ok. - */ - dev->result = ISC_R_SUCCESS; - return (DOIO_SUCCESS); -} - -/* - * Returns: - * DOIO_SUCCESS The operation succeeded. dev->result contains - * ISC_R_SUCCESS. - * - * DOIO_HARD A hard or unexpected I/O error was encountered. - * dev->result contains the appropriate error. - * - * DOIO_SOFT A soft I/O error was encountered. No senddone - * event was sent. The operation should be retried. - * - * No other return values are possible. - */ -static int -doio_send(isc_socket_t *sock, isc_socketevent_t *dev) { - int cc; - WSABUF iov[MAXSCATTERGATHER_SEND]; - size_t write_count; - struct msghdr msghdr; - char addrbuf[ISC_SOCKADDR_FORMATSIZE]; -#if USE_CMSG - char cmsg[CMSG_BUF_SIZE]; -#else - char *cmsg = NULL; -#endif - int attempts = 0; - int send_errno = 0; - char strbuf[ISC_STRERRORSIZE]; - - build_msghdr_send(sock, dev, &msghdr, cmsg, iov, &write_count); - -resend: - cc = internal_sendmsg(sock->fd, &msghdr, 0, &send_errno); - - /* - * Check for error or block condition. - */ - if (cc < 0) { - if (send_errno == WSAEINTR && ++attempts < NRETRIES) - goto resend; - - if (SOFT_ERROR(send_errno)) - return (DOIO_SOFT); - -#define SOFT_OR_HARD(_system, _isc) \ - if (send_errno == _system) { \ - if (sock->connected) { \ - dev->result = _isc; \ - return (DOIO_HARD); \ - } \ - return (DOIO_SOFT); \ - } -#define ALWAYS_HARD(_system, _isc) \ - if (send_errno == _system) { \ - dev->result = _isc; \ - return (DOIO_HARD); \ - } - - SOFT_OR_HARD(WSAEACCES, ISC_R_NOPERM); - SOFT_OR_HARD(WSAEAFNOSUPPORT, ISC_R_ADDRNOTAVAIL); - SOFT_OR_HARD(WSAECONNREFUSED, ISC_R_CONNREFUSED); - SOFT_OR_HARD(WSAENOTCONN, ISC_R_CONNREFUSED); - SOFT_OR_HARD(WSAECONNRESET, ISC_R_CONNECTIONRESET); - SOFT_OR_HARD(WSAENETRESET, ISC_R_CONNECTIONRESET); - SOFT_OR_HARD(WSAEDISCON, ISC_R_CONNECTIONRESET); - SOFT_OR_HARD(WSAENETDOWN, ISC_R_NETDOWN); - ALWAYS_HARD(WSAEADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL); - ALWAYS_HARD(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH); - ALWAYS_HARD(WSAEHOSTDOWN, ISC_R_HOSTUNREACH); - ALWAYS_HARD(WSAENETUNREACH, ISC_R_NETUNREACH); - ALWAYS_HARD(WSAENOBUFS, ISC_R_NORESOURCES); - ALWAYS_HARD(EPERM, ISC_R_HOSTUNREACH); - ALWAYS_HARD(EPIPE, ISC_R_NOTCONNECTED); - -#undef SOFT_OR_HARD -#undef ALWAYS_HARD - - /* - * The other error types depend on whether or not the - * socket is UDP or TCP. If it is UDP, some errors - * that we expect to be fatal under TCP are merely - * annoying, and are really soft errors. - * - * However, these soft errors are still returned as - * a status. - */ - isc_sockaddr_format(&dev->address, addrbuf, sizeof(addrbuf)); - isc__strerror(send_errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, "internal_send: %s: %s", - addrbuf, strbuf); - dev->result = isc__errno2result(send_errno); - return (DOIO_HARD); - } - - if (cc == 0) - UNEXPECTED_ERROR(__FILE__, __LINE__, - "internal_send: send() %s 0", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_RETURNED, "returned")); - - /* - * If we write less than we expected, update counters, poke. - */ - dev->n += cc; - if ((size_t)cc != write_count) - return (DOIO_SOFT); - - /* - * Exactly what we wanted to write. We're done with this - * entry. Post its completion event. - */ - dev->result = ISC_R_SUCCESS; - return (DOIO_SUCCESS); -} - -/* - * Kill. - * - * Caller must ensure that the socket is not locked and no external - * references exist. - */ -static void -destroy(isc_socket_t **sockp) { - isc_socket_t *sock = *sockp; - isc_socketmgr_t *manager = sock->manager; - - socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_DESTROYING, "destroying"); - - INSIST(ISC_LIST_EMPTY(sock->accept_list)); - INSIST(ISC_LIST_EMPTY(sock->recv_list)); - INSIST(ISC_LIST_EMPTY(sock->send_list)); - INSIST(sock->connect_ev == NULL); - REQUIRE(sock->fd >= 0 && sock->fd < FD_SETSIZE); - - LOCK(&manager->lock); - - /* - * No one has this socket open, so the watcher doesn't have to be - * poked, and the socket doesn't have to be locked. - */ - manager->fds[sock->fd] = NULL; - manager->fdstate[sock->fd] = CLOSE_PENDING; - select_poke(manager, sock->fd, SELECT_POKE_CLOSE); - ISC_LIST_UNLINK(manager->socklist, sock, link); - -#ifdef ISC_PLATFORM_USETHREADS - if (ISC_LIST_EMPTY(manager->socklist)) - SIGNAL(&manager->shutdown_ok); -#endif /* ISC_PLATFORM_USETHREADS */ - - /* - * XXX should reset manager->maxfd here - */ - - UNLOCK(&manager->lock); - - free_socket(sockp); -} - -static isc_result_t -allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type, - isc_socket_t **socketp) -{ - isc_socket_t *sock; - isc_result_t ret; - - sock = isc_mem_get(manager->mctx, sizeof(*sock)); - - if (sock == NULL) - return (ISC_R_NOMEMORY); - - ret = ISC_R_UNEXPECTED; - - sock->magic = 0; - sock->references = 0; - - sock->manager = manager; - sock->type = type; - sock->fd = -1; - - ISC_LINK_INIT(sock, link); - - /* - * set up list of readers and writers to be initially empty - */ - ISC_LIST_INIT(sock->recv_list); - ISC_LIST_INIT(sock->send_list); - ISC_LIST_INIT(sock->accept_list); - sock->connect_ev = NULL; - sock->pending_recv = 0; - sock->pending_send = 0; - sock->pending_accept = 0; - sock->listener = 0; - sock->connected = 0; - sock->connecting = 0; - sock->bound = 0; - - /* - * initialize the lock - */ - if (isc_mutex_init(&sock->lock) != ISC_R_SUCCESS) { - sock->magic = 0; - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_mutex_init() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - ret = ISC_R_UNEXPECTED; - goto error; - } - - /* - * Initialize readable and writable events - */ - ISC_EVENT_INIT(&sock->readable_ev, sizeof(intev_t), - ISC_EVENTATTR_NOPURGE, NULL, ISC_SOCKEVENT_INTR, - NULL, sock, sock, NULL, NULL); - ISC_EVENT_INIT(&sock->writable_ev, sizeof(intev_t), - ISC_EVENTATTR_NOPURGE, NULL, ISC_SOCKEVENT_INTW, - NULL, sock, sock, NULL, NULL); - - sock->magic = SOCKET_MAGIC; - *socketp = sock; - - return (ISC_R_SUCCESS); - - error: /* socket allocated */ - - return (ret); -} - -/* - * This event requires that the various lists be empty, that the reference - * count be 1, and that the magic number is valid. The other socket bits, - * like the lock, must be initialized as well. The fd associated must be - * marked as closed, by setting it to -1 on close, or this routine will - * also close the socket. - */ -static void -free_socket(isc_socket_t **socketp) { - isc_socket_t *sock = *socketp; - - INSIST(sock->references == 0); - INSIST(VALID_SOCKET(sock)); - INSIST(!sock->connecting); - INSIST(!sock->pending_recv); - INSIST(!sock->pending_send); - INSIST(!sock->pending_accept); - INSIST(ISC_LIST_EMPTY(sock->recv_list)); - INSIST(ISC_LIST_EMPTY(sock->send_list)); - INSIST(ISC_LIST_EMPTY(sock->accept_list)); - INSIST(!ISC_LINK_LINKED(sock, link)); - - sock->magic = 0; - - DESTROYLOCK(&sock->lock); - - isc_mem_put(sock->manager->mctx, sock, sizeof(*sock)); - - *socketp = NULL; -} - -/* - * Create a new 'type' socket managed by 'manager'. Events - * will be posted to 'task' and when dispatched 'action' will be - * called with 'arg' as the arg value. The new socket is returned - * in 'socketp'. - */ -isc_result_t -isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, - isc_socket_t **socketp) { - isc_socket_t *sock = NULL; - isc_result_t ret; -#if defined(USE_CMSG) || defined(SO_BSDCOMPAT) - int on = 1; -#endif - int socket_errno = 0; - char strbuf[ISC_STRERRORSIZE]; - - REQUIRE(VALID_MANAGER(manager)); - REQUIRE(socketp != NULL && *socketp == NULL); - - ret = allocate_socket(manager, type, &sock); - if (ret != ISC_R_SUCCESS) - return (ret); - - sock->pf = pf; - switch (type) { - case isc_sockettype_udp: - sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP); - break; - case isc_sockettype_tcp: - sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP); - break; - } - - if (sock->fd >= FD_SETSIZE) { - (void)closesocket(sock->fd); - isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_TOOMANYFDS, - "%s: too many open file descriptors", "socket"); - free_socket(&sock); - return (ISC_R_NORESOURCES); - } - - if (sock->fd < 0) { - socket_errno = WSAGetLastError(); - free_socket(&sock); - - switch (socket_errno) { - case WSAEMFILE: - case WSAENOBUFS: - return (ISC_R_NORESOURCES); - - case WSAEPROTONOSUPPORT: - case WSAEPFNOSUPPORT: - case WSAEAFNOSUPPORT: - return (ISC_R_FAMILYNOSUPPORT); - - default: - isc__strerror(socket_errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "socket() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - return (ISC_R_UNEXPECTED); - } - } - - if (make_nonblock(sock->fd) != ISC_R_SUCCESS) { - free_socket(&sock); - return (ISC_R_UNEXPECTED); - } - -#ifdef SO_BSDCOMPAT - if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT, - (void *)&on, sizeof(on)) < 0) { - socket_errno = WSAGetLastError(); - isc__strerror(socket_errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d, SO_BSDCOMPAT) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - strbuf); - /* Press on... */ - } -#endif - -#if defined(USE_CMSG) - if (type == isc_sockettype_udp) { - -#if defined(SO_TIMESTAMP) - if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP, - (void *)&on, sizeof(on)) < 0 - && WSAGetLastError() != WSAENOPROTOOPT) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d, SO_TIMESTAMP) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - /* Press on... */ - } -#endif /* SO_TIMESTAMP */ - -#if defined(ISC_PLATFORM_HAVEIPV6) -#ifdef IPV6_RECVPKTINFO - /* 2292bis */ - if ((pf == AF_INET6) - && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, - (void *)&on, sizeof (on)) < 0)) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d, IPV6_RECVPKTINFO) " - "%s: %s", sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - } -#else - /* 2292 */ - if ((pf == AF_INET6) - && (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO, - (void *)&on, sizeof (on)) < 0)) { - isc__strerror(WSAGetLaastError(), strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d, IPV6_PKTINFO) %s: %s", - sock->fd, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - } -#endif /* IPV6_RECVPKTINFO */ -#ifdef IPV6_USE_MIN_MTU /*2292bis, not too common yet*/ - /* use minimum MTU */ - if (pf == AF_INET6) { - (void)setsockopt(sock->fd, IPPROTO_IPV6, - IPV6_USE_MIN_MTU, - (void *)&on, sizeof (on)); - } -#endif -#endif /* ISC_PLATFORM_HAVEIPV6 */ - - } -#endif /* USE_CMSG */ - - sock->references = 1; - *socketp = sock; - - LOCK(&manager->lock); - - /* - * Note we don't have to lock the socket like we normally would because - * there are no external references to it yet. - */ - - manager->fds[sock->fd] = sock; - manager->fdstate[sock->fd] = MANAGED; - ISC_LIST_APPEND(manager->socklist, sock, link); - if (manager->maxfd < sock->fd) - manager->maxfd = sock->fd; - manager->minfd = min(manager->minfd, sock->fd); - - UNLOCK(&manager->lock); - - socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_CREATED, "created %u", sock->fd); - - return (ISC_R_SUCCESS); -} - -/* - * Attach to a socket. Caller must explicitly detach when it is done. - */ -void -isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) { - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(socketp != NULL && *socketp == NULL); - - LOCK(&sock->lock); - sock->references++; - UNLOCK(&sock->lock); - - *socketp = sock; -} - -/* - * Dereference a socket. If this is the last reference to it, clean things - * up by destroying the socket. - */ -void -isc_socket_detach(isc_socket_t **socketp) { - isc_socket_t *sock; - isc_boolean_t kill_socket = ISC_FALSE; - - REQUIRE(socketp != NULL); - sock = *socketp; - REQUIRE(VALID_SOCKET(sock)); - - LOCK(&sock->lock); - REQUIRE(sock->references > 0); - sock->references--; - if (sock->references == 0) - kill_socket = ISC_TRUE; - UNLOCK(&sock->lock); - - if (kill_socket) - destroy(&sock); - - *socketp = NULL; -} - -/* - * I/O is possible on a given socket. Schedule an event to this task that - * will call an internal function to do the I/O. This will charge the - * task with the I/O operation and let our select loop handler get back - * to doing something real as fast as possible. - * - * The socket and manager must be locked before calling this function. - */ -static void -dispatch_recv(isc_socket_t *sock) { - intev_t *iev; - isc_socketevent_t *ev; - - INSIST(!sock->pending_recv); - - ev = ISC_LIST_HEAD(sock->recv_list); - if (ev == NULL) - return; - - sock->pending_recv = 1; - iev = &sock->readable_ev; - - socket_log(sock, NULL, EVENT, NULL, 0, 0, - "dispatch_recv: event %p -> task %p", ev, ev->ev_sender); - - sock->references++; - iev->ev_sender = sock; - iev->ev_action = internal_recv; - iev->ev_arg = sock; - - isc_task_send(ev->ev_sender, (isc_event_t **)&iev); -} - -static void -dispatch_send(isc_socket_t *sock) { - intev_t *iev; - isc_socketevent_t *ev; - - INSIST(!sock->pending_send); - - ev = ISC_LIST_HEAD(sock->send_list); - if (ev == NULL) - return; - - sock->pending_send = 1; - iev = &sock->writable_ev; - - socket_log(sock, NULL, EVENT, NULL, 0, 0, - "dispatch_send: event %p -> task %p", ev, ev->ev_sender); - - sock->references++; - iev->ev_sender = sock; - iev->ev_action = internal_send; - iev->ev_arg = sock; - - isc_task_send(ev->ev_sender, (isc_event_t **)&iev); -} - -/* - * Dispatch an internal accept event. - */ -static void -dispatch_accept(isc_socket_t *sock) { - intev_t *iev; - isc_socket_newconnev_t *ev; - - INSIST(!sock->pending_accept); - - /* - * Are there any done events left, or were they all canceled - * before the manager got the socket lock? - */ - ev = ISC_LIST_HEAD(sock->accept_list); - if (ev == NULL) - return; - - sock->pending_accept = 1; - iev = &sock->readable_ev; - - sock->references++; /* keep socket around for this internal event */ - iev->ev_sender = sock; - iev->ev_action = internal_accept; - iev->ev_arg = sock; - - isc_task_send(ev->ev_sender, (isc_event_t **)&iev); -} - -static void -dispatch_connect(isc_socket_t *sock) { - intev_t *iev; - isc_socket_connev_t *ev; - - iev = &sock->writable_ev; - - ev = sock->connect_ev; - INSIST(ev != NULL); /* XXX */ - - INSIST(sock->connecting); - - sock->references++; /* keep socket around for this internal event */ - iev->ev_sender = sock; - iev->ev_action = internal_connect; - iev->ev_arg = sock; - - isc_task_send(ev->ev_sender, (isc_event_t **)&iev); -} - -/* - * Dequeue an item off the given socket's read queue, set the result code - * in the done event to the one provided, and send it to the task it was - * destined for. - * - * If the event to be sent is on a list, remove it before sending. If - * asked to, send and detach from the socket as well. - * - * Caller must have the socket locked if the event is attached to the socket. - */ -static void -send_recvdone_event(isc_socket_t *sock, isc_socketevent_t **dev) { - isc_task_t *task; - - task = (*dev)->ev_sender; - - (*dev)->ev_sender = sock; - - if (ISC_LINK_LINKED(*dev, ev_link)) - ISC_LIST_DEQUEUE(sock->recv_list, *dev, ev_link); - - if (((*dev)->attributes & ISC_SOCKEVENTATTR_ATTACHED) - == ISC_SOCKEVENTATTR_ATTACHED) - isc_task_sendanddetach(&task, (isc_event_t **)dev); - else - isc_task_send(task, (isc_event_t **)dev); -} - -/* - * See comments for send_recvdone_event() above. - * - * Caller must have the socket locked if the event is attached to the socket. - */ -static void -send_senddone_event(isc_socket_t *sock, isc_socketevent_t **dev) { - isc_task_t *task; - - INSIST(dev != NULL && *dev != NULL); - - task = (*dev)->ev_sender; - (*dev)->ev_sender = sock; - - if (ISC_LINK_LINKED(*dev, ev_link)) - ISC_LIST_DEQUEUE(sock->send_list, *dev, ev_link); - - if (((*dev)->attributes & ISC_SOCKEVENTATTR_ATTACHED) - == ISC_SOCKEVENTATTR_ATTACHED) - isc_task_sendanddetach(&task, (isc_event_t **)dev); - else - isc_task_send(task, (isc_event_t **)dev); -} - -/* - * Call accept() on a socket, to get the new file descriptor. The listen - * socket is used as a prototype to create a new isc_socket_t. The new - * socket has one outstanding reference. The task receiving the event - * will be detached from just after the event is delivered. - * - * On entry to this function, the event delivered is the internal - * readable event, and the first item on the accept_list should be - * the done event we want to send. If the list is empty, this is a no-op, - * so just unlock and return. - */ -static void -internal_accept(isc_task_t *me, isc_event_t *ev) { - isc_socket_t *sock; - isc_socketmgr_t *manager; - isc_socket_newconnev_t *dev; - isc_task_t *task; - ISC_SOCKADDR_LEN_T addrlen; - int fd; - isc_result_t result = ISC_R_SUCCESS; - int accept_errno = 0; - char strbuf[ISC_STRERRORSIZE]; - - UNUSED(me); - - sock = ev->ev_sender; - INSIST(VALID_SOCKET(sock)); - - LOCK(&sock->lock); - socket_log(sock, NULL, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTLOCK, - "internal_accept called, locked socket"); - - manager = sock->manager; - INSIST(VALID_MANAGER(manager)); - - INSIST(sock->listener); - INSIST(sock->pending_accept == 1); - sock->pending_accept = 0; - - INSIST(sock->references > 0); - sock->references--; /* the internal event is done with this socket */ - if (sock->references == 0) { - UNLOCK(&sock->lock); - destroy(&sock); - return; - } - - /* - * Get the first item off the accept list. - * If it is empty, unlock the socket and return. - */ - dev = ISC_LIST_HEAD(sock->accept_list); - if (dev == NULL) { - UNLOCK(&sock->lock); - return; - } - - /* - * Try to accept the new connection. If the accept fails with - * EAGAIN or EINTR, simply poke the watcher to watch this socket - * again. - */ - addrlen = sizeof(dev->newsocket->address.type); - memset(&dev->newsocket->address.type.sa, 0, addrlen); - fd = accept(sock->fd, &dev->newsocket->address.type.sa, - (void *)&addrlen); - if (fd < 0) { - accept_errno = WSAGetLastError(); - if (SOFT_ERROR(accept_errno) || accept_errno == WSAECONNRESET) { - goto soft_error; - } else { - isc__strerror(accept_errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "internal_accept: accept() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - fd = -1; - result = ISC_R_UNEXPECTED; - } - } else { - if (addrlen == 0) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "internal_accept(): " - "accept() failed to return " - "remote address"); - - (void)closesocket(fd); - goto soft_error; - } else if (dev->newsocket->address.type.sa.sa_family != - sock->pf) - { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "internal_accept(): " - "accept() returned peer address " - "family %u (expected %u)", - dev->newsocket->address. - type.sa.sa_family, - sock->pf); - (void)closesocket(fd); - goto soft_error; - } else if (fd >= FD_SETSIZE) { - isc_log_iwrite(isc_lctx, ISC_LOGCATEGORY_GENERAL, - ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR, - isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_TOOMANYFDS, - "%s: too many open file descriptors", - "accept"); - (void)closesocket(fd); - goto soft_error; - } - } - - if (fd != -1) { - dev->newsocket->address.length = addrlen; - dev->newsocket->pf = sock->pf; - } - - /* - * Pull off the done event. - */ - ISC_LIST_UNLINK(sock->accept_list, dev, ev_link); - - /* - * Poke watcher if there are more pending accepts. - */ - if (!ISC_LIST_EMPTY(sock->accept_list)) - select_poke(sock->manager, sock->fd, SELECT_POKE_ACCEPT); - - UNLOCK(&sock->lock); - - if (fd != -1 && (make_nonblock(fd) != ISC_R_SUCCESS)) { - closesocket(fd); - fd = -1; - result = ISC_R_UNEXPECTED; - } - - /* - * -1 means the new socket didn't happen. - */ - if (fd != -1) { - LOCK(&manager->lock); - ISC_LIST_APPEND(manager->socklist, dev->newsocket, link); - - dev->newsocket->fd = fd; - dev->newsocket->bound = 1; - dev->newsocket->connected = 1; - - /* - * Save away the remote address - */ - dev->address = dev->newsocket->address; - - manager->fds[fd] = dev->newsocket; - manager->fdstate[fd] = MANAGED; - if (manager->maxfd < fd) - manager->maxfd = fd; - manager->minfd = min(manager->minfd, sock->fd); - - socket_log(sock, &dev->newsocket->address, CREATION, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_ACCEPTEDCXN, - "accepted connection, new socket %p", - dev->newsocket); - - UNLOCK(&manager->lock); - } else { - dev->newsocket->references--; - free_socket(&dev->newsocket); - } - - /* - * Fill in the done event details and send it off. - */ - dev->result = result; - task = dev->ev_sender; - dev->ev_sender = sock; - - isc_task_sendanddetach(&task, (isc_event_t **)&dev); - return; - - soft_error: - select_poke(sock->manager, sock->fd, SELECT_POKE_ACCEPT); - UNLOCK(&sock->lock); - return; -} - -static void -internal_recv(isc_task_t *me, isc_event_t *ev) { - isc_socketevent_t *dev; - isc_socket_t *sock; - - INSIST(ev->ev_type == ISC_SOCKEVENT_INTR); - - sock = ev->ev_sender; - INSIST(VALID_SOCKET(sock)); - - LOCK(&sock->lock); - socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALRECV, - "internal_recv: task %p got event %p", me, ev); - - INSIST(sock->pending_recv == 1); - sock->pending_recv = 0; - - INSIST(sock->references > 0); - sock->references--; /* the internal event is done with this socket */ - if (sock->references == 0) { - UNLOCK(&sock->lock); - destroy(&sock); - return; - } - - /* - * Try to do as much I/O as possible on this socket. There are no - * limits here, currently. - */ - dev = ISC_LIST_HEAD(sock->recv_list); - while (dev != NULL) { - switch (doio_recv(sock, dev)) { - case DOIO_SOFT: - goto poke; - - case DOIO_EOF: - /* - * read of 0 means the remote end was closed. - * Run through the event queue and dispatch all - * the events with an EOF result code. - */ - do { - dev->result = ISC_R_EOF; - send_recvdone_event(sock, &dev); - dev = ISC_LIST_HEAD(sock->recv_list); - } while (dev != NULL); - goto poke; - - case DOIO_SUCCESS: - case DOIO_HARD: - send_recvdone_event(sock, &dev); - break; - } - - dev = ISC_LIST_HEAD(sock->recv_list); - } - - poke: - if (!ISC_LIST_EMPTY(sock->recv_list)) - select_poke(sock->manager, sock->fd, SELECT_POKE_READ); - - UNLOCK(&sock->lock); -} - -static void -internal_send(isc_task_t *me, isc_event_t *ev) { - isc_socketevent_t *dev; - isc_socket_t *sock; - - INSIST(ev->ev_type == ISC_SOCKEVENT_INTW); - - /* - * Find out what socket this is and lock it. - */ - sock = (isc_socket_t *)ev->ev_sender; - INSIST(VALID_SOCKET(sock)); - - LOCK(&sock->lock); - socket_log(sock, NULL, IOEVENT, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_INTERNALSEND, - "internal_send: task %p got event %p", me, ev); - - INSIST(sock->pending_send == 1); - sock->pending_send = 0; - - INSIST(sock->references > 0); - sock->references--; /* the internal event is done with this socket */ - if (sock->references == 0) { - UNLOCK(&sock->lock); - destroy(&sock); - return; - } - - /* - * Try to do as much I/O as possible on this socket. There are no - * limits here, currently. - */ - dev = ISC_LIST_HEAD(sock->send_list); - while (dev != NULL) { - switch (doio_send(sock, dev)) { - case DOIO_SOFT: - goto poke; - - case DOIO_HARD: - case DOIO_SUCCESS: - send_senddone_event(sock, &dev); - break; - } - - dev = ISC_LIST_HEAD(sock->send_list); - } - - poke: - if (!ISC_LIST_EMPTY(sock->send_list)) - select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE); - - UNLOCK(&sock->lock); -} - -static void -process_fds(isc_socketmgr_t *manager, int maxfd, int minfd, - fd_set *readfds, fd_set *writefds, fd_set *exceptfds) -{ - int i; - isc_socket_t *sock; - isc_boolean_t unlock_sock; - BOOL conn_check = FALSE; - - REQUIRE(maxfd <= FD_SETSIZE); - - /* - * Process read/writes on other fds here. Avoid locking - * and unlocking twice if both reads and writes are possible. - */ - for (i = minfd ; i <= maxfd ; i++) { - if (manager->fdstate[i] == CLOSE_PENDING) { - manager->fdstate[i] = CLOSED; - FD_CLR(i, &manager->read_fds); - FD_CLR(i, &manager->write_fds); - FD_CLR(i, &manager->except_fds); - - closesocket(i); - - continue; - } - - sock = manager->fds[i]; - unlock_sock = ISC_FALSE; - if (FD_ISSET(i, readfds)) { - if (sock == NULL) { - FD_CLR(i, &manager->read_fds); - goto check_write; - } - unlock_sock = ISC_TRUE; - LOCK(&sock->lock); - if (!SOCK_DEAD(sock)) { - if (sock->listener) - dispatch_accept(sock); - else - dispatch_recv(sock); - } - FD_CLR(i, &manager->read_fds); - } - check_write: - if (FD_ISSET(i, writefds)) { - if (sock == NULL) { - FD_CLR(i, &manager->write_fds); - continue; - } - if (!unlock_sock) { - unlock_sock = ISC_TRUE; - LOCK(&sock->lock); - } - if (!SOCK_DEAD(sock)) { - if (sock->connecting) { - dispatch_connect(sock); - conn_check = TRUE; - } - else - dispatch_send(sock); - } - FD_CLR(i, &manager->write_fds); - FD_CLR(i, &manager->except_fds); - } - if (FD_ISSET(i, exceptfds)) { - if (sock == NULL) { - FD_CLR(i, &manager->except_fds); - continue; - } - if (!unlock_sock) { - unlock_sock = ISC_TRUE; - LOCK(&sock->lock); - } - if (!SOCK_DEAD(sock)) { - if (sock->connecting) { - dispatch_connect(sock); - conn_check = TRUE; - } - } - FD_CLR(i, &manager->write_fds); - FD_CLR(i, &manager->except_fds); - } - - if (unlock_sock) - UNLOCK(&sock->lock); - } -} - -#ifdef ISC_PLATFORM_USETHREADS -/* - * This is the thread that will loop forever, always in a select or poll - * call. - * - * When select returns something to do, track down what thread gets to do - * this I/O and post the event to it. - */ -static isc_threadresult_t WINAPI -watcher(void *uap) { - isc_socketmgr_t *manager = uap; - isc_boolean_t done; - int ctlfd; - int cc; - fd_set readfds; - fd_set writefds; - fd_set exceptfds; - int msg, fd; - int maxfd; - int minfd; - int watcher_errno = 0; - char strbuf[ISC_STRERRORSIZE]; - - /* Timeout on select in case it's necesasary */ - struct timeval tv; - tv.tv_sec = MAX_SELECT_SECONDS; - tv.tv_usec = MAX_SELECT_MILLISECONDS*1000; - - /* - * Get the control fd here. This will never change. - */ - LOCK(&manager->lock); - ctlfd = manager->pipe_fds[0]; - - done = ISC_FALSE; - while (!done) { - do { - readfds = manager->read_fds; - writefds = manager->write_fds; - exceptfds = manager->except_fds; - maxfd = manager->maxfd; /* Pipe not included */ - minfd = manager->minfd; - watcher_errno = 0; - - UNLOCK(&manager->lock); - - if(maxfd > 0) { - cc = select(maxfd, &readfds, &writefds, - &exceptfds, &tv); - if (cc < 0 && bpipe_written <= 0) { - watcher_errno = WSAGetLastError(); - if (!SOFT_ERROR(watcher_errno) && - watcher_errno != WSAEINVAL) { - isc__strerror(watcher_errno, - strbuf, sizeof(strbuf)); - FATAL_ERROR(__FILE__, __LINE__, - "select() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - strbuf); - } - } - - } else { - /* - * Nothing to select on yet, so sleep - * and check again for work - */ - Sleep(MAX_SELECT_SECONDS*1000 - + MAX_SELECT_MILLISECONDS); - } - - LOCK(&manager->lock); - } while (cc < 0 && bpipe_written <= 0); - - - /* - * Process reads on internal, control fd. - */ - while (bpipe_written > 0) { - select_readmsg(manager, &fd, &msg); - InterlockedDecrement(&bpipe_written); - - manager_log(manager, IOEVENT, - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_SOCKET, - ISC_MSG_WATCHERMSG, - "watcher got message %d"), - msg); - - /* - * Nothing to read? - */ - if (msg == SELECT_POKE_NOTHING) - break; - - /* - * Handle shutdown message. We really should - * jump out of this loop right away, but - * it doesn't matter if we have to do a little - * more work first. - */ - if (msg == SELECT_POKE_SHUTDOWN) { - done = ISC_TRUE; - - break; - } - } - process_fds(manager, maxfd, minfd, &readfds, &writefds, &exceptfds); - } - - manager_log(manager, TRACE, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_EXITING, "watcher exiting")); - - UNLOCK(&manager->lock); - return ((isc_threadresult_t)0); -} -#endif /* ISC_PLATFORM_USETHREADS */ - -/* - * Create a new socket manager. - */ -isc_result_t -isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) { - isc_socketmgr_t *manager; -#ifdef ISC_PLATFORM_USETHREADS - char strbuf[ISC_STRERRORSIZE]; -#endif - - REQUIRE(managerp != NULL && *managerp == NULL); - -#ifndef ISC_PLATFORM_USETHREADS - if (socketmgr != NULL) { - socketmgr->refs++; - *managerp = socketmgr; - return (ISC_R_SUCCESS); - } -#endif /* ISC_PLATFORM_USETHREADS */ - - manager = isc_mem_get(mctx, sizeof(*manager)); - if (manager == NULL) - return (ISC_R_NOMEMORY); - - manager->magic = SOCKET_MANAGER_MAGIC; - manager->mctx = NULL; - memset(manager->fds, 0, sizeof(manager->fds)); - ISC_LIST_INIT(manager->socklist); - if (isc_mutex_init(&manager->lock) != ISC_R_SUCCESS) { - isc_mem_put(mctx, manager, sizeof(*manager)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_mutex_init() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - return (ISC_R_UNEXPECTED); - } - if (isc_condition_init(&manager->shutdown_ok) != ISC_R_SUCCESS) { - DESTROYLOCK(&manager->lock); - isc_mem_put(mctx, manager, sizeof(*manager)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_condition_init() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - return (ISC_R_UNEXPECTED); - } - - /* - * Create the special fds that will be used to wake up the - * select/poll loop when something internal needs to be done. - */ - if (internal_pipe(manager->pipe_fds) != 0) { - DESTROYLOCK(&manager->lock); - isc_mem_put(mctx, manager, sizeof(*manager)); - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "pipe() %s: %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - strbuf); - - return (ISC_R_UNEXPECTED); - } - - - /* - * Set up initial state for the select loop - */ - FD_ZERO(&manager->read_fds); - FD_ZERO(&manager->write_fds); - FD_ZERO(&manager->except_fds); - manager->maxfd = 0; - manager->minfd = FD_SETSIZE; - memset(manager->fdstate, 0, sizeof(manager->fdstate)); - - /* - * Start up the select/poll thread. - */ - if (isc_thread_create(watcher, manager, &manager->watcher) != - ISC_R_SUCCESS) { - DESTROYLOCK(&manager->lock); - isc_mem_put(mctx, manager, sizeof(*manager)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_thread_create() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - _close(manager->pipe_fds[0]); - _close(manager->pipe_fds[1]); - return (ISC_R_UNEXPECTED); - } - isc_mem_attach(mctx, &manager->mctx); - - *managerp = manager; - - return (ISC_R_SUCCESS); -} - -void -isc_socketmgr_destroy(isc_socketmgr_t **managerp) { - isc_socketmgr_t *manager; - int i; - isc_mem_t *mctx; - - /* - * Destroy a socket manager. - */ - - REQUIRE(managerp != NULL); - manager = *managerp; - REQUIRE(VALID_MANAGER(manager)); - -#ifndef ISC_PLATFORM_USETHREADS - if (manager->refs > 1) { - manager->refs--; - *managerp = NULL; - return; - } -#endif /* ISC_PLATFORM_USETHREADS */ - - LOCK(&manager->lock); - -#ifdef ISC_PLATFORM_USETHREADS - /* - * Wait for all sockets to be destroyed. - */ - while (!ISC_LIST_EMPTY(manager->socklist)) { - manager_log(manager, CREATION, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_SOCKETSREMAIN, - "sockets exist")); - WAIT(&manager->shutdown_ok, &manager->lock); - } -#else /* ISC_PLATFORM_USETHREADS */ - /* - * Hope all sockets have been destroyed. - */ - if (!ISC_LIST_EMPTY(manager->socklist)) { - manager_log(manager, CREATION, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_SOCKETSREMAIN, - "sockets exist")); - INSIST(0); - } -#endif /* ISC_PLATFORM_USETHREADS */ - - UNLOCK(&manager->lock); - - /* - * Here, poke our select/poll thread. Do this by closing the write - * half of the pipe, which will send EOF to the read half. - * This is currently a no-op in the non-threaded case. - */ - select_poke(manager, 0, SELECT_POKE_SHUTDOWN); - -#ifdef ISC_PLATFORM_USETHREADS - /* - * Wait for thread to exit. - */ - if (isc_thread_join(manager->watcher, NULL) != ISC_R_SUCCESS) - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_thread_join() %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); -#endif /* ISC_PLATFORM_USETHREADS */ - - /* - * Clean up. - */ -#ifdef ISC_PLATFORM_USETHREADS - _close(manager->pipe_fds[0]); - _close(manager->pipe_fds[1]); - (void)isc_condition_destroy(&manager->shutdown_ok); -#endif /* ISC_PLATFORM_USETHREADS */ - - for (i = 0 ; i < FD_SETSIZE ; i++) - if (manager->fdstate[i] == CLOSE_PENDING) - closesocket(i); - - DESTROYLOCK(&manager->lock); - manager->magic = 0; - mctx= manager->mctx; - isc_mem_put(mctx, manager, sizeof(*manager)); - - isc_mem_detach(&mctx); - - *managerp = NULL; -} - -static isc_result_t -socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, - unsigned int flags) -{ - int io_state; - isc_boolean_t have_lock = ISC_FALSE; - isc_task_t *ntask = NULL; - isc_result_t result = ISC_R_SUCCESS; - - dev->ev_sender = task; - - if (sock->type == isc_sockettype_udp) { - io_state = doio_recv(sock, dev); - } else { - LOCK(&sock->lock); - have_lock = ISC_TRUE; - - if (ISC_LIST_EMPTY(sock->recv_list)) - io_state = doio_recv(sock, dev); - else - io_state = DOIO_SOFT; - } - - switch (io_state) { - case DOIO_SOFT: - /* - * We couldn't read all or part of the request right now, so - * queue it. - * - * Attach to socket and to task - */ - isc_task_attach(task, &ntask); - dev->attributes |= ISC_SOCKEVENTATTR_ATTACHED; - - if (!have_lock) { - LOCK(&sock->lock); - have_lock = ISC_TRUE; - } - - /* - * Enqueue the request. If the socket was previously not being - * watched, poke the watcher to start paying attention to it. - */ - if (ISC_LIST_EMPTY(sock->recv_list)) - select_poke(sock->manager, sock->fd, SELECT_POKE_READ); - ISC_LIST_ENQUEUE(sock->recv_list, dev, ev_link); - - socket_log(sock, NULL, EVENT, NULL, 0, 0, - "socket_recv: event %p -> task %p", - dev, ntask); - - if ((flags & ISC_SOCKFLAG_IMMEDIATE) != 0) - result = ISC_R_INPROGRESS; - break; - - case DOIO_EOF: - dev->result = ISC_R_EOF; - /* fallthrough */ - - case DOIO_HARD: - case DOIO_SUCCESS: - if ((flags & ISC_SOCKFLAG_IMMEDIATE) == 0) - send_recvdone_event(sock, &dev); - break; - } - - if (have_lock) - UNLOCK(&sock->lock); - - return (result); -} - -isc_result_t -isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist, - unsigned int minimum, isc_task_t *task, - isc_taskaction_t action, const void *arg) -{ - isc_socketevent_t *dev; - isc_socketmgr_t *manager; - unsigned int iocount; - isc_buffer_t *buffer; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(buflist != NULL); - REQUIRE(!ISC_LIST_EMPTY(*buflist)); - REQUIRE(task != NULL); - REQUIRE(action != NULL); - - manager = sock->manager; - REQUIRE(VALID_MANAGER(manager)); - - iocount = isc_bufferlist_availablecount(buflist); - REQUIRE(iocount > 0); - - INSIST(sock->bound); - - dev = allocate_socketevent(sock, ISC_SOCKEVENT_RECVDONE, action, arg); - if (dev == NULL) { - return (ISC_R_NOMEMORY); - } - - /* - * UDP sockets are always partial read - */ - if (sock->type == isc_sockettype_udp) - dev->minimum = 1; - else { - if (minimum == 0) - dev->minimum = iocount; - else - dev->minimum = minimum; - } - - /* - * Move each buffer from the passed in list to our internal one. - */ - buffer = ISC_LIST_HEAD(*buflist); - while (buffer != NULL) { - ISC_LIST_DEQUEUE(*buflist, buffer, link); - ISC_LIST_ENQUEUE(dev->bufferlist, buffer, link); - buffer = ISC_LIST_HEAD(*buflist); - } - - return (socket_recv(sock, dev, task, 0)); -} - -isc_result_t -isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, - isc_task_t *task, isc_taskaction_t action, const void *arg) -{ - isc_socketevent_t *dev; - isc_socketmgr_t *manager; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(action != NULL); - - manager = sock->manager; - REQUIRE(VALID_MANAGER(manager)); - - INSIST(sock->bound); - - dev = allocate_socketevent(sock, ISC_SOCKEVENT_RECVDONE, action, arg); - if (dev == NULL) - return (ISC_R_NOMEMORY); - - return (isc_socket_recv2(sock, region, minimum, task, dev, 0)); -} - -isc_result_t -isc_socket_recv2(isc_socket_t *sock, isc_region_t *region, - unsigned int minimum, isc_task_t *task, - isc_socketevent_t *event, unsigned int flags) -{ - event->ev_sender = sock; - event->result = ISC_R_UNEXPECTED; - ISC_LIST_INIT(event->bufferlist); - event->region = *region; - event->n = 0; - event->offset = 0; - event->attributes = 0; - - /* - * UDP sockets are always partial read. - */ - if (sock->type == isc_sockettype_udp) - event->minimum = 1; - else { - if (minimum == 0) - event->minimum = region->length; - else - event->minimum = minimum; - } - - return (socket_recv(sock, event, task, flags)); -} - -static isc_result_t -socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, - isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, - unsigned int flags) -{ - int io_state; - isc_boolean_t have_lock = ISC_FALSE; - isc_task_t *ntask = NULL; - isc_result_t result = ISC_R_SUCCESS; - - dev->ev_sender = task; - - set_dev_address(address, sock, dev); - if (pktinfo != NULL) { - socket_log(sock, NULL, TRACE, isc_msgcat, ISC_MSGSET_SOCKET, - ISC_MSG_PKTINFOPROVIDED, - "pktinfo structure provided, ifindex %u (set to 0)", - pktinfo->ipi6_ifindex); - - dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO; - dev->pktinfo = *pktinfo; - /* - * Set the pktinfo index to 0 here, to let the kernel decide - * what interface it should send on. - */ - dev->pktinfo.ipi6_ifindex = 0; - } - - if (sock->type == isc_sockettype_udp) - io_state = doio_send(sock, dev); - else { - LOCK(&sock->lock); - have_lock = ISC_TRUE; - - if (ISC_LIST_EMPTY(sock->send_list)) - io_state = doio_send(sock, dev); - else - io_state = DOIO_SOFT; - } - - switch (io_state) { - case DOIO_SOFT: - /* - * We couldn't send all or part of the request right now, so - * queue it unless ISC_SOCKFLAG_NORETRY is set. - */ - if ((flags & ISC_SOCKFLAG_NORETRY) == 0) { - isc_task_attach(task, &ntask); - dev->attributes |= ISC_SOCKEVENTATTR_ATTACHED; - - if (!have_lock) { - LOCK(&sock->lock); - have_lock = ISC_TRUE; - } - - /* - * Enqueue the request. If the socket was previously not being - * watched, poke the watcher to start paying attention to it. - */ - if (ISC_LIST_EMPTY(sock->send_list)) - select_poke(sock->manager, sock->fd, - SELECT_POKE_WRITE); - ISC_LIST_ENQUEUE(sock->send_list, dev, ev_link); - - socket_log(sock, NULL, EVENT, NULL, 0, 0, - "socket_send: event %p -> task %p", - dev, ntask); - - if ((flags & ISC_SOCKFLAG_IMMEDIATE) != 0) - result = ISC_R_INPROGRESS; - break; - } - - case DOIO_HARD: - case DOIO_SUCCESS: - if ((flags & ISC_SOCKFLAG_IMMEDIATE) == 0) - send_senddone_event(sock, &dev); - break; - } - - if (have_lock) - UNLOCK(&sock->lock); - - return (result); -} - -isc_result_t -isc_socket_send(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg) -{ - /* - * REQUIRE() checking is performed in isc_socket_sendto(). - */ - return (isc_socket_sendto(sock, region, task, action, arg, NULL, - NULL)); -} - -isc_result_t -isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_taskaction_t action, const void *arg, - isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) -{ - isc_socketevent_t *dev; - isc_socketmgr_t *manager; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(region != NULL); - REQUIRE(task != NULL); - REQUIRE(action != NULL); - - manager = sock->manager; - REQUIRE(VALID_MANAGER(manager)); - - INSIST(sock->bound); - - dev = allocate_socketevent(sock, ISC_SOCKEVENT_SENDDONE, action, arg); - if (dev == NULL) { - return (ISC_R_NOMEMORY); - } - - dev->region = *region; - - return (socket_send(sock, dev, task, address, pktinfo, 0)); -} - -isc_result_t -isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg) -{ - return (isc_socket_sendtov(sock, buflist, task, action, arg, NULL, - NULL)); -} - -isc_result_t -isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, - isc_task_t *task, isc_taskaction_t action, const void *arg, - isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) -{ - isc_socketevent_t *dev; - isc_socketmgr_t *manager; - unsigned int iocount; - isc_buffer_t *buffer; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(buflist != NULL); - REQUIRE(!ISC_LIST_EMPTY(*buflist)); - REQUIRE(task != NULL); - REQUIRE(action != NULL); - - manager = sock->manager; - REQUIRE(VALID_MANAGER(manager)); - - iocount = isc_bufferlist_usedcount(buflist); - REQUIRE(iocount > 0); - - dev = allocate_socketevent(sock, ISC_SOCKEVENT_SENDDONE, action, arg); - if (dev == NULL) { - return (ISC_R_NOMEMORY); - } - - /* - * Move each buffer from the passed in list to our internal one. - */ - buffer = ISC_LIST_HEAD(*buflist); - while (buffer != NULL) { - ISC_LIST_DEQUEUE(*buflist, buffer, link); - ISC_LIST_ENQUEUE(dev->bufferlist, buffer, link); - buffer = ISC_LIST_HEAD(*buflist); - } - - return (socket_send(sock, dev, task, address, pktinfo, 0)); -} - -isc_result_t -isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, - isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, - isc_socketevent_t *event, unsigned int flags) -{ - REQUIRE((flags & ~(ISC_SOCKFLAG_IMMEDIATE|ISC_SOCKFLAG_NORETRY)) == 0); - if ((flags & ISC_SOCKFLAG_NORETRY) != 0) - REQUIRE(sock->type == isc_sockettype_udp); - event->ev_sender = sock; - event->result = ISC_R_UNEXPECTED; - ISC_LIST_INIT(event->bufferlist); - event->region = *region; - event->n = 0; - event->offset = 0; - event->attributes = 0; - - return (socket_send(sock, event, task, address, pktinfo, flags)); -} - -isc_result_t -isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) { - int bind_errno = 0; - char strbuf[ISC_STRERRORSIZE]; - int on = 1; - - LOCK(&sock->lock); - - INSIST(!sock->bound); - - if (sock->pf != sockaddr->type.sa.sa_family) { - UNLOCK(&sock->lock); - return (ISC_R_FAMILYMISMATCH); - } - if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, - sizeof(on)) < 0) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "setsockopt(%d) %s", sock->fd, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed")); - /* Press on... */ - } - if (bind(sock->fd, &sockaddr->type.sa, sockaddr->length) < 0) { - bind_errno = WSAGetLastError(); - UNLOCK(&sock->lock); - switch (bind_errno) { - case WSAEACCES: - return (ISC_R_NOPERM); - case WSAEADDRNOTAVAIL: - return (ISC_R_ADDRNOTAVAIL); - case WSAEADDRINUSE: - return (ISC_R_ADDRINUSE); - case WSAEINVAL: - return (ISC_R_BOUND); - default: - isc__strerror(bind_errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, "bind: %s", - strbuf); - return (ISC_R_UNEXPECTED); - } - } - - socket_log(sock, sockaddr, TRACE, - isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_BOUND, "bound"); - sock->bound = 1; - - UNLOCK(&sock->lock); - return (ISC_R_SUCCESS); -} - -/* - * Set up to listen on a given socket. We do this by creating an internal - * event that will be dispatched when the socket has read activity. The - * watcher will send the internal event to the task when there is a new - * connection. - * - * Unlike in read, we don't preallocate a done event here. Every time there - * is a new connection we'll have to allocate a new one anyway, so we might - * as well keep things simple rather than having to track them. - */ -isc_result_t -isc_socket_listen(isc_socket_t *sock, unsigned int backlog) { - char strbuf[ISC_STRERRORSIZE]; - - REQUIRE(VALID_SOCKET(sock)); - - LOCK(&sock->lock); - - REQUIRE(!sock->listener); - REQUIRE(sock->bound); - REQUIRE(sock->type == isc_sockettype_tcp); - - if (backlog == 0) - backlog = SOMAXCONN; - - if (listen(sock->fd, (int)backlog) < 0) { - UNLOCK(&sock->lock); - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); - - UNEXPECTED_ERROR(__FILE__, __LINE__, "listen: %s", strbuf); - - return (ISC_R_UNEXPECTED); - } - - sock->listener = 1; - - UNLOCK(&sock->lock); - return (ISC_R_SUCCESS); -} - -/* - * This should try to do agressive accept() XXXMLG - */ -isc_result_t -isc_socket_accept(isc_socket_t *sock, - isc_task_t *task, isc_taskaction_t action, const void *arg) -{ - isc_socket_newconnev_t *dev; - isc_socketmgr_t *manager; - isc_task_t *ntask = NULL; - isc_socket_t *nsock; - isc_result_t ret; - isc_boolean_t do_poke = ISC_FALSE; - - REQUIRE(VALID_SOCKET(sock)); - manager = sock->manager; - REQUIRE(VALID_MANAGER(manager)); - - LOCK(&sock->lock); - - REQUIRE(sock->listener); - - /* - * Sender field is overloaded here with the task we will be sending - * this event to. Just before the actual event is delivered the - * actual ev_sender will be touched up to be the socket. - */ - dev = (isc_socket_newconnev_t *) - isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN, - action, arg, sizeof (*dev)); - if (dev == NULL) { - UNLOCK(&sock->lock); - return (ISC_R_NOMEMORY); - } - ISC_LINK_INIT(dev, ev_link); - - ret = allocate_socket(manager, sock->type, &nsock); - if (ret != ISC_R_SUCCESS) { - isc_event_free((isc_event_t **)&dev); - UNLOCK(&sock->lock); - return (ret); - } - - /* - * Attach to socket and to task. - */ - isc_task_attach(task, &ntask); - nsock->references++; - - dev->ev_sender = ntask; - dev->newsocket = nsock; - - /* - * Poke watcher here. We still have the socket locked, so there - * is no race condition. We will keep the lock for such a short - * bit of time waking it up now or later won't matter all that much. - */ - if (ISC_LIST_EMPTY(sock->accept_list)) - do_poke = ISC_TRUE; - - ISC_LIST_ENQUEUE(sock->accept_list, dev, ev_link); - - if (do_poke) - select_poke(manager, sock->fd, SELECT_POKE_ACCEPT); - - UNLOCK(&sock->lock); - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, - isc_task_t *task, isc_taskaction_t action, const void *arg) -{ - isc_socket_connev_t *dev; - isc_task_t *ntask = NULL; - isc_socketmgr_t *manager; - int cc; - int errval; - char strbuf[ISC_STRERRORSIZE]; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(addr != NULL); - REQUIRE(task != NULL); - REQUIRE(action != NULL); - - manager = sock->manager; - REQUIRE(VALID_MANAGER(manager)); - REQUIRE(addr != NULL); - - if (isc_sockaddr_ismulticast(addr)) - return (ISC_R_MULTICAST); - - LOCK(&sock->lock); - - REQUIRE(!sock->connecting); - - dev = (isc_socket_connev_t *)isc_event_allocate(manager->mctx, sock, - ISC_SOCKEVENT_CONNECT, - action, arg, - sizeof (*dev)); - if (dev == NULL) { - UNLOCK(&sock->lock); - return (ISC_R_NOMEMORY); - } - ISC_LINK_INIT(dev, ev_link); - - /* - * Try to do the connect right away, as there can be only one - * outstanding, and it might happen to complete. - */ - sock->address = *addr; - cc = connect(sock->fd, &addr->type.sa, addr->length); - if (cc < 0) { - errval = WSAGetLastError(); - if (SOFT_ERROR(errval) || errval == WSAEINPROGRESS) - goto queue; - - switch (errval) { -#define ERROR_MATCH(a, b) case a: dev->result = b; goto err_exit; - ERROR_MATCH(WSAEACCES, ISC_R_NOPERM); - ERROR_MATCH(WSAEADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL); - ERROR_MATCH(WSAEAFNOSUPPORT, ISC_R_ADDRNOTAVAIL); - ERROR_MATCH(WSAECONNREFUSED, ISC_R_CONNREFUSED); - ERROR_MATCH(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH); - ERROR_MATCH(WSAEHOSTDOWN, ISC_R_HOSTUNREACH); - ERROR_MATCH(WSAENETUNREACH, ISC_R_NETUNREACH); - ERROR_MATCH(WSAENOBUFS, ISC_R_NORESOURCES); - ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH); - ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED); - ERROR_MATCH(WSAECONNRESET, ISC_R_CONNECTIONRESET); -#undef ERROR_MATCH - } - - sock->connected = 0; - - isc__strerror(errval, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, "%d/%s", errval, strbuf); - - UNLOCK(&sock->lock); - isc_event_free((isc_event_t **)&dev); - return (ISC_R_UNEXPECTED); - - err_exit: - sock->connected = 0; - isc_task_send(task, (isc_event_t **)&dev); - - UNLOCK(&sock->lock); - return (ISC_R_SUCCESS); - } - - /* - * If connect completed, fire off the done event. - */ - if (cc == 0) { - sock->connected = 1; - sock->bound = 1; - dev->result = ISC_R_SUCCESS; - isc_task_send(task, (isc_event_t **)&dev); - - UNLOCK(&sock->lock); - return (ISC_R_SUCCESS); - } - - queue: - - /* - * Attach to task. - */ - isc_task_attach(task, &ntask); - - sock->connecting = 1; - - dev->ev_sender = ntask; - - /* - * Poke watcher here. We still have the socket locked, so there - * is no race condition. We will keep the lock for such a short - * bit of time waking it up now or later won't matter all that much. - */ - if (sock->connect_ev == NULL) - select_poke(manager, sock->fd, SELECT_POKE_CONNECT); - - sock->connect_ev = dev; - - UNLOCK(&sock->lock); - return (ISC_R_SUCCESS); -} - -/* - * Called when a socket with a pending connect() finishes. - */ -static void -internal_connect(isc_task_t *me, isc_event_t *ev) { - isc_socket_t *sock; - isc_socket_connev_t *dev; - isc_task_t *task; - int cc; - ISC_SOCKADDR_LEN_T optlen; - int connect_errno = 0; - char strbuf[ISC_STRERRORSIZE]; - - UNUSED(me); - INSIST(ev->ev_type == ISC_SOCKEVENT_INTW); - - sock = ev->ev_sender; - INSIST(VALID_SOCKET(sock)); - - LOCK(&sock->lock); - - /* - * When the internal event was sent the reference count was bumped - * to keep the socket around for us. Decrement the count here. - */ - INSIST(sock->references > 0); - sock->references--; - if (sock->references == 0) { - UNLOCK(&sock->lock); - destroy(&sock); - return; - } - - /* - * Has this event been canceled? - */ - dev = sock->connect_ev; - if (dev == NULL) { - INSIST(!sock->connecting); - UNLOCK(&sock->lock); - return; - } - - INSIST(sock->connecting); - sock->connecting = 0; - - /* - * Get any possible error status here. - */ - optlen = sizeof(cc); - if (getsockopt(sock->fd, SOL_SOCKET, SO_ERROR, - (void *)&cc, (void *)&optlen) < 0) - connect_errno = WSAGetLastError(); - - if (connect_errno != 0) { - /* - * If the error is WSAEAGAIN, just re-select on this - * fd and pretend nothing strange happened. - */ - if (SOFT_ERROR(connect_errno) || connect_errno == WSAEINPROGRESS) { - sock->connecting = 1; - select_poke(sock->manager, sock->fd, - SELECT_POKE_CONNECT); - UNLOCK(&sock->lock); - - return; - } - - /* - * Translate other errors into ISC_R_* flavors. - */ - switch (connect_errno) { -#define ERROR_MATCH(a, b) case a: dev->result = b; break; - ERROR_MATCH(WSAEACCES, ISC_R_NOPERM); - ERROR_MATCH(WSAEADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL); - ERROR_MATCH(WSAEAFNOSUPPORT, ISC_R_ADDRNOTAVAIL); - ERROR_MATCH(WSAECONNREFUSED, ISC_R_CONNREFUSED); - ERROR_MATCH(WSAEHOSTUNREACH, ISC_R_HOSTUNREACH); - ERROR_MATCH(WSAEHOSTDOWN, ISC_R_HOSTUNREACH); - ERROR_MATCH(WSAENETUNREACH, ISC_R_NETUNREACH); - ERROR_MATCH(WSAENOBUFS, ISC_R_NORESOURCES); - ERROR_MATCH(EPERM, ISC_R_HOSTUNREACH); - ERROR_MATCH(EPIPE, ISC_R_NOTCONNECTED); - ERROR_MATCH(WSAETIMEDOUT, ISC_R_TIMEDOUT); - ERROR_MATCH(WSAECONNRESET, ISC_R_CONNECTIONRESET); -#undef ERROR_MATCH - default: - dev->result = ISC_R_UNEXPECTED; - isc__strerror(connect_errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "internal_connect: connect() %s", - strbuf); - } - } else { - dev->result = ISC_R_SUCCESS; - sock->connected = 1; - sock->bound = 1; - } - - sock->connect_ev = NULL; - - UNLOCK(&sock->lock); - - task = dev->ev_sender; - dev->ev_sender = sock; - isc_task_sendanddetach(&task, (isc_event_t **)&dev); -} - -isc_result_t -isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) { - isc_result_t ret; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(addressp != NULL); - - LOCK(&sock->lock); - - if (sock->connected) { - *addressp = sock->address; - ret = ISC_R_SUCCESS; - } else { - ret = ISC_R_NOTCONNECTED; - } - - UNLOCK(&sock->lock); - - return (ret); -} - -isc_result_t -isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { - ISC_SOCKADDR_LEN_T len; - isc_result_t ret; - char strbuf[ISC_STRERRORSIZE]; - - REQUIRE(VALID_SOCKET(sock)); - REQUIRE(addressp != NULL); - - LOCK(&sock->lock); - - if (!sock->bound) { - ret = ISC_R_NOTBOUND; - goto out; - } - - ret = ISC_R_SUCCESS; - - len = sizeof(addressp->type); - if (getsockname(sock->fd, &addressp->type.sa, (void *)&len) < 0) { - isc__strerror(WSAGetLastError(), strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, "getsockname: %s", - strbuf); - ret = ISC_R_UNEXPECTED; - goto out; - } - addressp->length = (unsigned int)len; - - out: - UNLOCK(&sock->lock); - - return (ret); -} - -/* - * Run through the list of events on this socket, and cancel the ones - * queued for task "task" of type "how". "how" is a bitmask. - */ -void -isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) { - - REQUIRE(VALID_SOCKET(sock)); - - /* - * Quick exit if there is nothing to do. Don't even bother locking - * in this case. - */ - if (how == 0) - return; - - LOCK(&sock->lock); - - /* - * All of these do the same thing, more or less. - * Each will: - * o If the internal event is marked as "posted" try to - * remove it from the task's queue. If this fails, mark it - * as canceled instead, and let the task clean it up later. - * o For each I/O request for that task of that type, post - * its done event with status of "ISC_R_CANCELED". - * o Reset any state needed. - */ - if (((how & ISC_SOCKCANCEL_RECV) == ISC_SOCKCANCEL_RECV) - && !ISC_LIST_EMPTY(sock->recv_list)) { - isc_socketevent_t *dev; - isc_socketevent_t *next; - isc_task_t *current_task; - - dev = ISC_LIST_HEAD(sock->recv_list); - - while (dev != NULL) { - current_task = dev->ev_sender; - next = ISC_LIST_NEXT(dev, ev_link); - - if ((task == NULL) || (task == current_task)) { - dev->result = ISC_R_CANCELED; - send_recvdone_event(sock, &dev); - } - dev = next; - } - } - - if (((how & ISC_SOCKCANCEL_SEND) == ISC_SOCKCANCEL_SEND) - && !ISC_LIST_EMPTY(sock->send_list)) { - isc_socketevent_t *dev; - isc_socketevent_t *next; - isc_task_t *current_task; - - dev = ISC_LIST_HEAD(sock->send_list); - - while (dev != NULL) { - current_task = dev->ev_sender; - next = ISC_LIST_NEXT(dev, ev_link); - - if ((task == NULL) || (task == current_task)) { - dev->result = ISC_R_CANCELED; - send_senddone_event(sock, &dev); - } - dev = next; - } - } - - if (((how & ISC_SOCKCANCEL_ACCEPT) == ISC_SOCKCANCEL_ACCEPT) - && !ISC_LIST_EMPTY(sock->accept_list)) { - isc_socket_newconnev_t *dev; - isc_socket_newconnev_t *next; - isc_task_t *current_task; - - dev = ISC_LIST_HEAD(sock->accept_list); - while (dev != NULL) { - current_task = dev->ev_sender; - next = ISC_LIST_NEXT(dev, ev_link); - - if ((task == NULL) || (task == current_task)) { - - ISC_LIST_UNLINK(sock->accept_list, dev, - ev_link); - - dev->newsocket->references--; - free_socket(&dev->newsocket); - - dev->result = ISC_R_CANCELED; - dev->ev_sender = sock; - isc_task_sendanddetach(¤t_task, - (isc_event_t **)&dev); - } - - dev = next; - } - } - - /* - * Connecting is not a list. - */ - if (((how & ISC_SOCKCANCEL_CONNECT) == ISC_SOCKCANCEL_CONNECT) - && sock->connect_ev != NULL) { - isc_socket_connev_t *dev; - isc_task_t *current_task; - - INSIST(sock->connecting); - sock->connecting = 0; - - dev = sock->connect_ev; - current_task = dev->ev_sender; - - if ((task == NULL) || (task == current_task)) { - sock->connect_ev = NULL; - - dev->result = ISC_R_CANCELED; - dev->ev_sender = sock; - isc_task_sendanddetach(¤t_task, - (isc_event_t **)&dev); - } - } - - UNLOCK(&sock->lock); -} - -isc_sockettype_t -isc_socket_gettype(isc_socket_t *sock) { - REQUIRE(VALID_SOCKET(sock)); - - return (sock->type); -} - -isc_boolean_t -isc_socket_isbound(isc_socket_t *sock) { - isc_boolean_t val; - - LOCK(&sock->lock); - val = ((sock->bound) ? ISC_TRUE : ISC_FALSE); - UNLOCK(&sock->lock); - - return (val); -} diff --git a/usr.sbin/bind/lib/isc/win32/stdio.c b/usr.sbin/bind/lib/isc/win32/stdio.c deleted file mode 100644 index d65ef05939d..00000000000 --- a/usr.sbin/bind/lib/isc/win32/stdio.c +++ /dev/null @@ -1,117 +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. - */ - -/* $ISC: stdio.c,v 1.3 2001/07/17 20:29:32 gson Exp $ */ - -#include <config.h> - -#include <io.h> -#include <errno.h> - -#include <isc/stdio.h> - -#include "errno2result.h" - -isc_result_t -isc_stdio_open(const char *filename, const char *mode, FILE **fp) { - FILE *f; - - f = fopen(filename, mode); - if (f == NULL) - return (isc__errno2result(errno)); - *fp = f; - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_stdio_close(FILE *f) { - int r; - - r = fclose(f); - if (r == 0) - return (ISC_R_SUCCESS); - else - return (isc__errno2result(errno)); -} - -isc_result_t -isc_stdio_seek(FILE *f, long offset, int whence) { - int r; - - r = fseek(f, offset, whence); - if (r == 0) - return (ISC_R_SUCCESS); - else - return (isc__errno2result(errno)); -} - -isc_result_t -isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) { - isc_result_t result = ISC_R_SUCCESS; - size_t r; - - clearerr(f); - r = fread(ptr, size, nmemb, f); - if (r != nmemb) { - if (feof(f)) - result = ISC_R_EOF; - else - result = isc__errno2result(errno); - } - if (nret != NULL) - *nret = r; - return (result); -} - -isc_result_t -isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f, - size_t *nret) -{ - isc_result_t result = ISC_R_SUCCESS; - size_t r; - - clearerr(f); - r = fwrite(ptr, size, nmemb, f); - if (r != nmemb) - result = isc__errno2result(errno); - if (nret != NULL) - *nret = r; - return (result); -} - -isc_result_t -isc_stdio_flush(FILE *f) { - int r; - - r = fflush(f); - if (r == 0) - return (ISC_R_SUCCESS); - else - return (isc__errno2result(errno)); -} - -isc_result_t -isc_stdio_sync(FILE *f) { - int r; - - r = _commit(_fileno(f)); - if (r == 0) - return (ISC_R_SUCCESS); - else - return (isc__errno2result(errno)); -} - diff --git a/usr.sbin/bind/lib/isc/win32/stdtime.c b/usr.sbin/bind/lib/isc/win32/stdtime.c deleted file mode 100644 index 53d5805a8ab..00000000000 --- a/usr.sbin/bind/lib/isc/win32/stdtime.c +++ /dev/null @@ -1,37 +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. - */ - -/* $ISC: stdtime.c,v 1.9 2001/07/08 05:09:14 mayer Exp $ */ - -#include <config.h> - -#include <time.h> - -#include <isc/assertions.h> -#include <isc/stdtime.h> -#include <isc/util.h> - -void -isc_stdtime_get(isc_stdtime_t *t) { - /* - * Set 't' to the number of seconds past 00:00:00 UTC, January 1, 1970. - */ - - REQUIRE(t != NULL); - - (void)time(t); -} diff --git a/usr.sbin/bind/lib/isc/win32/syslog.c b/usr.sbin/bind/lib/isc/win32/syslog.c deleted file mode 100644 index 27685640fa2..00000000000 --- a/usr.sbin/bind/lib/isc/win32/syslog.c +++ /dev/null @@ -1,162 +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. - */ - -/* $ISC: syslog.c,v 1.3 2001/07/09 21:06:19 gson Exp $ */ - -#include <config.h> - -#include <stdio.h> -#include <windows.h> -#include <string.h> -#include <stdlib.h> -#include <syslog.h> - -#include <isc/bindevt.h> -#include <isc/result.h> -#include <isc/syslog.h> -#include <isc/util.h> - -static HANDLE hAppLog = NULL; -static FILE *log_stream; -static int debug_level = 0; - -static struct dsn_c_pvt_sfnt { - int val; - const char *strval; -} facilities[] = { - { LOG_KERN, "kern" }, - { LOG_USER, "user" }, - { LOG_MAIL, "mail" }, - { LOG_DAEMON, "daemon" }, - { LOG_AUTH, "auth" }, - { LOG_SYSLOG, "syslog" }, - { LOG_LPR, "lpr" }, -#ifdef LOG_NEWS - { LOG_NEWS, "news" }, -#endif -#ifdef LOG_UUCP - { LOG_UUCP, "uucp" }, -#endif -#ifdef LOG_CRON - { LOG_CRON, "cron" }, -#endif -#ifdef LOG_AUTHPRIV - { LOG_AUTHPRIV, "authpriv" }, -#endif -#ifdef LOG_FTP - { LOG_FTP, "ftp" }, -#endif - { LOG_LOCAL0, "local0"}, - { LOG_LOCAL1, "local1"}, - { LOG_LOCAL2, "local2"}, - { LOG_LOCAL3, "local3"}, - { LOG_LOCAL4, "local4"}, - { LOG_LOCAL5, "local5"}, - { LOG_LOCAL6, "local6"}, - { LOG_LOCAL7, "local7"}, - { 0, NULL } -}; - -isc_result_t -isc_syslog_facilityfromstring(const char *str, int *facilityp) { - int i; - - REQUIRE(str != NULL); - REQUIRE(facilityp != NULL); - - for (i = 0 ; facilities[i].strval != NULL ; i++) { - if (strcasecmp(facilities[i].strval, str) == 0) { - *facilityp = facilities[i].val; - return (ISC_R_SUCCESS); - } - } - return (ISC_R_NOTFOUND); -} - -/* - * Log to the NT Event Log - */ -void -syslog(int level, const char *fmt, ...) { - va_list ap; - char buf[1024]; - char *str[1]; - - str[0] = buf; - - va_start(ap, fmt); - vsprintf(buf, fmt, ap); - va_end(ap); - - /* Make sure that the channel is open to write the event */ - if (hAppLog != NULL) { - switch (level) { - case LOG_INFO: - case LOG_NOTICE: - case LOG_DEBUG: - ReportEvent(hAppLog, EVENTLOG_INFORMATION_TYPE, 0, - BIND_INFO_MSG, NULL, 1, 0, str, NULL); - break; - case LOG_WARNING: - ReportEvent(hAppLog, EVENTLOG_WARNING_TYPE, 0, - BIND_WARN_MSG, NULL, 1, 0, str, NULL); - break; - default: - ReportEvent(hAppLog, EVENTLOG_ERROR_TYPE, 0, - BIND_ERR_MSG, NULL, 1, 0, str, NULL); - break; - } - } -} - -/* - * Initialize event logging - */ -void -openlog(const char *name, int flags, ...) { - /* Get a handle to the Application event log */ - hAppLog = RegisterEventSource(NULL, name); -} - -/* - * Close the Handle to the application Event Log - * We don't care whether or not we succeeded so ignore return values - * In fact if we failed then we would have nowhere to put the message - */ -void -closelog() { - DeregisterEventSource(hAppLog); -} - -/* - * Keep event logging synced with the current debug level - */ -void -ModifyLogLevel(int level) { - debug_level = level; -} - -/* - * Initialize logging for the port section of libbind. - * Piggyback onto stream given. - */ -void -InitNTLogging(FILE *stream, int debug) { - log_stream = stream; - ModifyLogLevel(debug); -} - diff --git a/usr.sbin/bind/lib/isc/win32/syslog.h b/usr.sbin/bind/lib/isc/win32/syslog.h deleted file mode 100644 index d9c5d245f8a..00000000000 --- a/usr.sbin/bind/lib/isc/win32/syslog.h +++ /dev/null @@ -1,74 +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. - */ - -/* $ISC: syslog.h,v 1.3 2001/07/09 21:06:20 gson Exp $ */ - -#ifndef _SYSLOG_H -#define _SYSLOG_H - -#include <stdio.h> - -/* Constant definitions for openlog() */ -#define LOG_PID 1 -#define LOG_CONS 2 -/* NT event log does not support facility level */ -#define LOG_KERN 0 -#define LOG_USER 0 -#define LOG_MAIL 0 -#define LOG_DAEMON 0 -#define LOG_AUTH 0 -#define LOG_SYSLOG 0 -#define LOG_LPR 0 -#define LOG_LOCAL0 0 -#define LOG_LOCAL1 0 -#define LOG_LOCAL2 0 -#define LOG_LOCAL3 0 -#define LOG_LOCAL4 0 -#define LOG_LOCAL5 0 -#define LOG_LOCAL6 0 -#define LOG_LOCAL7 0 - -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but signification condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -void -syslog(int level, const char *fmt, ...); - -void -openlog(const char *, int, ...); - -void -closelog(void); - -void -ModifyLogLevel(int level); - -void -InitNTLogging(FILE *, int); - -/* - * Include the event codes required for logging. - */ -#include <isc/bindevt.h> - -#endif diff --git a/usr.sbin/bind/lib/isc/win32/thread.c b/usr.sbin/bind/lib/isc/win32/thread.c deleted file mode 100644 index d17d56d94a4..00000000000 --- a/usr.sbin/bind/lib/isc/win32/thread.c +++ /dev/null @@ -1,68 +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. - */ - -/* $ISC: thread.c,v 1.17 2001/07/09 21:06:21 gson Exp $ */ - -#include <config.h> - -#include <process.h> - -#include <isc/thread.h> - -isc_result_t -isc_thread_create(isc_threadfunc_t start, isc_threadarg_t arg, - isc_thread_t *threadp) -{ - isc_thread_t thread; - unsigned int id; - - thread = (isc_thread_t)_beginthreadex(NULL, 0, start, arg, 0, &id); - if (thread == NULL) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - - *threadp = thread; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_thread_join(isc_thread_t thread, isc_threadresult_t *rp) { - DWORD result; - - result = WaitForSingleObject(thread, INFINITE); - if (result != WAIT_OBJECT_0) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - if (rp != NULL && !GetExitCodeThread(thread, rp)) { - /* XXX */ - return (ISC_R_UNEXPECTED); - } - (void)CloseHandle(thread); - - return (ISC_R_SUCCESS); -} - -void -isc_thread_setconcurrency(unsigned int level) { - /* - * This is unnecessary on Win32 systems, but is here so that the - * call exists - */ -} diff --git a/usr.sbin/bind/lib/isc/win32/time.c b/usr.sbin/bind/lib/isc/win32/time.c deleted file mode 100644 index 1ca299b1a35..00000000000 --- a/usr.sbin/bind/lib/isc/win32/time.c +++ /dev/null @@ -1,235 +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. - */ - -/* $ISC: time.c,v 1.24.2.3 2001/10/01 01:42:38 gson Exp $ */ - -#include <config.h> - -#include <errno.h> -#include <limits.h> -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include <windows.h> - -#include <isc/assertions.h> -#include <isc/time.h> -#include <isc/util.h> - -/* - * struct FILETIME uses "100-nanoseconds intervals". - * NS / S = 1000000000 (10^9). - * While it is reasonably obvious that this makes the needed - * conversion factor 10^7, it is coded this way for additional clarity. - */ -#define NS_PER_S 1000000000 -#define NS_INTERVAL 100 -#define INTERVALS_PER_S (NS_PER_S / NS_INTERVAL) -#define UINT64_MAX _UI64_MAX - -/*** - *** Absolute Times - ***/ - -static isc_time_t epoch = { { 0, 0 } }; -isc_time_t *isc_time_epoch = &epoch; - -/*** - *** Intervals - ***/ - -static isc_interval_t zero_interval = { 0 }; -isc_interval_t *isc_interval_zero = &zero_interval; - -void -isc_interval_set(isc_interval_t *i, unsigned int seconds, - unsigned int nanoseconds) -{ - REQUIRE(i != NULL); - REQUIRE(nanoseconds < NS_PER_S); - - i->interval = (LONGLONG)seconds * INTERVALS_PER_S - + nanoseconds / NS_INTERVAL; -} - -isc_boolean_t -isc_interval_iszero(isc_interval_t *i) { - REQUIRE(i != NULL); - if (i->interval == 0) - return (ISC_TRUE); - - return (ISC_FALSE); -} - -void -isc_time_settoepoch(isc_time_t *t) { - REQUIRE(t != NULL); - - t->absolute.dwLowDateTime = 0; - t->absolute.dwHighDateTime = 0; -} - -isc_boolean_t -isc_time_isepoch(isc_time_t *t) { - REQUIRE(t != NULL); - - if (t->absolute.dwLowDateTime == 0 && - t->absolute.dwHighDateTime == 0) - return (ISC_TRUE); - - return (ISC_FALSE); -} - -isc_result_t -isc_time_now(isc_time_t *t) { - REQUIRE(t != NULL); - - GetSystemTimeAsFileTime(&t->absolute); - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) { - ULARGE_INTEGER i1; - - REQUIRE(t != NULL); - REQUIRE(i != NULL); - - GetSystemTimeAsFileTime(&t->absolute); - - i1.LowPart = t->absolute.dwLowDateTime; - i1.HighPart = t->absolute.dwHighDateTime; - - if (UINT64_MAX - i1.QuadPart < (unsigned __int64)i->interval) - return (ISC_R_RANGE); - - i1.QuadPart += i->interval; - - t->absolute.dwLowDateTime = i1.LowPart; - t->absolute.dwHighDateTime = i1.HighPart; - - return (ISC_R_SUCCESS); -} - -int -isc_time_compare(isc_time_t *t1, isc_time_t *t2) { - REQUIRE(t1 != NULL && t2 != NULL); - - return ((int)CompareFileTime(&t1->absolute, &t2->absolute)); -} - -isc_result_t -isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { - ULARGE_INTEGER i1; - - REQUIRE(t != NULL && i != NULL && result != NULL); - - i1.LowPart = t->absolute.dwLowDateTime; - i1.HighPart = t->absolute.dwHighDateTime; - - if (UINT64_MAX - i1.QuadPart < (unsigned __int64)i->interval) - return (ISC_R_RANGE); - - i1.QuadPart += i->interval; - - result->absolute.dwLowDateTime = i1.LowPart; - result->absolute.dwHighDateTime = i1.HighPart; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { - ULARGE_INTEGER i1; - - REQUIRE(t != NULL && i != NULL && result != NULL); - - i1.LowPart = t->absolute.dwLowDateTime; - i1.HighPart = t->absolute.dwHighDateTime; - - if (i1.QuadPart < (unsigned __int64) i->interval) - return (ISC_R_RANGE); - - i1.QuadPart -= i->interval; - - result->absolute.dwLowDateTime = i1.LowPart; - result->absolute.dwHighDateTime = i1.HighPart; - - return (ISC_R_SUCCESS); -} - -isc_uint64_t -isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) { - ULARGE_INTEGER i1, i2; - LONGLONG i3; - - REQUIRE(t1 != NULL && t2 != NULL); - - i1.LowPart = t1->absolute.dwLowDateTime; - i1.HighPart = t1->absolute.dwHighDateTime; - i2.LowPart = t2->absolute.dwLowDateTime; - i2.HighPart = t2->absolute.dwHighDateTime; - - if (i1.QuadPart <= i2.QuadPart) - return (0); - - /* - * Convert to microseconds. - */ - i3 = (i1.QuadPart - i2.QuadPart) / 10; - - return (i3); -} - -isc_uint32_t -isc_time_nanoseconds(isc_time_t *t) { - SYSTEMTIME st; - - /* - * Convert the time to a SYSTEMTIME structure and the grab the - * milliseconds - */ - FileTimeToSystemTime(&t->absolute, &st); - - return ((isc_uint32_t)(st.wMilliseconds * 1000000)); -} - -void -isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len) { - FILETIME localft; - SYSTEMTIME st; - - static const char badtime[] = "Bad 00 99:99:99.999"; - static const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - REQUIRE(len > 0); - if (FileTimeToLocalFileTime(&t->absolute, &localft) && - FileTimeToSystemTime(&localft, &st)) - { - snprintf(buf, len, "%s %2u %02u:%02u:%02u.%03u", - months[st.wMonth - 1], st.wDay, st.wHour, st.wMinute, - st.wSecond, st.wMilliseconds); - } else { - snprintf(buf, len, badtime); - } -} diff --git a/usr.sbin/bind/lib/isc/win32/unistd.h b/usr.sbin/bind/lib/isc/win32/unistd.h deleted file mode 100644 index 145db8dcd01..00000000000 --- a/usr.sbin/bind/lib/isc/win32/unistd.h +++ /dev/null @@ -1,38 +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. - */ - -/* $ISC: unistd.h,v 1.3 2001/07/09 21:06:23 gson Exp $ */ - -/* None of these are defined in NT, so define them for our use */ -#define O_NONBLOCK 1 -#define PORT_NONBLOCK O_NONBLOCK - -/* - * fcntl() commands - */ -#define F_SETFL 0 -#define F_GETFL 1 -#define F_SETFD 2 -#define F_GETFD 3 -/* - * Enough problems not having full fcntl() without worrying about this! - */ -#undef F_DUPFD - -int fcntl(int, int, ...); - -#include <process.h> diff --git a/usr.sbin/bind/lib/isc/win32/version.c b/usr.sbin/bind/lib/isc/win32/version.c deleted file mode 100644 index f117c6bb9c5..00000000000 --- a/usr.sbin/bind/lib/isc/win32/version.c +++ /dev/null @@ -1,26 +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. - */ - -/* $ISC: version.c,v 1.2 2001/07/08 05:09:20 mayer Exp $ */ - -#include <versions.h> - -char isc_version[] = VERSION; - -unsigned int isc_libinterface = LIBINTERFACE; -unsigned int isc_librevision = LIBREVISION; -unsigned int isc_libage = LIBAGE; |