compress.h File Reference

#include <isc/lang.h>
#include <isc/region.h>
#include <dns/types.h>

Go to the source code of this file.

Data Structures

struct  dns_compressnode
struct  dns_compress
struct  dns_decompress

Defines

#define DNS_COMPRESS_H   1
#define DNS_COMPRESS_NONE   0x00
 no compression
#define DNS_COMPRESS_GLOBAL14   0x01
 "normal" compression.
#define DNS_COMPRESS_ALL   0x01
 all compression.
#define DNS_COMPRESS_CASESENSITIVE   0x02
 case sensitive compression.
#define DNS_COMPRESS_TABLESIZE   64
#define DNS_COMPRESS_INITIALNODES   16

Typedefs

typedef struct dns_compressnode dns_compressnode_t

Enumerations

enum  dns_decompresstype_t { DNS_DECOMPRESS_ANY, DNS_DECOMPRESS_STRICT, DNS_DECOMPRESS_NONE }

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.
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'.


Detailed Description

Direct manipulation of the structures is strongly discouraged.

Definition in file compress.h.


Define Documentation

#define DNS_COMPRESS_H   1

Definition at line 21 of file compress.h.

#define DNS_COMPRESS_NONE   0x00

no compression

Definition at line 30 of file compress.h.

Referenced by dns_decompress_init(), dns_decompress_setmethods(), fromwire_afsdb(), fromwire_any_tsig(), fromwire_cdnskey(), 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_naptr(), fromwire_nsec(), fromwire_nxt(), fromwire_rp(), fromwire_rrsig(), fromwire_rt(), fromwire_sig(), fromwire_tkey(), towire_afsdb(), towire_any_tsig(), towire_dname(), towire_in_a6(), towire_in_kx(), towire_in_nsap_ptr(), towire_in_px(), towire_in_srv(), towire_naptr(), towire_nsec(), towire_nxt(), towire_rp(), towire_rrsig(), towire_rt(), towire_sig(), and towire_tkey().

#define DNS_COMPRESS_GLOBAL14   0x01

"normal" compression.

Definition at line 31 of file compress.h.

Referenced by dns_message_parse(), dns_name_fromwire(), dns_name_towire(), dns_ncache_towire(), fromwire_ch_a(), fromwire_cname(), fromwire_lp(), fromwire_mb(), fromwire_md(), fromwire_mf(), fromwire_mg(), fromwire_minfo(), fromwire_mr(), fromwire_mx(), fromwire_ns(), fromwire_ptr(), fromwire_soa(), towire_ch_a(), towire_cname(), towire_mb(), towire_md(), towire_mf(), towire_mg(), towire_minfo(), towire_mr(), towire_mx(), towire_ns(), towire_ptr(), towire_soa(), and towiresorted().

#define DNS_COMPRESS_ALL   0x01

all compression.

Definition at line 32 of file compress.h.

Referenced by dns_compress_getmethods(), dns_compress_setmethods(), and dns_decompress_setmethods().

#define DNS_COMPRESS_CASESENSITIVE   0x02

case sensitive compression.

Definition at line 33 of file compress.h.

Referenced by dns_compress_findglobal(), dns_compress_getsensitive(), and dns_compress_setsensitive().

#define DNS_COMPRESS_TABLESIZE   64

Definition at line 39 of file compress.h.

Referenced by dns_compress_add(), dns_compress_findglobal(), dns_compress_init(), dns_compress_invalidate(), and dns_compress_rollback().

#define DNS_COMPRESS_INITIALNODES   16

Definition at line 40 of file compress.h.

Referenced by dns_compress_add(), dns_compress_invalidate(), and dns_compress_rollback().


Typedef Documentation

typedef struct dns_compressnode dns_compressnode_t

Definition at line 42 of file compress.h.


Enumeration Type Documentation

enum dns_decompresstype_t

Enumerator:
DNS_DECOMPRESS_ANY  Any compression.
DNS_DECOMPRESS_STRICT  Allowed compression.
DNS_DECOMPRESS_NONE  No compression.

Definition at line 64 of file compress.h.


Function Documentation

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:

Returns:

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:

Returns:

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:

Returns:

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:

Ensures: Returns:

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().

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.


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