updates.
[silc.git] / lib / silcclient / silcapi.h
index e7d7b9cc25355e491e33f5053c5d803d25df0495..175af9bca4bcbeea53e56a4f803a485249af37cc 100644 (file)
@@ -843,7 +843,8 @@ void silc_client_get_clients(SilcClient client,
  *    is the formatted nickname to find exact match from multiple found
  *    entries. The format must be same as given in the SilcClientParams
  *    structure to the client library. If the `format' is NULL all found
- *    clients by `nickname' are returned.
+ *    clients by `nickname' are returned. The caller must return the
+ *    returned array.
  *
  ***/
 SilcClientEntry *silc_client_get_clients_local(SilcClient client,
@@ -1766,13 +1767,24 @@ silc_client_request_authentication_method(SilcClient client,
                                          void *context);
 
 typedef enum {
+  SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT,
   SILC_CLIENT_FILE_MONITOR_SEND,
   SILC_CLIENT_FILE_MONITOR_RECEIVE,
   SILC_CLIENT_FILE_MONITOR_GET,
   SILC_CLIENT_FILE_MONITOR_PUT,
-  SILC_CLIENT_FILE_MONITOR_CLOSE,
+  SILC_CLIENT_FILE_MONITOR_CLOSED,
+  SILC_CLIENT_FILE_MONITOR_ERROR,
 } SilcClientMonitorStatus;
 
+typedef enum {
+  SILC_CLIENT_FILE_OK,
+  SILC_CLIENT_FILE_ERROR,
+  SILC_CLIENT_FILE_UNKNOWN_SESSION,
+  SILC_CLIENT_FILE_ALREADY_STARTED,
+  SILC_CLIENT_FILE_NO_SUCH_FILE,
+  SILC_CLIENT_FILE_PERMISSION_DENIED,
+} SilcClientFileError;
+
 /****f* silcclient/SilcClientAPI/silc_client_file_receive
  *
  * SYNOPSIS
@@ -1780,6 +1792,7 @@ typedef enum {
  *    typedef void (*SilcClientFileMonitor)(SilcClient client,
  *                                          SilcClientConnection conn,
  *                                          SilcClientMonitorStatus status,
+ *                                          SilcClientFileError error,
  *                                          uint64 offset,
  *                                          uint64 filesize,
  *                                          SilcClientEntry client_entry,
@@ -1800,6 +1813,7 @@ typedef enum {
 typedef void (*SilcClientFileMonitor)(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientMonitorStatus status,
+                                     SilcClientFileError error,
                                      uint64 offset,
                                      uint64 filesize,
                                      SilcClientEntry client_entry,
@@ -1833,11 +1847,26 @@ typedef void (*SilcClientFileMonitor)(SilcClient client,
  *    file indicated by the `filepath' is being transmitted to the remote
  *    client indicated by the `client_entry', already.
  *
+ *    If the `local_ip' is provided then this will try to bind the 
+ *    listener for key exchange protocol to that IP.  If `local_port' is
+ *    non-zero that port is used.  If `local_ip' is NULL then this will
+ *    automatically attempt to bind it to local IP address of the machine.
+ *    If that fails then this does not bind to any address and port, and
+ *    assume that the remote client will provide the listener for the
+ *    key exchange protocol.
+ *
+ *    If error will occur during the file transfer process the error
+ *    status will be returned in the monitor callback.  In this case
+ *    the application must call silc_client_file_close to close the
+ *    session.
+ *
  ***/
 uint32 silc_client_file_send(SilcClient client,
                             SilcClientConnection conn,
                             SilcClientFileMonitor monitor,
                             void *monitor_context,
+                            const char *local_ip,
+                            uint32 local_port,
                             SilcClientEntry client_entry,
                             const char *filepath);
 
@@ -1845,12 +1874,12 @@ uint32 silc_client_file_send(SilcClient client,
  *
  * SYNOPSIS
  *
- *    bool silc_client_file_receive(SilcClient client,
- *                                  SilcClientConnection conn,
- *                                  SilcClientFileMonitor monitor,
- *                                  void *monitor_context,
- *                                  SilcClientEntry client_entry,
- *                                  uint32 session_id);
+ *    SilcClientFileError 
+ *    silc_client_file_receive(SilcClient client,
+ *                             SilcClientConnection conn,
+ *                             SilcClientFileMonitor monitor,
+ *                             void *monitor_context,
+ *                             uint32 session_id);
  *
  * DESCRIPTION
  *
@@ -1861,21 +1890,26 @@ uint32 silc_client_file_send(SilcClient client,
  *    actually starting the file transmission.  The `monitor' callback
  *    will be called to monitor the transmission.
  *
+ *    If error will occur during the file transfer process the error
+ *    status will be returned in the monitor callback.  In this case
+ *    the application must call silc_client_file_close to close the
+ *    session.
+ *
  ***/
-bool silc_client_file_receive(SilcClient client,
-                             SilcClientConnection conn,
-                             SilcClientFileMonitor monitor,
-                             void *monitor_context,
-                             SilcClientEntry client_entry,
-                             uint32 session_id);
+SilcClientFileError 
+silc_client_file_receive(SilcClient client,
+                        SilcClientConnection conn,
+                        SilcClientFileMonitor monitor,
+                        void *monitor_context,
+                        uint32 session_id);
 
 /****f* silcclient/SilcClientAPI/silc_client_file_close
  *
  * SYNOPSIS
  *
- *    bool silc_client_file_close(SilcClient client,
- *                                SilcClientConnection conn,
- *                                uint32 session_id);
+ *    SilcClientFileError silc_client_file_close(SilcClient client,
+ *                                               SilcClientConnection conn,
+ *                                               uint32 session_id);
  *
  * DESCRIPTION
  *
@@ -1883,12 +1917,11 @@ bool silc_client_file_receive(SilcClient client,
  *    If file transmission is being conducted it will be aborted
  *    automatically. This function is also used to close the session
  *    after successful file transmission. This function can be used
- *    also to reject incoming file transmission request.  Returns TRUE
- *    if the session was closed and FALSE if such session does not exist.
+ *    also to reject incoming file transmission request.
  *
  ***/
-bool silc_client_file_close(SilcClient client,
-                           SilcClientConnection conn,
-                           uint32 session_id);
+SilcClientFileError silc_client_file_close(SilcClient client,
+                                          SilcClientConnection conn,
+                                          uint32 session_id);
 
 #endif