compress.h revision 575737b964590103f60542849d4536b5ccd4eb3c
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Copyright (C) 1999, 2000 Internet Software Consortium.
985687b4e080182c1a3a2173df02b94a5b78b24fBob Halley * Permission to use, copy, modify, and distribute this software for any
985687b4e080182c1a3a2173df02b94a5b78b24fBob Halley * purpose with or without fee is hereby granted, provided that the above
985687b4e080182c1a3a2173df02b94a5b78b24fBob Halley * copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
15a44745412679c30a6d022733925af70a38b715David Lawrence * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
15a44745412679c30a6d022733925af70a38b715David Lawrence * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
15a44745412679c30a6d022733925af70a38b715David Lawrence * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
15a44745412679c30a6d022733925af70a38b715David Lawrence * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15a44745412679c30a6d022733925af70a38b715David Lawrence * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15a44745412679c30a6d022733925af70a38b715David Lawrence * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington/* $Id: compress.h,v 1.21 2000/12/29 00:59:41 bwelling Exp $ */
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews#define DNS_COMPRESS_NONE 0x00 /* no compression */
985687b4e080182c1a3a2173df02b94a5b78b24fBob Halley#define DNS_COMPRESS_GLOBAL14 0x01 /* "normal" compression. */
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington#define DNS_COMPRESS_ALL 0x01 /* all compression. */
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington * Direct manipulation of the structures is strongly discouraged.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellingtontypedef struct dns_compressnode dns_compressnode_t;
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington unsigned int allowed; /* Allowed methods. */
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington unsigned int rdata; /* Start of local rdata. */
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington /* Global compression table. */
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington dns_compressnode_t *table[DNS_COMPRESS_TABLESIZE];
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington /* Preallocated nodes for the table. */
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington dns_compressnode_t initialnodes[DNS_COMPRESS_INITIALNODES];
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellingtontypedef enum {
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington DNS_DECOMPRESS_STRICT, /* Allowed compression */
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington unsigned int allowed; /* Allowed methods. */
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington unsigned int rdata; /* Start of local rdata. */
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington dns_decompresstype_t type; /* Strict checking */
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrencedns_compress_init(dns_compress_t *cctx, int edns, isc_mem_t *mctx);
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * Inialise the compression context structure pointed to by 'cctx'.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * 'cctx' is a valid dns_compress_t structure.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'mctx' is an initialized memory context.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * cctx->global is initialized.
c1a2cfef7f9156ffd15ded6cca6429a174319cc1Michael Graff * ISC_R_SUCCESS
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * failures from dns_rbt_create()
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * Invalidate the compression structure pointed to by cctx.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' to be initialized.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrewsdns_compress_setmethods(dns_compress_t *cctx, unsigned int allowed);
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * Sets allowed compression methods.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' to be initialized.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * Gets allowed compression methods.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' to be initialized.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * allowed compression bitmap.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * Gets edns value.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' to be initialized.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrewsdns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name,
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * Finds longest possible match of 'name' in the global compression table.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' to be initialized.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * 'name' to be a absolute name.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'prefix' to be initialized.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'suffix' to be initialized.
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * 'offset' to point it a isc_uint16_t.
62e22bc7a5497d759583693ba22d3ef4d9a042afAndreas Gustafsson * 'prefix', 'suffix' and 'offset' are valid if ISC_TRUE is
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews * ISC_TRUE / ISC_FALSE
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellingtondns_compress_add(dns_compress_t *cctx, dns_name_t *name, isc_uint16_t offset);
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * Add compression pointers for name to the compression table,
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * not replacing existing pointers.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' initialized
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'name' must be initialized and absolute
c1e7aff941dbf40090fec49300e728ad017d4f0cMark Andrewsdns_compress_rollback(dns_compress_t *cctx, isc_uint16_t offset);
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * Remove any compression pointers from global table >= offset.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'cctx' is initialized.
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellingtondns_decompress_init(dns_decompress_t *dctx, int edns,
d0221bfa6a08f7b284b231886928aa5d8ac87fc2Mark Andrews * Initalises 'dctx'.
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington * Records 'edns' and 'type' into the structure.
d0221bfa6a08f7b284b231886928aa5d8ac87fc2Mark Andrews * 'dctx' to be a valid pointer.
1ef8965366d91e02a4672c35a187d30aa4a4c72cMark Andrewsdns_decompress_invalidate(dns_decompress_t *dctx);
d0221bfa6a08f7b284b231886928aa5d8ac87fc2Mark Andrews * Invalidates 'dctx'.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'dctx' to be initialized
1ef8965366d91e02a4672c35a187d30aa4a4c72cMark Andrewsdns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed);
d0221bfa6a08f7b284b231886928aa5d8ac87fc2Mark Andrews * Sets 'dctx->allowed' to 'allowed'.
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'dctx' to be initialized
1ef8965366d91e02a4672c35a187d30aa4a4c72cMark Andrewsdns_decompress_getmethods(dns_decompress_t *dctx);
d0221bfa6a08f7b284b231886928aa5d8ac87fc2Mark Andrews * Returns 'dctx->allowed'
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'dctx' to be initialized
d0221bfa6a08f7b284b231886928aa5d8ac87fc2Mark Andrews * Returns 'dctx->edns'
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'dctx' to be initialized
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellingtondns_decompress_type(dns_decompress_t *dctx);
942d1a339b1fe617f7d17d66cb5fccce798d15aeBrian Wellington * Returns 'dctx->type'
575737b964590103f60542849d4536b5ccd4eb3cBrian Wellington * 'dctx' to be initialized
985687b4e080182c1a3a2173df02b94a5b78b24fBob Halley#endif /* DNS_COMPRESS_H */