rdataset.c revision 732e0731dec1922747bb3b3147cf2c3d16b22eaa
ca41b452ede6feaa9d8739ec3cae19389a7b0d03Bob Halley * Copyright (C) 1999 Internet Software Consortium.
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * Permission to use, copy, modify, and distribute this software for any
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * purpose with or without fee is hereby granted, provided that the above
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * copyright notice and this permission notice appear in all copies.
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * Make 'rdataset' a valid, disassociated rdataset.
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graffdns_rdataset_invalidate(dns_rdataset_t *rdataset) {
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff * Invalidate 'rdataset'.
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graffdns_rdataset_disassociate(dns_rdataset_t *rdataset) {
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff * Disassociate 'rdataset' from its rdata, allowing it to be reused.
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graffdns_rdataset_isassociated(dns_rdataset_t *rdataset) {
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff * Is 'rdataset' associated?
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graffquestion_disassociate(dns_rdataset_t *rdataset) {
62e4837585f2d48ce9ef3ad6880d8fb75a578e58Andreas Gustafssonquestion_cursor(dns_rdataset_t *rdataset) {
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graffquestion_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) {
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff * This routine should never be called.
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graffquestion_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graffstatic dns_rdatasetmethods_t question_methods = {
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graffdns_rdataset_makequestion(dns_rdataset_t *rdataset, dns_rdataclass_t rdclass,
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graff * Make 'rdataset' a valid, associated, question rdataset, with a
291b0d910d115e41a4b69d0603c3376aebf0c630Michael Graff * question class of 'rdclass' and type 'type'.
4e675038a097065ff13944232cd7c89ac5961984Michael Graff rdataset->attributes |= DNS_RDATASETATTR_QUESTION;
4e675038a097065ff13944232cd7c89ac5961984Michael Graffdns_rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
291b0d910d115e41a4b69d0603c3376aebf0c630Michael Graff * Make 'target' refer to the same rdataset as 'source'.
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graff * Move the rdata cursor to the first rdata in the rdataset (if any).
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff return ((rdataset->methods->first)(rdataset));
e24f605ad64182532640dc6721070456b13112d5Michael Graff * Move the rdata cursor to the next rdata in the rdataset (if any).
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graffdns_rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) {
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff * Make 'rdata' refer to the current rdata.
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff (rdataset->methods->current)(rdataset, rdata);
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff unsigned int *countp)
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff unsigned int count;
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff unsigned int headlen;
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff * Convert 'rdataset' to wire format, compressing names as specified
74889a341cac183d477e15cfead391a8f7bdba95Michael Graff * in cctx, and storing the result in 'target'.
74889a341cac183d477e15cfead391a8f7bdba95Michael Graff if ((rdataset->attributes & DNS_RDATASETATTR_QUESTION) != 0) {
74889a341cac183d477e15cfead391a8f7bdba95Michael Graff * copy out the name, type, class, ttl.
74889a341cac183d477e15cfead391a8f7bdba95Michael Graff dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL);
2311073ce0ef26c0250e91e4a083d7cc94fa7d33Michael Graff dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graff result = dns_name_towire(owner_name, cctx, target);
2311073ce0ef26c0250e91e4a083d7cc94fa7d33Michael Graff headlen = sizeof(dns_rdataclass_t) + sizeof(dns_rdatatype_t);
2311073ce0ef26c0250e91e4a083d7cc94fa7d33Michael Graff isc_buffer_putuint16(target, rdataset->rdclass);
e24f605ad64182532640dc6721070456b13112d5Michael Graff * Save space for rdlen.
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff * copy out the rdata
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff result = dns_compress_localinit(cctx, owner_name,
return (result);
return (result);
count++;
return (result);
return (DNS_R_SUCCESS);
return (result);
return (result);
return (DNS_R_SUCCESS);