1999-01-27 08:44:10 +00:00
|
|
|
/*
|
2018-02-23 09:53:12 +01:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2000-08-01 01:33:37 +00:00
|
|
|
*
|
2016-06-27 14:56:38 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2018-02-23 09:53:12 +01:00
|
|
|
*
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
1999-01-27 08:44:10 +00:00
|
|
|
*/
|
|
|
|
|
2000-06-22 22:00:42 +00:00
|
|
|
|
1999-01-27 08:44:10 +00:00
|
|
|
#ifndef DNS_RDATASLAB_H
|
|
|
|
#define DNS_RDATASLAB_H 1
|
|
|
|
|
2006-12-22 01:46:19 +00:00
|
|
|
/*! \file dns/rdataslab.h
|
2005-04-27 04:57:32 +00:00
|
|
|
* \brief
|
1999-01-27 08:44:10 +00:00
|
|
|
* Implements storage of rdatasets into slabs of memory.
|
|
|
|
*
|
|
|
|
* MP:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li Clients of this module must impose any required synchronization.
|
1999-01-27 08:44:10 +00:00
|
|
|
*
|
|
|
|
* Reliability:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li This module deals with low-level byte streams. Errors in any of
|
1999-01-27 08:44:10 +00:00
|
|
|
* the functions are likely to crash the server or corrupt memory.
|
|
|
|
*
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li If the caller passes invalid memory references, these functions are
|
1999-02-06 00:07:09 +00:00
|
|
|
* likely to crash the server or corrupt memory.
|
|
|
|
*
|
1999-01-27 08:44:10 +00:00
|
|
|
* Resources:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li None.
|
1999-01-27 08:44:10 +00:00
|
|
|
*
|
|
|
|
* Security:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li None.
|
1999-01-27 08:44:10 +00:00
|
|
|
*
|
|
|
|
* Standards:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li None.
|
1999-01-27 08:44:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/***
|
|
|
|
*** Imports
|
|
|
|
***/
|
|
|
|
|
2018-04-17 08:29:14 -07:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
1999-03-04 02:48:47 +00:00
|
|
|
#include <isc/lang.h>
|
1999-01-27 08:44:10 +00:00
|
|
|
|
|
|
|
#include <dns/types.h>
|
|
|
|
|
1999-03-04 02:48:47 +00:00
|
|
|
ISC_LANG_BEGINDECLS
|
|
|
|
|
2000-11-30 13:19:09 +00:00
|
|
|
#define DNS_RDATASLAB_FORCE 0x1
|
|
|
|
#define DNS_RDATASLAB_EXACT 0x2
|
|
|
|
|
2008-04-01 01:37:25 +00:00
|
|
|
#define DNS_RDATASLAB_OFFLINE 0x01 /* RRSIG is for offline DNSKEY */
|
|
|
|
#define DNS_RDATASLAB_WARNMASK 0x0E /*%< RRSIG(DNSKEY) expired
|
|
|
|
* warnings number mask. */
|
|
|
|
#define DNS_RDATASLAB_WARNSHIFT 1 /*%< How many bits to shift to find
|
|
|
|
* remaining expired warning number. */
|
|
|
|
|
|
|
|
|
1999-01-27 08:44:10 +00:00
|
|
|
/***
|
|
|
|
*** Functions
|
|
|
|
***/
|
|
|
|
|
1999-12-23 00:09:04 +00:00
|
|
|
isc_result_t
|
1999-01-27 08:44:10 +00:00
|
|
|
dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
|
|
|
isc_region_t *region, unsigned int reservelen);
|
2005-04-27 04:57:32 +00:00
|
|
|
/*%<
|
1999-01-27 08:44:10 +00:00
|
|
|
* Slabify a rdataset. The slab area will be allocated and returned
|
|
|
|
* in 'region'.
|
|
|
|
*
|
|
|
|
* Requires:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li 'rdataset' is valid.
|
1999-01-27 08:44:10 +00:00
|
|
|
*
|
|
|
|
* Ensures:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li 'region' will have base pointing to the start of allocated memory,
|
1999-01-27 08:44:10 +00:00
|
|
|
* with the slabified region beginning at region->base + reservelen.
|
|
|
|
* region->length contains the total length allocated.
|
|
|
|
*
|
|
|
|
* Returns:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li ISC_R_SUCCESS - successful completion
|
|
|
|
*\li ISC_R_NOMEMORY - no memory.
|
|
|
|
*\li XXX others
|
1999-01-27 08:44:10 +00:00
|
|
|
*/
|
|
|
|
|
1999-02-06 00:07:09 +00:00
|
|
|
unsigned int
|
|
|
|
dns_rdataslab_size(unsigned char *slab, unsigned int reservelen);
|
2005-04-27 04:57:32 +00:00
|
|
|
/*%<
|
1999-02-06 00:07:09 +00:00
|
|
|
* Return the total size of an rdataslab.
|
1999-01-27 08:44:10 +00:00
|
|
|
*
|
|
|
|
* Requires:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li 'slab' points to a slab.
|
1999-01-27 08:44:10 +00:00
|
|
|
*
|
|
|
|
* Returns:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li The number of bytes in the slab, including the reservelen.
|
1999-01-27 08:44:10 +00:00
|
|
|
*/
|
|
|
|
|
2016-11-02 17:31:27 +11:00
|
|
|
unsigned int
|
|
|
|
dns_rdataslab_count(unsigned char *slab, unsigned int reservelen);
|
|
|
|
/*%<
|
|
|
|
* Return the number of records in the rdataslab
|
|
|
|
*
|
|
|
|
* Requires:
|
|
|
|
*\li 'slab' points to a slab.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
*\li The number of records in the slab.
|
|
|
|
*/
|
|
|
|
|
1999-12-23 00:09:04 +00:00
|
|
|
isc_result_t
|
1999-04-01 04:00:39 +00:00
|
|
|
dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab,
|
|
|
|
unsigned int reservelen, isc_mem_t *mctx,
|
|
|
|
dns_rdataclass_t rdclass, dns_rdatatype_t type,
|
2000-11-30 13:19:09 +00:00
|
|
|
unsigned int flags, unsigned char **tslabp);
|
2005-04-27 04:57:32 +00:00
|
|
|
/*%<
|
1999-04-01 04:00:39 +00:00
|
|
|
* Merge 'oslab' and 'nslab'.
|
|
|
|
*/
|
|
|
|
|
1999-12-23 00:09:04 +00:00
|
|
|
isc_result_t
|
1999-06-16 21:03:07 +00:00
|
|
|
dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
|
|
|
|
unsigned int reservelen, isc_mem_t *mctx,
|
|
|
|
dns_rdataclass_t rdclass, dns_rdatatype_t type,
|
2000-12-01 01:22:45 +00:00
|
|
|
unsigned int flags, unsigned char **tslabp);
|
2005-04-27 04:57:32 +00:00
|
|
|
/*%<
|
2000-10-18 23:53:31 +00:00
|
|
|
* Subtract 'sslab' from 'mslab'. If 'exact' is true then all elements
|
|
|
|
* of 'sslab' must exist in 'mslab'.
|
1999-06-16 21:03:07 +00:00
|
|
|
*
|
|
|
|
* XXX
|
2000-12-01 01:22:45 +00:00
|
|
|
* valid flags are DNS_RDATASLAB_EXACT
|
1999-06-16 21:03:07 +00:00
|
|
|
*/
|
|
|
|
|
2018-04-17 08:29:14 -07:00
|
|
|
bool
|
2000-09-01 01:35:21 +00:00
|
|
|
dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
|
|
|
|
unsigned int reservelen);
|
2005-04-27 04:57:32 +00:00
|
|
|
/*%<
|
2002-11-12 23:24:45 +00:00
|
|
|
* Compare two rdataslabs for equality. This does _not_ do a full
|
2000-09-01 01:35:21 +00:00
|
|
|
* DNSSEC comparison.
|
|
|
|
*
|
|
|
|
* Requires:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li 'slab1' and 'slab2' point to slabs.
|
2000-09-01 01:35:21 +00:00
|
|
|
*
|
|
|
|
* Returns:
|
2018-04-17 08:29:14 -07:00
|
|
|
*\li true if the slabs are equal, false otherwise.
|
2000-09-01 01:35:21 +00:00
|
|
|
*/
|
2018-04-17 08:29:14 -07:00
|
|
|
bool
|
2002-11-12 23:24:45 +00:00
|
|
|
dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2,
|
2008-04-01 23:47:10 +00:00
|
|
|
unsigned int reservelen, dns_rdataclass_t rdclass,
|
2002-11-12 23:24:45 +00:00
|
|
|
dns_rdatatype_t type);
|
2005-04-27 04:57:32 +00:00
|
|
|
/*%<
|
2008-04-01 23:47:10 +00:00
|
|
|
* Compare two rdataslabs for DNSSEC equality.
|
2002-11-12 23:24:45 +00:00
|
|
|
*
|
|
|
|
* Requires:
|
2005-04-27 04:57:32 +00:00
|
|
|
*\li 'slab1' and 'slab2' point to slabs.
|
2002-11-12 23:24:45 +00:00
|
|
|
*
|
|
|
|
* Returns:
|
2018-04-17 08:29:14 -07:00
|
|
|
*\li true if the slabs are equal, #false otherwise.
|
2002-11-12 23:24:45 +00:00
|
|
|
*/
|
|
|
|
|
1999-03-04 02:48:47 +00:00
|
|
|
ISC_LANG_ENDDECLS
|
|
|
|
|
2000-04-29 02:02:38 +00:00
|
|
|
#endif /* DNS_RDATASLAB_H */
|