Annotation of kernel/bsd/netat/h/at_ddp_brt.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: 
                     26: /*
                     27:  *     Copyright (c) 1988, 1989 Apple Computer, Inc. 
                     28:  *
                     29:  *     The information contained herein is subject to change without
                     30:  *     notice and  should not be  construed as a commitment by Apple
                     31:  *     Computer, Inc. Apple Computer, Inc. assumes no responsibility
                     32:  *     for any errors that may appear.
                     33:  *
                     34:  *     Confidential and Proprietary to Apple Computer, Inc.
                     35:  */
                     36: 
                     37: /* "@(#)at_ddp_brt.h: 2.0, 1.7; 10/4/93; Copyright 1988-89, Apple Computer, Inc." */
                     38: 
                     39: typedef struct {
                     40:        int                     age_flag;
                     41:        at_if_t                 *ifID;
                     42:        union   {
                     43:                struct  etalk_addr      addr1;
                     44:                struct  atalk_addr      addr2;
                     45:        } addrs;
                     46:        at_net_al                       net;
                     47: #define et_addr        addrs.addr1
                     48: #define at_addr        addrs.addr2
                     49: } ddp_brt_t;
                     50: 
                     51: #define BRT_SWEEP_INT          10
                     52: #define        BRT_BSIZ                 4      /* bucket size */
                     53: #define        BRT_NB                  16      /* number of buckets */
                     54: #define        BRTSIZE                 (BRT_BSIZ * BRT_NB)
                     55: 
                     56: /* age_flag values */
                     57: #define        BRT_EMPTY               0       /* the BRT entry is empty     */
                     58:                                        /* (or aged out).             */
                     59: #define        BRT_VALID               1       /* BRT entry contains valid   */
                     60:                                        /* tuple                      */
                     61: #define        BRT_GETTING_OLD         2       /* BRT entry is a candidate   */
                     62:                                        /* for aging                  */
                     63: 
                     64: #define        BRT_HASH(a)   ((a) % BRT_NB)
                     65: 
                     66: #define        BRT_LOOK(brt, dst_net) {                                \
                     67:        register n;                                             \
                     68:        brt = &at_ddp_brt[BRT_HASH(dst_net) * BRT_BSIZ];        \
                     69:        for (n = 0 ; ; brt++) {                                 \
                     70:                if (brt->net == dst_net)                        \
                     71:                        break;                                  \
                     72:                if (++n >= BRT_BSIZ) {                          \
                     73:                        brt = NULL;                             \
                     74:                        break;                                  \
                     75:                }                                               \
                     76:        }                                                       \
                     77:        }
                     78: 
                     79: #define        NEW_BRT(brt, net) {                                     \
                     80:        register n;                                             \
                     81:        brt = &at_ddp_brt[BRT_HASH(net) * BRT_BSIZ];            \
                     82:        for (n = 0 ; ; brt++) {                                 \
                     83:                if (brt->age_flag == BRT_EMPTY)                 \
                     84:                        break;                                  \
                     85:                if (++n >= BRT_BSIZ) {                          \
                     86:                        brt = NULL;                             \
                     87:                        break;                                  \
                     88:                }                                               \
                     89:         }                                                       \
                     90:        }
                     91: 
                     92: /* Best Router Cache */
                     93: extern ddp_brt_t       at_ddp_brt[BRTSIZE];
                     94: 
                     95: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.