updates.
[silc.git] / lib / silcclient / client.h
index f7c6e3314b34294e0d87ba6c2356d67222f73fa0..d919965482cab898a8c8141221793611e9bfe99c 100644 (file)
@@ -70,12 +70,13 @@ struct SilcClientConnectionStruct {
   /*
    * Common data 
    */
-  /* Keys */
+  /* Keys and stuff negotiated in the SKE protocol */
   SilcCipher send_key;
   SilcCipher receive_key;
   SilcHmac hmac;
   unsigned char *hmac_key;
   unsigned int hmac_key_len;
+  SilcHash hash;
 
   /* Client ID and Channel ID cache. Messages transmitted in SILC network
      are done using different unique ID's. These are the cache for
@@ -152,6 +153,13 @@ struct SilcClientStruct {
   SilcClientConnection *conns;
   unsigned int conns_count;
 
+  /* Table of listenning sockets in client.  Client can have listeners
+     (like key agreement protocol server) and those sockets are saved here.
+     This table is checked always if the connection object cannot be found
+     from the `conns' table. */
+  SilcSocketConnection *sockets;
+  unsigned int sockets_count;
+
   /* Generic cipher and hash objects. These can be used and referenced
      by the application as well. */
   SilcCipher none_cipher;
@@ -197,12 +205,18 @@ do {                                                      \
   int __i;                                             \
                                                        \
   for (__i = 0; __i < (__x)->conns_count; __i++)       \
-    if ((__x)->conns[__i]->sock->sock == (__fd))       \
+    if ((__x)->conns[__i] &&                           \
+       (__x)->conns[__i]->sock->sock == (__fd))        \
       break;                                           \
                                                        \
-  if (__i >= (__x)->conns_count)                       \
+  if (__i >= (__x)->conns_count) {                     \
     (__sock) = NULL;                                   \
- (__sock) = (__x)->conns[__i]->sock;                   \
+    for (__i = 0; __i < (__x)->sockets_count; __i++)   \
+      if ((__x)->sockets[__i] &&                       \
+         (__x)->sockets[__i]->sock == (__fd))          \
+        (__sock) = (__x)->sockets[__i];                        \
+  } else                                               \
+    (__sock) = (__x)->conns[__i]->sock;                        \
 } while(0)
 
 /* Prototypes (some of the prototypes are defined in the silcapi.h) */
@@ -247,7 +261,7 @@ void silc_client_replace_from_channels(SilcClient client,
                                       SilcClientConnection conn,
                                       SilcClientEntry old,
                                       SilcClientEntry new);
-char *silc_client_chmode(unsigned int mode);
+char *silc_client_chmode(unsigned int mode, SilcChannelEntry channel);
 char *silc_client_chumode(unsigned int mode);
 char *silc_client_chumode_char(unsigned int mode);
 void silc_client_process_failure(SilcClient client,