Commit 05f90cac authored by Mark Andrews's avatar Mark Andrews
Browse files

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

parent 4556681e
......@@ -15,7 +15,7 @@
* 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
#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) {
isc_region_t region;
dns_rdata_ns_t *ns = target;
dns_name_t name;
REQUIRE(rdata->type == 2);
REQUIRE(target != NULL);
mctx = mctx; /*unused*/
REQUIRE(mctx != NULL);
ns->common.rdclass = rdata->rdclass;
ns->common.rdtype = rdata->type;
ISC_LINK_INIT(&ns->common, link);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
dns_fixedname_init(&ns->name);
dns_name_fromregion(dns_fixedname_name(&ns->name), &region);
dns_name_fromregion(&name, &region);
ns->mctx = mctx;
dns_name_init(&ns->name, NULL);
dns_name_dup(&name, ns->mctx, &ns->name);
return (DNS_R_SUCCESS);
}
static inline void
freestruct_ns(void *source) {
dns_rdata_ns_t *ns = source;
REQUIRE(source != NULL);
/* No action required. */
dns_name_free(&ns->name, ns->mctx);
ns->mctx = NULL;
}
static inline dns_result_t
......
......@@ -15,12 +15,13 @@
* 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>
typedef struct dns_rdata_ns {
dns_rdatacommon_t common;
dns_fixedname_t name;
isc_mem_t *mctx;
dns_name_t name;
} dns_rdata_ns_t;
......@@ -15,7 +15,7 @@
* 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
#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) {
isc_region_t region;
dns_rdata_soa_t *soa = target;
dns_name_t name;
dns_result_t result;
REQUIRE(rdata->type == 6);
REQUIRE(target != NULL);
mctx = mctx; /*unused*/
soa->common.rdclass = rdata->rdclass;
soa->common.rdtype = rdata->type;
ISC_LINK_INIT(&soa->common, link);
soa->mctx = mctx;
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
dns_fixedname_init(&soa->origin);
dns_name_fromregion(dns_fixedname_name(&soa->origin), &region);
isc_region_consume(&region,
name_length(dns_fixedname_name(&soa->origin)));
dns_fixedname_init(&soa->mname);
dns_name_fromregion(dns_fixedname_name(&soa->mname), &region);
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->origin, NULL);
result = dns_name_dup(&name, soa->mctx, &soa->origin);
if (result != DNS_R_SUCCESS)
return (result);
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);
isc_region_consume(&region, 4);
soa->refresh = uint32_fromregion(&region);
......@@ -302,6 +311,9 @@ freestruct_soa(void *source) {
REQUIRE(source != NULL);
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 */
}
......
......@@ -15,12 +15,15 @@
* 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 {
dns_rdatacommon_t common;
dns_fixedname_t origin;
dns_fixedname_t mname;
isc_mem_t *mctx;
dns_name_t origin;
dns_name_t mname;
isc_uint32_t serial; /* host order */
isc_uint32_t refresh; /* host order */
isc_uint32_t retry; /* host order */
......
......@@ -15,7 +15,15 @@
* 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 */
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;
......@@ -15,7 +15,7 @@
* 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
#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
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->rdclass == 1);
target = target;
mctx = mctx;
mctx = mctx; /* unused */
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
......
......@@ -15,9 +15,9 @@
* 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 {
dns_rdatacommon_t common;
isc_uint32_t address; /* network order */
struct in_addr in_addr;
} dns_rdata_in_a_t;
......@@ -15,7 +15,12 @@
* 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 */
typedef struct dns_rdata_in_aaaa {
dns_rdatacommon_t common;
struct in6_addr in6_addr;
} dns_rdata_in_aaaa_t;
......@@ -3,6 +3,7 @@
#define DNS_RDATASTRUCT_H 1
#include <isc/lang.h>
#include <isc/sockaddr.h>
ISC_LANG_BEGINDECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment