byaddr.c revision b6309ed962c4988a314d61742c4fbc4935467d68
/*
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: byaddr.c,v 1.32 2002/08/27 04:53:42 marka Exp $ */
#include <config.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/resolver.h>
/*
* XXXRTH We could use a static event...
*/
struct dns_byaddr {
/* Unlocked. */
unsigned int magic;
/* Locked by lock. */
unsigned int options;
isc_task_t * task;
};
#define MAX_RESTARTS 16
static char hex_digits[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
{
/*
* We dropped bitstring labels, so all lookups will use nibbles.
*/
return (dns_byaddr_createptrname2(address,
}
{
char textname[128];
unsigned char *bytes;
int i;
char *cp;
unsigned int len;
/*
* We create the text representation and then convert to a
* dns_name_t. This is not maximally efficient, but it keeps all
* of the knowledge of wire format in the dns_name_ routines.
*/
(bytes[0] & 0xff));
for (i = 15; i >= 0; i--) {
*cp++ = '.';
*cp++ = '.';
}
if ((options & DNS_BYADDROPT_IPV6INT) != 0)
else
} else
return (ISC_R_NOTIMPLEMENTED);
}
static inline isc_result_t
/*
* The caller must be holding the byaddr's lock.
*/
while (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_NOMEMORY);
}
if (result != ISC_R_SUCCESS) {
return (ISC_R_NOMEMORY);
}
}
if (result == ISC_R_NOMORE)
return (result);
}
static void
} else
}
static void
}
}
{
return (ISC_R_NOMEMORY);
goto cleanup_byaddr;
}
if (result != ISC_R_SUCCESS)
goto cleanup_event;
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
return (ISC_R_SUCCESS);
return (result);
}
void
}
}
void
}