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.
21 * Route cache routines. Server uses these to route packets to specific
22 * routes. If route entry doesn't exist for a specific destination, server
23 * uses primary route (default route).
28 * Revision 1.1 2000/06/27 11:36:56 priikone
34 #include "serverincludes.h"
37 /* Route cache hash table */
38 SilcServerRouteTable silc_route_cache[SILC_SERVER_ROUTE_SIZE];
40 /* Adds new route to the route cache. The argument `index' is the
41 index value generated by silc_server_route_hash. */
43 void silc_server_route_add(unsigned int index, unsigned int dest,
44 SilcServerList *router)
46 silc_route_cache[index].dest = dest;
47 silc_route_cache[index].router = router;
50 /* Checksk whether destination has a specific router. Returns the
51 router data if found, NULL otherwise. */
53 SilcServerList *silc_server_route_check(unsigned int dest,
58 index = silc_server_route_hash(dest, port);
60 if (silc_route_cache[index].router != NULL &&
61 silc_route_cache[index].dest == dest)
62 return silc_route_cache[index].router;