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.

This commit is contained in:
Michael Graff
2000-02-03 01:28:52 +00:00
parent 628b315462
commit 7a166c5c61
19 changed files with 200 additions and 118 deletions
+1
View File
@@ -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
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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.
+14 -8
View File
@@ -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 <isc/net.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <resolv.h>
#include <lwres/lwres.h>
#include <lwres/netdb.h> /* XXX #include <netdb.h> */
#include <errno.h>
#include <isc/string.h> /* need strsep */
#include <stdlib.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <arpa/inet.h>
#define SA(addr) ((struct sockaddr *)(addr))
#define SIN(addr) ((struct sockaddr_in *)(addr))
+2 -1
View File
@@ -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 =
+6 -6
View File
@@ -20,15 +20,15 @@
#include <stddef.h>
#include <isc/lang.h>
#include <isc/int.h>
#include <lwres/lang.h>
#include <lwres/int.h>
/*
* 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 */
+36
View File
@@ -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.h>
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 */
+29
View File
@@ -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 */
+10 -10
View File
@@ -101,10 +101,10 @@
*** Imports
***/
#include <isc/lang.h>
#include <isc/int.h>
#include <lwres/lang.h>
#include <lwres/int.h>
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 */
+13 -13
View File
@@ -20,23 +20,23 @@
#include <stddef.h>
#include <isc/lang.h>
#include <isc/int.h>
#include <lwres/lang.h>
#include <lwres/int.h>
#include <lwres/lwbuffer.h>
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 */
+21 -21
View File
@@ -20,8 +20,8 @@
#include <stddef.h>
#include <isc/lang.h>
#include <isc/int.h>
#include <lwres/lang.h>
#include <lwres/int.h>
#include <lwres/context.h>
#include <lwres/lwpacket.h>
@@ -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 */
+7 -5
View File
@@ -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 <stdio.h>
#include <isc/net.h>
#include <isc/lang.h>
#if 0
#include <lwres/net.h>
#endif
#include <lwres/lang.h>
#ifndef _PATH_HEQUIV
#define _PATH_HEQUIV "/etc/hosts.equiv"
+7
View File
@@ -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
+9 -9
View File
@@ -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;
+2 -2
View File
@@ -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);
+15 -15
View File
@@ -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);
+9 -9
View File
@@ -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);
+4 -4
View File
@@ -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;
}
+11 -11
View File
@@ -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) {