From 047079a2369c4f7ccc04ec3bb559c1ea00322c07 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Tue, 6 Jul 1999 22:57:44 +0000 Subject: [PATCH] sockaddr.c is now generic --- lib/isc/Makefile.in | 6 ++-- lib/isc/unix/Makefile.in | 2 +- lib/isc/unix/sockaddr.c | 73 ---------------------------------------- 3 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 lib/isc/unix/sockaddr.c diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index cdd5694f0c..018656b98f 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -28,7 +28,7 @@ CDEFINES = CWARNINGS = UNIXOBJS = unix/app.@O@ unix/time.@O@ unix/stdtime.@O@ \ - unix/socket.@O@ unix/interfaceiter.@O@ unix/sockaddr.@O@ + unix/socket.@O@ unix/interfaceiter.@O@ NLSOBJS = nls/msgcat.@O@ @@ -37,8 +37,8 @@ PTHREADOBJS = pthreads/condition.@O@ OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ base64.@O@ buffer.@O@ error.@O@ \ heap.@O@ lex.@O@ lib.@O@ mem.@O@ result.@O@ \ - rwlock.@O@ symtab.@O@ str.@O@ event.@O@ task.@O@ \ - timer.@O@ version.@O@ \ + rwlock.@O@ sockaddr.@O@ symtab.@O@ str.@O@ event.@O@ \ + task.@O@ timer.@O@ version.@O@ \ ${UNIXOBJS} ${NLSOBJS} ${PTHREADOBJS} LIBS = @LIBS@ diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in index 499e9f9ebf..6c6c6cefa9 100644 --- a/lib/isc/unix/Makefile.in +++ b/lib/isc/unix/Makefile.in @@ -25,7 +25,7 @@ CDEFINES = CWARNINGS = OBJS = app.@O@ time.@O@ stdtime.@O@ socket.@O@ \ - interfaceiter.@O@ sockaddr.@O@ + interfaceiter.@O@ SUBDIRS = include TARGETS = ${OBJS} diff --git a/lib/isc/unix/sockaddr.c b/lib/isc/unix/sockaddr.c deleted file mode 100644 index 77f25557ed..0000000000 --- a/lib/isc/unix/sockaddr.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 1999 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. - */ - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -isc_boolean_t -isc_sockaddr_equal(isc_sockaddr_t *a, isc_sockaddr_t *b) -{ - struct sockaddr *sa, *sb; - - sa = (struct sockaddr *)&a->type; - sb = (struct sockaddr *)&b->type; - - if (sa->sa_family != sb->sa_family) - return (ISC_FALSE); - -#ifdef HAVE_SA_LEN - if (sa->sa_len != sb->sa_len) - return (ISC_FALSE); - if (memcmp(sa->sa_data, sb->sa_data, sa->sa_len) != 0) - return (ISC_FALSE); -#else - switch (sa->sa_family) { - case AF_INET: { - struct sockaddr_in *sina, *sinb; - - sina = (struct sockaddr_in *)sa; - sinb = (struct sockaddr_in *)sb; - - if (sina->sin_port != sinb->sin_port) - return (ISC_FALSE); - if (memcmp(&sina->sin_addr, &sinb->sin_addr, 4) != 0) - return (ISC_FALSE); - - return (ISC_TRUE); - } - default: - INSIST("Unknown socket protocol"); - break; - } - -#endif - - UNEXPECTED_ERROR(__FILE__, __LINE__, "Cannot happen"); - return (ISC_FALSE); -}