compress.c revision ab023a65562e62b85a824509d829b6fad87e00b1
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * Copyright (C) 1999-2001 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * copyright notice and this permission notice appear in all copies.
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews * PERFORMANCE OF THIS SOFTWARE.
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews/* $Id: compress.c,v 1.55 2005/04/27 04:56:45 sra Exp $ */
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews#define CCTX_MAGIC ISC_MAGIC('C', 'C', 'T', 'X')
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews#define VALID_CCTX(x) ISC_MAGIC_VALID(x, CCTX_MAGIC)
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews#define DCTX_MAGIC ISC_MAGIC('D', 'C', 'T', 'X')
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews#define VALID_DCTX(x) ISC_MAGIC_VALID(x, DCTX_MAGIC)
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews *** Compression
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrewsdns_compress_init(dns_compress_t *cctx, int edns, isc_mem_t *mctx) {
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews unsigned int i;
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews REQUIRE(mctx != NULL); /* See: rdataset.c:towiresorted(). */
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews for (i = 0; i < DNS_COMPRESS_TABLESIZE; i++)
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews unsigned int i;
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrews for (i = 0; i < DNS_COMPRESS_TABLESIZE; i++) {
b976c39c07f7672bd1293e878b3306c7decf8afeMark Andrewsdns_compress_setmethods(dns_compress_t *cctx, unsigned int allowed) {
if (sensitive)
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
isc_region_t r;
return (r.length);
unsigned int start;
unsigned int count;
unsigned int hash;
unsigned int length;
unsigned int tlength;
count--;
start = 0;
while (count > 0) {
sizeof(dns_compressnode_t));
start++;
count--;
for (i = 0; i < DNS_COMPRESS_TABLESIZE; i++) {
case DNS_DECOMPRESS_ANY:
case DNS_DECOMPRESS_NONE:
case DNS_DECOMPRESS_STRICT: