secsh_sft.h File Reference


Data Structures

struct  SshSftFileAttributesRec
struct  SshSftParamRec
struct  SshSftOffsetRec

Typedefs

typedef unsigned int SshSftUInt32
typedef signed int SshSftInt32
typedef unsigned long long SshSftUInt64
typedef signed long long SshSftInt64
typedef SshSftInt64 SshSftTime
typedef unsigned int SshSftBoolean
typedef SshSftFileAttributesRec SshSftFileAttributesStruct
typedef SshSftFileAttributesStructSshSftFileAttributes
typedef int(*) SshSftSignalCB (void *context, SshSftSignal signal_type)
typedef void(*) SshSftProgressCB (void *context, SshSftUInt64 start_offset, SshSftUInt64 offset, SshSftUInt64 block_len, SshSftUInt64 total_len, SshSftBoolean finished)
typedef void(*) SshSftProgressCtxCreateCB (void *context, char *src_path, char *src_name, char *dst_path, char *dst_name, void **progress_cb_ctx_ret)
typedef void(*) SshSftProgressCtxDestroyCB (void *context, void *progress_cb_ctx)
typedef void(*) SshSftMessageCB (void *message_cb_ctx, void *progress_cb_ctx, SshSftOperation operation, SshSftAction action, char *src_path, char *src_name, char *dst_path, char *dst_name, char *long_name, SshSftFileAttributes attrs, SshSftError res, char *status_msg, SshSftInteract *interact_ret)
typedef SshSftParamRec SshSftParamStruct
typedef SshSftParamStructSshSftParam
typedef SshSftOffsetRec SshSftOffsetStruct
typedef SshSftOffsetStructSshSftOffset
typedef SshSftRec * SshSft
typedef SshSftFileRec * SshSftFile
typedef SshSftDirRec * SshSftDir
typedef SshSftGlobRec * SshSftGlob

Enumerations

enum  SshSftError {
  SSH_SFT_OK = 0, SSH_SFT_OK_HASH_MATCH = 1, SSH_SFT_OK_HASH_MATCH_DST_TRUNCATED = 2, SSH_SFT_OK_SKIP = 3,
  SSH_SFT_OK_ABORT = 4, SSH_SFT_OK_WITH_ERRORS = 5, SSH_SFT_ERROR = 10, SSH_SFT_ERROR_NO_LICENSE = 11,
  SSH_SFT_ERROR_NO_SERVER_LICENSE = 12, SSH_SFT_ERROR_NOT_DIR = 13, SSH_SFT_ERROR_EOF = 100, SSH_SFT_ERROR_NO_SUCH_FILE = 101,
  SSH_SFT_ERROR_PERMISSION_DENIED = 102, SSH_SFT_ERROR_FAILURE = 103, SSH_SFT_ERROR_BAD_MESSAGE = 104, SSH_SFT_ERROR_NO_CONNECTION = 105,
  SSH_SFT_ERROR_CONNECTION_LOST = 106, SSH_SFT_ERROR_OP_UNSUPPORTED = 107, SSH_SFT_ERROR_INVALID_HANDLE = 108, SSH_SFT_ERROR_NO_SUCH_PATH = 109,
  SSH_SFT_ERROR_FILE_ALREADY_EXISTS = 110, SSH_SFT_ERROR_WRITE_PROTECT = 111, SSH_SFT_ERROR_NO_MEDIA = 112, SSH_SFT_ERROR_EOF_SRC = 200,
  SSH_SFT_ERROR_NO_SUCH_FILE_SRC = 201, SSH_SFT_ERROR_PERMISSION_DENIED_SRC = 202, SSH_SFT_ERROR_FAILURE_SRC = 203, SSH_SFT_ERROR_BAD_MESSAGE_SRC = 204,
  SSH_SFT_ERROR_NO_CONNECTION_SRC = 205, SSH_SFT_ERROR_CONNECTION_LOST_SRC = 206, SSH_SFT_ERROR_OP_UNSUPPORTED_SRC = 207, SSH_SFT_ERROR_INVALID_HANDLE_SRC = 208,
  SSH_SFT_ERROR_NO_SUCH_PATH_SRC = 209, SSH_SFT_ERROR_FILE_ALREADY_EXISTS_SRC = 210, SSH_SFT_ERROR_WRITE_PROTECT_SRC = 211, SSH_SFT_ERROR_NO_MEDIA_SRC = 212,
  SSH_SFT_ERROR_EOF_DST = 300, SSH_SFT_ERROR_NO_SUCH_FILE_DST = 301, SSH_SFT_ERROR_PERMISSION_DENIED_DST = 302, SSH_SFT_ERROR_FAILURE_DST = 303,
  SSH_SFT_ERROR_BAD_MESSAGE_DST = 304, SSH_SFT_ERROR_NO_CONNECTION_DST = 305, SSH_SFT_ERROR_CONNECTION_LOST_DST = 306, SSH_SFT_ERROR_OP_UNSUPPORTED_DST = 307,
  SSH_SFT_ERROR_INVALID_HANDLE_DST = 308, SSH_SFT_ERROR_NO_SUCH_PATH_DST = 309, SSH_SFT_ERROR_FILE_ALREADY_EXISTS_DST = 310, SSH_SFT_ERROR_WRITE_PROTECT_DST = 311,
  SSH_SFT_ERROR_NO_MEDIA_DST = 312, SSH_SFT_ERROR_NO_BROKER_CONNECTION = 500, SSH_SFT_ERROR_AUTHENTICATION_FAILED = 501, SSH_SFT_ERROR_UNABLE_TO_CONNECT_SERVER = 502,
  SSH_SFT_ERROR_BROKER_FAILED = 503, SSH_SFT_ERROR_LOCAL_STREAM_FAILED = 504, SSH_SFT_ERROR_CONNECTION_ABORTED = 600, SSH_SFT_ERROR_READ = 601,
  SSH_SFT_ERROR_WRITE = 602, SSH_SFT_ERROR_OUT_OF_MEMORY = 603, SSH_SFT_ERROR_LISTENER = 604, SSH_SFT_ERROR_LIB_UNINITIALIZED = 605,
  SSH_SFT_ERROR_ILLEGAL_PARAMETER = 606, SSH_SFT_ERROR_NO_CHECKPOINT_ENTRY = 700, SSH_SFT_ERROR_CHECKPOINT_DATABASE = 701, SSH_SFT_ERROR_CHECKPOINT_READ = 702,
  SSH_SFT_ERROR_INTERNAL = 1000
}
enum  SshSftInteract {
  SSH_SFT_INTERACT_NO = 0, SSH_SFT_INTERACT_YES = 1, SSH_SFT_INTERACT_ABORT = 2, SSH_SFT_INTERACT_ASCII_CONV_DOS = 3,
  SSH_SFT_INTERACT_ASCII_CONV_UNIX = 4, SSH_SFT_INTERACT_ASCII_CONV_MAC = 5
}
enum  SshSftFileType {
  SSH_SFT_FILE_TYPE_REGULAR = 1, SSH_SFT_FILE_TYPE_DIRECTORY = 2, SSH_SFT_FILE_TYPE_SYMLINK = 3, SSH_SFT_FILE_TYPE_SPECIAL = 4,
  SSH_SFT_FILE_TYPE_UNKNOWN = 5
}
enum  SshSftFileFlags {
  SSH_SFT_FILE_FLAG_RDWR = 0x0001, SSH_SFT_FILE_FLAG_WRONLY = 0x0002, SSH_SFT_FILE_FLAG_RDONLY = 0x0004, SSH_SFT_FILE_FLAG_APPEND = 0x0008,
  SSH_SFT_FILE_FLAG_CREAT = 0x0010, SSH_SFT_FILE_FLAG_TRUNC = 0x0020, SSH_SFT_FILE_FLAG_EXCL = 0x0040
}
enum  SshSftChecksum {
  SSH_SFT_CHECKSUM_MD5 = 0, SSH_SFT_CHECKSUM_SHA1 = 1, SSH_SFT_CHECKSUM_NO = 2, SSH_SFT_CHECKSUM_MD5_FORCE = 3,
  SSH_SFT_CHECKSUM_SHA1_FORCE = 4, SSH_SFT_CHECKSUM_CHECKPOINT = 5
}
enum  SshSftStreaming { SSH_SFT_STREAMING_YES = 0, SSH_SFT_STREAMING_NO = 1, SSH_SFT_STREAMING_FORCE = 2, SSH_SFT_STREAMING_EXT = 3 }
enum  SshSftOperation {
  SSH_SFT_OPERATION_FILE_COPY = 0, SSH_SFT_OPERATION_FILE_MOVE = 1, SSH_SFT_OPERATION_DIR_STAT = 2, SSH_SFT_OPERATION_DIR_SETSTAT = 3,
  SSH_SFT_OPERATION_DIR_COPY = 4, SSH_SFT_OPERATION_DIR_MOVE = 5, SSH_SFT_OPERATION_DIR_REMOVE = 6
}
enum  SshSftAction {
  SSH_SFT_ACTION_ENTER_DIR = 0, SSH_SFT_ACTION_LEAVE_DIR = 1, SSH_SFT_ACTION_CREATE_DIR = 2, SSH_SFT_ACTION_LIST = 3,
  SSH_SFT_ACTION_START = 4, SSH_SFT_ACTION_COMPLETE = 5, SSH_SFT_ACTION_OVERWRITE = 6, SSH_SFT_ACTION_ASCII_CONVERSION_SRC = 7,
  SSH_SFT_ACTION_ASCII_CONVERSION_DST = 8, SSH_SFT_ACTION_REMOVE = 9, SSH_SFT_ACTION_REMOVE_DIR = 10, SSH_SFT_ACTION_REPORT_INFO = 11,
  SSH_SFT_ACTION_REPORT_WARNING = 12, SSH_SFT_ACTION_REPORT_ERROR = 13
}
enum  SshSftTransferMode { SSH_SFT_TRANSFER_MODE_BINARY = 0, SSH_SFT_TRANSFER_MODE_ASCII = 1, SSH_SFT_TRANSFER_MODE_AUTO = 2, SSH_SFT_TRANSFER_MODE_BINARY_ZOS = 3 }
enum  SshSftSignal { SSH_SFT_SIGNAL_SUSPEND = 0, SSH_SFT_SIGNAL_RESUME = 1, SSH_SFT_SIGNAL_ABORT = 2, SSH_SFT_SIGNAL_KILL = 3 }
enum  SshSftSetstatMode { SSH_SFT_SETSTAT_MODE_OCTAL = 0, SSH_SFT_SETSTAT_MODE_ADD = 1, SSH_SFT_SETSTAT_MODE_SUB = 2 }
enum  SshSftFileAttrFlags {
  SSH_SFT_FILE_ATTR_SIZE = 0x00000001, SSH_SFT_FILE_ATTR_UIDGID = 0x00000002, SSH_SFT_FILE_ATTR_PERMISSIONS = 0x00000004, SSH_SFT_FILE_ATTR_ACMODTIME = 0x00000008,
  SSH_SFT_FILE_ATTR_ACCESSTIME = 0x00000008, SSH_SFT_FILE_ATTR_CREATETIME = 0x00000010, SSH_SFT_FILE_ATTR_MODIFYTIME = 0x00000020, SSH_SFT_FILE_ATTR_ACL = 0x00000040,
  SSH_SFT_FILE_ATTR_OWNERGROUP = 0x00000080, SSH_SFT_FILE_ATTR_SUBSECOND_TIMES = 0x00000100, SSH_SFT_FILE_ATTR_EXTENDED = (int) 0x80000000
}
enum  {
  SSH_SFT_REQUEST_MAX_SIZE = 0x8000, SSH_SFT_REQUEST_MAX_NUM = 10, SSH_SFT_HASH_MAX_ITERATIONS = 20, SSH_SFT_HASH_MIN_BLOCK_SIZE = (1 * 1024 * 1024),
  SSH_SFT_HASH_MAX_BLOCK_SIZE = (10 * 1024 * 1024)
}
enum  SshSftDirSortFlags { SSH_SFT_DIR_FLAG_SORT_NAME = 0x00000001, SSH_SFT_DIR_FLAG_SORT_SIZE = 0x00000002, SSH_SFT_DIR_FLAG_SORT_REVERSE = 0x00000004 }
enum  { SSH_SFT_DIR_RECURSIVE = 0 }

Functions

SshSftFileAttributes ssh_sft_file_attrs_dup (SshSftFileAttributes attrs)
void ssh_sft_file_attrs_free (SshSftFileAttributes *attrs)
void ssh_sft_data_free (unsigned char **data)
void ssh_sft_error_msg_free (char **error_msg)
void ssh_sft_name_free (char **name)
SshSftGlob ssh_sft_glob_create (char *glob_string, char **root_ret, int *depth_ret)
void ssh_sft_glob_destroy (SshSftGlob *glob)
SshSftError ssh_sft_init (const char *crypto_dll_path, SshSftBoolean fips_mode, char **error_msg_ret)
void ssh_sft_uninit (void)
SshSftError ssh_sft_open (SshSftParam param, const char *broker_addr, const char *user, const char *host, const char *port, SshSecShBrokerAuthCb auth_cb, void *auth_cb_ctx, SshSft *handle_ret, char **error_msg_ret)
SshSftError ssh_sft_open_window (SshSftParam param, const char *broker_addr, const char *user, const char *host, const char *port, SshSecShBrokerAuthCb auth_cb, void *auth_cb_ctx, SshSft *handle_ret, char **error_msg_ret, SshWindowHandle window)
SshSftError ssh_sft_config (SshSft handle, SshSftParam param, char **error_msg_ret)
SshSftError ssh_sft_config_get (SshSft handle, SshSftParam param, char **error_msg_ret)
SshSftUInt32 ssh_sft_fxp_version (SshSft handle)
SshSftError ssh_sft_fxp_ext_data (SshSft handle, const char *ext_data_type, unsigned char **ext_data_ret, size_t *ext_data_len_ret)
SshSftError ssh_sft_close (SshSft handle, char **error_msg_ret)
SshSftError ssh_sft_destroy (SshSft handle, char **error_msg_ret)
SshSftError ssh_sft_file_open (SshSft handle, char *file, SshSftFileFlags flags, SshSftFileAttributes attrs, SshSftFile *handle_ret, char **error_msg_ret)
SshSftError ssh_sft_file_read (SshSftFile handle, SshSftUInt64 offset, char *data, SshSftUInt64 len, SshSftUInt64 *data_len_ret, char **error_msg_ret)
SshSftError ssh_sft_file_read_alloc (SshSftFile handle, SshSftUInt64 offset, SshSftUInt64 len, unsigned char **data_ret, SshSftUInt64 *data_len_ret, char **error_msg_ret)
SshSftError ssh_sft_file_write (SshSftFile handle, SshSftUInt64 offset, char *data, SshSftUInt64 data_len, char **error_msg_ret)
SshSftError ssh_sft_file_fstat (SshSftFile handle, SshSftFileAttributes *attrs_ret, char **error_msg_ret)
SshSftError ssh_sft_file_close (SshSftFile handle, char **error_msg_ret)
SshSftError ssh_sft_file_remove (SshSftFile handle, char **error_msg_ret)
SshSftError ssh_sft_stat (SshSft handle, char *file, SshSftFileAttributes *attrs_ret, char **error_msg_ret)
SshSftError ssh_sft_stat_dir (SshSft handle, char *dir, SshSftGlob glob, int max_depth, SshSftDirSortFlags sort_flags, SshSftMessageCB message_cb, void *message_cb_ctx, char **error_msg_ret)
SshSftError ssh_sft_lstat (SshSft handle, char *file, SshSftFileAttributes *attrs_ret, char **error_msg_ret)
SshSftError ssh_sft_hash (SshSft handle, char *file, const char *hash_name, SshSftUInt64 offset, size_t len, unsigned char **digest_ret, size_t *digest_len_ret, char **error_msg_ret)
SshSftError ssh_sft_copy (SshSft src_handle, char *src_file, SshSft dst_handle, char *dst_file, SshSftProgressCB progress_cb, void *progress_cb_ctx, SshSftMessageCB message_cb, void *message_cb_ctx, SshSftOffset copy_offset, char **error_msg_ret)
SshSftError ssh_sft_move (SshSft src_handle, char *src_file, SshSft dst_handle, char *dst_file, SshSftProgressCB progress_cb, void *progress_cb_ctx, SshSftMessageCB message_cb, void *message_cb_ctx, SshSftOffset copy_offset, char **error_msg_ret)
SshSftError ssh_sft_copy_dir (SshSft src_handle, char *src_dir, SshSft dst_handle, char *dst_dir, SshSftGlob glob, int max_depth, SshSftProgressCB progress_cb, void *progress_cb_ctx, SshSftProgressCtxCreateCB progress_ctx_create_cb, SshSftProgressCtxDestroyCB progress_ctx_destroy_cb, SshSftMessageCB message_cb, void *message_cb_ctx, char **error_msg_ret)
SshSftError ssh_sft_move_dir (SshSft src_handle, char *src_dir, SshSft dst_handle, char *dst_dir, SshSftGlob glob, int max_depth, SshSftProgressCB progress_cb, void *progress_cb_ctx, SshSftProgressCtxCreateCB progress_cb_ctx_create_cb, SshSftProgressCtxDestroyCB progress_cb_ctx_destroy_cb, SshSftMessageCB message_cb, void *message_cb_ctx, char **error_msg_ret)
SshSftError ssh_sft_setstat (SshSft handle, char *file, SshSftFileAttributes attrs, char **error_msg_ret)
SshSftError ssh_sft_truncate (SshSft handle, char *file, SshSftUInt64 size, char **error_msg_ret)
SshSftError ssh_sft_setstat_dir (SshSft handle, char *dir, SshSftGlob glob, int max_depth, SshSftUInt32 permissions, SshSftSetstatMode mode, SshSftMessageCB message_cb, void *message_cb_ctx, char **error_msg_ret)
SshSftError ssh_sft_dir_open (SshSft handle, char *dir, SshSftDir *handle_ret, char **error_msg_ret)
SshSftError ssh_sft_dir_read (SshSftDir handle, char **entry_name_ret, char **entry_long_name_ret, SshSftFileAttributes *entry_attrs_ret, size_t *queue_size_ret, char **error_msg_ret)
SshSftError ssh_sft_dir_close (SshSftDir handle, char **error_msg_ret)
SshSftError ssh_sft_dir_rmdir (SshSftDir handle, char **error_msg_ret)
SshSftError ssh_sft_mkdir (SshSft handle, char *dir, SshSftFileAttributes attrs, char **error_msg_ret)
SshSftError ssh_sft_rmdir (SshSft handle, char *dir, char **error_msg_ret)
SshSftError ssh_sft_rename (SshSft handle, char *old_file, char *new_file, char **error_msg_ret)
SshSftError ssh_sft_symlink (SshSft handle, char *target, char *link, char **error_msg_ret)
SshSftError ssh_sft_readlink (SshSft handle, char *link, char **file_ret, char **error_msg_ret)
SshSftError ssh_sft_realpath (SshSft handle, char *file, char **path_ret, char **error_msg_ret)
SshSftError ssh_sft_remove (SshSft handle, char *file, char **error_msg_ret)
SshSftError ssh_sft_remove_dir (SshSft handle, char *dir, SshSftGlob glob, int max_depth, SshSftMessageCB message_cb, void *message_cb_ctx, char **error_msg_ret)
SshSftError ssh_sft_abort (SshSft handle, char **error_msg_ret)
SshSftError ssh_sft_suspend (SshSft handle, char **error_msg_ret)
SshSftError ssh_sft_resume (SshSft handle, char **error_msg_ret)

Detailed Description

SSH Tectia Secure File Transfer (SFT) C-API

Version:
1.2.1
Author:
Tommi Linnakangas <tkl@ssh.com>
Copyright (c) 2004-2007 SSH Communications Security Corp, Finland All rights reserved.

Typedef Documentation

typedef struct SshSftRec* SshSft

Main context used in all operations.

typedef unsigned int SshSftBoolean

Boolean variables are integers. FALSE is 0 and all nonzero values are interpreted as TRUE.

typedef struct SshSftDirRec* SshSftDir

Context used in directory operations.

typedef struct SshSftFileRec* SshSftFile

Context used in file operations.

typedef struct SshSftFileAttributesRec SshSftFileAttributesStruct

Data structure for representing file attributes.

typedef struct SshSftGlobRec* SshSftGlob

Context used in globbing.

typedef signed int SshSftInt32

Signed 32 bit integers.

typedef signed long long SshSftInt64

Signed 64 bit integers.

typedef void(*) SshSftMessageCB(void *message_cb_ctx, void *progress_cb_ctx, SshSftOperation operation, SshSftAction action, char *src_path, char *src_name, char *dst_path, char *dst_name, char *long_name, SshSftFileAttributes attrs, SshSftError res, char *status_msg, SshSftInteract *interact_ret)

Function prototype for message callback.

SFT library calls message callback function when it needs to interact with the application. Different operations have different actions:

SSH_SFT_OPERATION_FILE_COPY -> SSH_SFT_ACTION_START (start file copy?) SSH_SFT_ACTION_OVERWRITE (overwrite file?) SSH_SFT_ACTION_ASCII_CONVERSION_SRC (conversion from source?) SSH_SFT_ACTION_ASCII_CONVERSION_DST (conversion to destination?)

SSH_SFT_OPERATION_FILE_MOVE -> SSH_SFT_ACTION_START (start file copy?) SSH_SFT_ACTION_OVERWRITE (overwrite file?) SSH_SFT_ACTION_ASCII_CONVERSION_SRC (conversion from source?) SSH_SFT_ACTION_ASCII_CONVERSION_DST (conversion to destination?) SSH_SFT_ACTION_REMOVE (remove file?)

SSH_SFT_OPERATION_DIR_COPY -> SSH_SFT_ACTION_ENTER_DIR (enter directory?) SSH_SFT_ACTION_LIST (list file/directory?) SSH_SFT_ACTION_CREATE_DIR (create directory?) SSH_SFT_ACTION_START (start file copy?) SSH_SFT_ACTION_OVERWRITE (overwrite file?) SSH_SFT_ACTION_ASCII_CONVERSION_SRC (conversion from source?) SSH_SFT_ACTION_ASCII_CONVERSION_DST (conversion to destination?) SSH_SFT_ACTION_REPORT_ERROR (continue with error?) SSH_SFT_ACTION_REPORT_WARNING (-) SSH_SFT_ACTION_REPORT_INFO (-)

SSH_SFT_OPERATION_DIR_MOVE -> SSH_SFT_ACTION_ENTER_DIR (enter directory?) SSH_SFT_ACTION_LIST (list file/directory?) SSH_SFT_ACTION_CREATE_DIR (create directory?) SSH_SFT_ACTION_START (start file copy?) SSH_SFT_ACTION_OVERWRITE (overwrite file?) SSH_SFT_ACTION_ASCII_CONVERSION_SRC (conversion from source?) SSH_SFT_ACTION_ASCII_CONVERSION_DST (conversion to destination?) SSH_SFT_ACTION_REMOVE (remove file?) SSH_SFT_ACTION_REMOVE_DIR (remove directory?) SSH_SFT_ACTION_REPORT_ERROR (continue with error?) SSH_SFT_ACTION_REPORT_WARNING (-) SSH_SFT_ACTION_REPORT_INFO (-)

SSH_SFT_OPERATION_DIR_REMOVE -> SSH_SFT_ACTION_ENTER_DIR (enter directory?) SSH_SFT_ACTION_LIST (list file/directory?) SSH_SFT_ACTION_REMOVE (remove file?) SSH_SFT_ACTION_REMOVE_DIR (remove directory?) SSH_SFT_ACTION_REPORT_ERROR (continue with error?) SSH_SFT_ACTION_REPORT_WARNING (-) SSH_SFT_ACTION_REPORT_INFO (-)

Parameters:
message_cb_ctx Message callback function context.
progress_cb_ctx Progress callback function context.
operation Operation.
action Action.
src_path Path to the source file.
src_name Name of the source file.
dst_path Path to the destination file.
dst_name Name of the destination file.
long_name Long name of the file in action SSH_SFT_ACTION_LIST.
attrs File attributes in action SSH_SFT_ACTION_LIST.
res Status code for the SFT operation.
status_msg Status message for the SFT operation.
interact_ret Interact return value.

typedef struct SshSftOffsetRec SshSftOffsetStruct

Offsets used in file copy.

typedef struct SshSftParamRec SshSftParamStruct

SFT parameters.

Each SFT session can be configured with parameters.

typedef void(*) SshSftProgressCB(void *context, SshSftUInt64 start_offset, SshSftUInt64 offset, SshSftUInt64 block_len, SshSftUInt64 total_len, SshSftBoolean finished)

Function prototype for file copy progress callback.

SFT library calls progress callback function after each succesful data transfer. This means that the progress callback function is called very often and should not perform any heavy functionality. It is suggested that progress callback function only updates statistics and some other thread performs further actions, like drawing the progress bar.

Parameters:
context Application specific context.
start_offset Initial offset in the file.
offset Current offset in the file.
block_len Length of the transferred block.
total_len Total length of the file.
finished Flag to specify, whether transfer is finished.

typedef void(*) SshSftProgressCtxCreateCB(void *context, char *src_path, char *src_name, char *dst_path, char *dst_name, void **progress_cb_ctx_ret)

Function prototype for creating file copy progress context.

Directory copy is performed so that more than one file is copied at the same time. For this reason, application must provide one context for each file transfer. SFT library calls progress context creation function before each file transfer. This context is then given to progress callback function during the file transfer.

Parameters:
context Application specific context.
src_path Path to the source file.
src_name Name of the source file.
dst_path Path to the destination file.
dst_name Name of the destination file.
progress_cb_ctx_ret Returned progress callback context.

typedef void(*) SshSftProgressCtxDestroyCB(void *context, void *progress_cb_ctx)

Function prototype for destroying file copy progress context.

After file transfer SFT library calls progress context destroy function. Application can then free resources bound to the context.

Parameters:
context Application specific context.
progress_cb_ctx Progress callback context.

typedef int(*) SshSftSignalCB(void *context, SshSftSignal signal_type)

Function prototype for signal callback function.

Signal callback is used by the library to tell the application that it has performed some action. For example, if library loses the connection (SSH_SFT_SIGNAL_KILL), the application must tear done the corresponding contexts. Also, for example if the application aborts file operation with 'ssh_sft_abort' function, SSH_SFT_SIGNAL_ABORT is received when abort is ready.

Parameters:
context Application specific context.
signal_type Type of the signal requested.
Returns:
TRUE, if signal has been received, FALSE otherwise.

typedef SshSftInt64 SshSftTime

Timestamps are signed 64 bit integers.

typedef unsigned int SshSftUInt32

Unsigned 32 bit integers.

typedef unsigned long long SshSftUInt64

Unsigned 64 bit integers.


Enumeration Type Documentation

anonymous enum

Enumerator:
SSH_SFT_REQUEST_MAX_SIZE  Default value for the maximum size of one SFTP data packet.
SSH_SFT_REQUEST_MAX_NUM  Default value for the maximum number of SFTP data packets sent in parallel.
SSH_SFT_HASH_MAX_ITERATIONS  Default value for the maximum number of binary search iterations in comparing two files.
SSH_SFT_HASH_MAX_BLOCK_SIZE  Default value for the minimum size that is used in calculating checksums (minimum binary search granularity). Default value for the maximum size that is used in calculating checksums (maximum binary search granularity).

anonymous enum

Enumerator:
SSH_SFT_DIR_RECURSIVE  Directory depth for recursive operation.

enum SshSftAction

SFT action code.

Action codes are used in directory and other operations to tell the user what kind of action starts. The user can then decide whether the action can start or not.

Enumerator:
SSH_SFT_ACTION_ENTER_DIR  Directory is entered.
SSH_SFT_ACTION_LEAVE_DIR  Directory is stepped out.
SSH_SFT_ACTION_CREATE_DIR  Directory is created.
SSH_SFT_ACTION_LIST  File or directory is listed.
SSH_SFT_ACTION_START  File copy or move is started.
SSH_SFT_ACTION_COMPLETE  File copy, move, remove and setstat is completed.
SSH_SFT_ACTION_OVERWRITE  File is overwritten.
SSH_SFT_ACTION_ASCII_CONVERSION_SRC  ASCII conversion method for source file is not known.
SSH_SFT_ACTION_ASCII_CONVERSION_DST  ASCII conversion method for destination file is not known.
SSH_SFT_ACTION_REMOVE  File is removed.
SSH_SFT_ACTION_REMOVE_DIR  Directory is removed.
SSH_SFT_ACTION_REPORT_INFO  Information about progress of an operation is passed to the user. No interaction is expected => interact_ret returned by user is ignored.
SSH_SFT_ACTION_REPORT_WARNING  Warning is reported to the user. No interaction is expected => interact_ret returned by user is ignored.
SSH_SFT_ACTION_REPORT_ERROR  Error is reported to the user. User can decide whether to continue operation after error or not.

enum SshSftChecksum

Checksum types.

SFT can use checksums to check whether two files are identical. There is also separate checkpoint database that can be used for saving the state of the file transfer. If the file transfer is interrupted, the database can be used for determining the point from where file transfer can be resumed.

Enumerator:
SSH_SFT_CHECKSUM_MD5  MD5 checksums are used for checking whether two files are identical. Checksums are not calculated for files that are smaller than the size of one data packet in SFTP protocol.
SSH_SFT_CHECKSUM_SHA1  SHA-1 checksums are used for checking whether two files are identical. Checksums are not calculated for files that are smaller than the size of one data packet in SFTP protocol.
SSH_SFT_CHECKSUM_NO  No checksums are used for checking whether two files are identical.
SSH_SFT_CHECKSUM_MD5_FORCE  MD5 checksums are used for checking whether two files are identical. Checksums are calculated for all files.
SSH_SFT_CHECKSUM_SHA1_FORCE  SHA-1 checksums are used for checking whether two files are identical. Checksums are calculated for all files.
SSH_SFT_CHECKSUM_CHECKPOINT  Separate checkpoint database is used for checking whether file transfer was interrupted. The transfer will resume from the point saved in the checkpoint database.

enum SshSftDirSortFlags

Enumerator:
SSH_SFT_DIR_FLAG_SORT_NAME  Directory listing is sorted by name (default).
SSH_SFT_DIR_FLAG_SORT_SIZE  Directory listing is sorted by size.
SSH_SFT_DIR_FLAG_SORT_REVERSE  Directory listing sort order is reversed.

enum SshSftError

Return values for SFT API functions.

All SFT API functions return these values. There is always a descriptive status message returned with the return value.

Enumerator:
SSH_SFT_OK  Operation was successful.
SSH_SFT_OK_HASH_MATCH  Destination file was identical to source file.
SSH_SFT_OK_HASH_MATCH_DST_TRUNCATED  Destination file was larger than source file, but the beginning part of it was identical to source file. Destination file was truncated to the size of the source file.
SSH_SFT_OK_SKIP  File operation was not performed.
SSH_SFT_OK_ABORT  File operation was aborted.
SSH_SFT_OK_WITH_ERRORS  Operation on multiple files was completed with some non-critical errors. Currently only operations working on directory trees can return this error.
SSH_SFT_ERROR  Operation failed.
SSH_SFT_ERROR_NO_LICENSE  No suitable license found.
SSH_SFT_ERROR_NO_SERVER_LICENSE  No suitable license found on the server.
SSH_SFT_ERROR_NOT_DIR  Entry is not directory.
SSH_SFT_ERROR_EOF  An attempt to read past the end-of-file was made; or, there are no more directory entries to return.
SSH_SFT_ERROR_NO_SUCH_FILE  A reference was made to a file which does not exist.
SSH_SFT_ERROR_PERMISSION_DENIED  The user does not have sufficient permissions to perform the operation.
SSH_SFT_ERROR_FAILURE  An error occured, but no specific error code exists to describe the failure.
SSH_SFT_ERROR_BAD_MESSAGE  A badly formatted packet or other SFTP protocol incompatibility was detected.
SSH_SFT_ERROR_NO_CONNECTION  There is no connection to the server.
SSH_SFT_ERROR_CONNECTION_LOST  The connection to the server was lost.
SSH_SFT_ERROR_OP_UNSUPPORTED  An attempted operation could not be completed by the server because the server does not support the operation.
SSH_SFT_ERROR_INVALID_HANDLE  The handle value was invalid.
SSH_SFT_ERROR_NO_SUCH_PATH  The file path does not exist or is invalid.
SSH_SFT_ERROR_FILE_ALREADY_EXISTS  The file already exists.
SSH_SFT_ERROR_WRITE_PROTECT  The file is on read-only media, or the media is write protected.
SSH_SFT_ERROR_NO_MEDIA  The requested operation cannot be completed because there is no media available in the drive.
SSH_SFT_ERROR_EOF_SRC  An attempt to read past the end-of-file was made; or, there are no more directory entries to return.
SSH_SFT_ERROR_NO_SUCH_FILE_SRC  A reference was made to a file which does not exist.
SSH_SFT_ERROR_PERMISSION_DENIED_SRC  The user does not have sufficient permissions to perform the operation.
SSH_SFT_ERROR_FAILURE_SRC  An error occured, but no specific error code exists to describe the failure.
SSH_SFT_ERROR_BAD_MESSAGE_SRC  A badly formatted packet or other SFTP protocol incompatibility was detected.
SSH_SFT_ERROR_NO_CONNECTION_SRC  There is no connection to the server.
SSH_SFT_ERROR_CONNECTION_LOST_SRC  The connection to the server was lost.
SSH_SFT_ERROR_OP_UNSUPPORTED_SRC  An attempted operation could not be completed by the server because the server does not support the operation.
SSH_SFT_ERROR_INVALID_HANDLE_SRC  The handle value was invalid.
SSH_SFT_ERROR_NO_SUCH_PATH_SRC  The file path does not exist or is invalid.
SSH_SFT_ERROR_FILE_ALREADY_EXISTS_SRC  The file already exists.
SSH_SFT_ERROR_WRITE_PROTECT_SRC  The file is on read-only media, or the media is write protected.
SSH_SFT_ERROR_NO_MEDIA_SRC  The requested operation cannot be completed because there is no media available in the drive.
SSH_SFT_ERROR_EOF_DST  An attempt to read past the end-of-file was made; or, there are no more directory entries to return.
SSH_SFT_ERROR_NO_SUCH_FILE_DST  A reference was made to a file which does not exist.
SSH_SFT_ERROR_PERMISSION_DENIED_DST  The user does not have sufficient permissions to perform the operation.
SSH_SFT_ERROR_FAILURE_DST  An error occured, but no specific error code exists to describe the failure.
SSH_SFT_ERROR_BAD_MESSAGE_DST  A badly formatted packet or other SFTP protocol incompatibility was detected.
SSH_SFT_ERROR_NO_CONNECTION_DST  There is no connection to the server.
SSH_SFT_ERROR_CONNECTION_LOST_DST  The connection to the server was lost.
SSH_SFT_ERROR_OP_UNSUPPORTED_DST  An attempted operation could not be completed by the server because the server does not support the operation.
SSH_SFT_ERROR_INVALID_HANDLE_DST  The handle value was invalid.
SSH_SFT_ERROR_NO_SUCH_PATH_DST  The file path does not exist or is invalid.
SSH_SFT_ERROR_FILE_ALREADY_EXISTS_DST  The file already exists.
SSH_SFT_ERROR_WRITE_PROTECT_DST  The file is on read-only media, or the media is write protected.
SSH_SFT_ERROR_NO_MEDIA_DST  The requested operation cannot be completed because there is no media available in the drive.
SSH_SFT_ERROR_NO_BROKER_CONNECTION  No connection to SSH Tectia Connection Broker.
SSH_SFT_ERROR_AUTHENTICATION_FAILED  Authentication failed.
SSH_SFT_ERROR_UNABLE_TO_CONNECT_SERVER  Could not connect to SSH server.
SSH_SFT_ERROR_BROKER_FAILED  Unspecified Broker error.
SSH_SFT_ERROR_LOCAL_STREAM_FAILED  Could not create local stream.
SSH_SFT_ERROR_CONNECTION_ABORTED  Connection was aborted.
SSH_SFT_ERROR_READ  Reading from stream failed.
SSH_SFT_ERROR_WRITE  Writing to stream failed.
SSH_SFT_ERROR_OUT_OF_MEMORY  Could not allocate memory.
SSH_SFT_ERROR_LISTENER  Could not create local listener.
SSH_SFT_ERROR_LIB_UNINITIALIZED  SFT library was not initialized.
SSH_SFT_ERROR_ILLEGAL_PARAMETER  Illegal parameter was given.
SSH_SFT_ERROR_NO_CHECKPOINT_ENTRY  No checkpoint entry was found in checkpoint database.
SSH_SFT_ERROR_INTERNAL  Internal error was encountered. This should not happen.

enum SshSftFileAttrFlags

Attribute flags are used for specifying, which attributes are present.

Enumerator:
SSH_SFT_FILE_ATTR_SIZE  Size attributes is present.
SSH_SFT_FILE_ATTR_UIDGID  UIDGID attribute is present. UIDGID is not allowed in SFTPv4.
SSH_SFT_FILE_ATTR_PERMISSIONS  Permissions attributes is present.
SSH_SFT_FILE_ATTR_ACMODTIME  Last modified time attribute is present. This attribute is only used in SFTPv3.
SSH_SFT_FILE_ATTR_ACCESSTIME  Last accessed time attribute is present. This attribute is only used in SFTPv4.
SSH_SFT_FILE_ATTR_CREATETIME  Create time attribute is present. This attribute is only used in SFTPv4 and later.
SSH_SFT_FILE_ATTR_MODIFYTIME  Last modified time attribute is present. This attribute is only used in SFTPv4 and later.
SSH_SFT_FILE_ATTR_ACL  Access control list attribute is present. This attribute is only used in SFTPv4 and later.
SSH_SFT_FILE_ATTR_OWNERGROUP  Owner and group attribute is present. This attribute is only used in SFTPv4 and later.
SSH_SFT_FILE_ATTR_SUBSECOND_TIMES  Subsecond times (time value granularity is less that second) attribute is present. This attribute is only used in SFTPv4 and later.
SSH_SFT_FILE_ATTR_EXTENDED  Extended attribute is present. This attribute is only used in SFTPv4 and later.

enum SshSftFileFlags

File open flags.

Different flags are used in opening file.

Enumerator:
SSH_SFT_FILE_FLAG_RDWR  Open file in read/write mode.
SSH_SFT_FILE_FLAG_WRONLY  Open file in write-only mode.
SSH_SFT_FILE_FLAG_APPEND  Open file in read-only mode. Open file in append mode.
SSH_SFT_FILE_FLAG_CREAT  The file is created, if it does not exist.
SSH_SFT_FILE_FLAG_TRUNC  Existing file is truncated when opened.
SSH_SFT_FILE_FLAG_EXCL  When used with SSH_SFT_FILE_OPEN_FLAG_CREAT, if the file already exists it is an error and the open will fail.

enum SshSftFileType

File types.

Different file types are used in SFT operations.

Enumerator:
SSH_SFT_FILE_TYPE_REGULAR  File is a regular file.
SSH_SFT_FILE_TYPE_DIRECTORY  File is a directory.
SSH_SFT_FILE_TYPE_SYMLINK  File is a symbolic link.
SSH_SFT_FILE_TYPE_SPECIAL  File is a special file.
SSH_SFT_FILE_TYPE_UNKNOWN  The type of the file is unknown.

enum SshSftInteract

Return values for user interaction.

These values are used when user interaction is needed to perform some operation. Interaction callback function is called from the library and the function must return the value for the library.

Enumerator:
SSH_SFT_INTERACT_NO  User answered 'no'.
SSH_SFT_INTERACT_YES  User answered 'yes'.
SSH_SFT_INTERACT_ABORT  User answered 'abort'.
SSH_SFT_INTERACT_ASCII_CONV_DOS  User was asked about ASCII conversion and he/she answered 'dos'.
SSH_SFT_INTERACT_ASCII_CONV_UNIX  User was asked about ASCII conversion and he/she answered 'unix'.
SSH_SFT_INTERACT_ASCII_CONV_MAC  User was asked about ASCII conversion and he/she answered 'mac'.