From 7a166c5c61a5aaa6eeb929bed152dc0a6b128e3d Mon Sep 17 00:00:00 2001 From: Michael Graff Date: Thu, 3 Feb 2000 01:28:52 +0000 Subject: [PATCH] completely decouple the lwres library from libisc. Bad michael for using isc/int.h and isc/lang.h, bad Mark for adding isc/tring.h, isc/net.h, and a few others. --- lib/dns/include/dns/adb.h | 1 + lib/lwres/context.c | 6 ++--- lib/lwres/context_p.h | 2 +- lib/lwres/getaddrinfo.c | 22 +++++++++------ lib/lwres/include/lwres/Makefile.in | 3 ++- lib/lwres/include/lwres/context.h | 12 ++++----- lib/lwres/include/lwres/int.h | 36 +++++++++++++++++++++++++ lib/lwres/include/lwres/lang.h | 29 ++++++++++++++++++++ lib/lwres/include/lwres/lwbuffer.h | 20 +++++++------- lib/lwres/include/lwres/lwpacket.h | 26 +++++++++--------- lib/lwres/include/lwres/lwres.h | 42 ++++++++++++++--------------- lib/lwres/include/lwres/netdb.h.in | 12 +++++---- lib/lwres/include/lwres/result.h | 7 +++++ lib/lwres/lwbuffer.c | 18 ++++++------- lib/lwres/lwpacket.c | 4 +-- lib/lwres/lwres_gabn.c | 30 ++++++++++----------- lib/lwres/lwres_gnba.c | 18 ++++++------- lib/lwres/lwres_noop.c | 8 +++--- lib/lwres/lwresutil.c | 22 +++++++-------- 19 files changed, 200 insertions(+), 118 deletions(-) create mode 100644 lib/lwres/include/lwres/int.h create mode 100644 lib/lwres/include/lwres/lang.h diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index 3f81d61ee5..100ecc1338 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -161,6 +161,7 @@ struct dns_adbfind { * * _LAMEPRUNED: * At least one address was omitted from the list because it was lame. + * This bit will NEVER be set if _RETURNLAME is set in the createfind(). */ #define DNS_ADBFIND_INET 0x00000001 #define DNS_ADBFIND_INET6 0x00000002 diff --git a/lib/lwres/context.c b/lib/lwres/context.c index 1e47536a03..289dcee357 100644 --- a/lib/lwres/context.c +++ b/lib/lwres/context.c @@ -73,7 +73,7 @@ lwres_context_create(lwres_context_t **contextp, void *arg, ctx->sock = -1; ctx->timeout = LWRES_DEFAULT_TIMEOUT; - ctx->serial = (isc_uint32_t)ctx; /* XXXMLG */ + ctx->serial = (lwres_uint32_t)ctx; /* XXXMLG */ (void)context_connect(ctx); /* XXXMLG */ @@ -99,7 +99,7 @@ lwres_context_destroy(lwres_context_t **contextp) CTXFREE(ctx, sizeof(lwres_context_t)); } -isc_uint32_t +lwres_uint32_t lwres_context_nextserial(lwres_context_t *ctx) { REQUIRE(ctx != NULL); @@ -108,7 +108,7 @@ lwres_context_nextserial(lwres_context_t *ctx) } void -lwres_context_initserial(lwres_context_t *ctx, isc_uint32_t serial) +lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial) { REQUIRE(ctx != NULL); diff --git a/lib/lwres/context_p.h b/lib/lwres/context_p.h index c7a444c40b..66d02f949d 100644 --- a/lib/lwres/context_p.h +++ b/lib/lwres/context_p.h @@ -33,7 +33,7 @@ */ struct lwres_context { unsigned int timeout; /* time to wait for reply */ - isc_uint32_t serial; /* serial number state */ + lwres_uint32_t serial; /* serial number state */ /* * For network I/O. diff --git a/lib/lwres/getaddrinfo.c b/lib/lwres/getaddrinfo.c index b223866058..5f10b4f63b 100644 --- a/lib/lwres/getaddrinfo.c +++ b/lib/lwres/getaddrinfo.c @@ -3,20 +3,26 @@ * The Berkeley Software Design Inc. software License Agreement specifies * the terms and conditions for redistribution. * - * BSDI $Id: getaddrinfo.c,v 1.9 2000/02/01 06:55:36 marka Exp $ + * BSDI $Id: getaddrinfo.c,v 1.10 2000/02/03 01:28:49 explorer Exp $ */ -#include +#include +#include #include + +#include + +#include +#include + +#include +#include +#include +#include + #include #include /* XXX #include */ -#include -#include /* need strsep */ -#include -#include -#include -#include #define SA(addr) ((struct sockaddr *)(addr)) #define SIN(addr) ((struct sockaddr_in *)(addr)) diff --git a/lib/lwres/include/lwres/Makefile.in b/lib/lwres/include/lwres/Makefile.in index 901b6232dc..f4c03cbf56 100644 --- a/lib/lwres/include/lwres/Makefile.in +++ b/lib/lwres/include/lwres/Makefile.in @@ -20,7 +20,8 @@ top_srcdir = @top_srcdir@ # # Only list headers that are to be installed! # -HEADERS = context.h lwbuffer.h lwpacket.h lwres.h netdb.h result.h +HEADERS = context.h lwbuffer.h lwpacket.h lwres.h netdb.h result.h \ + int.h lang.h SUBDIRS = TARGETS = diff --git a/lib/lwres/include/lwres/context.h b/lib/lwres/include/lwres/context.h index a0f41b37a6..55ffedc0f0 100644 --- a/lib/lwres/include/lwres/context.h +++ b/lib/lwres/include/lwres/context.h @@ -20,15 +20,15 @@ #include -#include -#include +#include +#include /* * Used to set various options such as timeout, authentication, etc */ typedef struct lwres_context lwres_context_t; -ISC_LANG_BEGINDECLS +LWRES_LANG_BEGINDECLS typedef void *(*lwres_malloc_t)(void *arg, size_t length); typedef void (*lwres_free_t)(void *arg, void *mem, size_t length); @@ -65,11 +65,11 @@ lwres_context_destroy(lwres_context_t **contextp); * contextp != NULL && contextp == NULL. */ -isc_uint32_t +lwres_uint32_t lwres_context_nextserial(lwres_context_t *ctx); void -lwres_context_initserial(lwres_context_t *ctx, isc_uint32_t serial); +lwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial); void lwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len); @@ -83,7 +83,7 @@ lwres_context_sendrecv(lwres_context_t *ctx, void *recvbase, int recvlen, int *recvd_len); -ISC_LANG_ENDDECLS +LWRES_LANG_ENDDECLS #endif /* LWRES_CONTEXT_H */ diff --git a/lib/lwres/include/lwres/int.h b/lib/lwres/include/lwres/int.h new file mode 100644 index 0000000000..53c68991e8 --- /dev/null +++ b/lib/lwres/include/lwres/int.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#ifndef LWRES_INT_H +#define LWRES_INT_H 1 + +#include + +LWRES_LANG_BEGINDECLS + +typedef char lwres_int8_t; +typedef unsigned char lwres_uint8_t; +typedef short lwres_int16_t; +typedef unsigned short lwres_uint16_t; +typedef int lwres_int32_t; +typedef unsigned int lwres_uint32_t; +typedef long long lwres_int64_t; +typedef unsigned long long lwres_uint64_t; + +LWRES_LANG_ENDDECLS + +#endif /* LWRES_INT_H */ diff --git a/lib/lwres/include/lwres/lang.h b/lib/lwres/include/lwres/lang.h new file mode 100644 index 0000000000..057b62af35 --- /dev/null +++ b/lib/lwres/include/lwres/lang.h @@ -0,0 +1,29 @@ +/* + * 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. + */ + +#ifndef LWRES_LANG_H +#define LWRES_LANG_H 1 + +#ifdef __cplusplus +#define LWRES_LANG_BEGINDECLS extern "C" { +#define LWRES_LANG_ENDDECLS } +#else +#define LWRES_LANG_BEGINDECLS +#define LWRES_LANG_ENDDECLS +#endif + +#endif /* LWRES_LANG_H */ diff --git a/lib/lwres/include/lwres/lwbuffer.h b/lib/lwres/include/lwres/lwbuffer.h index 7e323a271b..23cade5ceb 100644 --- a/lib/lwres/include/lwres/lwbuffer.h +++ b/lib/lwres/include/lwres/lwbuffer.h @@ -101,10 +101,10 @@ *** Imports ***/ -#include -#include +#include +#include -ISC_LANG_BEGINDECLS +LWRES_LANG_BEGINDECLS /*** *** Magic numbers @@ -262,7 +262,7 @@ lwres_buffer_back(lwres_buffer_t *b, unsigned int n); * */ -isc_uint8_t +lwres_uint8_t lwres_buffer_getuint8(lwres_buffer_t *b); /* * Read an unsigned 8-bit integer from 'b' and return it. @@ -283,7 +283,7 @@ lwres_buffer_getuint8(lwres_buffer_t *b); */ void -lwres_buffer_putuint8(lwres_buffer_t *b, isc_uint8_t val); +lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val); /* * Store an unsigned 8-bit integer from 'val' into 'b'. * @@ -296,7 +296,7 @@ lwres_buffer_putuint8(lwres_buffer_t *b, isc_uint8_t val); * The used pointer in 'b' is advanced by 1. */ -isc_uint16_t +lwres_uint16_t lwres_buffer_getuint16(lwres_buffer_t *b); /* * Read an unsigned 16-bit integer in network byte order from 'b', convert @@ -318,7 +318,7 @@ lwres_buffer_getuint16(lwres_buffer_t *b); */ void -lwres_buffer_putuint16(lwres_buffer_t *b, isc_uint16_t val); +lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val); /* * Store an unsigned 16-bit integer in host byte order from 'val' * into 'b' in network byte order. @@ -332,7 +332,7 @@ lwres_buffer_putuint16(lwres_buffer_t *b, isc_uint16_t val); * The used pointer in 'b' is advanced by 2. */ -isc_uint32_t +lwres_uint32_t lwres_buffer_getuint32(lwres_buffer_t *b); /* * Read an unsigned 32-bit integer in network byte order from 'b', convert @@ -354,7 +354,7 @@ lwres_buffer_getuint32(lwres_buffer_t *b); */ void -lwres_buffer_putuint32(lwres_buffer_t *b, isc_uint32_t val); +lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val); /* * Store an unsigned 32-bit integer in host byte order from 'val' * into 'b' in network byte order. @@ -380,6 +380,6 @@ lwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base, unsigned int l * */ -ISC_LANG_ENDDECLS +LWRES_LANG_ENDDECLS #endif /* LWRES_BUFFER_H */ diff --git a/lib/lwres/include/lwres/lwpacket.h b/lib/lwres/include/lwres/lwpacket.h index 3060aa9808..febd82ce54 100644 --- a/lib/lwres/include/lwres/lwpacket.h +++ b/lib/lwres/include/lwres/lwpacket.h @@ -20,23 +20,23 @@ #include -#include -#include +#include +#include #include typedef struct lwres_lwpacket lwres_lwpacket_t; struct lwres_lwpacket { - isc_uint32_t length; - isc_uint16_t version; - isc_uint16_t flags; - isc_uint32_t serial; - isc_uint32_t opcode; - isc_uint32_t result; - isc_uint32_t recvlength; - isc_uint16_t authtype; - isc_uint16_t authlength; + lwres_uint32_t length; + lwres_uint16_t version; + lwres_uint16_t flags; + lwres_uint32_t serial; + lwres_uint32_t opcode; + lwres_uint32_t result; + lwres_uint32_t recvlength; + lwres_uint16_t authtype; + lwres_uint16_t authlength; }; #define LWRES_LWPACKET_LENGTH (4 * 5 + 2 * 4) @@ -113,7 +113,7 @@ struct lwres_lwpacket { * NS, SOA, etc. using this opcode. */ -ISC_LANG_BEGINDECLS +LWRES_LANG_BEGINDECLS int lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt); @@ -121,6 +121,6 @@ lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt); int lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt); -ISC_LANG_ENDDECLS +LWRES_LANG_ENDDECLS #endif /* LWRES_LWPACKET_H */ diff --git a/lib/lwres/include/lwres/lwres.h b/lib/lwres/include/lwres/lwres.h index 8c200d46bf..bc189d5e3d 100644 --- a/lib/lwres/include/lwres/lwres.h +++ b/lib/lwres/include/lwres/lwres.h @@ -20,8 +20,8 @@ #include -#include -#include +#include +#include #include #include @@ -101,13 +101,13 @@ typedef struct { /* public */ - isc_uint16_t datalength; + lwres_uint16_t datalength; unsigned char *data; } lwres_nooprequest_t; typedef struct { /* public */ - isc_uint16_t datalength; + lwres_uint16_t datalength; unsigned char *data; } lwres_noopresponse_t; @@ -117,26 +117,26 @@ typedef struct { #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U typedef struct { - isc_uint32_t family; - isc_uint16_t length; + lwres_uint32_t family; + lwres_uint16_t length; const unsigned char *address; } lwres_addr_t; typedef struct { /* public */ - isc_uint32_t addrtypes; - isc_uint16_t namelen; + lwres_uint32_t addrtypes; + lwres_uint16_t namelen; char *name; } lwres_gabnrequest_t; typedef struct { /* public */ - isc_uint16_t naliases; - isc_uint16_t naddrs; + lwres_uint16_t naliases; + lwres_uint16_t naddrs; char *realname; char **aliases; - isc_uint16_t realnamelen; - isc_uint16_t *aliaslen; + lwres_uint16_t realnamelen; + lwres_uint16_t *aliaslen; lwres_addr_t *addrs; /* if base != NULL, it will be freed when this structure is freed. */ void *base; @@ -154,11 +154,11 @@ typedef struct { typedef struct { /* public */ - isc_uint16_t naliases; + lwres_uint16_t naliases; char *realname; char **aliases; - isc_uint16_t realnamelen; - isc_uint16_t *aliaslen; + lwres_uint16_t realnamelen; + lwres_uint16_t *aliaslen; /* if base != NULL, it will be freed when this structure is freed. */ void *base; size_t baselen; @@ -170,7 +170,7 @@ typedef struct { #define LWRES_MAX_ALIASES 8 /* max # of aliases */ #define LWRES_MAX_ADDRS 32 /* max # of addrs */ -ISC_LANG_BEGINDECLS +LWRES_LANG_BEGINDECLS int lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, @@ -356,20 +356,20 @@ lwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp); */ int -lwres_string_parse(lwres_buffer_t *b, char **c, isc_uint16_t *len); +lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len); int lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr); int lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, - isc_uint32_t addrtypes, lwres_gabnresponse_t **structp); + lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp); int -lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype, - isc_uint16_t addrlen, const unsigned char *addr, +lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype, + lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp); -ISC_LANG_ENDDECLS +LWRES_LANG_ENDDECLS #endif /* LWRES_LWRES_H */ diff --git a/lib/lwres/include/lwres/netdb.h.in b/lib/lwres/include/lwres/netdb.h.in index 498bb2b523..ac5a155de0 100644 --- a/lib/lwres/include/lwres/netdb.h.in +++ b/lib/lwres/include/lwres/netdb.h.in @@ -15,8 +15,8 @@ * SOFTWARE. */ -#ifndef lwres_netdb_h -#define lwres_netdb_h 1 +#ifndef LWRES_NETDB_H +#define LWRES_NETDB_H 1 /* * ++Copyright++ 1980, 1983, 1988, 1993 @@ -106,12 +106,14 @@ /* * @(#)netdb.h 8.1 (Berkeley) 6/2/93 - * $Id: netdb.h.in,v 1.10 2000/01/27 13:04:15 marka Exp $ + * $Id: netdb.h.in,v 1.11 2000/02/03 01:28:52 explorer Exp $ */ #include -#include -#include +#if 0 +#include +#endif +#include #ifndef _PATH_HEQUIV #define _PATH_HEQUIV "/etc/hosts.equiv" diff --git a/lib/lwres/include/lwres/result.h b/lib/lwres/include/lwres/result.h index c58eaabdb4..6dcdeeadf7 100644 --- a/lib/lwres/include/lwres/result.h +++ b/lib/lwres/include/lwres/result.h @@ -18,6 +18,13 @@ #ifndef LWRES_RESULT_H #define LWRES_RESULT_H 1 +/* + * XXXMLG + * should be unsigned when functions are fixed to return a status, not both + * a status and an FD or whatever. + */ +typedef int lwres_result_t; + #define LWRES_R_SUCCESS 0 #define LWRES_R_NOMEMORY -1 #define LWRES_R_TIMEOUT -2 diff --git a/lib/lwres/lwbuffer.c b/lib/lwres/lwbuffer.c index 4023af8465..8769ad38e5 100644 --- a/lib/lwres/lwbuffer.c +++ b/lib/lwres/lwbuffer.c @@ -140,11 +140,11 @@ lwres_buffer_back(lwres_buffer_t *b, unsigned int n) b->current -= n; } -isc_uint8_t +lwres_uint8_t lwres_buffer_getuint8(lwres_buffer_t *b) { unsigned char *cp; - isc_uint8_t result; + lwres_uint8_t result; /* * Read an unsigned 8-bit integer from 'b' and return it. @@ -162,7 +162,7 @@ lwres_buffer_getuint8(lwres_buffer_t *b) } void -lwres_buffer_putuint8(lwres_buffer_t *b, isc_uint8_t val) +lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val) { unsigned char *cp; @@ -175,11 +175,11 @@ lwres_buffer_putuint8(lwres_buffer_t *b, isc_uint8_t val) cp[0] = (val & 0x00ff); } -isc_uint16_t +lwres_uint16_t lwres_buffer_getuint16(lwres_buffer_t *b) { unsigned char *cp; - isc_uint16_t result; + lwres_uint16_t result; /* * Read an unsigned 16-bit integer in network byte order from 'b', @@ -199,7 +199,7 @@ lwres_buffer_getuint16(lwres_buffer_t *b) } void -lwres_buffer_putuint16(lwres_buffer_t *b, isc_uint16_t val) +lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val) { unsigned char *cp; @@ -213,11 +213,11 @@ lwres_buffer_putuint16(lwres_buffer_t *b, isc_uint16_t val) cp[1] = (val & 0x00ff); } -isc_uint32_t +lwres_uint32_t lwres_buffer_getuint32(lwres_buffer_t *b) { unsigned char *cp; - isc_uint32_t result; + lwres_uint32_t result; /* * Read an unsigned 32-bit integer in network byte order from 'b', @@ -239,7 +239,7 @@ lwres_buffer_getuint32(lwres_buffer_t *b) } void -lwres_buffer_putuint32(lwres_buffer_t *b, isc_uint32_t val) +lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val) { unsigned char *cp; diff --git a/lib/lwres/lwpacket.c b/lib/lwres/lwpacket.c index 5de154c221..c7613eaa24 100644 --- a/lib/lwres/lwpacket.c +++ b/lib/lwres/lwpacket.c @@ -27,7 +27,7 @@ #include "assert_p.h" -#define LWPACKET_LENGTH (sizeof(isc_uint16_t) * 4 + sizeof(isc_uint32_t) * 5) +#define LWPACKET_LENGTH (sizeof(lwres_uint16_t) * 4 + sizeof(lwres_uint32_t) * 5) int lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) @@ -54,7 +54,7 @@ lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) int lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt) { - isc_uint32_t space; + lwres_uint32_t space; REQUIRE(b != NULL); REQUIRE(pkt != NULL); diff --git a/lib/lwres/lwres_gabn.c b/lib/lwres/lwres_gabn.c index 953229b75c..460c8eee07 100644 --- a/lib/lwres/lwres_gabn.c +++ b/lib/lwres/lwres_gabn.c @@ -37,7 +37,7 @@ lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, size_t buflen; int ret; size_t payload_length; - isc_uint16_t datalen; + lwres_uint16_t datalen; REQUIRE(ctx != NULL); REQUIRE(req != NULL); @@ -99,7 +99,7 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, size_t buflen; int ret; size_t payload_length; - isc_uint16_t datalen; + lwres_uint16_t datalen; int x; REQUIRE(ctx != NULL); @@ -108,7 +108,7 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, REQUIRE(b != NULL); /* naliases, naddrs */ - payload_length = sizeof(isc_uint16_t) * 2; + payload_length = sizeof(lwres_uint16_t) * 2; /* real name encoding */ payload_length += 2 + req->realnamelen + 1; /* each alias */ @@ -116,7 +116,7 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, payload_length += 2 + req->aliaslen[x] + 1; /* each address */ for (x = 0 ; x < req->naddrs ; x++) { - payload_length += sizeof(isc_uint32_t) + sizeof(isc_uint16_t); + payload_length += sizeof(lwres_uint32_t) + sizeof(lwres_uint16_t); payload_length += req->addrs[x].length; } @@ -142,7 +142,7 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, /* encode naliases and naddrs */ - INSIST(SPACE_OK(b, sizeof(isc_uint16_t) * 2)); + INSIST(SPACE_OK(b, sizeof(lwres_uint16_t) * 2)); lwres_buffer_putuint16(b, req->naliases); lwres_buffer_putuint16(b, req->naddrs); @@ -164,8 +164,8 @@ lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, /* encode the addresses */ for (x = 0 ; x < req->naddrs ; x++) { - datalen = req->addrs[x].length + sizeof(isc_uint16_t) - + sizeof(isc_uint32_t); + datalen = req->addrs[x].length + sizeof(lwres_uint16_t) + + sizeof(lwres_uint32_t); INSIST(SPACE_OK(b, datalen)); lwres_buffer_putuint32(b, req->addrs[x].family); lwres_buffer_putuint16(b, req->addrs[x].length); @@ -186,8 +186,8 @@ lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, int ret; char *name; lwres_gabnrequest_t *gabn; - isc_uint32_t addrtypes; - isc_uint16_t namelen; + lwres_uint32_t addrtypes; + lwres_uint16_t namelen; REQUIRE(ctx != NULL); REQUIRE(pkt != NULL); @@ -230,8 +230,8 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, { int ret; unsigned int x; - isc_uint16_t naliases; - isc_uint16_t naddrs; + lwres_uint16_t naliases; + lwres_uint16_t naddrs; lwres_gabnresponse_t *gabn; REQUIRE(ctx != NULL); @@ -247,7 +247,7 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, /* * Pull off the name itself */ - if (!SPACE_REMAINING(b, sizeof(isc_uint16_t) * 2)) + if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t) * 2)) return (LWRES_R_UNEXPECTEDEND); naliases = lwres_buffer_getuint16(b); naddrs = lwres_buffer_getuint16(b); @@ -270,7 +270,7 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, goto out; } - gabn->aliaslen = CTXMALLOC(sizeof(isc_uint16_t) * naliases); + gabn->aliaslen = CTXMALLOC(sizeof(lwres_uint16_t) * naliases); if (gabn->aliaslen == NULL) { ret = LWRES_R_NOMEMORY; goto out; @@ -325,7 +325,7 @@ lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, CTXFREE(gabn->aliases, sizeof(char *) * naliases); if (gabn->aliaslen != NULL) CTXFREE(gabn->aliaslen, - sizeof(isc_uint16_t) * naliases); + sizeof(lwres_uint16_t) * naliases); if (gabn->addrs != NULL) CTXFREE(gabn->addrs, sizeof(lwres_addr_t) * naddrs); CTXFREE(gabn, sizeof(lwres_gabnresponse_t)); @@ -361,7 +361,7 @@ lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp) if (gabn->naliases > 0) { CTXFREE(gabn->aliases, sizeof(char *) * gabn->naliases); - CTXFREE(gabn->aliaslen, sizeof(isc_uint16_t) * gabn->naliases); + CTXFREE(gabn->aliaslen, sizeof(lwres_uint16_t) * gabn->naliases); } if (gabn->naddrs > 0) CTXFREE(gabn->addrs, sizeof(lwres_addr_t) * gabn->naddrs); diff --git a/lib/lwres/lwres_gnba.c b/lib/lwres/lwres_gnba.c index c217946bdd..fda40cbe8d 100644 --- a/lib/lwres/lwres_gnba.c +++ b/lib/lwres/lwres_gnba.c @@ -46,7 +46,7 @@ lwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req, REQUIRE(pkt != NULL); REQUIRE(b != NULL); - payload_length = sizeof(isc_uint32_t) + sizeof(isc_uint16_t) + payload_length = sizeof(lwres_uint32_t) + sizeof(lwres_uint16_t) + req->addr.length; buflen = LWRES_LWPACKET_LENGTH + payload_length; @@ -93,7 +93,7 @@ lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req, size_t buflen; int ret; size_t payload_length; - isc_uint16_t datalen; + lwres_uint16_t datalen; int x; REQUIRE(ctx != NULL); @@ -102,7 +102,7 @@ lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req, REQUIRE(b != NULL); /* naliases */ - payload_length = sizeof(isc_uint16_t); + payload_length = sizeof(lwres_uint16_t); /* real name encoding */ payload_length += 2 + req->realnamelen + 1; /* each alias */ @@ -130,7 +130,7 @@ lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req, } /* encode naliases */ - INSIST(SPACE_OK(b, sizeof(isc_uint16_t) * 2)); + INSIST(SPACE_OK(b, sizeof(lwres_uint16_t) * 2)); lwres_buffer_putuint16(b, req->naliases); /* encode the real name */ @@ -198,7 +198,7 @@ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, { int ret; unsigned int x; - isc_uint16_t naliases; + lwres_uint16_t naliases; lwres_gnbaresponse_t *gnba; REQUIRE(ctx != NULL); @@ -214,7 +214,7 @@ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, /* * Pull off the name itself */ - if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) + if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t))) return (LWRES_R_UNEXPECTEDEND); naliases = lwres_buffer_getuint16(b); @@ -234,7 +234,7 @@ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, goto out; } - gnba->aliaslen = CTXMALLOC(sizeof(isc_uint16_t) * naliases); + gnba->aliaslen = CTXMALLOC(sizeof(lwres_uint16_t) * naliases); if (gnba->aliaslen == NULL) { ret = LWRES_R_NOMEMORY; goto out; @@ -272,7 +272,7 @@ lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, CTXFREE(gnba->aliases, sizeof(char *) * naliases); if (gnba->aliaslen != NULL) CTXFREE(gnba->aliaslen, - sizeof(isc_uint16_t) * naliases); + sizeof(lwres_uint16_t) * naliases); CTXFREE(gnba, sizeof(lwres_gnbaresponse_t)); } @@ -306,7 +306,7 @@ lwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp) if (gnba->naliases > 0) { CTXFREE(gnba->aliases, sizeof(char *) * gnba->naliases); - CTXFREE(gnba->aliaslen, sizeof(isc_uint16_t) * gnba->naliases); + CTXFREE(gnba->aliaslen, sizeof(lwres_uint16_t) * gnba->naliases); } if (gnba->base != NULL) CTXFREE(gnba->base, gnba->baselen); diff --git a/lib/lwres/lwres_noop.c b/lib/lwres/lwres_noop.c index 9bcd211629..e986bff617 100644 --- a/lib/lwres/lwres_noop.c +++ b/lib/lwres/lwres_noop.c @@ -43,7 +43,7 @@ lwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req, REQUIRE(pkt != NULL); REQUIRE(b != NULL); - payload_length = sizeof(isc_uint16_t) + req->datalength; + payload_length = sizeof(lwres_uint16_t) + req->datalength; buflen = LWRES_LWPACKET_LENGTH + payload_length; buf = CTXMALLOC(buflen); @@ -94,7 +94,7 @@ lwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req, REQUIRE(pkt != NULL); REQUIRE(b != NULL); - payload_length = sizeof(isc_uint16_t) + req->datalength; + payload_length = sizeof(lwres_uint16_t) + req->datalength; buflen = LWRES_LWPACKET_LENGTH + payload_length; buf = CTXMALLOC(buflen); @@ -149,7 +149,7 @@ lwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, if (req == NULL) return (LWRES_R_NOMEMORY); - if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) { + if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t))) { ret = LWRES_R_UNEXPECTEDEND; goto out; } @@ -196,7 +196,7 @@ lwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, if (req == NULL) return (LWRES_R_NOMEMORY); - if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) { + if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t))) { ret = LWRES_R_UNEXPECTEDEND; goto out; } diff --git a/lib/lwres/lwresutil.c b/lib/lwres/lwresutil.c index f1a1ff5834..ccfe5a7a82 100644 --- a/lib/lwres/lwresutil.c +++ b/lib/lwres/lwresutil.c @@ -50,9 +50,9 @@ * */ int -lwres_string_parse(lwres_buffer_t *b, char **c, isc_uint16_t *len) +lwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len) { - isc_uint16_t datalen; + lwres_uint16_t datalen; char *string; REQUIRE(b != NULL); @@ -60,7 +60,7 @@ lwres_string_parse(lwres_buffer_t *b, char **c, isc_uint16_t *len) /* * Pull off the length (2 bytes) */ - if (!SPACE_REMAINING(b, sizeof(isc_uint16_t))) + if (!SPACE_REMAINING(b, sizeof(lwres_uint16_t))) return (LWRES_R_UNEXPECTEDEND); datalen = lwres_buffer_getuint16(b); @@ -94,7 +94,7 @@ lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr) { REQUIRE(addr != NULL); - if (!SPACE_REMAINING(b, sizeof(isc_uint32_t) + sizeof(isc_uint16_t))) + if (!SPACE_REMAINING(b, sizeof(lwres_uint32_t) + sizeof(lwres_uint16_t))) return (LWRES_R_UNEXPECTEDEND); addr->family = lwres_buffer_getuint32(b); addr->length = lwres_buffer_getuint16(b); @@ -108,7 +108,7 @@ lwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr) int lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, - isc_uint32_t addrtypes, lwres_gabnresponse_t **structp) + lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp) { lwres_gabnrequest_t request; lwres_gabnresponse_t *response; @@ -116,7 +116,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, int recvlen; lwres_buffer_t b_in, b_out; lwres_lwpacket_t pkt; - isc_uint32_t serial; + lwres_uint32_t serial; char *buffer; REQUIRE(ctx != NULL); @@ -128,7 +128,7 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, b_out.base = NULL; response = NULL; buffer = NULL; - serial = (isc_uint32_t)name; + serial = (lwres_uint32_t)name; buffer = CTXMALLOC(LWRES_RECVLENGTH); if (buffer == NULL) { @@ -213,8 +213,8 @@ lwres_getaddrsbyname(lwres_context_t *ctx, const char *name, int -lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype, - isc_uint16_t addrlen, const unsigned char *addr, +lwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype, + lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp) { lwres_gnbarequest_t request; @@ -223,7 +223,7 @@ lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype, int recvlen; lwres_buffer_t b_in, b_out; lwres_lwpacket_t pkt; - isc_uint32_t serial; + lwres_uint32_t serial; char *buffer; REQUIRE(ctx != NULL); @@ -236,7 +236,7 @@ lwres_getnamebyaddr(lwres_context_t *ctx, isc_uint32_t addrtype, b_out.base = NULL; response = NULL; buffer = NULL; - serial = (isc_uint32_t)addr; + serial = (lwres_uint32_t)addr; buffer = CTXMALLOC(LWRES_RECVLENGTH); if (buffer == NULL) {