ncache.c revision abb239e7fcc936cc19f6554e827b7f69c470938e
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 2004, 2005, 2007, 2008, 2010 Internet Systems Consortium, Inc. ("ISC")
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington * Copyright (C) 1999-2003 Internet Software Consortium.
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Permission to use, copy, modify, and/or distribute this software for any
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * purpose with or without fee is hereby granted, provided that the above
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/* $Id: ncache.c,v 1.50 2010/05/19 09:52:42 marka Exp $ */
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * The format of an ncache rdata is a sequence of one or more records of
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * the following format:
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff * rdata count
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * rdata length These two occur 'rdata count'
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * rdata times.
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrencecopy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff unsigned int count;
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Copy the rdataset count to the buffer.
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_buffer_putuint16(buffer, (isc_uint16_t)count);
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Copy the rdata length to the buffer.
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff isc_buffer_putuint16(buffer, (isc_uint16_t)r.length);
b8ef99c3a7be2835b2395faff2d46e46f5c4adb3Michael Graff * Copy the rdata to the buffer.
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graffdns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
isc_region_t r;
unsigned int next = 0;
&name);
DNS_RDATASETATTR_NCACHE) == 0)
return (result);
return (ISC_R_NOSPACE);
&buffer);
return (result);
return (ISC_R_NOSPACE);
next++;
return (result);
return (result);
return (ISC_R_NOSPACE);
ttl = 0;
return (ISC_R_NOSPACE);
== ISC_R_SUCCESS);
if (optout)
0, addedrdataset));
unsigned int *countp)
count = 0;
for (i = 0; i < rcount; i++) {
goto rollback;
goto rollback;
goto rollback;
count++;
goto rollback;
return (ISC_R_SUCCESS);
*countp = 0;
return (result);
static isc_result_t
unsigned int count;
if (count == 0) {
return (ISC_R_NOMORE);
count--;
return (ISC_R_SUCCESS);
static isc_result_t
unsigned int count;
unsigned int length;
unsigned char *raw;
if (count == 0)
return (ISC_R_NOMORE);
count--;
return (ISC_R_SUCCESS);
isc_region_t r;
unsigned int count;
return (count);
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
return (ISC_R_NOTFOUND);
return (result);
return (ISC_R_SUCCESS);
unsigned char *raw;
unsigned int count;
return (ISC_R_NOTFOUND);
return (result);
return (ISC_R_SUCCESS);
unsigned int count;
unsigned char *raw;