byaddr.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000-2005, 2007, 2009, 2013, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: byaddr.c,v 1.41 2009/09/02 23:48:02 tbox Exp $ */
/*! \file */
#include <config.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/resolver.h>
/*
* XXXRTH We could use a static event...
*/
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.
*/
"%u.%u.%u.%u.in-addr.arpa.",
(bytes[0] & 0xff));
for (i = 15; i >= 0; i--) {
*cp++ = '.';
*cp++ = '.';
}
if ((options & DNS_BYADDROPT_IPV6INT) != 0)
else
} else
return (ISC_R_NOTIMPLEMENTED);
}
struct dns_byaddr {
/* Unlocked. */
unsigned int magic;
/* Locked by lock. */
unsigned int options;
isc_task_t * task;
};
#define MAX_RESTARTS 16
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
}