decompression revision 95a08101c00db050de55b627dcd00a8d98831e32
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Name Decompression
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $Id: decompression,v 1.1 1999/02/24 00:51:13 marka Exp $
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein There are 4 type of compression: global 14 bit, global 16 bit,
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews local 14 bit and local 16 bit.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein In general the resolver / nameserver should accept any compression
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User 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.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein There are a few cases where it does not make sence to accept
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User compression pointers of a given type. i.e. the first domain name
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein in a message, local compression pointers in the ownername of a RR
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein or in a question.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein When performing regression testing however we should be as strict
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User as possible. Hence we need to be able modifiy the behaviour of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein decompression routines.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein To be able to decompress a domain name we need some or all of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein following pieces of information.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews 1. where the message starts.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 2. where the current rdata starts in the message (local compression).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 3. what the current owner name is (local compression).
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 4. where the domainname we are decompressing starts.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein 5. what are allowable decompression method. These vary across type
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User and edn version.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt struct dns_decompress {
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt unsigned int magic;
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User unsigned int allowed;
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt dns_name_t owner_name;
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt unsigned int rdata;
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt isc_boolean_t strict;
bfb7b680bf88c1fdd9949197b71c512c532280a4Tinderbox User dns_decompress_init(dns_decompress_t *dctx, int edns,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt isc_boolean_t strict, isc_mctx_t *mctx);
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt initalise dctx
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt dctx->ownername is invalidated
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt dns_result_t
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein isc_buffer_t *source);
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User initalise dctx->ownername
f9ce6280cec79deb16ff6d9807aa493ff23e10d9Tinderbox User record source->current to dctx->rdata
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User dns_decompress_invalidate(dns_decompress_t *dctx);
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt invalidate dctx
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User dns_decompress_localinvalidate(dns_decompress_t *dctx);
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User invalidate dctx->ownername
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed);
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt sets dctx->allowed
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt dns_decompress_getmethods(dns_decompress_t *dctx);
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt returns dctx->allowed
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt dns_decompress_edns(dns_decompress_t *dctx);
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User returns dctx->edns
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt isc_boolean_t
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User dns_decompress_strict(dns_decompress_t *dctx);
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User returns dctx->strict
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User dns_decompress_t *dctx, isc_boolean_t downcase,
363b21045b718d06d414784c96193dc9a233e8c5Tinderbox User isc_buffer_t *target)