mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 18:42:04 -04:00
checkpoint to/from struct support
This commit is contained in:
parent
973a193425
commit
2e8215dda9
11 changed files with 171 additions and 35 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: ns_2.c,v 1.19 1999/12/23 00:08:55 explorer Exp $ */
|
||||
/* $Id: ns_2.c,v 1.20 2000/01/17 03:21:53 marka Exp $ */
|
||||
|
||||
#ifndef RDATA_GENERIC_NS_2_C
|
||||
#define RDATA_GENERIC_NS_2_C
|
||||
|
|
@ -31,7 +31,7 @@ fromtext_ns(dns_rdataclass_t rdclass, dns_rdatatype_t type,
|
|||
|
||||
REQUIRE(type == 2);
|
||||
|
||||
rdclass = rdclass; /*unused*/
|
||||
UNUSED(rdclass);
|
||||
|
||||
RETERR(gettoken(lexer, &token,isc_tokentype_string, ISC_FALSE));
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ fromwire_ns(dns_rdataclass_t rdclass, dns_rdatatype_t type,
|
|||
|
||||
REQUIRE(type == 2);
|
||||
|
||||
rdclass = rdclass; /*unused*/
|
||||
UNUSED(rdclass);
|
||||
|
||||
if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx))
|
||||
dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
|
||||
|
|
@ -146,6 +146,7 @@ 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;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(rdata->type == 2);
|
||||
REQUIRE(target != NULL);
|
||||
|
|
@ -160,9 +161,11 @@ tostruct_ns(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
|
|||
dns_name_fromregion(&name, ®ion);
|
||||
ns->mctx = mctx;
|
||||
dns_name_init(&ns->name, NULL);
|
||||
dns_name_dup(&name, ns->mctx, &ns->name);
|
||||
result = dns_name_dup(&name, ns->mctx, &ns->name);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
ns->mctx = NULL;
|
||||
|
||||
return (DNS_R_SUCCESS);
|
||||
return (result);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: a6_38.c,v 1.18 1999/12/23 00:09:01 explorer Exp $ */
|
||||
/* $Id: a6_38.c,v 1.19 2000/01/17 03:21:49 marka Exp $ */
|
||||
|
||||
/* draft-ietf-ipngwg-dns-lookups-03.txt */
|
||||
|
||||
|
|
@ -262,12 +262,27 @@ static inline isc_result_t
|
|||
fromstruct_in_a6(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
|
||||
isc_buffer_t *target)
|
||||
{
|
||||
dns_rdata_in_a6_t *a6 = source;
|
||||
unsigned char prefixlen;
|
||||
unsigned char octets;
|
||||
|
||||
REQUIRE(type == 1);
|
||||
REQUIRE(rdclass == 1);
|
||||
REQUIRE(source != NULL);
|
||||
REQUIRE(a6->common.rdtype == type);
|
||||
REQUIRE(a6->common.rdclass == rdclass);
|
||||
|
||||
source = source;
|
||||
target = target;
|
||||
if (a6->prefixlen > 128)
|
||||
return (DNS_R_RANGE);
|
||||
|
||||
prefixlen = a6->prefixlen;
|
||||
RETERR(mem_tobuffer(target, &prefixlen, 1));
|
||||
|
||||
if (a6->prefixlen != 128) {
|
||||
|
||||
}
|
||||
|
||||
octets = 16 - prefixlen / 8;
|
||||
|
||||
return (DNS_R_NOTIMPLEMENTED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: kx_36.c,v 1.14 1999/12/23 00:09:02 explorer Exp $ */
|
||||
/* $Id: kx_36.c,v 1.15 2000/01/17 03:21:50 marka Exp $ */
|
||||
|
||||
/* RFC 2230 */
|
||||
|
||||
|
|
@ -159,33 +159,59 @@ static inline isc_result_t
|
|||
fromstruct_in_kx(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
|
||||
isc_buffer_t *target)
|
||||
{
|
||||
dns_rdata_in_kx_t *kx = source;
|
||||
isc_region_t region;
|
||||
|
||||
REQUIRE(type == 36);
|
||||
REQUIRE(rdclass == 1);
|
||||
REQUIRE(source != NULL);
|
||||
REQUIRE(kx->common.rdtype == type);
|
||||
REQUIRE(kx->common.rdclass == rdclass);
|
||||
|
||||
source = source;
|
||||
target = target;
|
||||
|
||||
return (DNS_R_NOTIMPLEMENTED);
|
||||
RETERR(uint16_tobuffer(kx->preference, target));
|
||||
dns_name_toregion(&kx->exchange, ®ion);
|
||||
return (isc_buffer_copyregion(target, ®ion));
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
tostruct_in_kx(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
|
||||
isc_region_t region;
|
||||
dns_rdata_in_kx_t *kx = target;
|
||||
dns_name_t name;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(rdata->type == 36);
|
||||
REQUIRE(rdata->rdclass == 1);
|
||||
REQUIRE(target != NULL);
|
||||
REQUIRE(mctx != NULL);
|
||||
|
||||
target = target;
|
||||
mctx = mctx;
|
||||
kx->common.rdclass = rdata->rdclass;
|
||||
kx->common.rdtype = rdata->type;
|
||||
ISC_LINK_INIT(&kx->common, link);
|
||||
|
||||
return (DNS_R_NOTIMPLEMENTED);
|
||||
dns_name_init(&name, NULL);
|
||||
dns_rdata_toregion(rdata, ®ion);
|
||||
|
||||
kx->preference = uint16_fromregion(®ion);
|
||||
isc_region_consume(®ion, 2);
|
||||
|
||||
dns_name_fromregion(&name, ®ion);
|
||||
kx->mctx = mctx;
|
||||
dns_name_init(&kx->exchange, NULL);
|
||||
result = dns_name_dup(&name, kx->mctx, &kx->exchange);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
kx->mctx = NULL;
|
||||
return (result);
|
||||
}
|
||||
|
||||
static inline void
|
||||
freestruct_in_kx(void *source) {
|
||||
REQUIRE(source != NULL);
|
||||
REQUIRE(ISC_FALSE);
|
||||
dns_rdata_in_kx_t *kx = source;
|
||||
|
||||
REQUIRE(source != NULL);
|
||||
|
||||
dns_name_free(&kx->exchange, kx->mctx);
|
||||
kx->mctx = NULL;
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
|
|
|
|||
|
|
@ -15,7 +15,13 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: kx_36.h,v 1.8 1999/09/15 23:03:35 explorer Exp $ */
|
||||
/* $Id: kx_36.h,v 1.9 2000/01/17 03:21:50 marka Exp $ */
|
||||
|
||||
/* RFC 2230 */
|
||||
|
||||
typedef struct dns_rdata_in_kx {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
isc_uint16_t preference;
|
||||
dns_name_t exchange;
|
||||
} dns_rdata_in_kx_t;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,17 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: naptr_35.h,v 1.8 1999/09/15 23:03:36 explorer Exp $ */
|
||||
/* $Id: naptr_35.h,v 1.9 2000/01/17 03:21:50 marka Exp $ */
|
||||
|
||||
/* RFC 2168 */
|
||||
|
||||
typedef struct dns_rdata_in_naptr {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
isc_uint16_t order;
|
||||
isc_uint16_t preference;
|
||||
char *flags;
|
||||
char *service;
|
||||
char *regexp;
|
||||
dns_name_t replacement;
|
||||
} dns_rdata_in_naptr_t;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: nsap-ptr_23.h,v 1.7 1999/09/15 23:03:36 explorer Exp $ */
|
||||
/* $Id: nsap-ptr_23.h,v 1.8 2000/01/17 03:21:50 marka Exp $ */
|
||||
|
||||
/* RFC 1348 */
|
||||
|
||||
typedef struct dns_rdata_in_nsap_ptr {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
dns_name_t owner;
|
||||
} dns_rdata_in_nsap_ptr_t;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,13 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: nsap_22.h,v 1.5 1999/09/15 23:03:36 explorer Exp $ */
|
||||
/* $Id: nsap_22.h,v 1.6 2000/01/17 03:21:51 marka Exp $ */
|
||||
|
||||
/* RFC 1706 */
|
||||
|
||||
typedef struct dns_rdata_in_nsap {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
unsigned char *nsap;
|
||||
isc_uint16_t length;
|
||||
} dns_rdata_in_nsap_t;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: px_26.c,v 1.12 1999/12/23 00:09:03 explorer Exp $ */
|
||||
/* $Id: px_26.c,v 1.13 2000/01/17 03:21:51 marka Exp $ */
|
||||
|
||||
/* RFC 2163 */
|
||||
|
||||
|
|
@ -201,33 +201,74 @@ static inline isc_result_t
|
|||
fromstruct_in_px(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
|
||||
isc_buffer_t *target)
|
||||
{
|
||||
dns_rdata_in_px_t *px = source;
|
||||
isc_region_t region;
|
||||
|
||||
REQUIRE(type == 26);
|
||||
REQUIRE(rdclass == 1);
|
||||
REQUIRE(source != NULL);
|
||||
REQUIRE(px->common.rdtype == type);
|
||||
REQUIRE(px->common.rdclass == rdclass);
|
||||
|
||||
source = source;
|
||||
target = target;
|
||||
|
||||
return (DNS_R_NOTIMPLEMENTED);
|
||||
RETERR(uint16_tobuffer(px->preference, target));
|
||||
dns_name_toregion(&px->map822, ®ion);
|
||||
RETERR(isc_buffer_copyregion(target, ®ion));
|
||||
dns_name_toregion(&px->mapx400, ®ion);
|
||||
return (isc_buffer_copyregion(target, ®ion));
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
tostruct_in_px(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
|
||||
isc_region_t region;
|
||||
isc_region_t nr;
|
||||
dns_rdata_in_px_t *px = target;
|
||||
dns_name_t name;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(rdata->type == 26);
|
||||
REQUIRE(rdata->rdclass == 1);
|
||||
REQUIRE(target != NULL);
|
||||
REQUIRE(mctx != NULL);
|
||||
|
||||
target = target;
|
||||
mctx = mctx;
|
||||
px->common.rdclass = rdata->rdclass;
|
||||
px->common.rdtype = rdata->type;
|
||||
ISC_LINK_INIT(&px->common, link);
|
||||
|
||||
return (DNS_R_NOTIMPLEMENTED);
|
||||
dns_name_init(&name, NULL);
|
||||
dns_rdata_toregion(rdata, ®ion);
|
||||
|
||||
px->preference = uint16_fromregion(®ion);
|
||||
isc_region_consume(®ion, 2);
|
||||
|
||||
dns_name_fromregion(&name, ®ion);
|
||||
dns_name_toregion(&name, &nr);
|
||||
isc_region_consume(®ion, nr.length);
|
||||
px->mctx = mctx;
|
||||
dns_name_init(&px->map822, NULL);
|
||||
result = dns_name_dup(&name, px->mctx, &px->map822);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
px->mctx = NULL;
|
||||
return (result);
|
||||
}
|
||||
|
||||
dns_name_init(&px->mapx400, NULL);
|
||||
result = dns_name_dup(&name, px->mctx, &px->map822);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_name_free(&px->map822, px->mctx);
|
||||
px->mctx = NULL;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static inline void
|
||||
freestruct_in_px(void *source) {
|
||||
REQUIRE(source != NULL);
|
||||
REQUIRE(ISC_FALSE); /*XXX*/
|
||||
dns_rdata_in_px_t *px = source;
|
||||
|
||||
REQUIRE(source != NULL);
|
||||
|
||||
dns_name_free(&px->map822, px->mctx);
|
||||
dns_name_free(&px->mapx400, px->mctx);
|
||||
px->mctx = NULL;
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
|
|
|
|||
|
|
@ -15,7 +15,14 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: px_26.h,v 1.7 1999/09/15 23:03:37 explorer Exp $ */
|
||||
/* $Id: px_26.h,v 1.8 2000/01/17 03:21:52 marka Exp $ */
|
||||
|
||||
/* RFC 2163 */
|
||||
|
||||
typedef struct dns_rdata_in_px {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
isc_uint16_t preference;
|
||||
dns_name_t map822;
|
||||
dns_name_t mapx400;
|
||||
} dns_rdata_in_px_t;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,16 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: srv_33.h,v 1.7 1999/09/15 23:03:37 explorer Exp $ */
|
||||
/* $Id: srv_33.h,v 1.8 2000/01/17 03:21:52 marka Exp $ */
|
||||
|
||||
/* RFC 2052 bis */
|
||||
|
||||
typedef struct dns_rdata_in_srv {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
isc_uint16_t priority;
|
||||
isc_uint16_t weight;
|
||||
isc_uint16_t port;
|
||||
dns_name_t target;
|
||||
} dns_rdata_in_srv_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,5 +15,13 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: wks_11.h,v 1.11 1999/09/15 23:03:38 explorer Exp $ */
|
||||
/* $Id: wks_11.h,v 1.12 2000/01/17 03:21:52 marka Exp $ */
|
||||
|
||||
typedef struct dns_rdata_in_wks {
|
||||
dns_rdatacommon_t common;
|
||||
isc_mem_t *mctx;
|
||||
struct in_addr in_addr;
|
||||
isc_uint16_t protocol;
|
||||
unsigned char *map;
|
||||
isc_uint16_t length;
|
||||
} dns_rdata_in_wks_t;
|
||||
|
|
|
|||
Loading…
Reference in a new issue