decompression revision 0d92b2da03ce93c195fc3a8ff0b2364791695531
7bd455641455950eff7d21be652c8142b134d32fTinderbox User Name Decompression
7bd455641455950eff7d21be652c8142b134d32fTinderbox User $Id: decompression,v 1.2 1999/02/24 00:57:57 marka Exp $
7bd455641455950eff7d21be652c8142b134d32fTinderbox User There are 4 type of compression: global 14 bit, global 16 bit,
7bd455641455950eff7d21be652c8142b134d32fTinderbox User local 14 bit and local 16 bit.
7bd455641455950eff7d21be652c8142b134d32fTinderbox User In general the resolver / nameserver should accept any compression
7bd455641455950eff7d21be652c8142b134d32fTinderbox User method at any time regardless of whether it was legal to
7bd455641455950eff7d21be652c8142b134d32fTinderbox User send it. This fits with the priciple of being liberal with
7bd455641455950eff7d21be652c8142b134d32fTinderbox User what you accept and strict with what you send.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews There are a few cases where it does not make sence to accept
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews compression pointers of a given type. i.e. the first domain name
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews in a message, local compression pointers in the ownername of a RR
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews or in a question.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews When performing regression testing however we should be as strict
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews as possible. Hence we need to be able modifiy the behaviour of the
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews decompression routines.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews To be able to decompress a domain name we need some or all of the
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews following pieces of information.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews 1. where the message starts.
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence 2. where the current rdata starts in the message (local compression).
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrence 3. what the current owner name is (local compression).
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews 4. where the domainname we are decompressing starts.
bff64bf12b58a6f80e740e94f2e42a32df18113aEvan Hunt 5. what are allowable decompression method. These vary across type
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrence and edn version.
92b796c963e7ba0217debfa27a0709f94934f5d5Mark AndrewsImplementation:
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley dns_rdata_fromwire will set the allowed decompression methods allowed
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley by looking at edns, strict and the type values.
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley struct dns_decompress {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley unsigned int magic;
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff unsigned int allowed;
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews dns_name_t owner_name;
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews unsigned int rdata;
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews isc_boolean_t strict;
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews dns_result_t
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews dns_decompress_init(dns_decompress_t *dctx, int edns,
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews isc_boolean_t strict, isc_mctx_t *mctx);
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews initalise dctx
f4ea363e3acc321b24ffe95a64a583e8041d6fd5Mark Andrews dctx->ownername is invalidated
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name,
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff isc_buffer_t *source);
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff initalise dctx->ownername
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff record source->current to dctx->rdata
5b7abbef511cea0b568be0bc8d5b3120a0b9034dEvan Hunt dns_decompress_invalidate(dns_decompress_t *dctx);
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff invalidate dctx
11dbf2fc38eea8c5d3fe7123718bf197a8bb2e6bMark Andrews dns_decompress_localinvalidate(dns_decompress_t *dctx);
11dbf2fc38eea8c5d3fe7123718bf197a8bb2e6bMark Andrews invalidate dctx->ownername
11dbf2fc38eea8c5d3fe7123718bf197a8bb2e6bMark Andrews dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed);
11dbf2fc38eea8c5d3fe7123718bf197a8bb2e6bMark Andrews sets dctx->allowed
11dbf2fc38eea8c5d3fe7123718bf197a8bb2e6bMark Andrews unsigned int
11463c0ac24692e229ec87f307f5e7df3c0a7e10Evan Hunt dns_decompress_getmethods(dns_decompress_t *dctx);
1c1290afabb3c8f4dd498170ac9592e5be450161Mark Andrews returns dctx->allowed
32ebb157b1d9409a186c86002827f8a1f4931f5aMark Andrews dns_decompress_edns(dns_decompress_t *dctx);
740e7340c55e9f0cf80c6fbbf7e8d3c1bdeaa255Mark Andrews returns dctx->edns
84f95ddb2572641022619950a211aff49e331c98Mukund Sivaraman isc_boolean_t
32ebb157b1d9409a186c86002827f8a1f4931f5aMark Andrews dns_decompress_strict(dns_decompress_t *dctx);
32ebb157b1d9409a186c86002827f8a1f4931f5aMark Andrews returns dctx->strict
1c1290afabb3c8f4dd498170ac9592e5be450161Mark Andrews dns_result_t
11463c0ac24692e229ec87f307f5e7df3c0a7e10Evan Hunt dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
32ebb157b1d9409a186c86002827f8a1f4931f5aMark Andrews dns_decompress_t *dctx, isc_boolean_t downcase,
32ebb157b1d9409a186c86002827f8a1f4931f5aMark Andrews isc_buffer_t *target)