include/libssh/sftp.h File Reference

SFTP handling functions. More...

#include <libssh/libssh.h>

Go to the source code of this file.

Functions

int sftp_async_read (SFTP_FILE *file, void *data, u32 len, u32 id)
 Wait for an asynchronous read to complete and save the data.
int sftp_async_read_begin (SFTP_FILE *file, u32 len)
 Start an asynchronous read from a file using an opened sftp file handle.
void sftp_attributes_free (SFTP_ATTRIBUTES *file)
 Free a sftp attribute structure.
char * sftp_canonicalize_path (SFTP_SESSION *sftp, const char *path)
 Canonicalize a sftp path.
int sftp_chmod (SFTP_SESSION *sftp, const char *file, mode_t mode)
 Change permissions of a file.
int sftp_chown (SFTP_SESSION *sftp, const char *file, uid_t owner, gid_t group)
 Change the file owner and group.
int sftp_close (SFTP_FILE *file)
 Close an open file handle.
int sftp_closedir (SFTP_DIR *dir)
 Close a directory handle opened by sftp_opendir().
int sftp_dir_close (SFTP_DIR *dir) SFTP_DEPRECATED
int sftp_dir_eof (SFTP_DIR *dir)
 Tell if the directory has reached EOF (End Of File).
int sftp_file_close (SFTP_FILE *file) SFTP_DEPRECATED
void sftp_free (SFTP_SESSION *sftp)
 Close and deallocate a sftp session.
SFTP_ATTRIBUTES * sftp_fstat (SFTP_FILE *file)
 Get information about a file or directory from a file handle.
int sftp_get_error (SFTP_SESSION *sftp)
 Get the last sftp error.
int sftp_init (SFTP_SESSION *sftp)
 Initialize the sftp session with the server.
SFTP_ATTRIBUTES * sftp_lstat (SFTP_SESSION *session, const char *path)
 Get information about a file or directory.
int sftp_mkdir (SFTP_SESSION *sftp, const char *directory, mode_t mode)
 Create a directory.
SFTP_SESSION * sftp_new (SSH_SESSION *session)
 Start a new sftp session.
SFTP_FILE * sftp_open (SFTP_SESSION *session, const char *file, int flags, mode_t mode)
 Open a file on the server.
SFTP_DIR * sftp_opendir (SFTP_SESSION *session, const char *path)
 Open a directory used to obtain directory entries.
ssize_t sftp_read (SFTP_FILE *file, void *buf, size_t count)
 Read from a file using an opened sftp file handle.
SFTP_ATTRIBUTES * sftp_readdir (SFTP_SESSION *session, SFTP_DIR *dir)
 Get a single file attributes structure of a directory.
char * sftp_readlink (SFTP_SESSION *sftp, const char *path)
 Read the value of a symbolic link.
int sftp_rename (SFTP_SESSION *sftp, const char *original, const char *newname)
 Rename or move a file or directory.
void sftp_rewind (SFTP_FILE *file)
 Rewinds the position of the file pointer to the beginning of the file.
int sftp_rm (SFTP_SESSION *sftp, const char *file) SFTP_DEPRECATED
int sftp_rmdir (SFTP_SESSION *sftp, const char *directory)
 Remove a directoy.
int sftp_seek (SFTP_FILE *file, u32 new_offset)
 Seek to a specific location in a file.
int sftp_seek64 (SFTP_FILE *file, u64 new_offset)
 Seek to a specific location in a file.
int sftp_server_version (SFTP_SESSION *sftp)
 Get the version of the SFTP protocol supported by the server.
int sftp_setstat (SFTP_SESSION *sftp, const char *file, SFTP_ATTRIBUTES *attr)
 Set file attributes on a file, directory or symbolic link.
SFTP_ATTRIBUTES * sftp_stat (SFTP_SESSION *session, const char *path)
 Get information about a file or directory.
int sftp_symlink (SFTP_SESSION *sftp, const char *target, const char *dest)
 Create a symbolic link.
unsigned long sftp_tell (SFTP_FILE *file)
 Report current byte position in file.
u64 sftp_tell64 (SFTP_FILE *file)
 Report current byte position in file.
int sftp_unlink (SFTP_SESSION *sftp, const char *file)
 Unlink (delete) a file.
int sftp_utimes (SFTP_SESSION *sftp, const char *file, const struct timeval *times)
 Change the last modification and access time of a file.
ssize_t sftp_write (SFTP_FILE *file, const void *buf, size_t count)
 Write to a file using an opened sftp file handle.


Detailed Description

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 inspecified in which order messages may be sent back to the client


doxygen