rdataslab.c File Reference

#include <config.h>
#include <stdlib.h>
#include <isc/mem.h>
#include <isc/region.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/result.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdataslab.h>

Go to the source code of this file.

Data Structures

struct  xrdata

Functions

static int compare_rdata (const void *p1, const void *p2)
 Note: the "const void *" are just to make qsort happy.
isc_result_t dns_rdataslab_fromrdataset (dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen)
 Slabify a rdataset. The slab area will be allocated and returned in 'region'.
static void rdataset_disassociate (dns_rdataset_t *rdataset)
static isc_result_t rdataset_first (dns_rdataset_t *rdataset)
static isc_result_t rdataset_next (dns_rdataset_t *rdataset)
static void rdataset_current (dns_rdataset_t *rdataset, dns_rdata_t *rdata)
static void rdataset_clone (dns_rdataset_t *source, dns_rdataset_t *target)
static unsigned int rdataset_count (dns_rdataset_t *rdataset)
void dns_rdataslab_tordataset (unsigned char *slab, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t rdtype, dns_rdatatype_t covers, dns_ttl_t ttl, dns_rdataset_t *rdataset)
 Construct an rdataset from a slab.
unsigned int dns_rdataslab_size (unsigned char *slab, unsigned int reservelen)
 Return the total size of an rdataslab.
static void rdata_from_slab (unsigned char **current, dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_rdata_t *rdata)
static isc_boolean_t rdata_in_slab (unsigned char *slab, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_rdata_t *rdata)
isc_result_t dns_rdataslab_merge (unsigned char *oslab, unsigned char *nslab, unsigned int reservelen, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_rdatatype_t type, unsigned int flags, unsigned char **tslabp)
 Merge 'oslab' and 'nslab'.
isc_result_t dns_rdataslab_subtract (unsigned char *mslab, unsigned char *sslab, unsigned int reservelen, isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_rdatatype_t type, unsigned int flags, unsigned char **tslabp)
 Subtract 'sslab' from 'mslab'. If 'exact' is true then all elements of 'sslab' must exist in 'mslab'.
isc_boolean_t dns_rdataslab_equal (unsigned char *slab1, unsigned char *slab2, unsigned int reservelen)
 Compare two rdataslabs for equality. This does _not_ do a full DNSSEC comparison.
isc_boolean_t dns_rdataslab_equalx (unsigned char *slab1, unsigned char *slab2, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t type)
 Compare two rdataslabs for DNSSEC equality.

Variables

static dns_rdatasetmethods_t rdataset_methods


Detailed Description

Definition in file rdataslab.c.


Function Documentation

static int compare_rdata ( const void *  p1,
const void *  p2 
) [static]

Note: the "const void *" are just to make qsort happy.

Definition at line 87 of file rdataslab.c.

References dns_rdata_compare(), and xrdata::rdata.

Referenced by dns_rdataslab_fromrdataset(), and dns_rdataslab_merge().

isc_result_t dns_rdataslab_fromrdataset ( dns_rdataset_t rdataset,
isc_mem_t mctx,
isc_region_t region,
unsigned int  reservelen 
)

Slabify a rdataset. The slab area will be allocated and returned in 'region'.

Requires:

Ensures: Returns:

Definition at line 126 of file rdataslab.c.

References isc_region::base, compare_rdata(), dns_rdata::data, DNS_R_SINGLETON, dns_rdata_init(), DNS_RDATA_OFFLINE, dns_rdataset_count(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), DNS_RDATASLAB_OFFLINE, dns_rdatatype_issingleton(), INSIST, isc_mem_get, isc_mem_put, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_NOMORE, ISC_R_NOSPACE, ISC_R_SUCCESS, dns_rdata::length, isc_region::length, xrdata::order, xrdata::rdata, removed(), and dns_rdataset::type.

Referenced by addclosest(), addnoqname(), addrdataset(), loading_addrdataset(), and subtractrdataset().

static void rdataset_disassociate ( dns_rdataset_t rdataset  )  [static]

Definition at line 352 of file rdataslab.c.

References UNUSED.

static isc_result_t rdataset_first ( dns_rdataset_t rdataset  )  [static]

Definition at line 357 of file rdataslab.c.

References ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdataset::private3, dns_rdataset::private5, and dns_rdataset::privateuint4.

static isc_result_t rdataset_next ( dns_rdataset_t rdataset  )  [static]

Definition at line 384 of file rdataslab.c.

References ISC_R_NOMORE, ISC_R_SUCCESS, dns_rdataset::private5, and dns_rdataset::privateuint4.

static void rdataset_current ( dns_rdataset_t rdataset,
dns_rdata_t rdata 
) [static]

Definition at line 407 of file rdataslab.c.

References isc_region::base, dns_rdata_fromregion(), DNS_RDATA_OFFLINE, DNS_RDATASLAB_OFFLINE, dns_rdata::flags, isc_region::length, dns_rdataset::private5, r, dns_rdataset::rdclass, REQUIRE, and dns_rdataset::type.

static void rdataset_clone ( dns_rdataset_t source,
dns_rdataset_t target 
) [static]

Definition at line 434 of file rdataslab.c.

References dns_rdataset::private5, and dns_rdataset::privateuint4.

static unsigned int rdataset_count ( dns_rdataset_t rdataset  )  [static]

Definition at line 445 of file rdataslab.c.

References dns_rdataset::private3.

void dns_rdataslab_tordataset ( unsigned char *  slab,
unsigned int  reservelen,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  rdtype,
dns_rdatatype_t  covers,
dns_ttl_t  ttl,
dns_rdataset_t rdataset 
)

Construct an rdataset from a slab.

Requires:

Ensures:

Definition at line 476 of file rdataslab.c.

References dns_rdataset::covers, dns_rdataset_isassociated(), dns_rdataset::methods, dns_rdataset::private1, dns_rdataset::private2, dns_rdataset::private3, dns_rdataset::private5, dns_rdataset::privateuint4, dns_rdataset::rdclass, REQUIRE, dns_rdataset::trust, dns_rdataset::ttl, and dns_rdataset::type.

unsigned int dns_rdataslab_size ( unsigned char *  slab,
unsigned int  reservelen 
)

Return the total size of an rdataslab.

Requires:

Returns:

Definition at line 502 of file rdataslab.c.

References REQUIRE.

Referenced by destroynode(), free_noqname(), free_rdataset(), rbt_datafixer(), and rbt_datawriter().

static void rdata_from_slab ( unsigned char **  current,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  type,
dns_rdata_t rdata 
) [inline, static]

Definition at line 535 of file rdataslab.c.

References isc_region::base, dns_rdata_fromregion(), DNS_RDATA_OFFLINE, DNS_RDATASLAB_OFFLINE, dns_rdata::flags, ISC_FALSE, ISC_TRUE, isc_region::length, and offline().

Referenced by dns_rdataslab_equalx(), dns_rdataslab_merge(), dns_rdataslab_subtract(), and rdata_in_slab().

static isc_boolean_t rdata_in_slab ( unsigned char *  slab,
unsigned int  reservelen,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  type,
dns_rdata_t rdata 
) [inline, static]

Definition at line 571 of file rdataslab.c.

References dns_rdata_compare(), DNS_RDATA_INIT, dns_rdata_reset(), ISC_FALSE, ISC_TRUE, and rdata_from_slab().

Referenced by dns_rdataslab_merge().

isc_result_t dns_rdataslab_merge ( unsigned char *  oslab,
unsigned char *  nslab,
unsigned int  reservelen,
isc_mem_t mctx,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  type,
unsigned int  flags,
unsigned char **  tslabp 
)

Merge 'oslab' and 'nslab'.

Definition at line 602 of file rdataslab.c.

References compare_rdata(), dns_rdata::data, DNS_R_NOTEXACT, DNS_R_SINGLETON, DNS_R_UNCHANGED, dns_rdata_init(), DNS_RDATA_INIT, dns_rdata_reset(), DNS_RDATASLAB_EXACT, DNS_RDATASLAB_FORCE, dns_rdatatype_issingleton(), INSIST, ISC_FALSE, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_NOSPACE, ISC_R_SUCCESS, ISC_TF, ISC_TRUE, dns_rdata::length, rdata_from_slab(), rdata_in_slab(), and REQUIRE.

Referenced by add32().

isc_result_t dns_rdataslab_subtract ( unsigned char *  mslab,
unsigned char *  sslab,
unsigned int  reservelen,
isc_mem_t mctx,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  type,
unsigned int  flags,
unsigned char **  tslabp 
)

Subtract 'sslab' from 'mslab'. If 'exact' is true then all elements of 'sslab' must exist in 'mslab'.

XXX valid flags are DNS_RDATASLAB_EXACT

Definition at line 870 of file rdataslab.c.

References DNS_R_NOTEXACT, DNS_R_NXRRSET, DNS_R_UNCHANGED, dns_rdata_compare(), DNS_RDATA_INIT, dns_rdata_reset(), DNS_RDATASLAB_EXACT, INSIST, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, xrdata::order, rdata_from_slab(), and REQUIRE.

Referenced by subtractrdataset().

isc_boolean_t dns_rdataslab_equal ( unsigned char *  slab1,
unsigned char *  slab2,
unsigned int  reservelen 
)

Compare two rdataslabs for equality. This does _not_ do a full DNSSEC comparison.

Requires:

Returns:

Definition at line 1044 of file rdataslab.c.

References ISC_FALSE, and ISC_TRUE.

Referenced by add32().

isc_boolean_t dns_rdataslab_equalx ( unsigned char *  slab1,
unsigned char *  slab2,
unsigned int  reservelen,
dns_rdataclass_t  rdclass,
dns_rdatatype_t  type 
)

Compare two rdataslabs for DNSSEC equality.

Requires:

Returns:

Definition at line 1092 of file rdataslab.c.

References dns_rdata_compare(), DNS_RDATA_INIT, dns_rdata_reset(), ISC_FALSE, ISC_TRUE, and rdata_from_slab().

Referenced by add32().


Variable Documentation

dns_rdatasetmethods_t rdataset_methods [static]

Initial value:

 {
        rdataset_disassociate,
        rdataset_first,
        rdataset_next,
        rdataset_current,
        rdataset_clone,
        rdataset_count,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL
}

Definition at line 454 of file rdataslab.c.


Generated on Tue Apr 28 17:41:13 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha