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