compress.c revision 89b117b7560a7efae552539bf4a56e4b62fbac38
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/* $Id: compress.c,v 1.28 2000/04/27 21:46:31 halley Exp $ */
#define DNS_NAME_USEINLINE 1
#include <config.h>
#include <string.h>
#include <isc/assertions.h>
#include <dns/compress.h>
#include <dns/fixedname.h>
static void
static isc_boolean_t
static void
/***
*** Compression
***/
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
}
void
}
void
}
unsigned int
}
int
}
{
workspace));
}
void
{
}
void
/*
* Initalise things.
*/
origin);
if (result != ISC_R_SUCCESS)
break;
if (result != ISC_R_SUCCESS)
break;
if (result != ISC_R_SUCCESS)
break;
/*
* If the delete is successful the chain is broken.
*/
goto again;
}
}
}
/***
*** Decompression
***/
void
}
void
}
void
}
unsigned int
}
int
}
}
/***
*** Private
***/
static void
}
/*
* Add the labels in prefix to RBT.
*/
static void
{
unsigned int count;
unsigned int start;
unsigned int n;
unsigned char buffer[255];
if (dns_name_isabsolute(prefix))
count--;
start = 0;
if (result != ISC_R_SUCCESS)
return;
n = dns_name_countlabels(&full);
while (count > 0) {
break;
return;
if (result != ISC_R_SUCCESS) {
return;
}
start++;
n--;
count--;
}
}
/*
* Find the longest match of name in root.
* If match is found return ISC_TRUE. prefix, suffix and offset
* are updated.
* If no match is found return ISC_FALSE.
*/
static isc_boolean_t
{
unsigned int foundlabels;
unsigned int namelabels;
unsigned int foundbits;
unsigned int namebits;
unsigned int bits;
unsigned int prefixlen;
unsigned int j;
/*
* Getting rid of the offsets table for foundname improves
* perfomance, since the offsets table is not needed and maintaining
* it has costs.
*/
return (ISC_FALSE);
return (ISC_FALSE);
/*
* Do we have to do bit string processing?
*/
} else
if (prefixlen == 0) {
} else
if (result != ISC_R_SUCCESS)
return (ISC_FALSE);
return (ISC_TRUE);
}
/*
* At this stage we have a bit string label to split in two.
* There is potentially a prefix before this label and definitly
* a suffix after it (if only the root).
*/
if (result != ISC_R_SUCCESS)
return (ISC_FALSE);
if (prefixlen != 0) {
}
j = 0;
/*
* Copy least significant bits.
*/
while (j < bits) {
if (bit)
j++;
}
buf[0] = DNS_LABELTYPE_BITSTRING;
buf[1] = j;
if (result != ISC_R_SUCCESS)
return (ISC_FALSE);
return (ISC_TRUE);
}