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