updates.
[silc.git] / apps / silcd / idlist.h
index f701514bc7fd6314b7f61cc72bfbc0efd469b92b..bd526b9368ba5732f09953162312f6e7ad15724a 100644 (file)
@@ -30,7 +30,7 @@ typedef struct SilcChannelEntryStruct *SilcChannelEntry;
    the cache. */
 typedef struct {
   SilcIDCache cache;
-  void *timeout_queue;
+  SilcSchedule schedule;
 } *SilcIDListPurge;
 
 /* Channel key re-key context. */
@@ -38,6 +38,7 @@ typedef struct {
   void *context;
   SilcChannelEntry channel;
   uint32 key_len;
+  SilcTask task;
 } *SilcServerChannelRekey;
 
 /* Generic rekey context for connections */
@@ -52,15 +53,24 @@ typedef struct {
   void *context;
 } *SilcServerRekey;
 
+/* ID List Entry status type and all the types. */
+typedef uint8 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 */
+
 /*
    Generic ID list data structure.
 
    This structure is included in all ID list entries and it includes data
    pointers that are common to all ID entries.  This structure is always
    defined to the first field in the ID entries and is used to explicitly
-   cast to this type without first explicitly casting to correct ID entry
-   type.  Hence, the ID list entry is casted to this type to get this data
-   from the ID entry (which is usually opaque pointer).
+   type cast to this type without first explicitly casting to correct ID
+   entry type.  Hence, the ID list entry is type casted to this type to
+   get this data from the ID entry (which is usually opaque pointer).
 
    Note that some of the fields may be NULL.
 
@@ -83,9 +93,12 @@ typedef struct {
   /* Public key */
   SilcPublicKey public_key;
 
-  long last_receive;         /* Time last received data */
-  long last_sent;           /* Time last sent data */
-  bool registered;           /* Boolean whether connection is registered */
+  long last_receive;           /* Time last received data */
+  long last_sent;              /* Time last sent data */
+
+  unsigned long created;       /* Time when entry was created */
+
+  SilcIDListStatus status;     /* Status mask of the entry */
 } *SilcIDListData, SilcIDListDataStruct;
 
 /* 
@@ -301,6 +314,14 @@ typedef struct SilcChannelClientEntryStruct {
        but as just said, this is usually pointer to the socket connection
        list.
 
+   uint16 resolve_cmd_ident
+
+       Command identifier for the entry when the entry's data.status
+       is SILC_IDLIST_STATUS_RESOLVING.  If this entry is asked to be
+       resolved when the status is set then the resolver may attach to
+       this command identifier and handle the process after the resolving
+       is over.
+
 */
 struct SilcClientEntryStruct {
   /* Generic data structure. DO NOT add anything before this! */
@@ -324,6 +345,10 @@ struct SilcClientEntryStruct {
 
   /* Connection data */
   void *connection;
+
+  /* data.status is RESOLVING and this includes the resolving command 
+     reply identifier. */
+  uint16 resolve_cmd_ident;
 };
 
 /* 
@@ -460,6 +485,8 @@ struct SilcChannelEntryStruct {
   SilcHmac hmac;
 
   SilcServerChannelRekey rekey;
+
+  unsigned long created;
 };
 
 /* 
@@ -531,13 +558,14 @@ silc_idlist_add_server(SilcIDList id_list,
                       void *connection);
 SilcServerEntry
 silc_idlist_find_server_by_id(SilcIDList id_list, SilcServerID *id,
-                             SilcIDCacheEntry *ret_entry);
+                             bool registered, SilcIDCacheEntry *ret_entry);
 SilcServerEntry
 silc_idlist_find_server_by_name(SilcIDList id_list, char *name,
-                               SilcIDCacheEntry *ret_entry);
+                               bool registered, SilcIDCacheEntry *ret_entry);
 SilcServerEntry
 silc_idlist_find_server_by_conn(SilcIDList id_list, char *hostname,
-                               int port, SilcIDCacheEntry *ret_entry);
+                               int port, bool registered,
+                               SilcIDCacheEntry *ret_entry);
 SilcServerEntry
 silc_idlist_replace_server_id(SilcIDList id_list, SilcServerID *old_id,
                              SilcServerID *new_id);
@@ -557,7 +585,7 @@ int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
                                    uint32 *clients_count);
 SilcClientEntry
 silc_idlist_find_client_by_id(SilcIDList id_list, SilcClientID *id,
-                             SilcIDCacheEntry *ret_entry);
+                             bool registered, SilcIDCacheEntry *ret_entry);
 SilcClientEntry
 silc_idlist_replace_client_id(SilcIDList id_list, SilcClientID *old_id,
                              SilcClientID *new_id);