/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 1988, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)radix.h 8.2 (Berkeley) 10/31/94
* imp Exp $
*/
#ifndef _RADIX_H_
#define _RADIX_H_
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#endif
#include <sys/sysmacros.h>
#ifdef MALLOC_DECLARE
#endif
/*
* Radix search tree node layout.
*/
struct radix_node {
union {
struct { /* leaf only data: */
} rn_leaf;
struct { /* node only data: */
} rn_node;
} rn_u;
};
/*
* Annotations to tree concerning potential routes applying to subtrees.
*/
struct radix_mask {
union {
} rm_rmu;
};
struct radix_node_head {
(void *v, void *mask,
(void *v, void *mask,
(void *v, struct radix_node_head *head);
/* rnh_matchaddr_args: locate based on sockaddr and match_leaf_t() */
(void *v, struct radix_node_head *head,
match_leaf_t *f, void *w);
(void *v, struct radix_node_head *head);
/* rn_walktree_mt: MT safe version of rn_walktree */
(struct radix_node_head *head, void *a, void *m,
walktree_f_t *f, void *w);
#ifdef _KERNEL
#endif
};
#ifdef _KERNEL
/*
* BSD's sockaddr_in and sockadr have a sin_len and an sa_len
* field respectively, as the first field in the structure, and
* everything in radix.c assumes that the first byte of the "varg"
* passed in tells the length of the key (the sockaddr).
*
* Since Solaris' sockaddr_in and sockadr, do not have these fields, we
* define a BSD4-like sockaddr_in structure with rt_sin_len field to
* make LEN macro wn radix.c to work correctly for Solaris
* The callers of functions of radix.c have to use this data structure
*/
struct rt_sockaddr {
};
#define R_Zalloc(p, c, n) \
if (p = kmem_cache_alloc((c), KM_NOSLEEP)) {\
bzero(p, n); \
}
#else /* _KERNEL */
#ifndef RADIX_NODE_HEAD_RLOCK
#endif
#ifndef RADIX_NODE_HEAD_WLOCK
#endif
#ifndef RADIX_NODE_HEAD_UNLOCK
#endif
#endif /* _KERNEL */
#ifndef min
#endif
#ifndef max
#endif
void rn_init(void);
void rn_fini(void);
int rn_inithead(void **, int);
int rn_freenode(struct radix_node *, void *);
void rn_freehead(struct radix_node_head *);
#ifdef __cplusplus
}
#endif
#endif /* _RADIX_H_ */