radix.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2007-2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
/*
* This source was adapted from MRT's RCS Ids:
* Id: radix.c,v 1.10.2.1 1999/11/29 05:16:24 masaki Exp
* Id: prefix.c,v 1.37.2.9 2000/03/10 02:53:19 labovit Exp
*/
#include <config.h>
static isc_result_t
static void
static isc_result_t
static int
static void
static isc_result_t
int bitlen)
{
return (ISC_R_NOTIMPLEMENTED);
return (ISC_R_NOMEMORY);
} else {
/* AF_UNSPEC is "any" or "none"--treat it as AF_INET */
}
return (ISC_R_SUCCESS);
}
static void
int refs;
return;
if (refs <= 0) {
sizeof(isc_prefix_t));
}
}
static isc_result_t
/*
* If this prefix is a static allocation, copy it into new memory.
* (Note, the refcount still has to be destroyed by the calling
* routine.)
*/
return (ret);
}
return (ISC_R_SUCCESS);
}
static int
/* Mask length of zero matches everything */
if (mask == 0)
return (1);
int n = mask / 8;
if ((mask % 8) == 0 ||
return (1);
}
return (0);
}
return (ISC_R_NOMEMORY);
radix->num_active_node = 0;
radix->num_added_node = 0;
return (ISC_R_SUCCESS);
}
/*
* if func is supplied, it will be called as func(node->data)
* before deleting the node
*/
static void
isc_radix_node_t *l = Xrn->l;
isc_radix_node_t *r = Xrn->r;
} else {
}
radix->num_active_node--;
if (l != NULL) {
if (r != NULL) {
*Xsp++ = r;
}
Xrn = l;
} else if (r != NULL) {
Xrn = r;
} else {
}
}
}
}
void
}
/*
* func will be called as func(node->prefix, node->data)
*/
void
}
{
return (ISC_R_NOTFOUND);
}
else
break;
}
while (cnt-- > 0) {
continue;
{
{
}
}
}
return (ISC_R_NOTFOUND);
} else {
return (ISC_R_SUCCESS);
}
}
{
isc_uint32_t i, j, r;
return (ISC_R_NOMEMORY);
for (i = 0; i < 4; i++)
if (result != ISC_R_SUCCESS) {
sizeof(isc_radix_node_t));
return (result);
}
/*
* If source is non-NULL, then we're merging in a
* node from an existing radix tree. To keep
* the node_num values consistent, the calling
* function will add the total number of nodes
* added to num_added_node at the end of
* the merge operation--we don't do it here.
*/
for (i = 0; i < 4; i++) {
}
} else {
/* "any" or "none" */
for (i = 0; i < 4; i++)
} else {
}
}
radix->num_active_node++;
return (ISC_R_SUCCESS);
}
{
break;
} else {
break;
}
}
/* Find the first bit different. */
differ_bit = 0;
for (i = 0; i*8 < check_bit; i++) {
continue;
}
/* I know the better way, but for now. */
for (j = 0; j < 8; j++) {
if (BIT_TEST (r, (0x80 >> j)))
break;
}
/* Must be found. */
INSIST(j < 8);
differ_bit = i * 8 + j;
break;
}
if (differ_bit > check_bit)
}
/* Set node_num only if it hasn't been set before */
/* Merging nodes */
for (i = 0; i < 4; i++) {
}
}
} else {
/* "any" or "none" */
for (i = 0; i < 4; i++) {
next;
next;
}
}
} else {
++radix->num_added_node;
}
}
return (ISC_R_SUCCESS);
} else {
if (result != ISC_R_SUCCESS)
return (result);
}
/* Merging node */
for (i = 0; i < 4; i++) {
}
}
} else {
/* "any" or "none" */
for (i = 0; i < 4; i++)
} else {
}
}
return (ISC_R_SUCCESS);
}
return (ISC_R_NOMEMORY);
sizeof(isc_radix_node_t));
return (ISC_R_NOMEMORY);
}
}
if (result != ISC_R_SUCCESS) {
sizeof(isc_radix_node_t));
return (result);
}
for (i = 0; i < 4; i++) {
}
radix->num_active_node++;
/* Merging node */
for (i = 0; i < 4; i++) {
}
}
} else {
/* "any" or "none" */
for (i = 0; i < 4; i++)
} else {
}
}
{
} else {
}
return (ISC_R_SUCCESS);
}
if (bitlen == differ_bit) {
} else {
}
} else {
}
} else {
for (i = 0; i < 4; i++) {
}
radix->num_active_node++;
} else {
}
} else {
}
}
return (ISC_R_SUCCESS);
}
void
/*
* This might be a placeholder node -- have to check and
* make sure there is a prefix associated with it!
*/
return;
}
radix->num_active_node--;
return;
}
} else {
}
radix->num_active_node--;
return;
/* We need to remove parent too. */
} else {
}
radix->num_active_node--;
return;
}
if (node->r) {
} else {
}
radix->num_active_node--;
return;
}
radix->num_active_node--;
} else {
}
}
/*
Local Variables:
c-basic-offset: 4
indent-tabs-mode: t
End:
*/