updates.
[silc.git] / apps / silcd / serverconfig.h
index f06ab5796bab5d0fe8213d6824c7a457ec15e372..d2e0a40eccda21662a79e2d5532458d9ea6638f5 100644 (file)
 typedef struct SilcServerConfigCipherStruct {
   char *name;
   char *module;
-  uint32 key_length;
-  uint32 block_length;
+  SilcUInt32 key_length;
+  SilcUInt32 block_length;
   struct SilcServerConfigCipherStruct *next;
 } SilcServerConfigCipher;
 
 typedef struct SilcServerConfigHashStruct {
   char *name;
   char *module;
-  uint32 block_length;
-  uint32 digest_length;
+  SilcUInt32 block_length;
+  SilcUInt32 digest_length;
   struct SilcServerConfigHashStruct *next;
 } SilcServerConfigHash;
 
 typedef struct SilcServerConfigHmacStruct {
   char *name;
   char *hash;
-  uint32 mac_length;
+  SilcUInt32 mac_length;
   struct SilcServerConfigHmacStruct *next;
 } SilcServerConfigHmac;
 
@@ -52,7 +52,7 @@ typedef struct SilcServerConfigPkcsStruct {
 typedef struct SilcServerConfigServerInfoStruct {
   char *server_name;
   char *server_ip;
-  uint16 port;
+  SilcUInt16 port;
   char *server_type;   /* E.g. "Test Server" */
   char *location;      /* geographic location */
   char *admin;         /* admin full name */
@@ -67,21 +67,24 @@ typedef struct SilcServerConfigServerInfoStruct {
 
 typedef struct SilcServerConfigLoggingStruct {
   char *file;
-  uint32 maxsize;
+  SilcUInt32 maxsize;
 } SilcServerConfigLogging;
 
 /* Connection parameters */
 typedef struct SilcServerConfigConnParams {
   char *name;
-  uint32 connections_max;
-  uint32 connections_max_per_host;
-  uint32 keepalive_secs;
-  uint32 reconnect_count;
-  uint32 reconnect_interval;
-  uint32 reconnect_interval_max;
+  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;
-  uint32 key_exchange_rekey;
+  SilcUInt32 key_exchange_rekey;
   bool key_exchange_pfs;
+  char *version_protocol;
+  char *version_software;
+  char *version_software_vendor;
   struct SilcServerConfigConnParams *next;
 } SilcServerConfigConnParams;
 
@@ -89,8 +92,8 @@ typedef struct SilcServerConfigConnParams {
 typedef struct SilcServerConfigClientStruct {
   char *host;
   unsigned char *passphrase;
-  uint32 passphrase_len;
-  void *publickey;
+  SilcUInt32 passphrase_len;
+  SilcHashTable publickeys;
   SilcServerConfigConnParams *param;
   struct SilcServerConfigClientStruct *next;
 } SilcServerConfigClient;
@@ -101,8 +104,8 @@ typedef struct SilcServerConfigAdminStruct {
   char *user;
   char *nick;
   unsigned char *passphrase;
-  uint32 passphrase_len;
-  void *publickey;
+  SilcUInt32 passphrase_len;
+  SilcHashTable publickeys;
   struct SilcServerConfigAdminStruct *next;
 } SilcServerConfigAdmin;
 
@@ -117,8 +120,8 @@ typedef struct SilcServerConfigDenyStruct {
 typedef struct SilcServerConfigServerStruct {
   char *host;
   unsigned char *passphrase;
-  uint32 passphrase_len;
-  void *publickey;
+  SilcUInt32 passphrase_len;
+  SilcHashTable publickeys;
   char *version;
   SilcServerConfigConnParams *param;
   bool backup_router;
@@ -129,15 +132,15 @@ typedef struct SilcServerConfigServerStruct {
 typedef struct SilcServerConfigRouterStruct {
   char *host;
   unsigned char *passphrase;
-  uint32 passphrase_len;
-  void *publickey;
-  uint16 port;
+  SilcUInt32 passphrase_len;
+  SilcHashTable publickeys;
+  SilcUInt16 port;
   char *version;
   SilcServerConfigConnParams *param;
   bool initiator;
   bool backup_router;
   char *backup_replace_ip;
-  uint16 backup_replace_port;
+  SilcUInt16 backup_replace_port;
   bool backup_local;
   struct SilcServerConfigRouterStruct *next;
 } SilcServerConfigRouter;
@@ -146,14 +149,19 @@ typedef struct SilcServerConfigRouterStruct {
 typedef struct {
   void *tmp;
 
+  /* Reference count (when this reaches zero, config object is destroyed) */
+  SilcUInt16 refcount;
+
   /* The General section */
   char *module_path;
   bool prefer_passphrase_auth;
   bool require_reverse_lookup;
-  uint32 channel_rekey_secs;
-  uint32 key_exchange_timeout;
-  uint32 conn_auth_timeout;
+  SilcUInt32 channel_rekey_secs;
+  SilcUInt32 key_exchange_timeout;
+  SilcUInt32 conn_auth_timeout;
   SilcServerConfigConnParams param;
+  bool logging_quick;
+  long logging_flushdelay;
 
   /* Other configuration sections */
   SilcServerConfigCipher *cipher;
@@ -173,11 +181,20 @@ 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(SilcServer server, 
+                                         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 +207,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);
@@ -201,6 +218,5 @@ silc_server_config_find_router_conn(SilcServer server, char *host, int port);
 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);
 
 #endif /* !SERVERCONFIG_H */