tupdates
[silc.git] / apps / silcd / server.h
index 65ab966e51115a25809f265c020d6ecedb4d428c..9e626f5e3949bcdd4bf046bd8455a300e750b53b 100644 (file)
@@ -29,47 +29,6 @@ typedef struct SilcServerStruct *SilcServer;
 /* Forward declaration of backup server context */
 typedef struct SilcServerBackupStruct *SilcServerBackup;
 
-#define SILC_SERVER_MAX_CONNECTIONS 1000
-
-/* General definitions */
-
-/* SILC port */
-#define SILC_PORT 768;
-
-/* Server and router. Used internally by the code. */
-#define SILC_SERVER 0
-#define SILC_ROUTER 1
-#define SILC_BACKUP_ROUTER 2
-
-/* Connection retry timeout. We implement exponential backoff algorithm
-   in connection retry. The interval of timeout grows when retry count
-   grows. */
-#define SILC_SERVER_RETRY_COUNT        7        /* Max retry count */
-#define SILC_SERVER_RETRY_MULTIPLIER   2        /* Interval growth */
-#define SILC_SERVER_RETRY_RANDOMIZER   2        /* timeout += rnd % 2 */
-#define SILC_SERVER_RETRY_INTERVAL_MIN 10       /* Min retry timeout */
-#define SILC_SERVER_RETRY_INTERVAL_MAX 600      /* Max generated timeout */
-
-/* 
-   Silc Server Params.
-
-   Structure to hold various default parameters for server that can be
-   given before running the server. 
-
-*/
-typedef struct {
-  uint32 retry_count;
-  uint32 retry_interval_min;
-  uint32 retry_interval_min_usec;
-  uint32 retry_interval_max;
-  char retry_keep_trying;
-
-  uint32 protocol_timeout;
-  uint32 protocol_timeout_usec;
-
-  char require_reverse_mapping;
-} *SilcServerParams;
-
 /* Callback function that is called after the key exchange and connection
    authentication protocols has been completed with a remote router. The
    `server_entry' is the remote router entry. */
@@ -77,6 +36,7 @@ typedef void (*SilcServerConnectRouterCallback)(SilcServer server,
                                                SilcServerEntry server_entry,
                                                void *context);
 
+/* Connection structure used when connection to remote */
 typedef struct {
   SilcSocketConnection sock;
 
@@ -87,7 +47,11 @@ typedef struct {
   char *backup_replace_ip;
   int backup_replace_port;
   bool no_reconnect;
-  
+
+  /* Connection configuration (maybe NULL), and connection params */
+  void *conn;
+  void *param;
+
   /* Current connection retry info */
   uint32 retry_count;
   uint32 retry_timeout;
@@ -99,6 +63,35 @@ typedef struct {
   void *callback_context;
 } *SilcServerConnection;
 
+/* General definitions */
+
+/* SILC port */
+#define SILC_PORT 768;
+
+/* Server and router. Used internally by the code. */
+#define SILC_SERVER 0
+#define SILC_ROUTER 1
+#define SILC_BACKUP_ROUTER 2
+
+/* Default parameter values */
+
+/* Connection retry timeout. We implement exponential backoff algorithm
+   in connection retry. The interval of timeout grows when retry count
+   grows. */
+#define SILC_SERVER_RETRY_COUNT        7        /* Max retry count */
+#define SILC_SERVER_RETRY_MULTIPLIER   2        /* Interval growth */
+#define SILC_SERVER_RETRY_RANDOMIZER   2        /* timeout += rnd % 2 */
+#define SILC_SERVER_RETRY_INTERVAL_MIN 10       /* Min retry timeout */
+#define SILC_SERVER_RETRY_INTERVAL_MAX 600      /* Max generated timeout */
+
+#define SILC_SERVER_KEEPALIVE          300      /* Heartbeat interval */
+#define SILC_SERVER_CHANNEL_REKEY      3600     /* Channel rekey interval */
+#define SILC_SERVER_REKEY              3600     /* Session rekey interval */
+#define SILC_SERVER_SKE_TIMEOUT        60       /* SKE timeout */
+#define SILC_SERVER_CONNAUTH_TIMEOUT   60       /* CONN_AUTH timeout */
+#define SILC_SERVER_MAX_CONNECTIONS    1000     /* Max connections */
+#define SILC_SERVER_MAX_CONNECTIONS_SINGLE 1000  /* Max connections per host */
+
 /* Macros */
 
 /* This macro is used to send notify messages with formatted string. The