updates.
[silc.git] / lib / silcclient / silcclient.h
index 231347173198f1e0509527e17bf0208ee2a2c55e..928650c788e8bfff98e8dd81c6b9bbec974bf0ad 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silcclient/SilcClientAPI
+/****h* silcclient/Client Library Interface
  *
  * DESCRIPTION
  *
@@ -68,7 +68,6 @@ typedef struct SilcClientCommandStruct *SilcClientCommand;
 typedef struct SilcClientCommandContextStruct *SilcClientCommandContext;
 typedef struct SilcClientCommandReplyContextStruct 
                                            *SilcClientCommandReplyContext;
-typedef struct SilcChannelPrivateKeyStruct *SilcChannelPrivateKey;
 typedef struct SilcChannelUserStruct *SilcChannelUser;
 
 /* General definitions */
@@ -146,28 +145,51 @@ typedef struct {
                                         provided it. This is NULL if the
                                         library generated the key or if
                                         the SKE key material was used. */
-  uint32 key_len;                    /* The key length */
+  SilcUInt32 key_len;                /* The key length */
 } *SilcPrivateMessageKeys;
 /***/
 
+/****s* silcclient/SilcClientAPI/SilcChannelPrivateKey
+ *
+ * NAME
+ *
+ *    typedef struct { ... } SilcChannelPrivateKey;
+ *
+ * DESCRIPTION
+ *
+ *    Structure to hold one channel private key. The array of this structure
+ *    is returned by silc_client_list_channel_private_keys function.
+ *
+ * SOURCE
+ */
+typedef struct SilcChannelPrivateKeyStruct {
+  char *name;                        /* Application given name */
+  SilcCipher cipher;                 /* The cipher and key */
+  SilcHmac hmac;                     /* The HMAC and hmac key */
+  unsigned char *key;                /* The key data */
+  SilcUInt32 key_len;                /* The key length */
+} *SilcChannelPrivateKey;
+/***/
 
 /****f* silcclient/SilcClientAPI/SilcAskPassphrase
  *
  * SYNOPSIS
  *
  *    typedef void (*SilcAskPassphrase)(unsigned char *passphrase,
- *                                     uint32 passphrase_len,
+ *                                     SilcUInt32 passphrase_len,
  *                                     void *context);
  *
  * DESCRIPTION
  *
  *    Ask passphrase callback. This is called by the application when the
  *    library calls `ask_passphrase' client operation.  The callback delivers
- *    the passphrase to the library.
+ *    the passphrase to the library.  The passphrases in SILC protocol
+ *    MUST be in UTF-8 encoding, therefore the `passphrase' SHOULD be UTF-8
+ *    encoded, and if it is not then library will attempt to encode it.
  *
  ***/
 typedef void (*SilcAskPassphrase)(unsigned char *passphrase,
-                                 uint32 passphrase_len,
+                                 SilcUInt32 passphrase_len,
                                  void *context);
 
 /****f* silcclient/SilcClientAPI/SilcVerifyPublicKey
@@ -192,7 +214,7 @@ typedef void (*SilcVerifyPublicKey)(bool success, void *context);
  *    typedef void (*SilcGetAuthMeth)(bool success, 
  *                                    SilcProtocolAuthMeth auth_meth,
  *                                    const unsigned char *auth_data,
- *                                    uint32 auth_data_len, void *context);
+ *                                    SilcUInt32 auth_data_len, void *context);
  * 
  * DESCRIPTION
  *
@@ -209,7 +231,7 @@ typedef void (*SilcVerifyPublicKey)(bool success, void *context);
 typedef void (*SilcGetAuthMeth)(bool success, 
                                SilcProtocolAuthMeth auth_meth,
                                const unsigned char *auth_data,
-                               uint32 auth_data_len, void *context);
+                               SilcUInt32 auth_data_len, void *context);
 
 /****d* silcclient/SilcClientAPI/SilcClientMessageType
  *
@@ -232,6 +254,28 @@ typedef enum {
 } SilcClientMessageType;
 /***/
 
+/****d* silcclient/SilcClientAPI/SilcClientConnectionStatus
+ *
+ * NAME
+ *
+ *    typedef enum { ... } SilcClientConnectionStatus
+ *
+ * DESCRIPTION
+ *
+ *    This type is returned to the `connect' client operation to indicate
+ *    the status of the created connection.  It can indicated if it was
+ *    successful or whether an error occurred.
+ *
+ * SOURCE
+ */
+typedef enum {
+  SILC_CLIENT_CONN_SUCCESS,           /* Successfully connected */
+  SILC_CLIENT_CONN_SUCCESS_RESUME,     /* Successfully connected and
+                                         resumed old detached session */
+  SILC_CLIENT_CONN_ERROR,             /* Error occurred during connecting */
+} SilcClientConnectionStatus;
+/***/
+
 /****s* silcclient/SilcClientAPI/SilcClientOperations
  *
  * NAME
@@ -261,13 +305,16 @@ typedef struct {
      `msg' maybe NULL. */
   void (*channel_message)(SilcClient client, SilcClientConnection conn, 
                          SilcClientEntry sender, SilcChannelEntry channel, 
-                         SilcMessageFlags flags, char *msg);
+                         SilcMessageFlags flags,
+                         const unsigned char *message,
+                         SilcUInt32 message_len);
 
   /* Private message to the client. The `sender' is the sender of the
      message. */
   void (*private_message)(SilcClient client, SilcClientConnection conn,
                          SilcClientEntry sender, SilcMessageFlags flags,
-                         char *msg);
+                         const unsigned char *message,
+                         SilcUInt32 message_len);
 
   /* Notify message to the client. The notify arguments are sent in the
      same order as servers sends them. The arguments are same as received
@@ -307,17 +354,25 @@ typedef struct {
      the command reply status server returned. The `command' is the command
      reply being processed. The function has variable argument list and each
      command defines the number and type of arguments it passes to the
-     application (on error they are not sent). */
+     application (on error they are not sent).
+
+     The arguments are sent in the same order as servers sends them.  The 
+     arguments are same as received from the server except for ID's.  If 
+     ID is received application receives the corresponding entry to the 
+     ID. For example, if Client ID is receives application receives 
+     SilcClientEntry. */
   void (*command_reply)(SilcClient client, SilcClientConnection conn,
                        SilcCommandPayload cmd_payload, int success,
                        SilcCommand command, SilcCommandStatus status, ...);
 
   /* Called to indicate that connection was either successfully established
      or connecting failed.  This is also the first time application receives
-     the SilcClientConnection objecet which it should save somewhere.
-     If the `success' is FALSE the application must always call the function
+     the SilcClientConnection object which it should save somewhere.
+     The `status' indicated whether the connection were successful.  If it
+     is error value the application must always call the function
      silc_client_close_connection. */
-  void (*connect)(SilcClient client, SilcClientConnection conn, int success);
+  void (*connect)(SilcClient client, SilcClientConnection conn,
+                 SilcClientConnectionStatus status);
 
   /* Called to indicate that connection was disconnected to the server. */
   void (*disconnect)(SilcClient client, SilcClientConnection conn);
@@ -328,7 +383,7 @@ typedef struct {
      authentication method and authentication data is called. The `conn'
      may be NULL. */
   void (*get_auth_method)(SilcClient client, SilcClientConnection conn,
-                         char *hostname, uint16 port,
+                         char *hostname, SilcUInt16 port,
                          SilcGetAuthMeth completion, void *context);
 
   /* Verifies received public key. The `conn_type' indicates which entity
@@ -337,12 +392,13 @@ typedef struct {
      `completion' must be called after the public key has been verified. */
   void (*verify_public_key)(SilcClient client, SilcClientConnection conn,
                            SilcSocketType conn_type, unsigned char *pk, 
-                           uint32 pk_len, SilcSKEPKType pk_type,
+                           SilcUInt32 pk_len, SilcSKEPKType pk_type,
                            SilcVerifyPublicKey completion, void *context);
 
   /* Ask (interact, that is) a passphrase from user. The passphrase is
      returned to the library by calling the `completion' callback with
-     the `context'. */
+     the `context'. The returned passphrase SHOULD be in UTF-8 encoded,
+     if not then the library will attempt to encode. */
   void (*ask_passphrase)(SilcClient client, SilcClientConnection conn,
                         SilcAskPassphrase completion, void *context);
 
@@ -365,7 +421,7 @@ typedef struct {
      `completion' and `context' arguments must be set by the application. */
   int (*key_agreement)(SilcClient client, SilcClientConnection conn,
                       SilcClientEntry client_entry, const char *hostname,
-                      uint16 port, SilcKeyAgreementCallback *completion,
+                      SilcUInt16 port, SilcKeyAgreementCallback *completion,
                       void **context);
 
   /* Notifies application that file transfer protocol session is being
@@ -375,8 +431,28 @@ typedef struct {
      transfer request, by calling the silc_client_file_receive or
      silc_client_file_close, respectively. */
   void (*ftp)(SilcClient client, SilcClientConnection conn,
-             SilcClientEntry client_entry, uint32 session_id,
-             const char *hostname, uint16 port);
+             SilcClientEntry client_entry, SilcUInt32 session_id,
+             const char *hostname, SilcUInt16 port);
+
+  /* Delivers SILC session detachment data indicated by `detach_data' to the
+     application.  If application has issued SILC_COMMAND_DETACH command     
+     the client session in the SILC network is not quit.  The client remains 
+     in the network but is detached.  The detachment data may be used later
+     to resume the session in the SILC Network.  The appliation is   
+     responsible of saving the `detach_data', to for example in a file.
+
+     The detachment data can be given as argument to the functions
+     silc_client_connect_to_server, or silc_client_add_connection when
+     creating connection to remote server, inside SilcClientConnectionParams
+     structure.  If it is provided the client library will attempt to resume
+     the session in the network.  After the connection is created
+     successfully, the application is responsible of setting the user
+     interface for user into the same state it was before detaching (showing
+     same channels, channel modes, etc).  It can do this by fetching the
+     information (like joined channels) from the client library. */
+  void (*detach)(SilcClient client, SilcClientConnection conn,
+                const unsigned char *detach_data,
+                SilcUInt32 detach_data_len);
 } SilcClientOperations;
 /***/
 
@@ -501,7 +577,8 @@ typedef struct {
  *    the client. The `application' is application specific user data pointer
  *    and caller must free it. The `silc_version' is the application version
  *    that will be used to compare against remote host's (usually a server)
- *    version string.
+ *    version string.  The `application' context is accessible by the
+ *    application by client->application, client being SilcClient.
  *
  ***/
 SilcClient silc_client_alloc(SilcClientOperations *ops, 
@@ -590,12 +667,45 @@ void silc_client_stop(SilcClient client);
 
 /* Connecting functions (client.c) */
 
+/****s* silcclient/SilcClientAPI/SilcClientConnectionParams
+ *
+ * NAME
+ *
+ *    typedef struct { ... } SilcClientConnectionParams;
+ *
+ * DESCRIPTION
+ *
+ *    Client connection parameters.  This can be filled by the application
+ *    and given as argument to silc_client_connect_to_server or to
+ *    silc_client_add_connection.
+ *
+ * SOURCE
+ */
+typedef struct {
+  /* The SILC session detachment data that was returned by `detach' client
+     operation when the application detached from the network.  Application
+     is responsible of saving the data and giving it as argument here
+     for resuming the session in the SILC network.
+
+     If this is provided here the client library will attempt to resume
+     the session in the network.  After the connection is created
+     successfully, the application is responsible of setting the user
+     interface for user into the same state it was before detaching (showing
+     same channels, channel modes, etc).  It can do this by fetching the
+     information (like joined channels) from the client library. */
+  unsigned char *detach_data;
+  SilcUInt32 detach_data_len;
+
+} SilcClientConnectionParams;
+/***/
+
 /****f* silcclient/SilcClientAPI/silc_client_connect_to_server
  *
  * SYNOPSIS
  *
- *    int silc_client_connect_to_server(SilcClient client, int port,
- *                                      char *host, void *context);
+ *    int silc_client_connect_to_server(SilcClient client, 
+ *                                      SilcClientConnectionParams *params,
+ *                                      int port, char *host, void *context);
  *
  * DESCRIPTION
  *
@@ -605,20 +715,24 @@ void silc_client_stop(SilcClient client);
  *    that is created after the connection is created. Note that application
  *    may handle the connecting process outside the library. If this is the
  *    case then this function is not used at all. When the connecting is
- *    done the `connect' client operation is called.
+ *    done the `connect' client operation is called, and the `context' is
+ *    accessible with conn->context, conn being SilcClientConnection.
+ *    If the `params' is provided they are used by the routine.
  *
  ***/
-int silc_client_connect_to_server(SilcClient client, int port,
-                                 char *host, void *context);
+int silc_client_connect_to_server(SilcClient client, 
+                                 SilcClientConnectionParams *params,
+                                 int port, char *host, void *context);
 
 /****f* silcclient/SilcClientAPI/silc_client_add_connection
  *
  * SYNOPSIS
  *
- *    SilcClientConnection silc_client_add_connection(SilcClient client,
- *                                                    char *hostname,
- *                                                   int port,
- *                                                   void *context);
+ *
+ *    SilcClientConnection
+ *    silc_client_add_connection(SilcClient client,
+ *                               SilcClientConnectionParams *params,
+ *                               char *hostname, int port, void *context);
  *
  * DESCRIPTION
  *
@@ -626,15 +740,21 @@ int silc_client_connect_to_server(SilcClient client, int port,
  *    connection to the connection table and returns a pointer to it. A client
  *    can have multiple connections to multiple servers. Every connection must
  *    be added to the client using this function. User data `context' may
- *    be sent as argument. This function is normally used only if the 
- *    application performed the connecting outside the library. The library
+ *    be sent as argument.  If the `params' is provided they are used by 
+ *    the routine.
+ *
+ * NOTES
+ *
+ *    This function is normally used only if the application performed 
+ *    the connecting outside the library, and did not called the
+ *    silc_client_connect_to_server function at all. The library
  *    however may use this internally.
  *
  ***/
-SilcClientConnection silc_client_add_connection(SilcClient client,
-                                               char *hostname,
-                                               int port,
-                                               void *context);
+SilcClientConnection
+silc_client_add_connection(SilcClient client,
+                          SilcClientConnectionParams *params,
+                          char *hostname, int port, void *context);
 
 /****f* silcclient/SilcClientAPI/silc_client_del_connection
  *
@@ -700,8 +820,8 @@ void silc_client_del_socket(SilcClient client, SilcSocketConnection sock);
  *    directly if application is performing its own connecting and does not
  *    use the connecting provided by this library. This function is normally
  *    used only if the application performed the connecting outside the
- *    library. The library however may use this internally. Returns FALSE
- *    if the key exchange could not be started.
+ *    library. The library however may use this internally.  After the
+ *    key exchange is performed the `connect' client operation is called.
  *
  ***/
 void silc_client_start_key_exchange(SilcClient client,
@@ -713,22 +833,15 @@ void silc_client_start_key_exchange(SilcClient client,
  * SYNOPSIS
  *
  *    void silc_client_close_connection(SilcClient client,
- *                                      SilcSocketConnection sock,
  *                                      SilcClientConnection conn);
  *
  * DESCRIPTION
  *
  *    Closes connection to remote end. Free's all allocated data except
  *    for some information such as nickname etc. that are valid at all time. 
- *    If the `sock' is NULL then the conn->sock will be used.  If `sock' is
- *    provided it will be checked whether the sock and `conn->sock' are the
- *    same (they can be different, ie. a socket can use `conn' as its
- *    connection but `conn->sock' might be actually a different connection
- *    than the `sock'). 
  *
  ***/
 void silc_client_close_connection(SilcClient client,
-                                 SilcSocketConnection sock,
                                  SilcClientConnection conn);
 
 
@@ -744,7 +857,7 @@ void silc_client_close_connection(SilcClient client,
  *                                          SilcChannelPrivateKey key,
  *                                          SilcMessageFlags flags,
  *                                          unsigned char *data, 
- *                                          uint32 data_len, 
+ *                                          SilcUInt32 data_len, 
  *                                          int force_send);
  *
  * DESCRIPTION
@@ -769,7 +882,7 @@ void silc_client_send_channel_message(SilcClient client,
                                      SilcChannelPrivateKey key,
                                      SilcMessageFlags flags,
                                      unsigned char *data, 
-                                     uint32 data_len, 
+                                     SilcUInt32 data_len, 
                                      int force_send);
 
 /****f* silcclient/SilcClientAPI/silc_client_send_private_message
@@ -781,7 +894,7 @@ void silc_client_send_channel_message(SilcClient client,
  *                                          SilcClientEntry client_entry,
  *                                          SilcMessageFlags flags,
  *                                          unsigned char *data, 
- *                                          uint32 data_len, 
+ *                                          SilcUInt32 data_len, 
  *                                          int force_send);
  *
  * DESCRIPTION
@@ -800,7 +913,7 @@ void silc_client_send_private_message(SilcClient client,
                                      SilcClientEntry client_entry,
                                      SilcMessageFlags flags,
                                      unsigned char *data, 
-                                     uint32 data_len, 
+                                     SilcUInt32 data_len, 
                                      int force_send);
 
 
@@ -813,7 +926,7 @@ void silc_client_send_private_message(SilcClient client,
  *    typedef void (*SilcGetClientCallback)(SilcClient client,
  *                                          SilcClientConnection conn,
  *                                          SilcClientEntry *clients,
- *                                          uint32 clients_count,
+ *                                          SilcUInt32 clients_count,
  *                                          void *context);
  *
  * DESCRIPTION
@@ -827,7 +940,7 @@ void silc_client_send_private_message(SilcClient client,
 typedef void (*SilcGetClientCallback)(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientEntry *clients,
-                                     uint32 clients_count,
+                                     SilcUInt32 clients_count,
                                      void *context);
 
 /****f* silcclient/SilcClientAPI/silc_client_get_clients
@@ -872,7 +985,7 @@ void silc_client_get_clients(SilcClient client,
  *                                                   SilcClientConnection conn,
  *                                                   const char *nickname,
  *                                                   const char *format,
- *                                                   uint32 *clients_count);
+ *                                                   SilcUInt32 *clients_count);
  *
  * DESCRIPTION
  *
@@ -891,7 +1004,7 @@ SilcClientEntry *silc_client_get_clients_local(SilcClient client,
                                               SilcClientConnection conn,
                                               const char *nickname,
                                               const char *format,
-                                              uint32 *clients_count);
+                                              SilcUInt32 *clients_count);
 
 /****f* silcclient/SilcClientAPI/silc_client_get_clients_by_list
  *
@@ -899,7 +1012,7 @@ SilcClientEntry *silc_client_get_clients_local(SilcClient client,
  *
  *    void silc_client_get_clients_by_list(SilcClient client,
  *                                         SilcClientConnection conn,
- *                                         uint32 list_count,
+ *                                         SilcUInt32 list_count,
  *                                         SilcBuffer client_id_list,
  *                                         SilcGetClientCallback completion,
  *                                         void *context);
@@ -918,7 +1031,7 @@ SilcClientEntry *silc_client_get_clients_local(SilcClient client,
  ***/
 void silc_client_get_clients_by_list(SilcClient client,
                                     SilcClientConnection conn,
-                                    uint32 list_count,
+                                    SilcUInt32 list_count,
                                     SilcBuffer client_id_list,
                                     SilcGetClientCallback completion,
                                     void *context);
@@ -991,7 +1104,7 @@ bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
  *    typedef void (*SilcGetChannelCallback)(SilcClient client,
  *                                           SilcClientConnection conn,
  *                                           SilcChannelEntry *channels,
- *                                           uint32 channels_count,
+ *                                           SilcUInt32 channels_count,
  *                                           void *context);
  *
  * DESCRIPTION
@@ -1005,7 +1118,7 @@ bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
 typedef void (*SilcGetChannelCallback)(SilcClient client,
                                       SilcClientConnection conn,
                                       SilcChannelEntry *channels,
-                                      uint32 channels_count,
+                                      SilcUInt32 channels_count,
                                       void *context);
 
 /****f* silcclient/SilcClientAPI/silc_client_get_channel
@@ -1253,8 +1366,8 @@ void silc_client_command_call(SilcClientCommand command,
  *
  *    void silc_client_command_send(SilcClient client, 
  *                                  SilcClientConnection conn,
- *                                  SilcCommand command, uint16 ident,
- *                                  uint32 argc, ...);
+ *                                  SilcCommand command, SilcUInt16 ident,
+ *                                  SilcUInt32 argc, ...);
  *
  * DESCRIPTION
  *
@@ -1266,8 +1379,8 @@ void silc_client_command_call(SilcClientCommand command,
  *
  ***/
 void silc_client_command_send(SilcClient client, SilcClientConnection conn,
-                             SilcCommand command, uint16 ident,
-                             uint32 argc, ...);
+                             SilcCommand command, SilcUInt16 ident,
+                             SilcUInt32 argc, ...);
 
 /****f* silcclient/SilcClientAPI/silc_client_command_pending
  *
@@ -1275,7 +1388,7 @@ void silc_client_command_send(SilcClient client, SilcClientConnection conn,
  *
  *    void silc_client_command_pending(SilcClientConnection conn,
  *                                     SilcCommand reply_cmd,
- *                                     uint16 ident,
+ *                                     SilcUInt16 ident,
  *                                     SilcCommandCb callback,
  *                                     void *context);
  *
@@ -1294,7 +1407,7 @@ void silc_client_command_send(SilcClient client, SilcClientConnection conn,
  ***/
 void silc_client_command_pending(SilcClientConnection conn,
                                 SilcCommand reply_cmd,
-                                uint16 ident,
+                                SilcUInt16 ident,
                                 SilcCommandCb callback,
                                 void *context);
 
@@ -1310,7 +1423,7 @@ void silc_client_command_pending(SilcClientConnection conn,
  *                                            SilcClientEntry client_entry,
  *                                            char *cipher,
  *                                            unsigned char *key,
- *                                            uint32 key_len,
+ *                                            SilcUInt32 key_len,
  *                                            bool generate_key,
  *                                            bool responder);
  *
@@ -1343,7 +1456,7 @@ int silc_client_add_private_message_key(SilcClient client,
                                        SilcClientEntry client_entry,
                                        char *cipher,
                                        unsigned char *key,
-                                       uint32 key_len,
+                                       SilcUInt32 key_len,
                                        bool generate_key,
                                        bool responder);
 
@@ -1426,7 +1539,7 @@ int silc_client_del_private_message_key(SilcClient client,
  *    SilcPrivateMessageKeys
  *    silc_client_list_private_message_keys(SilcClient client,
  *                                          SilcClientConnection conn,
- *                                          uint32 *key_count);
+ *                                          SilcUInt32 *key_count);
  * 
  * DESCRIPTION
  *
@@ -1442,14 +1555,14 @@ int silc_client_del_private_message_key(SilcClient client,
 SilcPrivateMessageKeys
 silc_client_list_private_message_keys(SilcClient client,
                                      SilcClientConnection conn,
-                                     uint32 *key_count);
+                                     SilcUInt32 *key_count);
 
 /****f* silcclient/SilcClientAPI/silc_client_free_private_message_keys
  *
  * SYNOPSIS
  *
  *    void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
- *                                               uint32 key_count);
+ *                                               SilcUInt32 key_count);
  * 
  * DESCRIPTION
  *
@@ -1458,7 +1571,7 @@ silc_client_list_private_message_keys(SilcClient client,
  *
  ***/
 void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
-                                          uint32 key_count);
+                                          SilcUInt32 key_count);
 
 
 /* Channel private key management (client_channel.c, 
@@ -1471,10 +1584,11 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
  *    int silc_client_add_channel_private_key(SilcClient client,
  *                                            SilcClientConnection conn,
  *                                            SilcChannelEntry channel,
+ *                                            const char *name,
  *                                            char *cipher,
  *                                            char *hmac,
  *                                            unsigned char *key,
- *                                            uint32 key_len);
+ *                                            SilcUInt32 key_len);
  * 
  * DESCRIPTION
  *
@@ -1485,6 +1599,7 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
  *    key in order to decrypt the messages. However, it is possible to have
  *    several private keys per one channel. In this case only some of the
  *    clients on the channel may know the one key and only some the other key.
+ *    The `name' can be application given name for the key.
  *
  *    The private key for channel is optional. If it is not set then the
  *    channel messages are encrypted using the channel key generated by the
@@ -1510,10 +1625,11 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
 int silc_client_add_channel_private_key(SilcClient client,
                                        SilcClientConnection conn,
                                        SilcChannelEntry channel,
+                                       const char *name,
                                        char *cipher,
                                        char *hmac,
                                        unsigned char *key,
-                                       uint32 key_len);
+                                       SilcUInt32 key_len);
 
 /****f* silcclient/SilcClientAPI/silc_client_del_channel_private_keys
  *
@@ -1566,7 +1682,7 @@ int silc_client_del_channel_private_key(SilcClient client,
  *    silc_client_list_channel_private_keys(SilcClient client,
  *                                          SilcClientConnection conn,
  *                                          SilcChannelEntry channel,
- *                                          uint32 *key_count);
+ *                                          SilcUInt32 *key_count);
  *
  * DESCRIPTION
  *
@@ -1581,14 +1697,14 @@ SilcChannelPrivateKey *
 silc_client_list_channel_private_keys(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcChannelEntry channel,
-                                     uint32 *key_count);
+                                     SilcUInt32 *key_count);
 
 /****f* silcclient/SilcClientAPI/silc_client_free_channel_private_keys
  *
  * SYNOPSIS
  *
  *    void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
- *                                               uint32 key_count);
+ *                                               SilcUInt32 key_count);
  *
  * DESCRIPTION
  *
@@ -1596,7 +1712,28 @@ silc_client_list_channel_private_keys(SilcClient client,
  *
  ***/
 void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
-                                          uint32 key_count);
+                                          SilcUInt32 key_count);
+
+/****f* silcclient/SilcClientAPI/silc_client_current_channel_private_key
+ *
+ * SYNOPSIS
+ *
+ *    void silc_client_current_channel_private_key(SilcClient client,
+ *                                                 SilcClientConnection conn,
+ *                                                 SilcChannelEntry channel,
+ *                                                 SilcChannelPrivateKey key);
+ *
+ * DESCRIPTION
+ *
+ *    Sets the `key' to be used as current channel private key on the
+ *    `channel'.  Packet sent after calling this function will be secured
+ *    with `key'.
+ *
+ ***/
+void silc_client_current_channel_private_key(SilcClient client,
+                                            SilcClientConnection conn,
+                                            SilcChannelEntry channel,
+                                            SilcChannelPrivateKey key);
 
 
 /* Key Agreement routines (client_keyagr.c) */
@@ -1610,7 +1747,7 @@ void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
  *                                        SilcClientEntry client_entry,
  *                                        char *hostname,
  *                                        int port,
- *                                        uint32 timeout_secs,
+ *                                        SilcUInt32 timeout_secs,
  *                                        SilcKeyAgreementCallback completion,
  *                                        void *context);
  *
@@ -1663,7 +1800,7 @@ void silc_client_send_key_agreement(SilcClient client,
                                    const char *hostname,
                                    const char *bindhost,
                                    int port,
-                                   uint32 timeout_secs,
+                                   SilcUInt32 timeout_secs,
                                    SilcKeyAgreementCallback completion,
                                    void *context);
 
@@ -1899,10 +2036,10 @@ typedef enum {
  *                                          SilcClientConnection conn,
  *                                          SilcClientMonitorStatus status,
  *                                          SilcClientFileError error,
- *                                          uint64 offset,
- *                                          uint64 filesize,
+ *                                          SilcUInt64 offset,
+ *                                          SilcUInt64 filesize,
  *                                          SilcClientEntry client_entry,
- *                                          uint32 session_id,
+ *                                          SilcUInt32 session_id,
  *                                          const char *filepath,
  *                                          void *context);
  *
@@ -1922,10 +2059,10 @@ typedef void (*SilcClientFileMonitor)(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientMonitorStatus status,
                                      SilcClientFileError error,
-                                     uint64 offset,
-                                     uint64 filesize,
+                                     SilcUInt64 offset,
+                                     SilcUInt64 filesize,
                                      SilcClientEntry client_entry,
-                                     uint32 session_id,
+                                     SilcUInt32 session_id,
                                      const char *filepath,
                                      void *context);
 
@@ -1939,10 +2076,10 @@ typedef void (*SilcClientFileMonitor)(SilcClient client,
  *                          SilcClientFileMonitor monitor,
  *                          void *monitor_context,
  *                          const char *local_ip,
- *                          uint32 local_port,
+ *                          SilcUInt32 local_port,
  *                          SilcClientEntry client_entry,
  *                          const char *filepath);
- *                          uint32 *session_id);
+ *                          SilcUInt32 *session_id);
  *
  * DESCRIPTION
  *
@@ -1977,10 +2114,10 @@ silc_client_file_send(SilcClient client,
                      SilcClientFileMonitor monitor,
                      void *monitor_context,
                      const char *local_ip,
-                     uint32 local_port,
+                     SilcUInt32 local_port,
                      SilcClientEntry client_entry,
                      const char *filepath,
-                     uint32 *session_id);
+                     SilcUInt32 *session_id);
 
 /****f* silcclient/SilcClientAPI/silc_client_file_receive
  *
@@ -1991,7 +2128,7 @@ silc_client_file_send(SilcClient client,
  *                             SilcClientConnection conn,
  *                             SilcClientFileMonitor monitor,
  *                             void *monitor_context,
- *                             uint32 session_id);
+ *                             SilcUInt32 session_id);
  *
  * DESCRIPTION
  *
@@ -2013,7 +2150,7 @@ silc_client_file_receive(SilcClient client,
                         SilcClientConnection conn,
                         SilcClientFileMonitor monitor,
                         void *monitor_context,
-                        uint32 session_id);
+                        SilcUInt32 session_id);
 
 /****f* silcclient/SilcClientAPI/silc_client_file_close
  *
@@ -2021,7 +2158,7 @@ silc_client_file_receive(SilcClient client,
  *
  *    SilcClientFileError silc_client_file_close(SilcClient client,
  *                                               SilcClientConnection conn,
- *                                               uint32 session_id);
+ *                                               SilcUInt32 session_id);
  *
  * DESCRIPTION
  *
@@ -2034,7 +2171,7 @@ silc_client_file_receive(SilcClient client,
  ***/
 SilcClientFileError silc_client_file_close(SilcClient client,
                                           SilcClientConnection conn,
-                                          uint32 session_id);
+                                          SilcUInt32 session_id);
 
 #include "client.h"
 #include "command.h"