#include <config.h>
#include <isc/mem.h>
#include <isc/string.h>
#include <isc/util.h>
#include <dns/compress.h>
#include <dns/fixedname.h>
#include <dns/rbt.h>
#include <dns/result.h>
Go to the source code of this file.
Defines | |
#define | DNS_NAME_USEINLINE 1 |
#define | CCTX_MAGIC ISC_MAGIC('C', 'C', 'T', 'X') |
#define | VALID_CCTX(x) ISC_MAGIC_VALID(x, CCTX_MAGIC) |
#define | DCTX_MAGIC ISC_MAGIC('D', 'C', 'T', 'X') |
#define | VALID_DCTX(x) ISC_MAGIC_VALID(x, DCTX_MAGIC) |
#define | NODENAME(node, name) |
Functions | |
isc_result_t | dns_compress_init (dns_compress_t *cctx, int edns, isc_mem_t *mctx) |
Initialise the compression context structure pointed to by 'cctx'. | |
void | dns_compress_invalidate (dns_compress_t *cctx) |
Invalidate the compression structure pointed to by cctx. | |
void | dns_compress_setmethods (dns_compress_t *cctx, unsigned int allowed) |
Sets allowed compression methods. | |
unsigned int | dns_compress_getmethods (dns_compress_t *cctx) |
Gets allowed compression methods. | |
void | dns_compress_setsensitive (dns_compress_t *cctx, isc_boolean_t sensitive) |
isc_boolean_t | dns_compress_getsensitive (dns_compress_t *cctx) |
int | dns_compress_getedns (dns_compress_t *cctx) |
Gets edns value. | |
isc_boolean_t | dns_compress_findglobal (dns_compress_t *cctx, const dns_name_t *name, dns_name_t *prefix, isc_uint16_t *offset) |
Finds longest possible match of 'name' in the global compression table. | |
static unsigned int | name_length (const dns_name_t *name) |
void | dns_compress_add (dns_compress_t *cctx, const dns_name_t *name, const dns_name_t *prefix, isc_uint16_t offset) |
Add compression pointers for 'name' to the compression table, not replacing existing pointers. | |
void | dns_compress_rollback (dns_compress_t *cctx, isc_uint16_t offset) |
Remove any compression pointers from global table >= offset. | |
void | dns_decompress_init (dns_decompress_t *dctx, int edns, dns_decompresstype_t type) |
Initializes 'dctx'. Records 'edns' and 'type' into the structure. | |
void | dns_decompress_invalidate (dns_decompress_t *dctx) |
Invalidates 'dctx'. | |
void | dns_decompress_setmethods (dns_decompress_t *dctx, unsigned int allowed) |
Sets 'dctx->allowed' to 'allowed'. | |
unsigned int | dns_decompress_getmethods (dns_decompress_t *dctx) |
Returns 'dctx->allowed'. | |
int | dns_decompress_edns (dns_decompress_t *dctx) |
Returns 'dctx->edns'. | |
dns_decompresstype_t | dns_decompress_type (dns_decompress_t *dctx) |
Returns 'dctx->type'. |
Definition in file compress.c.
#define DNS_NAME_USEINLINE 1 |
Definition at line 22 of file compress.c.
#define CCTX_MAGIC ISC_MAGIC('C', 'C', 'T', 'X') |
#define VALID_CCTX | ( | x | ) | ISC_MAGIC_VALID(x, CCTX_MAGIC) |
Definition at line 36 of file compress.c.
Referenced by dns_compress_add(), dns_compress_findglobal(), dns_compress_getedns(), dns_compress_getmethods(), dns_compress_getsensitive(), dns_compress_invalidate(), dns_compress_rollback(), dns_compress_setmethods(), and dns_compress_setsensitive().
#define DCTX_MAGIC ISC_MAGIC('D', 'C', 'T', 'X') |
#define VALID_DCTX | ( | x | ) | ISC_MAGIC_VALID(x, DCTX_MAGIC) |
Definition at line 39 of file compress.c.
Referenced by dns_decompress_edns(), dns_decompress_getmethods(), dns_decompress_invalidate(), dns_decompress_setmethods(), and dns_decompress_type().
#define NODENAME | ( | node, | |||
name | ) |
Value:
do { \ (name)->length = (node)->r.length; \ (name)->labels = (node)->labels; \ (name)->ndata = (node)->r.base; \ (name)->attributes = DNS_NAMEATTR_ABSOLUTE; \ } while (0)
Definition at line 123 of file compress.c.
Referenced by addonlevel(), chain_name(), dns_compress_findglobal(), dns_rbt_addnode(), dns_rbt_findnode(), dns_rbt_fullnamefromnode(), dns_rbt_namefromnode(), dns_rbtnodechain_current(), dns_rbtnodechain_down(), dns_rbtnodechain_next(), dns_rbtnodechain_nextflat(), serialize_node(), and treefix().
isc_result_t dns_compress_init | ( | dns_compress_t * | cctx, | |
int | edns, | |||
isc_mem_t * | mctx | |||
) |
Initialise the compression context structure pointed to by 'cctx'.
Requires:
Definition at line 46 of file compress.c.
References dns_compress::allowed, CCTX_MAGIC, dns_compress::count, DNS_COMPRESS_TABLESIZE, dns_compress::edns, ISC_R_SUCCESS, dns_compress::magic, dns_compress::mctx, REQUIRE, return(), and dns_compress::table.
Referenced by add_test_data(), client_send(), render(), req_render(), resquery_send(), sendstream(), and setup_lookup().
void dns_compress_invalidate | ( | dns_compress_t * | cctx | ) |
Invalidate the compression structure pointed to by cctx.
Requires:
Definition at line 63 of file compress.c.
References dns_compress::allowed, isc_region::base, dns_compressnode::count, DNS_COMPRESS_INITIALNODES, DNS_COMPRESS_TABLESIZE, dns_compress::edns, isc_mem_put, isc_region::length, dns_compress::magic, dns_compress::mctx, dns_compressnode::next, dns_compressnode::offset, dns_compressnode::r, REQUIRE, dns_compress::table, and VALID_CCTX.
Referenced by add_test_data(), client_send(), render(), req_render(), resquery_send(), sendstream(), and setup_lookup().
void dns_compress_setmethods | ( | dns_compress_t * | cctx, | |
unsigned int | allowed | |||
) |
Sets allowed compression methods.
Requires:
Definition at line 87 of file compress.c.
References dns_compress::allowed, DNS_COMPRESS_ALL, REQUIRE, and VALID_CCTX.
Referenced by dns_ncache_towire(), towire_afsdb(), towire_any_tsig(), towire_ch_a(), towire_cname(), towire_dname(), towire_in_a6(), towire_in_kx(), towire_in_nsap_ptr(), towire_in_px(), towire_in_srv(), towire_mb(), towire_md(), towire_mf(), towire_mg(), towire_minfo(), towire_mr(), towire_mx(), towire_naptr(), towire_ns(), towire_nsec(), towire_nxt(), towire_ptr(), towire_rp(), towire_rrsig(), towire_rt(), towire_sig(), towire_soa(), towire_tkey(), and towiresorted().
unsigned int dns_compress_getmethods | ( | dns_compress_t * | cctx | ) |
Gets allowed compression methods.
Requires:
Definition at line 95 of file compress.c.
References dns_compress::allowed, DNS_COMPRESS_ALL, REQUIRE, and VALID_CCTX.
Referenced by dns_name_towire().
void dns_compress_setsensitive | ( | dns_compress_t * | cctx, | |
isc_boolean_t | sensitive | |||
) |
Definition at line 101 of file compress.c.
References dns_compress::allowed, DNS_COMPRESS_CASESENSITIVE, REQUIRE, and VALID_CCTX.
Referenced by client_send(), req_render(), and sendstream().
isc_boolean_t dns_compress_getsensitive | ( | dns_compress_t * | cctx | ) |
Definition at line 111 of file compress.c.
References dns_compress::allowed, DNS_COMPRESS_CASESENSITIVE, ISC_TF, REQUIRE, and VALID_CCTX.
int dns_compress_getedns | ( | dns_compress_t * | cctx | ) |
Gets edns value.
Requires:
Definition at line 118 of file compress.c.
References dns_compress::edns, REQUIRE, and VALID_CCTX.
isc_boolean_t dns_compress_findglobal | ( | dns_compress_t * | cctx, | |
const dns_name_t * | name, | |||
dns_name_t * | prefix, | |||
isc_uint16_t * | offset | |||
) |
Finds longest possible match of 'name' in the global compression table.
Requires:
Definition at line 137 of file compress.c.
References dns_compress::allowed, dns_compress::count, DNS_COMPRESS_CASESENSITIVE, DNS_COMPRESS_TABLESIZE, dns_name_caseequal(), dns_name_countlabels(), dns_name_equal(), dns_name_getlabelsequence(), dns_name_hash(), dns_name_init(), dns_name_isabsolute(), dns_name_reset(), hash, INSIST, ISC_FALSE, ISC_TRUE, dns_compressnode::next, NODENAME, dns_compressnode::offset, REQUIRE, dns_compress::table, and VALID_CCTX.
Referenced by dns_name_towire().
static unsigned int name_length | ( | const dns_name_t * | name | ) | [inline, static] |
Definition at line 192 of file compress.c.
References dns_name_toregion(), isc_region::length, and r.
Referenced by casecompare_hip(), casecompare_ipseckey(), casecompare_nsec(), casecompare_rrsig(), checknames_minfo(), checknames_soa(), compare_any_tsig(), compare_ch_a(), compare_in_px(), compare_minfo(), compare_rp(), compare_sig(), compare_soa(), compare_tkey(), digest_ch_a(), digest_in_px(), digest_minfo(), digest_nxt(), digest_rp(), digest_soa(), dns_compress_add(), tostruct_any_tsig(), tostruct_ch_a(), tostruct_in_px(), tostruct_ipseckey(), tostruct_minfo(), tostruct_nsec(), tostruct_nxt(), tostruct_rp(), tostruct_rrsig(), tostruct_sig(), tostruct_soa(), tostruct_tkey(), totext_any_tsig(), totext_ch_a(), totext_in_px(), totext_ipseckey(), totext_nsec(), totext_nxt(), totext_rrsig(), totext_sig(), totext_soa(), totext_tkey(), towire_any_tsig(), towire_ch_a(), towire_in_px(), towire_minfo(), towire_nsec(), towire_nxt(), towire_rrsig(), towire_sig(), towire_soa(), and towire_tkey().
void dns_compress_add | ( | dns_compress_t * | cctx, | |
const dns_name_t * | name, | |||
const dns_name_t * | prefix, | |||
isc_uint16_t | offset | |||
) |
Add compression pointers for 'name' to the compression table, not replacing existing pointers.
Requires:
Definition at line 199 of file compress.c.
References isc_region::base, dns_compressnode::count, dns_compress::count, DNS_COMPRESS_INITIALNODES, DNS_COMPRESS_TABLESIZE, dns_name_countlabels(), dns_name_fromregion(), dns_name_getlabelsequence(), dns_name_hash(), dns_name_init(), dns_name_isabsolute(), dns_name_toregion(), hash, dns_compress::initialnodes, ISC_FALSE, isc_mem_get, isc_mem_put, dns_compressnode::labels, isc_region::length, dns_compress::mctx, name_length(), dns_compressnode::next, dns_compressnode::offset, dns_compressnode::r, r, REQUIRE, start, dns_compress::table, and VALID_CCTX.
Referenced by dns_name_towire().
void dns_compress_rollback | ( | dns_compress_t * | cctx, | |
isc_uint16_t | offset | |||
) |
Remove any compression pointers from global table >= offset.
Requires:
Definition at line 276 of file compress.c.
References isc_region::base, dns_compress::count, dns_compressnode::count, DNS_COMPRESS_INITIALNODES, DNS_COMPRESS_TABLESIZE, isc_mem_put, isc_region::length, dns_compress::mctx, dns_compressnode::next, dns_compressnode::offset, dns_compressnode::r, REQUIRE, dns_compress::table, and VALID_CCTX.
Referenced by dns_message_renderend(), dns_message_rendersection(), dns_ncache_towire(), dns_rdata_towire(), and towiresorted().
void dns_decompress_init | ( | dns_decompress_t * | dctx, | |
int | edns, | |||
dns_decompresstype_t | type | |||
) |
Initializes 'dctx'. Records 'edns' and 'type' into the structure.
Requires:
Definition at line 308 of file compress.c.
References dns_decompress::allowed, DCTX_MAGIC, DNS_COMPRESS_NONE, dns_decompress::edns, dns_decompress::magic, REQUIRE, and dns_decompress::type.
Referenced by ATF_TC_BODY(), dns_message_parse(), dns_nsec3param_fromprivate(), journal_open(), load_raw(), and rdata_validate().
void dns_decompress_invalidate | ( | dns_decompress_t * | dctx | ) |
Invalidates 'dctx'.
Requires:
Definition at line 321 of file compress.c.
References dns_decompress::magic, REQUIRE, and VALID_DCTX.
Referenced by ATF_TC_BODY(), dns_journal_destroy(), dns_nsec3param_fromprivate(), and rdata_validate().
void dns_decompress_setmethods | ( | dns_decompress_t * | dctx, | |
unsigned int | allowed | |||
) |
Sets 'dctx->allowed' to 'allowed'.
Requires:
Definition at line 329 of file compress.c.
References dns_decompress::allowed, DNS_COMPRESS_ALL, DNS_COMPRESS_NONE, DNS_DECOMPRESS_ANY, DNS_DECOMPRESS_NONE, DNS_DECOMPRESS_STRICT, REQUIRE, dns_decompress::type, and VALID_DCTX.
Referenced by dns_message_parse(), fromwire_afsdb(), fromwire_any_tsig(), fromwire_cdnskey(), fromwire_ch_a(), fromwire_cname(), fromwire_dname(), fromwire_dnskey(), fromwire_hip(), fromwire_in_a6(), fromwire_in_kx(), fromwire_in_nsap_ptr(), fromwire_in_px(), fromwire_in_srv(), fromwire_ipseckey(), fromwire_key(), fromwire_lp(), fromwire_mb(), fromwire_md(), fromwire_mf(), fromwire_mg(), fromwire_minfo(), fromwire_mr(), fromwire_mx(), fromwire_naptr(), fromwire_ns(), fromwire_nsec(), fromwire_nxt(), fromwire_ptr(), fromwire_rp(), fromwire_rrsig(), fromwire_rt(), fromwire_sig(), fromwire_soa(), and fromwire_tkey().
unsigned int dns_decompress_getmethods | ( | dns_decompress_t * | dctx | ) |
Returns 'dctx->allowed'.
Requires:
Definition at line 347 of file compress.c.
References dns_decompress::allowed, REQUIRE, and VALID_DCTX.
int dns_decompress_edns | ( | dns_decompress_t * | dctx | ) |
Returns 'dctx->edns'.
Requires:
Definition at line 355 of file compress.c.
References dns_decompress::edns, REQUIRE, and VALID_DCTX.
dns_decompresstype_t dns_decompress_type | ( | dns_decompress_t * | dctx | ) |
Returns 'dctx->type'.
Requires:
Definition at line 363 of file compress.c.
References REQUIRE, dns_decompress::type, and VALID_DCTX.