libssh
0.11.0
The SSH library
|
Functions | |
ssh_scp | ssh_scp_new (ssh_session session, int mode, const char *location) |
Create a new scp session. | |
int | ssh_scp_init (ssh_scp scp) |
Initialize the scp channel. | |
int | ssh_scp_close (ssh_scp scp) |
Close the scp channel. | |
void | ssh_scp_free (ssh_scp scp) |
Free a scp context. | |
int | ssh_scp_push_directory (ssh_scp scp, const char *dirname, int mode) |
Create a directory in a scp in sink mode. | |
int | ssh_scp_leave_directory (ssh_scp scp) |
Leave a directory. | |
int | ssh_scp_push_file64 (ssh_scp scp, const char *filename, uint64_t size, int mode) |
Initialize the sending of a file to a scp in sink mode, using a 64-bit size. | |
int | ssh_scp_push_file (ssh_scp scp, const char *filename, size_t size, int mode) |
Initialize the sending of a file to a scp in sink mode. | |
int | ssh_scp_response (ssh_scp scp, char **response) |
int | ssh_scp_write (ssh_scp scp, const void *buffer, size_t len) |
Write into a remote scp file. | |
int | ssh_scp_read_string (ssh_scp scp, char *buffer, size_t len) |
Read a string on a channel, terminated by ' '. | |
int | ssh_scp_pull_request (ssh_scp scp) |
Wait for a scp request (file, directory). | |
int | ssh_scp_deny_request (ssh_scp scp, const char *reason) |
Deny the transfer of a file or creation of a directory coming from the remote party. | |
int | ssh_scp_accept_request (ssh_scp scp) |
Accepts transfer of a file or creation of a directory coming from the remote party. | |
int | ssh_scp_read (ssh_scp scp, void *buffer, size_t size) |
Read from a remote scp file. | |
const char * | ssh_scp_request_get_filename (ssh_scp scp) |
Get the name of the directory or file being pushed from the other party. | |
int | ssh_scp_request_get_permissions (ssh_scp scp) |
Get the permissions of the directory or file being pushed from the other party. | |
size_t | ssh_scp_request_get_size (ssh_scp scp) |
Get the size of the file being pushed from the other party. | |
uint64_t | ssh_scp_request_get_size64 (ssh_scp scp) |
Get the size of the file being pushed from the other party. | |
int | ssh_scp_integer_mode (const char *mode) |
Convert a scp text mode to an integer. | |
char * | ssh_scp_string_mode (int mode) |
Convert a unix mode into a scp string. | |
const char * | ssh_scp_request_get_warning (ssh_scp scp) |
Get the warning string from a scp handle. | |
SCP protocol over SSH functions
int ssh_scp_accept_request | ( | ssh_scp | scp | ) |
Accepts transfer of a file or creation of a directory coming from the remote party.
[in] | scp | The scp handle. |
int ssh_scp_close | ( | ssh_scp | scp | ) |
Close the scp channel.
[in] | scp | The scp context to close. |
int ssh_scp_deny_request | ( | ssh_scp | scp, |
const char * | reason ) |
Deny the transfer of a file or creation of a directory coming from the remote party.
[in] | scp | The scp handle. |
[in] | reason | A nul-terminated string with a human-readable explanation of the deny. |
void ssh_scp_free | ( | ssh_scp | scp | ) |
Free a scp context.
[in] | scp | The context to free. |
int ssh_scp_init | ( | ssh_scp | scp | ) |
Initialize the scp channel.
[in] | scp | The scp context to initialize. |
int ssh_scp_integer_mode | ( | const char * | mode | ) |
Convert a scp text mode to an integer.
[in] | mode | The mode to convert, e.g. "0644". |
int ssh_scp_leave_directory | ( | ssh_scp | scp | ) |
Leave a directory.
ssh_scp ssh_scp_new | ( | ssh_session | session, |
int | mode, | ||
const char * | location ) |
Create a new scp session.
[in] | session | The SSH session to use. |
[in] | mode | One of SSH_SCP_WRITE or SSH_SCP_READ, depending if you need to drop files remotely or read them. It is not possible to combine read and write. SSH_SCP_RECURSIVE Flag can be or'ed to this to indicate that you're going to use recursion. Browsing through directories is not possible without this. |
[in] | location | The directory in which write or read will be done. Any push or pull will be relative to this place. This can also be a pattern of files to download (read). |
int ssh_scp_pull_request | ( | ssh_scp | scp | ) |
Wait for a scp request (file, directory).
int ssh_scp_push_directory | ( | ssh_scp | scp, |
const char * | dirname, | ||
int | mode ) |
Create a directory in a scp in sink mode.
[in] | scp | The scp handle. |
[in] | dirname | The name of the directory being created. |
[in] | mode | The UNIX permissions for the new directory, e.g. 0755. |
int ssh_scp_push_file | ( | ssh_scp | scp, |
const char * | filename, | ||
size_t | size, | ||
int | mode ) |
Initialize the sending of a file to a scp in sink mode.
[in] | scp | The scp handle. |
[in] | filename | The name of the file being sent. It should not contain any path indicator |
[in] | size | Exact size in bytes of the file being sent. |
[in] | mode | The UNIX permissions for the new file, e.g. 0644. |
int ssh_scp_push_file64 | ( | ssh_scp | scp, |
const char * | filename, | ||
uint64_t | size, | ||
int | mode ) |
Initialize the sending of a file to a scp in sink mode, using a 64-bit size.
[in] | scp | The scp handle. |
[in] | filename | The name of the file being sent. It should not contain any path indicator |
[in] | size | Exact size in bytes of the file being sent. |
[in] | mode | The UNIX permissions for the new file, e.g. 0644. |
int ssh_scp_read | ( | ssh_scp | scp, |
void * | buffer, | ||
size_t | size ) |
Read from a remote scp file.
[in] | scp | The scp handle. |
[in] | buffer | The destination buffer. |
[in] | size | The size of the buffer. |
int ssh_scp_read_string | ( | ssh_scp | scp, |
char * | buffer, | ||
size_t | len ) |
Read a string on a channel, terminated by '
'.
[in] | scp | The scp handle. |
[out] | buffer | A pointer to a buffer to place the string. |
[in] | len | The size of the buffer in bytes. If the string is bigger than len-1, only len-1 bytes are read and the string is null-terminated. |
const char * ssh_scp_request_get_filename | ( | ssh_scp | scp | ) |
Get the name of the directory or file being pushed from the other party.
int ssh_scp_request_get_permissions | ( | ssh_scp | scp | ) |
Get the permissions of the directory or file being pushed from the other party.
size_t ssh_scp_request_get_size | ( | ssh_scp | scp | ) |
Get the size of the file being pushed from the other party.
uint64_t ssh_scp_request_get_size64 | ( | ssh_scp | scp | ) |
Get the size of the file being pushed from the other party.
const char * ssh_scp_request_get_warning | ( | ssh_scp | scp | ) |
Get the warning string from a scp handle.
[in] | scp | The scp handle. |
char * ssh_scp_string_mode | ( | int | mode | ) |
Convert a unix mode into a scp string.
[in] | mode | The mode to convert, e.g. 420 or 0644. |
int ssh_scp_write | ( | ssh_scp | scp, |
const void * | buffer, | ||
size_t | len ) |
Write into a remote scp file.
[in] | scp | The scp handle. |
[in] | buffer | The buffer to write. |
[in] | len | The number of bytes to write. |