1/* 2 * Copyright (c) 1988, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)radix.h 8.2 (Berkeley) 10/31/94 30 * |
31 * $FreeBSD: head/sbin/routed/radix.h 190715 2009-04-05 15:55:09Z phk $ |
32 */ 33 34#ifndef __RADIX_H_ 35#define __RADIX_H_ 36 37#include <sys/cdefs.h> 38struct walkarg; 39 --- 35 unchanged lines hidden (view full) --- 75#define rn_off rn_u.rn_node.rn_Off 76#define rn_l rn_u.rn_node.rn_L 77#define rn_r rn_u.rn_node.rn_R 78 79/* 80 * Annotations to tree concerning potential routes applying to subtrees. 81 */ 82 |
83struct radix_mask { |
84 short rm_b; /* bit offset; -1-index(netmask) */ 85 char rm_unused; /* cf. rn_bmask */ 86 u_char rm_flags; /* cf. rn_flags */ 87 struct radix_mask *rm_mklist; /* more masks to try */ 88 union { 89 caddr_t rmu_mask; /* the mask */ 90 struct radix_node *rmu_leaf; /* for normal routes */ 91 } rm_rmu; 92 int rm_refs; /* # of references to this struct */ |
93}; |
94 95#define rm_mask rm_rmu.rmu_mask 96#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ 97 98#define MKGet(m) {\ 99 if (rn_mkfreelist) {\ 100 m = rn_mkfreelist; \ 101 rn_mkfreelist = (m)->rm_mklist; \ --- 32 unchanged lines hidden (view full) --- 134 135#define Bcmp(a, b, n) memcmp(((void *)(a)), ((void *)(b)), (n)) 136#define Bcopy(a, b, n) memmove(((void *)(b)), ((void *)(a)), (size_t)(n)) 137#define Bzero(p, n) memset((void *)(p), 0, (size_t)(n)); 138#define Free(p) free((void *)p); 139 140void rn_init(void); 141int rn_inithead(struct radix_node_head **head, int off); |
142int rn_walktree(struct radix_node_head *, 143 int (*)(struct radix_node *, struct walkarg *), 144 struct walkarg *); 145 |
146#endif /* __RADIX_H_ */ |