]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/net/radix.h
xnu-344.21.73.tar.gz
[apple/xnu.git] / bsd / net / radix.h
index eeef4221b4f6691ac38741fd9d69cdbe4edb1f52..1f0ccf517776bb54ea711e1f924b91db849345ff 100644 (file)
@@ -3,19 +3,22 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
  * SUCH DAMAGE.
  *
  *     @(#)radix.h     8.2 (Berkeley) 10/31/94
+ * $FreeBSD: src/sys/net/radix.h,v 1.16.2.1 2000/05/03 19:17:11 wollman Exp $
  */
 
 #ifndef _RADIX_H_
 #define        _RADIX_H_
+#include <sys/appleapiopts.h>
+
+#if !defined(KERNEL) || defined(__APPLE_API_PRIVATE)
 
 #ifdef MALLOC_DECLARE
 MALLOC_DECLARE(M_RTABLE);
@@ -67,8 +74,8 @@ MALLOC_DECLARE(M_RTABLE);
 
 struct radix_node {
        struct  radix_mask *rn_mklist;  /* list of masks contained in subtree */
-       struct  radix_node *rn_p;       /* parent */
-       short   rn_b;                   /* bit offset; -1-index(netmask) */
+       struct  radix_node *rn_parent;  /* parent */
+       short   rn_bit;                 /* bit offset; -1-index(netmask) */
        char    rn_bmask;               /* node: mask for bit test*/
        u_char  rn_flags;               /* enumerated next */
 #define RNF_NORMAL     1               /* leaf contains normal route */
@@ -93,19 +100,27 @@ struct radix_node {
 #endif
 };
 
-#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey
-#define rn_key rn_u.rn_leaf.rn_Key
-#define rn_mask rn_u.rn_leaf.rn_Mask
-#define rn_off rn_u.rn_node.rn_Off
-#define rn_l rn_u.rn_node.rn_L
-#define rn_r rn_u.rn_node.rn_R
-
+#define        rn_dupedkey     rn_u.rn_leaf.rn_Dupedkey
+#define        rn_key          rn_u.rn_leaf.rn_Key
+#define        rn_mask         rn_u.rn_leaf.rn_Mask
+#define        rn_offset       rn_u.rn_node.rn_Off
+#define        rn_left         rn_u.rn_node.rn_L
+#define        rn_right        rn_u.rn_node.rn_R
+
+#if 0
+/* for backward compatibility with previous definitions */
+#define rn_p           rn_parent
+#define rn_b           rn_bit
+#define rn_off                 rn_offset
+#define rn_l           rn_left
+#define rn_r           rn_right
+#endif
 /*
  * Annotations to tree concerning potential routes applying to subtrees.
  */
 
 struct radix_mask {
-       short   rm_b;                   /* bit offset; -1-index(netmask) */
+       short   rm_bit;                 /* bit offset; -1-index(netmask) */
        char    rm_unused;              /* cf. rn_bmask */
        u_char  rm_flags;               /* cf. rn_flags */
        struct  radix_mask *rm_mklist;  /* more masks to try */
@@ -116,8 +131,9 @@ struct radix_mask {
        int     rm_refs;                /* # of references to this struct */
 };
 
-#define rm_mask rm_rmu.rmu_mask
-#define rm_leaf rm_rmu.rmu_leaf                /* extra field would make 32 bytes */
+#define        rm_mask rm_rmu.rmu_mask
+#define        rm_leaf rm_rmu.rmu_leaf         /* extra field would make 32 bytes */
+
 
 #define MKGet(m) {\
        if (rn_mkfreelist) {\
@@ -186,5 +202,5 @@ struct radix_node
                        struct radix_node_head *head)),
         *rn_match __P((void *, struct radix_node_head *));
 
-
+#endif /* __APPLE_API_PRIVATE || !KERNEL */
 #endif /* _RADIX_H_ */