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