* Radix search tree node layout.    */</em>    struct Radix_node {    struct radix_mask
*rn_mklist; /* indication a mask may apply */</em>    struct radix_node *rn_p; <em>/* parent
*/</em>    struct radix_info rn_ri; <em>/* bit number and mask, flags */</em>    int rn_off;  
<em>/* precomputed offset for byte test */</em>    struct radix_node *rn_l; <em>/* progeny
*/</em>    struct radix_node *rn_r; <em>/* progeny */</em>    };    struct Radix_leaf {    struct
radix_mask *rn_mklist; <em>/* our handle to the annotation */</em>    struct radix_node *rn_p;
<em>/* parent */</em>    struct radix_info rn_ri; <em>/* bit number and mask, flags */</em>   
caddr_t rn_key;   <em>/* object of search */</em>    caddr_t rn_mask;  <em>/* netmask, if
present */</em>    struct radix_node *rn_dupedkey;    };    <em>/*    * The actual radix node
struct is defined    * in terms of a structure containing a union with copious defines such as:   
*/</em>    #define <strong>rn_key</strong> rn_u.rn_leaf.rn_Key    #define
<strong>rn_b</strong> rn_ri.ri_b    <em>/*    * Annotations to tree concerning potential routes
applying to subtrees.    */</em>    extern struct radix_mask {    struct radix_info rm_ri; <em>/*
bit number and mask, flags */</em>    struct radix_mask *rm_mklist; <em>/* more masks to try
*/</em>    caddr_t rm_mask;  <em>/* the mask */</em>    int rm_refs;  <em>/* # of references
to this struct */</em>    } *rn_mkfreelist;    struct radix_node *    rn_search(v, head)    struct
radix_node *head;    register caddr_t v;    {    register struct radix_node *x;    for (x = head;
x->rn_b >= 0;) {    if (x->rn_bmask & v[x->rn_off])    x = x->rn_r;    else    x = x->rn_l;    }   
return x;    };    </code></pre>    <h2>Appendix B: Header Files for routing mesages,
structures.</h2>    This also is a slightly simplified version of    the actual header file:   
<pre><code>    <em>/*    *  Copyright (c) 1980, 1990 Regents of the University of California.   
*  All rights reserved.    *    * @(#)route.h 7.12a (Berkeley) 11/28/90    */</em>    <em>/*    *
These numbers are used by reliable protocols for determining    * retransmission behavior and are
included in the routing structure.    */</em>    struct rt_metrics {    u_long rmx_locks; <em>/*
Kernel must leave these values alone */</em>    u_long rmx_mtu; <em>/* MTU for this path
*/</em>    u_long rmx_hopcount; <em>/* max hops expected */</em>    u_long rmx_expire;
<em>/* lifetime for route, e.g. redirect */</em>    u_long rmx_recvpipe; <em>/* inbound
delay-bandwith product */</em>    u_long rmx_sendpipe; <em>/* outbound delay-bandwith
product */</em>    u_long rmx_ssthresh; <em>/* outbound gateway buffer limit */</em>   
u_long rmx_rtt; <em>/* estimated round trip time */</em>    u_long rmx_rttvar; <em>/*
estimated rtt variance */</em>    };    <em>/*    * Bits for locking and initializing metrics   
*/</em>    #define <strong>RTV_MTU</strong>  0x1 <em>/* init or lock    _mtu */</em>   
#define <strong>RTV_HOPCOUNT</strong> 0x2 <em>/* init or    lock _hopcount */</em>   
#define <strong>RTV_EXPIRE</strong> 0x4 <em>/* init or    lock _hopcount */</em>   
#define <strong>RTV_RPIPE</strong> 0x8 <em>/* init or lock    _recvpipe */</em>    #define
<strong>RTV_SPIPE</strong> 0x10 <em>/* init or    lock _sendpipe */</em>    #define
<strong>RTV_SSTHRESH</strong> 0x20 <em>/* init    or lock _ssthresh */</em>    #define
<strong>RTV_RTT</strong>  0x40 <em>/* init or lock    _rtt */</em>    #define
<strong>RTV_RTTVAR</strong> 0x80 <em>/* init or    lock _rttvar */</em>    struct rtentry {  
 struct radix_node rt_nodes[2]; <em>/* tree glue, and other values */</em>    #define
<strong>rt_key(r)</strong> ((struct sockaddr *)((r)->rt_nodes->rn_key))    #define
<strong>rt_mask(r)</strong> ((struct sockaddr *)((r)->rt_nodes->rn_mask))    struct sockaddr
*rt_gateway; <em>/* value */</em>    short rt_flags;  <em>/* up/down?, host/net */</em>   
short rt_refcnt;  <em>/* # held references */</em>    u_long rt_use;   <em>/* raw # packets
forwarded */</em>    struct ifnet *rt_ifp;  <em>/* the answer: interface to use */</em>    struct
ifaddr *rt_ifa;  <em>/* the answer: interface to use */</em>    struct sockaddr *rt_genmask;
<em>/* for generation of cloned routes    */</em>    caddr_t rt_llinfo;  <em>/* pointer to link
level info cache */</em>    struct rt_metrics rt_rmx; <em>/* metrics used by rx'ing protocols
*/</em> short rt_idle;  <em>/* easy to tell llayer still live */</em> }; <em>/* * Flags */</em>
#define <strong>RTF_UP</strong>  0x1  <em>/* route useable */</em> #define
<strong>RTF_GATEWAY</strong> 0x2  <em>/* destination is a gateway */</em> #define
<strong>RTF_HOST</strong> 0x4  <em>/* host entry (net otherwise) */</em> #define
<strong>RTF_REJECT</strong> 0x8  <em>/* host or net unreachable */</em> #define
<strong>RTF_DYNAMIC</strong> 0x10  <em>/* created dynamically (by redirect) */</em>
#define <strong>RTF_MODIFIED</strong> 0x20  <em>/* modified dynamically (by redirect)
*/</em> #define <strong>RTF_DONE</strong> 0x40  <em>/* message confirmed */</em>
#define <strong>RTF_MASK</strong> 0x80  <em>/* subnet mask present */</em> #define
<strong>RTF_CLONING</strong> 0x100  <em>/* generate new routes on use */</em> #define
<strong>RTF_XRESOLVE</strong> 0x200  <em>/* external daemon resolves name */</em>
#define <strong>RTF_LLINFO</strong> 0x400  <em>/* generated by ARP or ESIS */</em>
<em>/* * Structures for routing messages. */</em> struct rt_msghdr { u_short rtm_msglen;
<em>/* to skip over non-understood messages */</em> u_char rtm_version; <em>/* future
binary compatability */</em> u_char rtm_type; <em>/* message type */</em> u_short
rtm_index; <em>/* index for associated ifp */</em> pid_t rtm_pid; <em>/* identify sender
*/</em> int rtm_addrs; <em>/* bitmask identifying sockaddrs in msg */</em> int rtm_seq;
<em>/* for sender to identify action */</em> int rtm_errno; <em>/* why failed */</em> int
rtm_flags; <em>/* flags, incl. kern & message, e.g. DONE */</em> int rtm_use; <em>/* from
rtentry */</em> u_long rtm_inits; <em>/* which metrics we are initializing */</em> struct
rt_metrics rtm_rmx;   <em>/* metrics themselves */</em> }; <em>/* * Message Types */</em>
#define <strong>RTM_ADD</strong>  0x1 <em>/* Add Route */</em> #define
<strong>RTM_DELETE</strong> 0x2 <em>/* Delete Route */</em> #define
<strong>RTM_CHANGE</strong> 0x3 <em>/* Change Metrics or flags */</em> #define
<strong>RTM_GET</strong>  0x4 <em>/* Report Metrics */</em> #define
<strong>RTM_LOSING</strong> 0x5 <em>/* Kernel Suspects Partitioning */</em> #define
<strong>RTM_REDIRECT</strong> 0x6 <em>/* Told to use different route */</em> #define
<strong>RTM_MISS</strong> 0x7 <em>/* Lookup failed on this address */</em> #define
<strong>RTM_LOCK</strong> 0x8 <em>/* fix specified metrics */</em> #define
<strong>RTM_OLDADD</strong> 0x9 <em>/* caused by SIOCADDRT */</em> #define
<strong>RTM_OLDDEL</strong> 0xa <em>/* caused by SIOCDELRT */</em> #define
<strong>RTM_RESOLVE</strong> 0xb <em>/* req to resolve dst to LL addr */</em> <em>/*
* Bits for identifying trailing or optional sockaddrs. */</em> #define
<strong>RTA_DST</strong>  0x1 <em>/* destination sockaddr present */</em> #define
<strong>RTA_GATEWAY</strong> 0x2 <em>/* gateway sockaddr present */</em> #define
<strong>RTA_NETMASK</strong> 0x4 <em>/* netmask sockaddr present */</em> #define
<strong>RTA_GENMASK</strong> 0x8 <em>/* cloning mask sockaddr present */</em>
#define <strong>RTA_IFP</strong>  0x10 <em>/* interface name sockaddr present */</em>
#define <strong>RTA_IFA</strong>  0x20 <em>/* interface addr sockaddr present */</em>
#define <strong>RTA_AUTHOR</strong> 0x40 <em>/* sockaddr for author of redirect
*/</em> </code></pre> </html>:::