Merged silc_1_0_branch to trunk.
[silc.git] / apps / silcd / route.c
index f166075aaf1781857ab1dd8fb8e26f7c43c89c49..5488bb315659a5417fbaf692ecbf5ae8b065e807 100644 (file)
@@ -2,9 +2,9 @@
 
   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
@@ -40,7 +40,7 @@ SilcServerRouteTable silc_route_cache[SILC_SERVER_ROUTE_SIZE];
 /* 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(uint32 index, unsigned int dest,
+void silc_server_route_add(SilcUInt32 index, unsigned int dest,
                           SilcServerEntry router)
 {
   silc_route_cache[index].dest = dest;
@@ -50,10 +50,10 @@ void silc_server_route_add(uint32 index, unsigned int dest,
 /* Checksk whether destination has a specific router. Returns the
    router data if found, NULL otherwise. */
 
-SilcServerEntry silc_server_route_check(uint32 dest, 
-                                       uint16 port)
+SilcServerEntry silc_server_route_check(SilcUInt32 dest, 
+                                       SilcUInt16 port)
 {
-  uint32 index;
+  SilcUInt32 index;
 
   index = silc_server_route_hash(dest, port);
 
@@ -72,9 +72,10 @@ SilcSocketConnection silc_server_route_get(SilcServer server, void *id,
                                           SilcIdType id_type)
 {
   if (server->server_type == SILC_ROUTER) {
-    uint32 dest;
-    uint16 port;
+    SilcUInt32 dest = 0;
+    SilcUInt16 port = 0;
     SilcServerEntry router = NULL;
+#if 0
 
     switch(id_type) {
     case SILC_ID_CLIENT:
@@ -93,12 +94,14 @@ SilcSocketConnection silc_server_route_get(SilcServer server, void *id,
       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 (SilcSocketConnection)router->connection;
   }
 
-  return (SilcSocketConnection)server->id_entry->router->connection;
+  return (server->id_entry->router) 
+       ? (SilcSocketConnection)server->id_entry->router->connection
+       : NULL;
 }