decompression revision 95a08101c00db050de55b627dcd00a8d98831e32
Name Decompression
$Id: decompression,v 1.1 1999/02/24 00:51:13 marka Exp $
Overview.
There are 4 type of compression: global 14 bit, global 16 bit,
local 14 bit and local 16 bit.
In general the resolver / nameserver should accept any compression
method at any time regardless of whether it was legal to
send it. This fits with the priciple of being liberal with
what you accept and strict with what you send.
There are a few cases where it does not make sence to accept
compression pointers of a given type. i.e. the first domain name
in a message, local compression pointers in the ownername of a RR
or in a question.
When performing regression testing however we should be as strict
as possible. Hence we need to be able modifiy the behaviour of the
decompression routines.
To be able to decompress a domain name we need some or all of the
following pieces of information.
1. where the message starts.
2. where the current rdata starts in the message (local compression).
3. what the current owner name is (local compression).
4. where the domainname we are decompressing starts.
5. what are allowable decompression method. These vary across type
and edn version.
Types:
struct dns_decompress {
unsigned int magic;
unsigned int allowed;
int edns;
dns_name_t owner_name;
unsigned int rdata;
isc_boolean_t strict;
}
Functions:
dns_result_t
dns_decompress_init(dns_decompress_t *dctx, int edns,
isc_boolean_t strict, isc_mctx_t *mctx);
initalise dctx
dctx->ownername is invalidated
dns_result_t
dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name,
isc_buffer_t *source);
initalise dctx->ownername
record source->current to dctx->rdata
void
dns_decompress_invalidate(dns_decompress_t *dctx);
invalidate dctx
void
dns_decompress_localinvalidate(dns_decompress_t *dctx);
invalidate dctx->ownername
void
dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed);
sets dctx->allowed
unsigned int
dns_decompress_getmethods(dns_decompress_t *dctx);
returns dctx->allowed
int
dns_decompress_edns(dns_decompress_t *dctx);
returns dctx->edns
isc_boolean_t
dns_decompress_strict(dns_decompress_t *dctx);
returns dctx->strict
dns_result_t
dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
dns_decompress_t *dctx, isc_boolean_t downcase,
isc_buffer_t *target)