libssh 0.4.8
|
SFTP handling functions. More...
#include <sys/types.h>
#include "libssh.h"
Go to the source code of this file.
Functions | |
LIBSSH_API int | sftp_async_read (sftp_file file, void *data, uint32_t len, uint32_t id) |
Wait for an asynchronous read to complete and save the data. | |
LIBSSH_API int | sftp_async_read_begin (sftp_file file, uint32_t len) |
Start an asynchronous read from a file using an opened sftp file handle. | |
LIBSSH_API void | sftp_attributes_free (sftp_attributes file) |
Free a sftp attribute structure. | |
LIBSSH_API char * | sftp_canonicalize_path (sftp_session sftp, const char *path) |
Canonicalize a sftp path. | |
LIBSSH_API int | sftp_chmod (sftp_session sftp, const char *file, mode_t mode) |
Change permissions of a file. | |
LIBSSH_API int | sftp_chown (sftp_session sftp, const char *file, uid_t owner, gid_t group) |
Change the file owner and group. | |
LIBSSH_API int | sftp_close (sftp_file file) |
Close an open file handle. | |
LIBSSH_API int | sftp_closedir (sftp_dir dir) |
Close a directory handle opened by sftp_opendir(). | |
LIBSSH_API int | sftp_dir_eof (sftp_dir dir) |
Tell if the directory has reached EOF (End Of File). | |
LIBSSH_API int | sftp_extension_supported (sftp_session sftp, const char *name, const char *data) |
Check if the given extension is supported. | |
LIBSSH_API unsigned int | sftp_extensions_get_count (sftp_session sftp) |
Get the count of extensions provided by the server. | |
LIBSSH_API const char * | sftp_extensions_get_data (sftp_session sftp, unsigned int indexn) |
Get the data of the extension provided by the server. | |
LIBSSH_API const char * | sftp_extensions_get_name (sftp_session sftp, unsigned int indexn) |
Get the name of the extension provided by the server. | |
LIBSSH_API void | sftp_free (sftp_session sftp) |
Close and deallocate a sftp session. | |
LIBSSH_API sftp_attributes | sftp_fstat (sftp_file file) |
Get information about a file or directory from a file handle. | |
LIBSSH_API sftp_statvfs_t | sftp_fstatvfs (sftp_file file) |
Get information about a mounted file system. | |
LIBSSH_API int | sftp_get_error (sftp_session sftp) |
Get the last sftp error. | |
LIBSSH_API int | sftp_init (sftp_session sftp) |
Initialize the sftp session with the server. | |
LIBSSH_API sftp_attributes | sftp_lstat (sftp_session session, const char *path) |
Get information about a file or directory. | |
LIBSSH_API int | sftp_mkdir (sftp_session sftp, const char *directory, mode_t mode) |
Create a directory. | |
LIBSSH_API sftp_session | sftp_new (ssh_session session) |
Start a new sftp session. | |
LIBSSH_API sftp_file | sftp_open (sftp_session session, const char *file, int accesstype, mode_t mode) |
Open a file on the server. | |
LIBSSH_API sftp_dir | sftp_opendir (sftp_session session, const char *path) |
Open a directory used to obtain directory entries. | |
LIBSSH_API ssize_t | sftp_read (sftp_file file, void *buf, size_t count) |
Read from a file using an opened sftp file handle. | |
LIBSSH_API sftp_attributes | sftp_readdir (sftp_session session, sftp_dir dir) |
Get a single file attributes structure of a directory. | |
LIBSSH_API char * | sftp_readlink (sftp_session sftp, const char *path) |
Read the value of a symbolic link. | |
LIBSSH_API int | sftp_rename (sftp_session sftp, const char *original, const char *newname) |
Rename or move a file or directory. | |
LIBSSH_API void | sftp_rewind (sftp_file file) |
Rewinds the position of the file pointer to the beginning of the file. | |
LIBSSH_API int | sftp_rmdir (sftp_session sftp, const char *directory) |
Remove a directoy. | |
LIBSSH_API int | sftp_seek (sftp_file file, uint32_t new_offset) |
Seek to a specific location in a file. | |
LIBSSH_API int | sftp_seek64 (sftp_file file, uint64_t new_offset) |
Seek to a specific location in a file. | |
LIBSSH_API int | sftp_server_version (sftp_session sftp) |
Get the version of the SFTP protocol supported by the server. | |
LIBSSH_API int | sftp_setstat (sftp_session sftp, const char *file, sftp_attributes attr) |
Set file attributes on a file, directory or symbolic link. | |
LIBSSH_API sftp_attributes | sftp_stat (sftp_session session, const char *path) |
Get information about a file or directory. | |
LIBSSH_API sftp_statvfs_t | sftp_statvfs (sftp_session sftp, const char *path) |
Get information about a mounted file system. | |
LIBSSH_API void | sftp_statvfs_free (sftp_statvfs_t statvfs_o) |
Free the memory of an allocated statvfs. | |
LIBSSH_API int | sftp_symlink (sftp_session sftp, const char *target, const char *dest) |
Create a symbolic link. | |
LIBSSH_API unsigned long | sftp_tell (sftp_file file) |
Report current byte position in file. | |
LIBSSH_API uint64_t | sftp_tell64 (sftp_file file) |
Report current byte position in file. | |
LIBSSH_API int | sftp_unlink (sftp_session sftp, const char *file) |
Unlink (delete) a file. | |
LIBSSH_API int | sftp_utimes (sftp_session sftp, const char *file, const struct timeval *times) |
Change the last modification and access time of a file. | |
LIBSSH_API ssize_t | sftp_write (sftp_file file, const void *buf, size_t count) |
Write to a file using an opened sftp file handle. |
SFTP handling functions.
SFTP commands are channeled by the ssh sftp subsystem. Every packet is sent/read using a sftp_packet type structure. Related to these packets, most of the server answers are messages having an ID and a message specific part. It is described by sftp_message when reading a message, the sftp system puts it into the queue, so the process having asked for it can fetch it, while continuing to read for other messages (it is unspecified in which order messages may be sent back to the client