rdataset.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2012, 2014-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$ */
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <dns/compress.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
static const char *trustnames[] = {
"none",
"pending-additional",
"pending-answer",
"additional",
"glue",
"answer",
"authauthority",
"authanswer",
"secure",
"local" /* aka ultimate */
};
const char *
return ("bad");
return (trustnames[trust]);
}
void
/*
* Make 'rdataset' a valid, disassociated rdataset.
*/
rdataset->attributes = 0;
rdataset->privateuint4 = 0;
}
void
/*
* Invalidate 'rdataset'.
*/
rdataset->attributes = 0;
rdataset->privateuint4 = 0;
}
void
/*
* Disassociate 'rdataset' from its rdata, allowing it to be reused.
*/
rdataset->attributes = 0;
rdataset->privateuint4 = 0;
}
/*
* Is 'rdataset' associated?
*/
return (ISC_TRUE);
return (ISC_FALSE);
}
static void
}
static isc_result_t
return (ISC_R_NOMORE);
}
static void
/*
* This routine should never be called.
*/
REQUIRE(0);
}
static void
}
static unsigned int
/*
* This routine should never be called.
*/
REQUIRE(0);
return (0);
}
static dns_rdatasetmethods_t question_methods = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
void
{
/*
* Make 'rdataset' a valid, associated, question rdataset, with a
* question class of 'rdclass' and type 'type'.
*/
}
unsigned int
/*
* Return the number of records in 'rdataset'.
*/
}
void
/*
* Make 'target' refer to the same rdataset as 'source'.
*/
}
/*
* Move the rdata cursor to the first rdata in the rdataset (if any).
*/
}
/*
* Move the rdata cursor to the next rdata in the rdataset (if any).
*/
}
void
/*
* Make 'rdata' refer to the current rdata.
*/
}
#define MAX_SHUFFLE 32
struct towire_sort {
int key;
};
static int
}
static isc_result_t
{
isc_region_t r;
unsigned int headlen;
/*
* Convert 'rdataset' to wire format, compressing names as specified
* in cctx, and storing the result in 'target'.
*/
count = 1;
/*
* This is a negative caching rdataset.
*/
unsigned int ncache_opts = 0;
if ((options & DNS_RDATASETTOWIRE_OMITDNSSEC) != 0)
countp));
} else {
if (result == ISC_R_NOMORE)
return (ISC_R_SUCCESS);
if (result != ISC_R_SUCCESS)
return (result);
}
/*
* Do we want to shuffle this answer?
*/
} else {
}
if (shuffle) {
/*
* First we get handles to all of the rdata.
*/
i = 0;
do {
dns_rdata_init(&shuffled[i]);
i++;
} while (result == ISC_R_SUCCESS);
if (result != ISC_R_NOMORE)
goto cleanup;
/*
* Now we shuffle.
*/
if (WANT_FIXED(rdataset)) {
/*
* 'Fixed' order.
*/
for (i = 0; i < count; i++) {
}
} else if (WANT_RANDOM(rdataset)) {
/*
* 'Random' order.
*/
for (i = 0; i < count; i++) {
else
}
} else {
/*
* "Cyclic" order.
*/
unsigned int j;
if (val == ISC_UINT32_MAX)
for (i = 0; i < count; i++) {
else
j++;
if (j == count)
j = 0; /* Wrap around. */
}
}
/*
* Sorted order.
*/
}
savedbuffer = *target;
i = 0;
added = 0;
do {
/*
* Copy out the name, type, class, ttl.
*/
if (result != ISC_R_SUCCESS)
goto rollback;
if (!question)
+ 2; /* XXX 2 for rdata len */
goto rollback;
}
if (!question) {
/*
* Save space for rdlen.
*/
/*
* Copy out the rdata
*/
if (shuffle)
else {
}
if (result != ISC_R_SUCCESS)
goto rollback;
added++;
}
if (shuffle) {
i++;
if (i == count)
else
} else {
}
} while (result == ISC_R_SUCCESS);
if (result != ISC_R_NOMORE)
goto rollback;
goto cleanup;
goto cleanup;
}
*countp = 0;
*target = savedbuffer;
return (result);
}
const dns_name_t *owner_name,
const void *order_arg,
unsigned int options,
unsigned int *countp)
{
}
const dns_name_t *owner_name,
const void *order_arg,
unsigned int options,
unsigned int *countp,
void **state)
{
}
unsigned int options,
unsigned int *countp)
{
}
{
/*
* For each rdata in rdataset, call 'add' for each name and type in the
* rdata which is subject to additional section processing.
*/
if (result != ISC_R_SUCCESS)
return (result);
do {
if (result == ISC_R_SUCCESS)
} while (result == ISC_R_SUCCESS);
if (result != ISC_R_NOMORE)
return (result);
return (ISC_R_SUCCESS);
}
return (ISC_R_NOTIMPLEMENTED);
}
{
return (ISC_R_NOTIMPLEMENTED);
}
return (ISC_R_NOTIMPLEMENTED);
}
{
return (ISC_R_NOTIMPLEMENTED);
}
/*
* Additional cache stuff
*/
dns_zone_t **zonep,
{
}
return (ISC_R_FAILURE);
}
{
}
return (ISC_R_FAILURE);
}
{
}
return (ISC_R_FAILURE);
}
void
else
}
void
}
void
}
void
}
void
}
void
{
isc_uint32_t ttl = 0;
/*
* If we accept expired RRsets keep them for no more than 120 seconds.
*/
if (acceptexpired &&
ttl = 120;
}