Support for SILC 1.2 INVITE and BAN commands. Client supports
[silc.git] / apps / silcd / idlist.h
index 9766921f6bccc33bd186a26f2e80d6153af8f0c1..ac67e10ad5a06cc950476c76f706d1d185828a78 100644 (file)
@@ -2,9 +2,9 @@
 
   idlist.h
 
-  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+  Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2001 Pekka Riikonen
+  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
@@ -30,13 +30,11 @@ typedef struct SilcChannelEntryStruct *SilcChannelEntry;
    the cache. */
 typedef struct {
   SilcIDCache cache;
-  SilcSchedule schedule;
   SilcUInt32 timeout;
 } *SilcIDListPurge;
 
 /* Channel key re-key context. */
 typedef struct {
-  void *context;
   SilcChannelEntry channel;
   SilcUInt32 key_len;
   SilcTask task;
@@ -54,14 +52,20 @@ typedef struct {
   void *context;
 } *SilcServerRekey;
 
-/* ID List Entry status type and all the types. */
+/* ID List Entry status flags. */
 typedef SilcUInt8 SilcIDListStatus;
-#define SILC_IDLIST_STATUS_NONE         0x00    /* No status */
-#define SILC_IDLIST_STATUS_REGISTERED   0x01    /* Entry is registered */
-#define SILC_IDLIST_STATUS_RESOLVED     0x02    /* Entry info is resolved */
-#define SILC_IDLIST_STATUS_RESOLVING    0x04    /* Entry is being resolved
-                                                  with WHOIS or IDENTIFY */
-#define SILC_IDLIST_STATUS_DISABLED     0x08    /* Entry is disabled */
+#define SILC_IDLIST_STATUS_NONE         0x00  /* No status */
+#define SILC_IDLIST_STATUS_REGISTERED   0x01  /* Entry is registered */
+#define SILC_IDLIST_STATUS_RESOLVED     0x02  /* Entry info is resolved */
+#define SILC_IDLIST_STATUS_RESOLVING    0x04  /* Entry is being resolved
+                                                with WHOIS or IDENTIFY */
+#define SILC_IDLIST_STATUS_DISABLED     0x08  /* Entry is disabled */
+#define SILC_IDLIST_STATUS_RESUMED      0x10  /* Entry is resumed */
+#define SILC_IDLIST_STATUS_LOCAL        0x20  /* Entry locally connected */
+#define SILC_IDLIST_STATUS_RESUME_RES   0x40  /* Entry resolved while
+                                                resuming */
+#define SILC_IDLIST_STATUS_NOATTR       0x80  /* Entry does not support
+                                                attributes in WHOIS */
 
 /*
    Generic ID list data structure.
@@ -343,6 +347,10 @@ struct SilcClientEntryStruct {
   long last_command;
   SilcUInt8 fast_command;
 
+  /* Requested Attributes */
+  unsigned char *attrs;
+  SilcUInt16 attrs_len;
+
   /* Pointer to the router */
   SilcServerEntry router;
 
@@ -352,6 +360,9 @@ struct SilcClientEntryStruct {
   /* Connection data */
   void *connection;
 
+  /* Last time updated/accessed */
+  unsigned long updated;
+
   /* data.status is RESOLVING and this includes the resolving command 
      reply identifier. */
   SilcUInt16 resolve_cmd_ident;
@@ -414,14 +425,10 @@ struct SilcClientEntryStruct {
        the cipher to be used. This can be set at SILC_COMMAND_JOIN.
 
    SilcPublicKey founder_key
-   SilcAuthMethod founder_method
-   unsigned char *founder_passwd
-   SilcUInt32 founder_passwd_len
 
-       If the SILC_CMODE_FOUNDER_AUTH has been set then these will include
-       the founder's public key, authentication method and the password
-       if the method is SILC_AUTH_PASSWORD.  If it is SILC_AUTH_PUBLIC_KEY
-       then the `founder_passwd' is NULL.
+       If the SILC_CMODE_FOUNDER_AUTH has been set then this will include
+       the founder's public key.  When the mode and this key is set the
+       channel is also permanent channel and cannot be destroyed.
 
    SilcHashTable user_list
 
@@ -462,20 +469,15 @@ struct SilcChannelEntryStruct {
   char *channel_name;
   SilcUInt32 mode;
   SilcChannelID *id;
-  bool global_users;
   char *topic;
   char *cipher;
   char *hmac_name;
-
   SilcPublicKey founder_key;
-  SilcAuthMethod founder_method;
-  unsigned char *founder_passwd;
-  SilcUInt32 founder_passwd_len;
 
   SilcUInt32 user_limit;
   unsigned char *passphrase;
-  char *invite_list;
-  char *ban_list;
+  SilcHashTable invite_list;
+  SilcHashTable ban_list;
 
   /* All users on this channel */
   SilcHashTable user_list;
@@ -488,13 +490,16 @@ struct SilcChannelEntryStruct {
   SilcCipher channel_key;
   unsigned char *key;
   SilcUInt32 key_len;
-  unsigned char iv[SILC_CIPHER_MAX_IV_SIZE];
   SilcHmac hmac;
 
   SilcServerChannelRekey rekey;
-
   unsigned long created;
-  bool disabled;
+  unsigned long updated;
+
+  /* Flags */
+  unsigned int global_users : 1;
+  unsigned int disabled : 1;
+  unsigned int users_resolved : 1;
 };
 
 /* 
@@ -596,8 +601,9 @@ SilcClientEntry
 silc_idlist_find_client_by_id(SilcIDList id_list, SilcClientID *id,
                              bool registered, SilcIDCacheEntry *ret_entry);
 SilcClientEntry
-silc_idlist_replace_client_id(SilcIDList id_list, SilcClientID *old_id,
-                             SilcClientID *new_id);
+silc_idlist_replace_client_id(SilcServer server,
+                             SilcIDList id_list, SilcClientID *old_id,
+                             SilcClientID *new_id, const char *nickname);
 void silc_idlist_client_destructor(SilcIDCache cache,
                                   SilcIDCacheEntry entry);
 SilcChannelEntry