route.c
- Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+ Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2000 Pekka Riikonen
+ Copyright (C) 2000 - 2002 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Adds new route to the route cache. The argument `index' is the
index value generated by silc_server_route_hash. */
-void silc_server_route_add(unsigned int index, unsigned int dest,
+void silc_server_route_add(SilcUInt32 index, unsigned int dest,
SilcServerEntry router)
{
silc_route_cache[index].dest = dest;
/* Checksk whether destination has a specific router. Returns the
router data if found, NULL otherwise. */
-SilcServerEntry silc_server_route_check(unsigned int dest,
- unsigned short port)
+SilcServerEntry silc_server_route_check(SilcUInt32 dest,
+ SilcUInt16 port)
{
- unsigned int index;
+ SilcUInt32 index;
index = silc_server_route_hash(dest, port);
If we are normal server then this just returns our primary route. If
we are router we will do route lookup. */
-SilcSocketConnection silc_server_route_get(SilcServer server, void *id,
+SilcPacketStream silc_server_route_get(SilcServer server, void *id,
SilcIdType id_type)
{
if (server->server_type == SILC_ROUTER) {
- unsigned int dest;
- unsigned short port;
+ SilcUInt32 dest = 0;
+ SilcUInt16 port = 0;
SilcServerEntry router = NULL;
+#if 0
switch(id_type) {
case SILC_ID_CLIENT:
return NULL;
}
- router = silc_server_route_check(dest, port);
- if (!router)
- return (SilcSocketConnection)server->id_entry->router->connection;
+#endif
- return (SilcSocketConnection)router->connection;
+ router = silc_server_route_check(dest, port);
+ if (router)
+ return router->connection;
}
- return (SilcSocketConnection)server->id_entry->router->connection;
+ return (server->id_entry->router)
+ ? server->id_entry->router->connection
+ : NULL;
}