5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
26 /* Size of the route cache hash table */
27 #define SILC_SERVER_ROUTE_SIZE 256
30 SILC Server Route table
32 Following short description of the fields.
36 Destination IPv4 address. Can be used to quickly check whether
37 the found route entry is what the caller wanted.
39 SilcServerEntry router
41 Pointer to the router specific data.
46 SilcServerEntry router;
47 } SilcServerRouteTable;
49 /* Route cache hash table */
50 extern SilcServerRouteTable silc_route_cache[SILC_SERVER_ROUTE_SIZE];
52 /* Macros and super macros */
54 /* Returns route cache hash table entry index. This is IPv4 specific.
55 `port' argument may be zero (0) if it doesn't exist. This has been
56 taken from Linux kernel's route cache code. */
58 uint32 silc_server_route_hash(unsigned int addr,
63 hash = ((addr & 0xf0f0f0f0) >> 4) | ((addr & 0x0f0f0f0f) << 4);
72 void silc_server_route_add(uint32 index, unsigned int dest,
73 SilcServerEntry router);
74 SilcServerEntry silc_server_route_check(uint32 dest,
76 SilcSocketConnection silc_server_route_get(SilcServer server, void *id,