SILC_KEY_AGREEMENT_ERROR, /* Unknown error occurred */
SILC_KEY_AGREEMENT_FAILURE, /* The protocol failed */
SILC_KEY_AGREEMENT_TIMEOUT, /* The protocol timeout */
+ SILC_KEY_AGREEMENT_ABORTED, /* The protocol aborted */
} SilcKeyAgreementStatus;
/***/
***/
void silc_client_run(SilcClient client);
+/****f* silcclient/SilcClientAPI/silc_client_run_one
+ *
+ * SYNOPSIS
+ *
+ * void silc_client_run_one(SilcClient client);
+ *
+ * DESCRIPTION
+ *
+ * Runs the client and returns immeadiately. This function is used when
+ * the SILC Client object indicated by the `client' is run under some
+ * other scheduler, or event loop or main loop. On GUI applications,
+ * for example this may be desired to used to run the client under the
+ * GUI application's main loop. Typically the GUI application would
+ * register an idle task that calls this function multiple times in
+ * a second to quickly process the SILC specific data.
+ *
+ ***/
+void silc_client_run_one(SilcClient client);
+
/****f* silcclient/SilcClientAPI/silc_client_stop
*
* SYNOPSIS
void silc_client_send_key_agreement(SilcClient client,
SilcClientConnection conn,
SilcClientEntry client_entry,
- char *hostname,
+ const char *hostname,
+ const char *bindhost,
int port,
uint32 timeout_secs,
SilcKeyAgreementCallback completion,
* before the key agreement protocol has been performed. After it has
* been performed the library will automatically unbind the port. The
* `client_entry' is the client to which we sent the key agreement
- * request.
+ * request. The key agreement completion callback will be called
+ * with SILC_KEY_AGREEMENT_ABORTED status.
*
***/
void silc_client_abort_key_agreement(SilcClient client,
SilcConnectionAuthRequest callback,
void *context);
+/****d* silcclient/SilcClientAPI/SilcClientMonitorStatus
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcClientMonitorStatus;
+ *
+ * DESCRIPTION
+ *
+ * File transmission session status types. These will indicate
+ * the status of the file transmission session.
+ *
+ * SOURCE
+ */
typedef enum {
- SILC_CLIENT_FILE_MONITOR_SEND,
- SILC_CLIENT_FILE_MONITOR_RECEIVE,
+ SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT, /* In key agreemenet phase */
+ SILC_CLIENT_FILE_MONITOR_SEND, /* Sending file */
+ SILC_CLIENT_FILE_MONITOR_RECEIVE, /* Receiving file */
SILC_CLIENT_FILE_MONITOR_GET,
SILC_CLIENT_FILE_MONITOR_PUT,
- SILC_CLIENT_FILE_MONITOR_CLOSE,
+ SILC_CLIENT_FILE_MONITOR_CLOSED, /* Session closed */
+ SILC_CLIENT_FILE_MONITOR_ERROR, /* Error during session */
} SilcClientMonitorStatus;
+/***/
-/****f* silcclient/SilcClientAPI/silc_client_file_receive
+/****d* silcclient/SilcClientAPI/SilcClientFileError
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcClientFileError;
+ *
+ * DESCRIPTION
+ *
+ * File transmission error types. These types are returned by
+ * some of the file transmission functions, and by the monitor
+ * callback to indicate error.
+ *
+ * SOURCE
+ */
+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/SilcClientFileMonitor
*
* SYNOPSIS
*
* typedef void (*SilcClientFileMonitor)(SilcClient client,
* SilcClientConnection conn,
* SilcClientMonitorStatus status,
+ * SilcClientFileError error,
* uint64 offset,
* uint64 filesize,
* SilcClientEntry client_entry,
*
* Monitor callback that is called during the file transmission to
* monitor the transmission process. The `status' indicates the current
- * monitoring process. The `offset' is the currently transmitted amount
- * of total `filesize'. The `client_entry' indicates the remote client,
- * and the transmission session ID is the `session_id'. The filename
- * being transmitted is indicated by the `filepath'.
+ * monitoring process. The `error' will indicate the error type
+ * if `status' is SILC_CLIENT_FILE_MONITOR_ERROR. The `offset' is the
+ * currently transmitted amount of total `filesize'. The `client_entry'
+ * indicates the remote client, and the transmission session ID is the
+ * `session_id'. The filename being transmitted is indicated by the
+ * `filepath'.
*
***/
typedef void (*SilcClientFileMonitor)(SilcClient client,
SilcClientConnection conn,
SilcClientMonitorStatus status,
+ SilcClientFileError error,
uint64 offset,
uint64 filesize,
SilcClientEntry client_entry,
*
* SYNOPSIS
*
- * void silc_client_file_send(SilcClient client,
- * SilcClientConnection conn,
- * SilcClientFileMonitor monitor,
- * void *monitor_context,
- * SilcClientEntry client_entry,
- * const char *filepath);
+ * 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);
*
* DESCRIPTION
*
* 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);
*
* 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
*
* 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
*
* 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