Merged silc_1_0_branch to trunk.
[silc.git] / apps / silcd / serverconfig.h
index 2af85bbd8618fffb7ed540cfd335dd213d5a7f96..2104976ed3e87275c5c485ab67a941d792cd930f 100644 (file)
@@ -2,9 +2,9 @@
 
   serverconfig.h
 
-  Author: Johnny Mnemonic <johnny@themnemonic.org>
+  Author: Giovanni Giacobbi <giovanni@giacobbi.net>
 
-  Copyright (C) 1997 - 2002 Johnny Mnemonic
+  Copyright (C) 1997 - 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
@@ -49,10 +49,16 @@ typedef struct SilcServerConfigPkcsStruct {
   struct SilcServerConfigPkcsStruct *next;
 } SilcServerConfigPkcs;
 
-typedef struct SilcServerConfigServerInfoStruct {
-  char *server_name;
+typedef struct SilcServerConfigServerInfoInterfaceStruct {
   char *server_ip;
   SilcUInt16 port;
+  struct SilcServerConfigServerInfoInterfaceStruct *next;
+} SilcServerConfigServerInfoInterface;
+
+typedef struct SilcServerConfigServerInfoStruct {
+  char *server_name;
+  SilcServerConfigServerInfoInterface *primary;
+  SilcServerConfigServerInfoInterface *secondary;
   char *server_type;   /* E.g. "Test Server" */
   char *location;      /* geographic location */
   char *admin;         /* admin full name */
@@ -72,17 +78,26 @@ typedef struct SilcServerConfigLoggingStruct {
 
 /* Connection parameters */
 typedef struct SilcServerConfigConnParams {
+  struct SilcServerConfigConnParams *next;
   char *name;
+  char *version_protocol;
+  char *version_software;
+  char *version_software_vendor;
   SilcUInt32 connections_max;
   SilcUInt32 connections_max_per_host;
   SilcUInt32 keepalive_secs;
   SilcUInt32 reconnect_count;
   SilcUInt32 reconnect_interval;
   SilcUInt32 reconnect_interval_max;
-  bool reconnect_keep_trying;
   SilcUInt32 key_exchange_rekey;
-  bool key_exchange_pfs;
-  struct SilcServerConfigConnParams *next;
+  SilcUInt32 qos_rate_limit;
+  SilcUInt32 qos_bytes_limit;
+  SilcUInt32 qos_limit_sec;
+  SilcUInt32 qos_limit_usec;
+  unsigned int key_exchange_pfs      : 1;
+  unsigned int reconnect_keep_trying : 1;
+  unsigned int anonymous             : 1;
+  unsigned int qos                   : 1;
 } SilcServerConfigConnParams;
 
 /* Holds all client authentication data from config file */
@@ -119,7 +134,6 @@ typedef struct SilcServerConfigServerStruct {
   unsigned char *passphrase;
   SilcUInt32 passphrase_len;
   SilcHashTable publickeys;
-  char *version;
   SilcServerConfigConnParams *param;
   bool backup_router;
   struct SilcServerConfigServerStruct *next;
@@ -132,7 +146,6 @@ typedef struct SilcServerConfigRouterStruct {
   SilcUInt32 passphrase_len;
   SilcHashTable publickeys;
   SilcUInt16 port;
-  char *version;
   SilcServerConfigConnParams *param;
   bool initiator;
   bool backup_router;
@@ -146,6 +159,9 @@ typedef struct SilcServerConfigRouterStruct {
 typedef struct {
   void *tmp;
 
+  /* Reference count (when this reaches zero, config object is destroyed) */
+  SilcInt32 refcount;
+
   /* The General section */
   char *module_path;
   bool prefer_passphrase_auth;
@@ -154,6 +170,12 @@ typedef struct {
   SilcUInt32 key_exchange_timeout;
   SilcUInt32 conn_auth_timeout;
   SilcServerConfigConnParams param;
+  bool detach_disabled;
+  SilcUInt32 detach_timeout;
+  bool logging_timestamp;
+  bool logging_quick;
+  long logging_flushdelay;
+  char *debug_string;
 
   /* Other configuration sections */
   SilcServerConfigCipher *cipher;
@@ -173,11 +195,19 @@ typedef struct {
   SilcServerConfigRouter *routers;
 } *SilcServerConfig;
 
+typedef struct {
+  SilcServerConfig config;
+  void *ref_ptr;
+} SilcServerConfigRef;
+
 /* Prototypes */
 
 /* Basic config operations */
-SilcServerConfig silc_server_config_alloc(char *filename);
+SilcServerConfig silc_server_config_alloc(const char *filename);
 void silc_server_config_destroy(SilcServerConfig config);
+void silc_server_config_ref(SilcServerConfigRef *ref, SilcServerConfig config,
+                           void *ref_ptr);
+void silc_server_config_unref(SilcServerConfigRef *ref);
 
 /* Algorithm registering and reset functions */
 bool silc_server_config_register_ciphers(SilcServer server);
@@ -190,7 +220,7 @@ void silc_server_config_setlogfiles(SilcServer server);
 SilcServerConfigClient *
 silc_server_config_find_client(SilcServer server, char *host);
 SilcServerConfigAdmin *
-silc_server_config_find_admin(SilcServer server, char *host, char *user, 
+silc_server_config_find_admin(SilcServer server, char *host, char *user,
                              char *nick);
 SilcServerConfigDeny *
 silc_server_config_find_denied(SilcServer server, char *host);
@@ -198,9 +228,12 @@ SilcServerConfigServer *
 silc_server_config_find_server_conn(SilcServer server, char *host);
 SilcServerConfigRouter *
 silc_server_config_find_router_conn(SilcServer server, char *host, int port);
+SilcServerConfigRouter *
+silc_server_config_find_backup_conn(SilcServer server, char *host);
 bool silc_server_config_is_primary_route(SilcServer server);
 SilcServerConfigRouter *
 silc_server_config_get_primary_router(SilcServer server);
-bool silc_server_config_set_defaults(SilcServer server);
+SilcServerConfigRouter *
+silc_server_config_get_backup_router(SilcServer server);
 
 #endif /* !SERVERCONFIG_H */