2000-06-21 23:50:43 +00:00
|
|
|
Copyright (C) 1999, 2000 Internet Software Consortium.
|
|
|
|
See COPYRIGHT in the source root or http://www.isc.org/copyright for terms.
|
|
|
|
|
1999-02-24 00:57:57 +00:00
|
|
|
Name Decompression
|
1999-02-24 00:51:13 +00:00
|
|
|
|
2000-08-01 01:33:37 +00:00
|
|
|
$Id: decompression,v 1.5 2000/08/01 01:18:09 tale Exp $
|
1999-02-24 00:51:13 +00:00
|
|
|
|
|
|
|
Overview.
|
2000-08-01 01:33:37 +00:00
|
|
|
|
1999-02-24 00:51:13 +00:00
|
|
|
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.
|
|
|
|
|
1999-02-24 00:57:57 +00:00
|
|
|
Implementation:
|
2000-08-01 01:33:37 +00:00
|
|
|
|
1999-02-24 00:57:57 +00:00
|
|
|
dns_rdata_fromwire will set the allowed decompression methods allowed
|
|
|
|
by looking at edns, strict and the type values.
|
|
|
|
|
1999-02-24 00:51:13 +00:00
|
|
|
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:
|
|
|
|
|
1999-02-24 06:31:35 +00:00
|
|
|
void
|
1999-02-24 00:51:13 +00:00
|
|
|
dns_decompress_init(dns_decompress_t *dctx, int edns,
|
1999-02-24 06:31:35 +00:00
|
|
|
isc_boolean_t strict);
|
1999-02-24 00:51:13 +00:00
|
|
|
initalise dctx
|
|
|
|
dctx->ownername is invalidated
|
|
|
|
|
1999-02-24 06:31:35 +00:00
|
|
|
void
|
1999-02-24 00:51:13 +00:00
|
|
|
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)
|