2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Adjust / add stucture definitions for NS/SOA/A/AAAA/A6 records.

This commit is contained in:
Mark Andrews
1999-09-02 06:40:15 +00:00
parent 4556681e19
commit 05f90cac85
9 changed files with 77 additions and 30 deletions

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: ns_2.c,v 1.17 1999/08/31 22:05:54 halley Exp $ */ /* $Id: ns_2.c,v 1.18 1999/09/02 06:40:14 marka Exp $ */
#ifndef RDATA_GENERIC_NS_2_C #ifndef RDATA_GENERIC_NS_2_C
#define RDATA_GENERIC_NS_2_C #define RDATA_GENERIC_NS_2_C
@@ -145,27 +145,34 @@ static inline dns_result_t
tostruct_ns(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) { tostruct_ns(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
isc_region_t region; isc_region_t region;
dns_rdata_ns_t *ns = target; dns_rdata_ns_t *ns = target;
dns_name_t name;
REQUIRE(rdata->type == 2); REQUIRE(rdata->type == 2);
REQUIRE(target != NULL); REQUIRE(target != NULL);
REQUIRE(mctx != NULL);
mctx = mctx; /*unused*/
ns->common.rdclass = rdata->rdclass; ns->common.rdclass = rdata->rdclass;
ns->common.rdtype = rdata->type; ns->common.rdtype = rdata->type;
ISC_LINK_INIT(&ns->common, link); ISC_LINK_INIT(&ns->common, link);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region); dns_rdata_toregion(rdata, &region);
dns_fixedname_init(&ns->name); dns_name_fromregion(&name, &region);
dns_name_fromregion(dns_fixedname_name(&ns->name), &region); ns->mctx = mctx;
dns_name_init(&ns->name, NULL);
dns_name_dup(&name, ns->mctx, &ns->name);
return (DNS_R_SUCCESS); return (DNS_R_SUCCESS);
} }
static inline void static inline void
freestruct_ns(void *source) { freestruct_ns(void *source) {
dns_rdata_ns_t *ns = source;
REQUIRE(source != NULL); REQUIRE(source != NULL);
/* No action required. */
dns_name_free(&ns->name, ns->mctx);
ns->mctx = NULL;
} }
static inline dns_result_t static inline dns_result_t

View File

@@ -15,12 +15,13 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: ns_2.h,v 1.13 1999/07/05 00:32:37 marka Exp $ */ /* $Id: ns_2.h,v 1.14 1999/09/02 06:40:14 marka Exp $ */
#include <dns/fixedname.h> #include <dns/fixedname.h>
typedef struct dns_rdata_ns { typedef struct dns_rdata_ns {
dns_rdatacommon_t common; dns_rdatacommon_t common;
dns_fixedname_t name; isc_mem_t *mctx;
dns_name_t name;
} dns_rdata_ns_t; } dns_rdata_ns_t;

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: soa_6.c,v 1.22 1999/08/31 22:05:55 halley Exp $ */ /* $Id: soa_6.c,v 1.23 1999/09/02 06:40:14 marka Exp $ */
#ifndef RDATA_GENERIC_SOA_6_C #ifndef RDATA_GENERIC_SOA_6_C
#define RDATA_GENERIC_SOA_6_C #define RDATA_GENERIC_SOA_6_C
@@ -264,25 +264,34 @@ static inline dns_result_t
tostruct_soa(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) { tostruct_soa(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
isc_region_t region; isc_region_t region;
dns_rdata_soa_t *soa = target; dns_rdata_soa_t *soa = target;
dns_name_t name;
dns_result_t result;
REQUIRE(rdata->type == 6); REQUIRE(rdata->type == 6);
REQUIRE(target != NULL); REQUIRE(target != NULL);
mctx = mctx; /*unused*/
soa->common.rdclass = rdata->rdclass; soa->common.rdclass = rdata->rdclass;
soa->common.rdtype = rdata->type; soa->common.rdtype = rdata->type;
ISC_LINK_INIT(&soa->common, link); ISC_LINK_INIT(&soa->common, link);
soa->mctx = mctx;
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region); dns_rdata_toregion(rdata, &region);
dns_fixedname_init(&soa->origin); dns_name_fromregion(&name, &region);
dns_name_fromregion(dns_fixedname_name(&soa->origin), &region); isc_region_consume(&region, name_length(&name));
isc_region_consume(&region, dns_name_init(&soa->origin, NULL);
name_length(dns_fixedname_name(&soa->origin))); result = dns_name_dup(&name, soa->mctx, &soa->origin);
dns_fixedname_init(&soa->mname); if (result != DNS_R_SUCCESS)
dns_name_fromregion(dns_fixedname_name(&soa->mname), &region); return (result);
isc_region_consume(&region,
name_length(dns_fixedname_name(&soa->mname))); dns_name_fromregion(&name, &region);
isc_region_consume(&region, name_length(&name));
dns_name_init(&soa->mname, NULL);
result = dns_name_dup(&name, soa->mctx, &soa->mname);
if (result != DNS_R_SUCCESS)
return (result);
soa->serial = uint32_fromregion(&region); soa->serial = uint32_fromregion(&region);
isc_region_consume(&region, 4); isc_region_consume(&region, 4);
soa->refresh = uint32_fromregion(&region); soa->refresh = uint32_fromregion(&region);
@@ -302,6 +311,9 @@ freestruct_soa(void *source) {
REQUIRE(source != NULL); REQUIRE(source != NULL);
REQUIRE(soa->common.rdtype == 6); REQUIRE(soa->common.rdtype == 6);
dns_name_free(&soa->origin, soa->mctx);
dns_name_free(&soa->mname, soa->mctx);
soa->mctx = NULL;
/* No action required */ /* No action required */
} }

View File

@@ -15,12 +15,15 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: soa_6.h,v 1.16 1999/05/07 03:24:12 marka Exp $ */ /* $Id: soa_6.h,v 1.17 1999/09/02 06:40:14 marka Exp $ */
#include <dns/name.h>
typedef struct dns_rdata_soa { typedef struct dns_rdata_soa {
dns_rdatacommon_t common; dns_rdatacommon_t common;
dns_fixedname_t origin; isc_mem_t *mctx;
dns_fixedname_t mname; dns_name_t origin;
dns_name_t mname;
isc_uint32_t serial; /* host order */ isc_uint32_t serial; /* host order */
isc_uint32_t refresh; /* host order */ isc_uint32_t refresh; /* host order */
isc_uint32_t retry; /* host order */ isc_uint32_t retry; /* host order */

View File

@@ -15,7 +15,15 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: a6_38.h,v 1.9 1999/05/07 03:24:13 marka Exp $ */ /* $Id: a6_38.h,v 1.10 1999/09/02 06:40:14 marka Exp $ */
/* draft-ietf-ipngwg-dns-lookups-03.txt */ /* draft-ietf-ipngwg-dns-lookups-03.txt */
typedef struct dns_rdata_in_a6 {
dns_rdatacommon_t common;
isc_mem_t *mctx;
dns_name_t prefix;
isc_uint32_t prefixlen;
struct in6_addr in6_addr;
} dns_rdata_in_a6_t;

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: a_1.c,v 1.19 1999/08/31 22:03:59 halley Exp $ */ /* $Id: a_1.c,v 1.20 1999/09/02 06:40:14 marka Exp $ */
#ifndef RDATA_IN_1_A_1_C #ifndef RDATA_IN_1_A_1_C
#define RDATA_IN_1_A_1_C #define RDATA_IN_1_A_1_C
@@ -149,14 +149,24 @@ fromstruct_in_a(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
static inline dns_result_t static inline dns_result_t
tostruct_in_a(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) { tostruct_in_a(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
dns_rdata_in_a_t *a = target;
isc_uint32_t n;
isc_region_t region;
REQUIRE(rdata->type == 1); REQUIRE(rdata->type == 1);
REQUIRE(rdata->rdclass == 1); REQUIRE(rdata->rdclass == 1);
target = target; mctx = mctx; /* unused */
mctx = mctx;
return (DNS_R_NOTIMPLEMENTED); a->common.rdclass = rdata->rdclass;
a->common.rdtype = rdata->type;
ISC_LINK_INIT(&a->common, link);
dns_rdata_toregion(rdata, &region);
n = uint32_fromregion(&region);
a->in_addr.s_addr = htonl(n);
return (DNS_R_SUCCESS);
} }
static inline void static inline void

View File

@@ -15,9 +15,9 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: a_1.h,v 1.14 1999/05/07 03:24:13 marka Exp $ */ /* $Id: a_1.h,v 1.15 1999/09/02 06:40:15 marka Exp $ */
typedef struct dns_rdata_in_a { typedef struct dns_rdata_in_a {
dns_rdatacommon_t common; dns_rdatacommon_t common;
isc_uint32_t address; /* network order */ struct in_addr in_addr;
} dns_rdata_in_a_t; } dns_rdata_in_a_t;

View File

@@ -15,7 +15,12 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: aaaa_28.h,v 1.8 1999/05/07 03:24:14 marka Exp $ */ /* $Id: aaaa_28.h,v 1.9 1999/09/02 06:40:15 marka Exp $ */
/* RFC 1886 */ /* RFC 1886 */
typedef struct dns_rdata_in_aaaa {
dns_rdatacommon_t common;
struct in6_addr in6_addr;
} dns_rdata_in_aaaa_t;

View File

@@ -3,6 +3,7 @@
#define DNS_RDATASTRUCT_H 1 #define DNS_RDATASTRUCT_H 1
#include <isc/lang.h> #include <isc/lang.h>
#include <isc/sockaddr.h>
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS