Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
Copyright (C) 1999-2001  Internet Software Consortium.
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.

			Name Decompression

	$Id: decompression,v 1.8 2004/03/05 05:04:46 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.

Implementation:

	dns_rdata_fromwire will set the allowed decompression methods allowed
	by looking at edns, strict and the type values.

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:

	void
	dns_decompress_init(dns_decompress_t *dctx, int edns,
			    isc_boolean_t strict);
	initalise dctx
	dctx->ownername is invalidated

	void
	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)
