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