updates. New data types.
[silc.git] / apps / silcd / idlist.h
index 57eb1d065931097edb11aa24c067e18aed12423a..eff107b6aae2d84327a9792653dd3ffee5713a90 100644 (file)
@@ -33,6 +33,13 @@ typedef struct {
   void *timeout_queue;
 } *SilcIDListPurge;
 
+/* Channel key re-key context. */
+typedef struct {
+  void *context;
+  SilcChannelEntry channel;
+  uint32 key_len;
+} *SilcServerChannelRekey;
+
 /*
    Generic ID list data structure.
 
@@ -57,7 +64,7 @@ typedef struct {
   /* HMAC and raw key data */
   SilcHmac hmac;
   unsigned char *hmac_key;
-  unsigned int hmac_key_len;
+  uint32 hmac_key_len;
 
   /* public key */
   SilcPublicKey public_key;
@@ -159,7 +166,7 @@ struct SilcServerEntryStruct {
 
        Pointer to the client list. This is the client currently on channel.
 
-   unsigned int mode
+   uint32 mode
 
        Client's current mode on the channel.
 
@@ -180,7 +187,7 @@ struct SilcServerEntryStruct {
 */
 typedef struct SilcChannelClientEntryStruct {
   SilcClientEntry client;
-  unsigned int mode;
+  uint32 mode;
   SilcChannelEntry channel;
   struct SilcChannelClientEntryStruct *client_list;
   struct SilcChannelClientEntryStruct *channel_list;
@@ -326,7 +333,7 @@ struct SilcClientEntryStruct {
 
        Logical name of the channel.
 
-   unsigned int mode
+   uint32 mode
 
        Current mode of the channel.  See lib/silccore/silcchannel.h for
        all modes.
@@ -363,7 +370,7 @@ struct SilcClientEntryStruct {
    SilcPublicKey founder_key
    SilcAuthMethod founder_method
    unsigned char *founder_passwd
-   unsigned int founder_passwd_len
+   uint32 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
@@ -381,7 +388,7 @@ struct SilcClientEntryStruct {
        The key of the channel (the cipher actually).
 
    unsigned char *key
-   unsigned int key_len
+   uint32 key_len
 
        Raw key data of the channel key.
 
@@ -394,10 +401,14 @@ struct SilcClientEntryStruct {
 
        HMAC of the channel.
 
+   SilcServerChannelRekey rekey
+
+       Channel key re-key context.
+
 */
 struct SilcChannelEntryStruct {
   char *channel_name;
-  unsigned int mode;
+  uint32 mode;
   SilcChannelID *id;
   int global_users;
   char *topic;
@@ -407,9 +418,9 @@ struct SilcChannelEntryStruct {
   SilcPublicKey founder_key;
   SilcAuthMethod founder_method;
   unsigned char *founder_passwd;
-  unsigned int founder_passwd_len;
+  uint32 founder_passwd_len;
 
-  unsigned int user_limit;
+  uint32 user_limit;
   unsigned char *passphrase;
   char *invite_list;
   char *ban_list;
@@ -423,9 +434,11 @@ struct SilcChannelEntryStruct {
   /* Channel keys */
   SilcCipher channel_key;
   unsigned char *key;
-  unsigned int key_len;
+  uint32 key_len;
   unsigned char iv[SILC_CIPHER_MAX_IV_SIZE];
   SilcHmac hmac;
+
+  SilcServerChannelRekey rekey;
 };
 
 /* 
@@ -507,20 +520,21 @@ silc_idlist_find_server_by_conn(SilcIDList id_list, char *hostname,
 SilcServerEntry
 silc_idlist_replace_server_id(SilcIDList id_list, SilcServerID *old_id,
                              SilcServerID *new_id);
-void silc_idlist_del_server(SilcIDList id_list, SilcServerEntry entry);
+int silc_idlist_del_server(SilcIDList id_list, SilcServerEntry entry);
 SilcClientEntry
 silc_idlist_add_client(SilcIDList id_list, unsigned char *nickname, 
-                      unsigned int nickname_len, char *username, 
+                      uint32 nickname_len, char *username, 
                       char *userinfo, SilcClientID *id, 
                       SilcServerEntry router, void *connection);
 int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry);
-SilcClientEntry *
-silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
-                                   char *server, unsigned int *clients_count);
-SilcClientEntry *
-silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
-                               SilcHash md5hash,
-                               unsigned int *clients_count);
+int silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
+                                       char *server, 
+                                       SilcClientEntry **clients,
+                                       uint32 *clients_count);
+int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
+                                   SilcHash md5hash,
+                                   SilcClientEntry **clients,
+                                   uint32 *clients_count);
 SilcClientEntry
 silc_idlist_find_client_by_hash(SilcIDList id_list, char *nickname,
                                SilcHash md5hash, SilcIDCacheEntry *ret_entry);
@@ -548,6 +562,6 @@ silc_idlist_replace_channel_id(SilcIDList id_list, SilcChannelID *old_id,
                               SilcChannelID *new_id);
 SilcChannelEntry *
 silc_idlist_get_channels(SilcIDList id_list, SilcChannelID *channel_id,
-                        unsigned int *channels_count);
+                        uint32 *channels_count);
 
 #endif