secsh_sft.h File Reference
Detailed Description
SSH Tectia Secure File Transfer (SFT) C-API- Version:
- 1.2.1
Define Documentation
SshSftError ssh_sft_init_2 | ( | broker, | |||
init_params, | |||||
emsgr | ) | ssh_sft_init_2_v(broker, init_params, emsgr, SSH_SFT_API_VERSION) |
Simple macro to automatically include version in init call
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 struct SshSftInitParamsRec SshSftInitParamsStruct |
SFT initialization parameters
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:
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:
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:
enum SshSftDirSortFlags |
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:
enum SshSftFileAttrFlags |
Attribute flags are used for specifying, which attributes are present.
- Enumerator:
enum SshSftFileFlags |
File open flags.
Different flags are used in opening file.
- Enumerator:
enum SshSftFileType |
File types.
Different file types are used in SFT operations.
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:
enum SshSftOperation |
SFT operation code.
Operation codes are used whenever the user needs to be informed about what kind of operation is going on. User can decide then whether the operation can continue or not. The main use of these operation codes is in directory operations.
- Enumerator:
enum SshSftSetstatMode |
enum SshSftSignal |
Signal type.
Signal types are used for transfering signals from the library to the application. 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.
enum SshSftStreaming |
Streaming types.
SFT can use two file transfer methods: traditional SFTP protocol and streaming. Traditional SFTP file transfer uses SFTP READ and WRITE messages to transfer file data. Streaming does not use SFTP protocol, but transfers the file data over a dedicated SSH channel without protocol overhead. There is a small overhead on setting up streaming channel, so it is not used for small files that can be sent using just one READ and WRITE messages.
- Enumerator:
enum SshSftTransferMode |
File transfer mode.
File can be transferred either in binary or ASCII mode. In ASCII mode newlines are converted from source convention to destination convention.
- Enumerator:
Function Documentation
SshSftError ssh_sft_abort | ( | SshSft | handle, | |
char ** | error_msg_ret | |||
) |
Abort operation.
The ongoing file operations can be aborted with this function. 'handle' specifies the session that is aborted.
- Parameters:
handle Handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_close | ( | SshSft | handle, | |
char ** | error_msg_ret | |||
) |
Close SFT session.
This function closes the session given in 'handle'.
- Parameters:
handle Handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_config | ( | SshSft | handle, | |
SshSftParam | param, | |||
char ** | error_msg_ret | |||
) |
Configure SFT session.
This function re-configures the session given in 'handle' using the parameters in 'param'.
- Parameters:
handle Handle to SFT session. param SFT parameters. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_config_get | ( | SshSft | handle, | |
SshSftParam | param, | |||
char ** | error_msg_ret | |||
) |
Get SFT configuration.
This function gets the configuration of the session given in 'handle'.
- Parameters:
handle Handle to SFT session. param SFT parameters. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Copy file.
Source file name with path is given in 'src_file'. Destination file name with path is given in 'dst_file'. File is copied from remote or local host specified by 'src_handle' to remote or local host specified by 'dst_handle'. 'handles' must be successfully opened before they are used.
'progress_cb' and 'progress_cb_ctx' are used for informing the caller about the progress of the file transfer.
'message_cb' and 'message_cb_ctx' are used for informing the caller about different actions during file transfer. For example, if destination file already exists and the user must be asked, whether the file can be overwritten, 'message_cb' function is called.
With 'copy_offset' it is possible to give the starting offsets of the source and destination files. If 'copy_offset' is NULL, no offsets are used.
- Parameters:
src_handle Handle to source SFT session. src_file Absolute path of the source file. dst_handle Handle to destination SFT session. dst_file Absolute path of the destination file. progress_cb Progress callback function pointer. progress_cb_ctx Progress callback context. message_cb Message callback function pointer. message_cb_ctx Message callback context. copy_offset Offsets to be used. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Copy directory.
Source directory name with path is given in 'src_dir'. Destination directory name with path is given in 'dst_dir'. Directory is copied from remote or local host specified by 'src_handle' to remote or local host specified by 'dst_handle'. 'src_handle' and 'dst_handle' must be successfully opened before they are used.
'glob' context is used for globbing. If 'glob' is NULL, no globbing is done. 'max_depth' specifies the maximum depth of the directory traversal. If 'max_depth' is set to 0, the whole directory is copied recursively. 'progress_cb' and 'progress_cb_ctx' are used for informing the caller about the progress of the file transfer. 'progress_ctx_create_cb' function is used for creating context for each file copy operation. 'progress_ctx_destroy_cb' function is used for destroying the created context. 'progress_cb_ctx' is given to both create adn destroy functions as an argument. 'message_cb' and 'message_cb_ctx' are used for informing the caller about different actions during file transfer. For example, if destination file already exists and the user must be asked, whether the file can be overwritten, 'message_cb' function is called.
- Parameters:
src_handle Handle to source SFT session. src_dir Absolute path of the source directory. dst_handle Handle to destination SFT session. dst_dir Absolute path of the destination directory. glob Globbing context. max_depth Maximum depth of directory traversal. progress_cb Progress callback function pointer. progress_cb_ctx Progress callback context. progress_ctx_create_cb Progress callback context create function pointer. progress_ctx_destroy_cb Progress callback context destroy function pointer. message_cb Message callback function pointer. message_cb_ctx Message callback context. error_msg_ret Returned error message.
- Returns:
- SshSftError.
void ssh_sft_data_free | ( | unsigned char ** | data | ) |
Free data.
This function frees data that was allocated by SFT API function. The pointer is also zeroed.
- Parameters:
data Pointer to data pointer.
SshSftError ssh_sft_destroy | ( | SshSft | handle, | |
char ** | error_msg_ret | |||
) |
Destroy SFT session.
This function frees allocated memory of the session given in 'handle'.
- Parameters:
handle Handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_dir_close | ( | SshSftDir | handle, | |
char ** | error_msg_ret | |||
) |
Run CLOSE on open directory.
This function closes directory specified by 'handle'. The 'handle' is also destroyed and cannot be used anymore.
- Parameters:
handle Handle to opened directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_dir_open | ( | SshSft | handle, | |
char * | dir, | |||
SshSftDir * | handle_ret, | |||
char ** | error_msg_ret | |||
) |
Run OPENDIR on directory 'dir'.
This function opens the directory on the remote or local host specified by session 'handle'. Directory name with path is given in 'dir'. The handle to the opened directory is returned in 'handle_ret'. The directory can be closed with 'ssh_sft_dir_close' after it has been used. Directory handle must not be used after SFT session handle is closed.
- Parameters:
handle Handle to SFT session. dir Absolute path of the directory. handle_ret Returned handle to opened directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Run READDIR on open directory.
This function reads directory contents from the directory specified by 'handle'. Directory must be successfully opened with 'ssh_sft_dir_open' before it is used. Directory name with path is given in 'dir'. The data of one directory entry is returned in 'entry_name_ret', 'entry_long_name_ret' and 'entry_attrs_ret'. The number of entries in the queue is returned in 'queue_size_ret'. Its value tells the caller how many entries can be fetched without sending protocol message to the server. The memory for the directory entry is dynamically allocated and must be freed using 'ssh_sft_name_free' and 'ssh_sft_file_attrs_free' functions. The function returns SSH_SFT_ERROR_EOF, if no more entries can be found.
- Parameters:
handle Handle to opened directory. entry_name_ret Returned name of the entry. entry_long_name_ret Returned long name of the entry. entry_attrs_ret Returned attributes of the entry. queue_size_ret Returned number of entries queued. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_dir_rmdir | ( | SshSftDir | handle, | |
char ** | error_msg_ret | |||
) |
Run RMDIR on open directory.
This function closes and removes directory specified by 'handle'. The 'handle' is also destroyed and cannot be used anymore.
- Parameters:
handle Handle to opened directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
void ssh_sft_error_msg_free | ( | char ** | error_msg | ) |
Free error message.
This function frees error message that was allocated by SFT API function. The pointer is also zeroed.
- Parameters:
error_msg Pointer to error message string pointer.
SshSftFileAttributes ssh_sft_file_attrs_dup | ( | SshSftFileAttributes | attrs | ) |
Duplicate file attributes.
This function allocates memory for file attributes and copies the values to the newly allocated memory. Attributes must be freed with 'ssh_sft_file_attrs_free' function.
- Parameters:
attrs File attributes.
- Returns:
- Copy of file attributes.
void ssh_sft_file_attrs_free | ( | SshSftFileAttributes * | attrs | ) |
Free file attributes.
This function frees file attribute structure that was allocated by SFT API function. The pointer is also zeroed.
- Parameters:
attrs Pointer to file attributes pointer.
SshSftError ssh_sft_file_close | ( | SshSftFile | handle, | |
char ** | error_msg_ret | |||
) |
Run CLOSE on open file.
This function closes the file specified by 'handle'. The 'handle' is also destroyed and cannot be used anymore.
- Parameters:
handle Handle to opened file. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_file_fstat | ( | SshSftFile | handle, | |
SshSftFileAttributes * | attrs_ret, | |||
char ** | error_msg_ret | |||
) |
Run STAT on open file.
This function gets file attributes of the file specified by 'handle'. File must be successfully opened before it is used. File attributes are returned in 'attrs_ret'. The memory for the attributes is dynamically allocated. It must be freed using 'ssh_sft_file_attrs_free' function.
- Parameters:
handle Handle to opened file. attrs_ret Returned file attributes. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_file_open | ( | SshSft | handle, | |
char * | file, | |||
SshSftFileFlags | flags, | |||
SshSftFileAttributes | attrs, | |||
SshSftFile * | handle_ret, | |||
char ** | error_msg_ret | |||
) |
Run OPEN on file 'file'.
This function opens the file on the remote or local host specified by SFT session 'handle'. File name with path is given in 'file'. The open flags must be given in 'flags' (SSH_SFT_FILE_FLAG_RDWR | SSH_SFT_FILE_FLAG_WRONLY | SSH_SFT_FILE_FLAG_RDONLY | SSH_SFT_FILE_FLAG_APPEND | SSH_SFT_FILE_FLAG_CREAT | SSH_SFT_FILE_FLAG_TRUNC | SSH_SFT_FILE_FLAG_EXCL). The handle to the opened file is returned in 'handle_ret'. The file can be closed with 'ssh_sft_file_close' after it has been used. File handle must not be used after SFT session handle is closed.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. flags Flags used in opening the file. attrs File attributes used in opening the file. handle_ret Returned handle to opened file. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_file_read | ( | SshSftFile | handle, | |
SshSftUInt64 | offset, | |||
char * | data, | |||
SshSftUInt64 | len, | |||
SshSftUInt64 * | data_len_ret, | |||
char ** | error_msg_ret | |||
) |
Run READ on open file.
This function reads the data of the file specified by 'handle'. File must be successfully opened with 'ssh_sft_file_open' before it is used. The offset to the file data is given in 'offset'. The length of the data block requested is given in 'len'. The data is stored into a user allocated buffer 'data'. The length of the data in the buffer is returned in 'data_len_ret'.
- Parameters:
handle Handle to opened file. offset Offset in the file. data Data buffer. len Length of the requested data. data_len_ret Length of the received data. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_file_read_alloc | ( | SshSftFile | handle, | |
SshSftUInt64 | offset, | |||
SshSftUInt64 | len, | |||
unsigned char ** | data_ret, | |||
SshSftUInt64 * | data_len_ret, | |||
char ** | error_msg_ret | |||
) |
Run READ on open file.
This function reads the data of the file specified by 'handle'. File must be successfully opened with 'ssh_sft_file_open' before it is used. The offset to the file data is given in 'offset'. The length of the data block requested is given in 'len'. The allocated data buffer is returned in 'data_ret'. The length of the buffer is returned in 'data_len_ret'.
- Parameters:
handle Handle to opened file. offset Offset in the file. len Length of the requested data. data_ret Returned data buffer. data_len_ret Returned length of the received data. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_file_remove | ( | SshSftFile | handle, | |
char ** | error_msg_ret | |||
) |
Run REMOVE on open file.
This function closes and removes the file specified by 'handle'. The 'handle' is also destroyed and cannot be used anymore.
- Parameters:
handle Handle to opened file. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_file_write | ( | SshSftFile | handle, | |
SshSftUInt64 | offset, | |||
char * | data, | |||
SshSftUInt64 | data_len, | |||
char ** | error_msg_ret | |||
) |
Run WRITE on open file.
This function writes file data to the file specified by 'handle'. File must be successfully opened with 'ssh_sft_file_open' before it is used. The offset to the file is given in 'offset'. The data buffer to be written is given in 'data'. The length of the buffer is given in 'data_len'.
- Parameters:
handle Handle to opened file. offset Offset in the file. data Data buffer. data_len Length of the data in the buffer. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_fxp_ext_data | ( | SshSft | handle, | |
const char * | ext_data_type, | |||
unsigned char ** | ext_data_ret, | |||
size_t * | ext_data_len_ret | |||
) |
Get SFT protocol extension data.
This function gets extension data received from the server. The type of the data is given in string 'ext_data_type'. The data is returned in 'ext_data_ret'. The length of the data is returned in 'ext_data_len'. Extension data is dynamically allocated and must be freed with function 'ssh_sft_data_free'.
- Parameters:
handle Handle to SFT session. ext_data_type Extension data type. ext_data_ret Returned extension data. ext_data_len_ret Returned length of the extension data.
- Returns:
- SshSftError.
SshSftUInt32 ssh_sft_fxp_version | ( | SshSft | handle | ) |
Get SFT protocol version.
This function returns the negotiated SFTP protocol version.
- Parameters:
handle Handle to SFT session.
- Returns:
- Negotiated SFTP protocol version.
SshSftGlob ssh_sft_glob_create | ( | char * | glob_string, | |
char ** | root_ret, | |||
int * | depth_ret | |||
) |
Create globbing context.
This function creates globbing context out of 'glob_string'. The root directory, below which globbing is performed is returned in 'root_ret'. The depth of the globbing is returned in 'depth_ret'.
- Parameters:
glob_string Globbing string. root_ret Returned root string. depth_ret Returned depth.
- Returns:
- The globbing context.
void ssh_sft_glob_destroy | ( | SshSftGlob * | glob | ) |
Free globbing context.
This function frees memory allocated for the globbing context. The pointer is also zeroed.
- Parameters:
glob Pointer to globbing context.
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 | |||
) |
Get HASH of the 'file'.
This functions returns the file data digest of length 'len' from 'offset'. The digest is returned in 'digest_ret' and its length in 'digest_len_ret'. The hash algorithm name is given in 'hash_name'. Supported values for hash algorithm names are: "md5". The memory for the digest is dynamically allocated. It must be freed using 'ssh_sft_data_free' function.
- Parameters:
handle Handle to SFT session. file Absolute path of file. hash_name Name of the hash algorithm. offset Offset in the file. len Length of the data to be hashed. digest_ret Returned digest. digest_len_ret Returned length of the digest. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_init | ( | const char * | crypto_dll_path, | |
SshSftBoolean | fips_mode, | |||
char ** | error_msg_ret | |||
) |
Initialize SFT library (depricated).
The path to an SSH crypto library DLL is given in 'crypto_dll_path'. The cryptographic functions to be used in the SFT library are taken from this DLL only if 'fips_mode' is set. Otherwise static functions are used.
'fips_mode' flag indicates whether the FIPS certification mode is to be used for the cryptographic operations. Note that if 'fips_mode' is TRUE, the DLL in 'crypto_dll_path' (or the static library) must support FIPS mode or this function will fail.
The function returns SshSftError with associated error message in 'error_msg_ret'.
- Parameters:
crypto_dll_path Path to crypto DLL plugin. fips_mode Flag to enable FIPS mode. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_init_2_v | ( | SshSecShBroker | broker, | |
SshSftInitParams | init_params, | |||
char ** | error_msg_ret, | |||
unsigned int | version | |||
) |
Initialize SFT library.
This function initializes the SFT library. The SFT library must be initialized before it is used.
- Parameters:
broker Broker handle obtained from Tectia API. init_params Parameter structure. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_lstat | ( | SshSft | handle, | |
char * | file, | |||
SshSftFileAttributes * | attrs_ret, | |||
char ** | error_msg_ret | |||
) |
Run LSTAT on file 'file'.
This function gets the attribute of the file on the remote or local host specified by session 'handle'. If the file is a symbolic link, the link attributes are returned. 'handle' must be successfully opened before it is used. File name with path is given in 'file'. File attributes are returned in 'attrs_ret'. The memory for the attributes is dynamically allocated. It must be freed using 'ssh_sft_file_attrs_free' function.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. attrs_ret Returned file attributes. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_mkdir | ( | SshSft | handle, | |
char * | dir, | |||
SshSftFileAttributes | attrs, | |||
char ** | error_msg_ret | |||
) |
Create directory.
The remote or local host of the file is specified by session 'handle'. 'handle' must be successfully opened before it are used. Directory name with path is given in 'dir' and directory attributes, e.g. permissions, in 'attrs'.
- Parameters:
handle Handle to SFT session. dir Absolute path of the directory. attrs Attributes for the new directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Move directory.
This function is the same as 'ssh_sft_copy_dir' except that the source directory is remove after successful directory copy.
- Parameters:
src_handle Handle to source SFT session. src_dir Absolute path of the source directory. dst_handle Handle to destination SFT session. dst_dir Absolute path of the destination directory. glob Globbing context. max_depth Maximum depth of directory traversal. progress_cb Progress callback function pointer. progress_cb_ctx Progress callback context. progress_ctx_create_cb Progress callback context create function pointer. progress_ctx_destroy_cb Progress callback context destroy function pointer. message_cb Message callback function pointer. message_cb_ctx Message callback context. error_msg_ret Returned error message.
- Returns:
- SshSftError.
void ssh_sft_name_free | ( | char ** | name | ) |
Free name.
This function frees name that was allocated by SFT API function. The pointer is also zeroed.
- Parameters:
name Pointer to name pointer.
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 | |||
) |
Open SFT session to "user@host:port".
The SFT session can be configured by giving suitable values in 'param'. The broker can be identified with 'broker_addr'. The function returns a handle to the session in 'handle_ret'. The returned handle must be used in all succeeding file operations. If 'host' is NULL, session to local file access is opened.
All calls of this function must receive the same broker address. If some call receives different address than previous calls the function will fail with error: SSH_SFT_ERROR_ILLEGAL_PARAMETER.
- Parameters:
param SFT parameters. broker_addr Broker address string. user Username string. host Hostname string. port Port number in a string. auth_cb Pointer to function that is used by the Broker to request authentication. auth_cb_ctx Context given to Broker authentication function. handle_ret Returned handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Open SFT session to "user@host:port" and update window.
The SFT session can be configured by giving suitable values in 'param'. The broker can be identified with 'broker_addr'. The function returns a handle to the session in 'handle_ret'. The returned handle must be used in all succeeding file operations. If 'host' is NULL, session to local file access is opened.
Behavior of this function is the same as ssh_sft_open, but it updates the given window while waiting for the Broker to establish the connection.
- Parameters:
param SFT parameters. broker_addr Broker address string. user Username string. host Hostname string. port Port number in a string. auth_cb Pointer to function that is used by the Broker to request authentication. auth_cb_ctx Context given to Broker authentication function. handle_ret Returned handle to SFT session. error_msg_ret Returned error message. window Window handle to be updated Type SshWindowHandle is defined as 'HWND' in windows otherwise as 'void*'
- Returns:
- SshSftError.
SshSftError ssh_sft_open_with_connection | ( | SshSftParam | param, | |
unsigned int | connection_id, | |||
SshWindowHandle | window, | |||
SshSft * | handle_ret, | |||
char ** | error_msg_ret | |||
) |
Open SFT session over an existing connection
- Parameters:
param SFT parameters. connection_id Preopened connection. window Window handle to be updated Type SshWindowHandle is defined as 'HWND' in windows otherwise as 'void*' handle_ret Returned handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_readlink | ( | SshSft | handle, | |
char * | link, | |||
char ** | file_ret, | |||
char ** | error_msg_ret | |||
) |
Run READLINK on symbolic link 'link'.
The remote or local host of the link is specified by session 'handle'. 'handle' must be successfully opened before it are used. Link name with path is given in 'link'. The real name of the file the link points to is returned in 'file_ret'. The memory for the file name is dynamically allocated and must be freed using 'ssh_sft_name_free' function.
- Parameters:
handle Handle to SFT session. link Absolute path of the link. file_ret Returned absolute path of the resolved file/directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_realpath | ( | SshSft | handle, | |
char * | file, | |||
char ** | path_ret, | |||
char ** | error_msg_ret | |||
) |
Resolve absolute path of 'file'.
The remote or local host of the link is specified by session 'handle'. 'handle' must be successfully opened before it are used. File name with path is given in 'file'. The absolute path of 'file' is returned in 'path_ret'. The memory for the path name is dynamically allocated and must be freed using 'ssh_sft_name_free' function.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. path_ret Returned absolute path of the resolved file/directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_remove | ( | SshSft | handle, | |
char * | file, | |||
char ** | error_msg_ret | |||
) |
Remove file.
The remote or local host of the file is specified by session 'handle'. 'handle' must be successfully opened before it are used. File name with path is given in 'file'.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Remove directory recursively.
The remote or local host of the directory is specified by session 'handle'. 'handle' must be successfully opened before it are used. Directory name with path is given in 'dir'.
'glob' context is used for globbing. 'max_depth' specifies the maximum depth of the directory traversal. If 'max_depth' is set to 0, the whole directory is removed recursively. 'message_cb' and 'message_cb_ctx' are used for informing the caller about different actions.
- Parameters:
handle Handle to SFT session. dir Absolute path of the directory. glob Globbing context. max_depth Maximum depth of directory traversal. message_cb Message callback function pointer. message_cb_ctx Message callback context. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_rename | ( | SshSft | handle, | |
char * | old_file, | |||
char * | new_file, | |||
char ** | error_msg_ret | |||
) |
Rename file.
Old file name with path is given in 'old_file'. New file name with path is given in 'new_file'. File is renamed in the remote or local host specified by session 'handle'. 'handle' must be successfully opened before it is used.
- Parameters:
handle Handle to SFT session. old_file Absolute path of the old file. new_file Absolute path of the new file. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_resume | ( | SshSft | handle, | |
char ** | error_msg_ret | |||
) |
Resume operation.
The ongoing operations can be resumed with this function. 'handle' specifies the session that is resumed. If the session is not suspended, this function does nothing.
- Parameters:
handle Handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_rmdir | ( | SshSft | handle, | |
char * | dir, | |||
char ** | error_msg_ret | |||
) |
Remove directory.
The remote or local host of the file is specified by session 'handle'. 'handle' must be successfully opened before it are used. Directory name with path is given in 'dir'. The directory must be empty for the operation to succeed.
- Parameters:
handle Handle to SFT session. dir Absolute path of the directory. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_setstat | ( | SshSft | handle, | |
char * | file, | |||
SshSftFileAttributes | attrs, | |||
char ** | error_msg_ret | |||
) |
Run SETSTAT on file 'file'.
The remote or local host of the file is specified by session 'handle'. 'handle' must be successfully opened before it are used. File name with path is given in 'file'. File attributes are given in 'attrs'.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. attrs File attributes. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Run SETSTAT on directory 'dir'.
This function sets file and directory modes recursively.
'glob' context is used for globbing. If 'glob' is NULL, no globbing is used. 'max_depth' specifies the maximum depth of the directory traversal. If 'max_depth' is set to 0, the whole directory is set recursively. 'permissions' is the desired permissions in UNIX format for the files and directories. 'mode' specifies how the permissions are applied to the entry. 'message_cb' and 'message_cb_ctx' are used for informing the caller about different actions.
- Parameters:
handle Handle to SFT session. dir Absolute path of the directory. glob Globbing context. max_depth Maximum depth of directory traversal. permissions Desired permissions. mode Mode of how permissions are applied. message_cb Message callback function pointer. message_cb_ctx Message callback context. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_stat | ( | SshSft | handle, | |
char * | file, | |||
SshSftFileAttributes * | attrs_ret, | |||
char ** | error_msg_ret | |||
) |
Run STAT on file 'file'.
This function gets the attributes of the file on the remote or local host specified by session 'handle'. 'handle' must be successfully opened before it is used. File name with path is given in 'file'. File attributes are returned in 'attrs_ret'. The memory for the attributes is dynamically allocated. It must be freed using 'ssh_sft_file_attrs_free' function.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. attrs_ret Returned file attributes. error_msg_ret Returned error message.
- Returns:
- SshSftError.
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 | |||
) |
Run STAT on directory 'dir'.
This function gets file and directory attributes recursively. 'glob' context is used for globbing. If 'glob' is NULL, no globbing is done. 'max_depth' specifies the maximum depth of the directory traversal. If 'max_depth' is set to 0, the whole directory is listed recursively. 'sort_flags' specify the sort order of the directory listing (SSH_SFT_DIR_FLAG_SORT_NAME or SSH_SFT_DIR_FLAG_SORT_SIZE combined with SSH_SFT_DIR_FLAG_SORT_REVERSE). The name and attributes of each entry are returned to the user using 'message_cb' function.
- Parameters:
handle Handle to SFT session. dir Absolute path of the directory. glob Globbing context. max_depth Maximum depth of directory traversal. sort_flags Flags to specify sort order. message_cb Message callback function pointer. message_cb_ctx Message callback context. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_suspend | ( | SshSft | handle, | |
char ** | error_msg_ret | |||
) |
Suspend operation.
The ongoing operations can be suspended with this function. 'handle' specifies the session that is suspended. If the session is already suspended, this function does nothing.
- Parameters:
handle Handle to SFT session. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_symlink | ( | SshSft | handle, | |
char * | target, | |||
char * | link, | |||
char ** | error_msg_ret | |||
) |
Create symbolic link.
This function creates symbolic link of name 'link'. The link points to 'target'. Symbolic link is created in the remote or local host specified by session 'handle'. 'handle' must be successfully opened before it is used.
- Parameters:
handle Handle to SFT session. target Absolute path of the target file/directory. link Absolute path of the link. error_msg_ret Returned error message.
- Returns:
- SshSftError.
SshSftError ssh_sft_truncate | ( | SshSft | handle, | |
char * | file, | |||
SshSftUInt64 | size, | |||
char ** | error_msg_ret | |||
) |
Truncate file 'file'.
This function truncates the file on the remote or local host specified by session 'handle'. 'handle' must be successfully opened before it is used. File name with path is given in 'file'.
- Parameters:
handle Handle to SFT session. file Absolute path of the file. size New size of the file. error_msg_ret Returned error message.
- Returns:
- SshSftError.
void ssh_sft_uninit | ( | void | ) |
Uninitialize SFT library.
The SFT library must be uninitialized after it has been used.