]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
ff6e181a A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
1c79356b | 12 | * |
ff6e181a A |
13 | * The Original Code and all software distributed under the License are |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
ff6e181a A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
1c79356b A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | /* | |
25 | * Copyright (c) 1988, 1989 Apple Computer, Inc. | |
26 | */ | |
27 | ||
28 | #ifndef _NETAT_AT_DDP_BRT_H_ | |
29 | #define _NETAT_AT_DDP_BRT_H_ | |
9bccf70c | 30 | #include <sys/appleapiopts.h> |
91447636 A |
31 | #ifdef KERNEL_PRIVATE |
32 | #ifdef __APPLE_API_OBSOLETE | |
1c79356b A |
33 | |
34 | typedef struct { | |
35 | int age_flag; | |
36 | at_ifaddr_t *ifID; | |
37 | struct etalk_addr et_addr; | |
38 | at_net_al net; | |
39 | } ddp_brt_t; | |
40 | ||
41 | #define BRT_SWEEP_INT (10 * PR_SLOWHZ) | |
42 | #define BRT_BSIZ 4 /* bucket size */ | |
43 | #define BRT_NB 16 /* number of buckets */ | |
44 | #define BRTSIZE (BRT_BSIZ * BRT_NB) | |
45 | ||
46 | /* age_flag values */ | |
47 | #define BRT_EMPTY 0 /* the BRT entry is empty */ | |
48 | /* (or aged out). */ | |
49 | #define BRT_VALID 1 /* BRT entry contains valid */ | |
50 | /* tuple */ | |
51 | #define BRT_GETTING_OLD 2 /* BRT entry is a candidate */ | |
52 | /* for aging */ | |
53 | ||
54 | #define BRT_HASH(a) ((a) % BRT_NB) | |
55 | ||
56 | #define BRT_LOOK(brt, dst_net) { \ | |
57 | register n; \ | |
58 | brt = &at_ddp_brt[BRT_HASH(dst_net) * BRT_BSIZ]; \ | |
59 | for (n = 0 ; ; brt++) { \ | |
60 | if (brt->net == dst_net) \ | |
61 | break; \ | |
62 | if (++n >= BRT_BSIZ) { \ | |
63 | brt = NULL; \ | |
64 | break; \ | |
65 | } \ | |
66 | } \ | |
67 | } | |
68 | ||
69 | #define NEW_BRT(brt, net) { \ | |
70 | register n; \ | |
71 | brt = &at_ddp_brt[BRT_HASH(net) * BRT_BSIZ]; \ | |
72 | for (n = 0 ; ; brt++) { \ | |
73 | if (brt->age_flag == BRT_EMPTY) \ | |
74 | break; \ | |
75 | if (++n >= BRT_BSIZ) { \ | |
76 | brt = NULL; \ | |
77 | break; \ | |
78 | } \ | |
79 | } \ | |
80 | } | |
81 | ||
82 | /* Best Router Cache */ | |
83 | extern ddp_brt_t at_ddp_brt[BRTSIZE]; | |
84 | ||
91447636 A |
85 | #endif /* __APPLE_API_OBSOLETE */ |
86 | #endif /* KERNEL_PRIVATE */ | |
1c79356b A |
87 | #endif /* _NETAT_AT_DDP_BRT_H_ */ |
88 |