libssh 0.7.2

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List

sftp.h
1 /*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2003-2008 by Aris Adamantiadis
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
37 #ifndef SFTP_H
38 #define SFTP_H
39
40 #include <sys/types.h>
41
42 #include "libssh.h"
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 #ifdef _WIN32
49 #ifndef uid_t
50 typedef uint32_t uid_t;
51 #endif /* uid_t */
52 #ifndef gid_t
53 typedef uint32_t gid_t;
54 #endif /* gid_t */
55 #ifdef _MSC_VER
56 #ifndef ssize_t
57 typedef _W64 SSIZE_T ssize_t;
58 #endif /* ssize_t */
59 #endif /* _MSC_VER */
60 #endif /* _WIN32 */
61
62 #define LIBSFTP_VERSION 3
63
64 typedef struct sftp_attributes_struct* sftp_attributes;
65 typedef struct sftp_client_message_struct* sftp_client_message;
66 typedef struct sftp_dir_struct* sftp_dir;
67 typedef struct sftp_ext_struct *sftp_ext;
68 typedef struct sftp_file_struct* sftp_file;
69 typedef struct sftp_message_struct* sftp_message;
70 typedef struct sftp_packet_struct* sftp_packet;
71 typedef struct sftp_request_queue_struct* sftp_request_queue;
72 typedef struct sftp_session_struct* sftp_session;
73 typedef struct sftp_status_message_struct* sftp_status_message;
74 typedef struct sftp_statvfs_struct* sftp_statvfs_t;
75
76 struct sftp_session_struct {
77 ssh_session session;
78 ssh_channel channel;
79 int server_version;
80 int client_version;
81 int version;
82 sftp_request_queue queue;
83 uint32_t id_counter;
84 int errnum;
85 void **handles;
86 sftp_ext ext;
87 };
88
89 struct sftp_packet_struct {
90 sftp_session sftp;
91 uint8_t type;
92 ssh_buffer payload;
93 };
94
95 /* file handler */
96 struct sftp_file_struct {
97 sftp_session sftp;
98 char *name;
99 uint64_t offset;
100 ssh_string handle;
101 int eof;
102 int nonblocking;
103 };
104
105 struct sftp_dir_struct {
106 sftp_session sftp;
107 char *name;
108 ssh_string handle; /* handle to directory */
109 ssh_buffer buffer; /* contains raw attributes from server which haven't been parsed */
110 uint32_t count; /* counts the number of following attributes structures into buffer */
111 int eof; /* end of directory listing */
112 };
113
114 struct sftp_message_struct {
115 sftp_session sftp;
116 uint8_t packet_type;
117 ssh_buffer payload;
118 uint32_t id;
119 };
120
121 /* this is a bunch of all data that could be into a message */
122 struct sftp_client_message_struct {
123 sftp_session sftp;
124 uint8_t type;
125 uint32_t id;
126 char *filename; /* can be "path" */
127 uint32_t flags;
128 sftp_attributes attr;
129 ssh_string handle;
130 uint64_t offset;
131 uint32_t len;
132 int attr_num;
133 ssh_buffer attrbuf; /* used by sftp_reply_attrs */
134 ssh_string data; /* can be newpath of rename() */
135 ssh_buffer complete_message; /* complete message in case of retransmission*/
136 char *str_data; /* cstring version of data */
137 };
138
139 struct sftp_request_queue_struct {
140 sftp_request_queue next;
141 sftp_message message;
142 };
143
144 /* SSH_FXP_MESSAGE described into .7 page 26 */
145 struct sftp_status_message_struct {
146 uint32_t id;
147 uint32_t status;
148 ssh_string error_unused; /* not used anymore */
149 ssh_string lang_unused; /* not used anymore */
150 char *errormsg;
151 char *langmsg;
152 };
153
154 struct sftp_attributes_struct {
155 char *name;
156 char *longname; /* ls -l output on openssh, not reliable else */
157 uint32_t flags;
158 uint8_t type;
159 uint64_t size;
160 uint32_t uid;
161 uint32_t gid;
162 char *owner; /* set if openssh and version 4 */
163 char *group; /* set if openssh and version 4 */
164 uint32_t permissions;
165 uint64_t atime64;
166 uint32_t atime;
167 uint32_t atime_nseconds;
168 uint64_t createtime;
169 uint32_t createtime_nseconds;
170 uint64_t mtime64;
171 uint32_t mtime;
172 uint32_t mtime_nseconds;
173 ssh_string acl;
174 uint32_t extended_count;
175 ssh_string extended_type;
176 ssh_string extended_data;
177 };
178
182 struct sftp_statvfs_struct {
183 uint64_t f_bsize;
184 uint64_t f_frsize;
185 uint64_t f_blocks;
186 uint64_t f_bfree;
187 uint64_t f_bavail;
188 uint64_t f_files;
189 uint64_t f_ffree;
190 uint64_t f_favail;
191 uint64_t f_fsid;
192 uint64_t f_flag;
193 uint64_t f_namemax;
194 };
195
205 LIBSSH_API sftp_session sftp_new(ssh_session session);
206
217 LIBSSH_API sftp_session sftp_new_channel(ssh_session session, ssh_channel channel);
218
219
225 LIBSSH_API void sftp_free(sftp_session sftp);
226
236 LIBSSH_API int sftp_init(sftp_session sftp);
237
250 LIBSSH_API int sftp_get_error(sftp_session sftp);
251
260 LIBSSH_API unsigned int sftp_extensions_get_count(sftp_session sftp);
261
271 LIBSSH_API const char *sftp_extensions_get_name(sftp_session sftp, unsigned int indexn);
272
284 LIBSSH_API const char *sftp_extensions_get_data(sftp_session sftp, unsigned int indexn);
285
303 LIBSSH_API int sftp_extension_supported(sftp_session sftp, const char *name,
304 const char *data);
305
318 LIBSSH_API sftp_dir sftp_opendir(sftp_session session, const char *path);
319
333 LIBSSH_API sftp_attributes sftp_readdir(sftp_session session, sftp_dir dir);
334
344 LIBSSH_API int sftp_dir_eof(sftp_dir dir);
345
358 LIBSSH_API sftp_attributes sftp_stat(sftp_session session, const char *path);
359
375 LIBSSH_API sftp_attributes sftp_lstat(sftp_session session, const char *path);
376
387 LIBSSH_API sftp_attributes sftp_fstat(sftp_file file);
388
394 LIBSSH_API void sftp_attributes_free(sftp_attributes file);
395
403 LIBSSH_API int sftp_closedir(sftp_dir dir);
404
414 LIBSSH_API int sftp_close(sftp_file file);
415
444 LIBSSH_API sftp_file sftp_open(sftp_session session, const char *file, int accesstype,
445 mode_t mode);
446
452 LIBSSH_API void sftp_file_set_nonblocking(sftp_file handle);
453
459 LIBSSH_API void sftp_file_set_blocking(sftp_file handle);
460
475 LIBSSH_API ssize_t sftp_read(sftp_file file, void *buf, size_t count);
476
508 LIBSSH_API int sftp_async_read_begin(sftp_file file, uint32_t len);
509
533 LIBSSH_API int sftp_async_read(sftp_file file, void *data, uint32_t len, uint32_t id);
534
551 LIBSSH_API ssize_t sftp_write(sftp_file file, const void *buf, size_t count);
552
562 LIBSSH_API int sftp_seek(sftp_file file, uint32_t new_offset);
563
574 LIBSSH_API int sftp_seek64(sftp_file file, uint64_t new_offset);
575
585 LIBSSH_API unsigned long sftp_tell(sftp_file file);
586
596 LIBSSH_API uint64_t sftp_tell64(sftp_file file);
597
604 LIBSSH_API void sftp_rewind(sftp_file file);
605
617 LIBSSH_API int sftp_unlink(sftp_session sftp, const char *file);
618
630 LIBSSH_API int sftp_rmdir(sftp_session sftp, const char *directory);
631
647 LIBSSH_API int sftp_mkdir(sftp_session sftp, const char *directory, mode_t mode);
648
664 LIBSSH_API int sftp_rename(sftp_session sftp, const char *original, const char *newname);
665
680 LIBSSH_API int sftp_setstat(sftp_session sftp, const char *file, sftp_attributes attr);
681
697 LIBSSH_API int sftp_chown(sftp_session sftp, const char *file, uid_t owner, gid_t group);
698
714 LIBSSH_API int sftp_chmod(sftp_session sftp, const char *file, mode_t mode);
715
730 LIBSSH_API int sftp_utimes(sftp_session sftp, const char *file, const struct timeval *times);
731
745 LIBSSH_API int sftp_symlink(sftp_session sftp, const char *target, const char *dest);
746
758 LIBSSH_API char *sftp_readlink(sftp_session sftp, const char *path);
759
771 LIBSSH_API sftp_statvfs_t sftp_statvfs(sftp_session sftp, const char *path);
772
782 LIBSSH_API sftp_statvfs_t sftp_fstatvfs(sftp_file file);
783
789 LIBSSH_API void sftp_statvfs_free(sftp_statvfs_t statvfs_o);
790
800 LIBSSH_API char *sftp_canonicalize_path(sftp_session sftp, const char *path);
801
809 LIBSSH_API int sftp_server_version(sftp_session sftp);
810
811 #ifdef WITH_SERVER
812
821 LIBSSH_API sftp_session sftp_server_new(ssh_session session, ssh_channel chan);
822
830 LIBSSH_API int sftp_server_init(sftp_session sftp);
831 #endif /* WITH_SERVER */
832
833 /* this is not a public interface */
834 #define SFTP_HANDLES 256
835 sftp_packet sftp_packet_read(sftp_session sftp);
836 int sftp_packet_write(sftp_session sftp,uint8_t type, ssh_buffer payload);
837 void sftp_packet_free(sftp_packet packet);
838 int buffer_add_attributes(ssh_buffer buffer, sftp_attributes attr);
839 sftp_attributes sftp_parse_attr(sftp_session session, ssh_buffer buf,int expectname);
840 /* sftpserver.c */
841
842 LIBSSH_API sftp_client_message sftp_get_client_message(sftp_session sftp);
843 LIBSSH_API void sftp_client_message_free(sftp_client_message msg);
844 LIBSSH_API uint8_t sftp_client_message_get_type(sftp_client_message msg);
845 LIBSSH_API const char *sftp_client_message_get_filename(sftp_client_message msg);
846 LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
847 LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
848 LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
849 LIBSSH_API int sftp_send_client_message(sftp_session sftp, sftp_client_message msg);
850 int sftp_reply_name(sftp_client_message msg, const char *name,
851 sftp_attributes attr);
852 int sftp_reply_handle(sftp_client_message msg, ssh_string handle);
853 ssh_string sftp_handle_alloc(sftp_session sftp, void *info);
854 int sftp_reply_attr(sftp_client_message msg, sftp_attributes attr);
855 void *sftp_handle(sftp_session sftp, ssh_string handle);
856 int sftp_reply_status(sftp_client_message msg, uint32_t status, const char *message);
857 int sftp_reply_names_add(sftp_client_message msg, const char *file,
858 const char *longname, sftp_attributes attr);
859 int sftp_reply_names(sftp_client_message msg);
860 int sftp_reply_data(sftp_client_message msg, const void *data, int len);
861 void sftp_handle_remove(sftp_session sftp, void *handle);
862
863 /* SFTP commands and constants */
864 #define SSH_FXP_INIT 1
865 #define SSH_FXP_VERSION 2
866 #define SSH_FXP_OPEN 3
867 #define SSH_FXP_CLOSE 4
868 #define SSH_FXP_READ 5
869 #define SSH_FXP_WRITE 6
870 #define SSH_FXP_LSTAT 7
871 #define SSH_FXP_FSTAT 8
872 #define SSH_FXP_SETSTAT 9
873 #define SSH_FXP_FSETSTAT 10
874 #define SSH_FXP_OPENDIR 11
875 #define SSH_FXP_READDIR 12
876 #define SSH_FXP_REMOVE 13
877 #define SSH_FXP_MKDIR 14
878 #define SSH_FXP_RMDIR 15
879 #define SSH_FXP_REALPATH 16
880 #define SSH_FXP_STAT 17
881 #define SSH_FXP_RENAME 18
882 #define SSH_FXP_READLINK 19
883 #define SSH_FXP_SYMLINK 20
884
885 #define SSH_FXP_STATUS 101
886 #define SSH_FXP_HANDLE 102
887 #define SSH_FXP_DATA 103
888 #define SSH_FXP_NAME 104
889 #define SSH_FXP_ATTRS 105
890
891 #define SSH_FXP_EXTENDED 200
892 #define SSH_FXP_EXTENDED_REPLY 201
893
894 /* attributes */
895 /* sftp draft is completely braindead : version 3 and 4 have different flags for same constants */
896 /* and even worst, version 4 has same flag for 2 different constants */
897 /* follow up : i won't develop any sftp4 compliant library before having a clarification */
898
899 #define SSH_FILEXFER_ATTR_SIZE 0x00000001
900 #define SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
901 #define SSH_FILEXFER_ATTR_ACCESSTIME 0x00000008
902 #define SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
903 #define SSH_FILEXFER_ATTR_CREATETIME 0x00000010
904 #define SSH_FILEXFER_ATTR_MODIFYTIME 0x00000020
905 #define SSH_FILEXFER_ATTR_ACL 0x00000040
906 #define SSH_FILEXFER_ATTR_OWNERGROUP 0x00000080
907 #define SSH_FILEXFER_ATTR_SUBSECOND_TIMES 0x00000100
908 #define SSH_FILEXFER_ATTR_EXTENDED 0x80000000
909 #define SSH_FILEXFER_ATTR_UIDGID 0x00000002
910
911 /* types */
912 #define SSH_FILEXFER_TYPE_REGULAR 1
913 #define SSH_FILEXFER_TYPE_DIRECTORY 2
914 #define SSH_FILEXFER_TYPE_SYMLINK 3
915 #define SSH_FILEXFER_TYPE_SPECIAL 4
916 #define SSH_FILEXFER_TYPE_UNKNOWN 5
917
926 #define SSH_FX_OK 0
927
928 #define SSH_FX_EOF 1
929
930 #define SSH_FX_NO_SUCH_FILE 2
931
932 #define SSH_FX_PERMISSION_DENIED 3
933
934 #define SSH_FX_FAILURE 4
935
936 #define SSH_FX_BAD_MESSAGE 5
937
938 #define SSH_FX_NO_CONNECTION 6
939
940 #define SSH_FX_CONNECTION_LOST 7
941
942 #define SSH_FX_OP_UNSUPPORTED 8
943
944 #define SSH_FX_INVALID_HANDLE 9
945
946 #define SSH_FX_NO_SUCH_PATH 10
947
948 #define SSH_FX_FILE_ALREADY_EXISTS 11
949
950 #define SSH_FX_WRITE_PROTECT 12
951
952 #define SSH_FX_NO_MEDIA 13
953
956 /* file flags */
957 #define SSH_FXF_READ 0x01
958 #define SSH_FXF_WRITE 0x02
959 #define SSH_FXF_APPEND 0x04
960 #define SSH_FXF_CREAT 0x08
961 #define SSH_FXF_TRUNC 0x10
962 #define SSH_FXF_EXCL 0x20
963 #define SSH_FXF_TEXT 0x40
964
965 /* rename flags */
966 #define SSH_FXF_RENAME_OVERWRITE 0x00000001
967 #define SSH_FXF_RENAME_ATOMIC 0x00000002
968 #define SSH_FXF_RENAME_NATIVE 0x00000004
969
970 #define SFTP_OPEN SSH_FXP_OPEN
971 #define SFTP_CLOSE SSH_FXP_CLOSE
972 #define SFTP_READ SSH_FXP_READ
973 #define SFTP_WRITE SSH_FXP_WRITE
974 #define SFTP_LSTAT SSH_FXP_LSTAT
975 #define SFTP_FSTAT SSH_FXP_FSTAT
976 #define SFTP_SETSTAT SSH_FXP_SETSTAT
977 #define SFTP_FSETSTAT SSH_FXP_FSETSTAT
978 #define SFTP_OPENDIR SSH_FXP_OPENDIR
979 #define SFTP_READDIR SSH_FXP_READDIR
980 #define SFTP_REMOVE SSH_FXP_REMOVE
981 #define SFTP_MKDIR SSH_FXP_MKDIR
982 #define SFTP_RMDIR SSH_FXP_RMDIR
983 #define SFTP_REALPATH SSH_FXP_REALPATH
984 #define SFTP_STAT SSH_FXP_STAT
985 #define SFTP_RENAME SSH_FXP_RENAME
986 #define SFTP_READLINK SSH_FXP_READLINK
987 #define SFTP_SYMLINK SSH_FXP_SYMLINK
988
989 /* openssh flags */
990 #define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */
991 #define SSH_FXE_STATVFS_ST_NOSUID 0x2 /* no setuid */
992
993 #ifdef __cplusplus
994 } ;
995 #endif
996
997 #endif /* SFTP_H */
998
1000 /* vim: set ts=2 sw=2 et cindent: */
sftp_extensions_get_name
const char * sftp_extensions_get_name(sftp_session sftp, unsigned int indexn)
Get the name of the extension provided by the server.
Definition: sftp.c:616
sftp_tell
unsigned long sftp_tell(sftp_file file)
Report current byte position in file.
Definition: sftp.c:2053
sftp_symlink
int sftp_symlink(sftp_session sftp, const char *target, const char *dest)
Create a symbolic link.
Definition: sftp.c:2497
sftp_mkdir
int sftp_mkdir(sftp_session sftp, const char *directory, mode_t mode)
Create a directory.
Definition: sftp.c:2208
sftp_statvfs_struct::f_blocks
uint64_t f_blocks
fundamental fs block size
Definition: sftp.h:185
sftp_unlink
int sftp_unlink(sftp_session sftp, const char *file)
Unlink (delete) a file.
Definition: sftp.c:2068
sftp_server_new
sftp_session sftp_server_new(ssh_session session, ssh_channel chan)
Create a new sftp server session.
Definition: sftp.c:183
sftp_statvfs_struct::f_frsize
uint64_t f_frsize
file system block size
Definition: sftp.h:184
sftp_read
ssize_t sftp_read(sftp_file file, void *buf, size_t count)
Read from a file using an opened sftp file handle.
Definition: sftp.c:1725
sftp_extensions_get_data
const char * sftp_extensions_get_data(sftp_session sftp, unsigned int indexn)
Get the data of the extension provided by the server.
Definition: sftp.c:632
sftp_statvfs_free
void sftp_statvfs_free(sftp_statvfs_t statvfs_o)
Free the memory of an allocated statvfs.
Definition: sftp.c:2874
sftp_fstatvfs
sftp_statvfs_t sftp_fstatvfs(sftp_file file)
Get information about a mounted file system.
Definition: sftp.c:2798
sftp_open
sftp_file sftp_open(sftp_session session, const char *file, int accesstype, mode_t mode)
Open a file on the server.
Definition: sftp.c:1619
sftp_lstat
sftp_attributes sftp_lstat(sftp_session session, const char *path)
Get information about a file or directory.
Definition: sftp.c:3042
sftp_chmod
int sftp_chmod(sftp_session sftp, const char *file, mode_t mode)
Change permissions of a file.
Definition: sftp.c:2470
sftp_init
int sftp_init(sftp_session sftp)
Initialize the sftp session with the server.
Definition: sftp.c:514
sftp_free
void sftp_free(sftp_session sftp)
Close and deallocate a sftp session.
Definition: sftp.c:258
sftp_statvfs_struct::f_fsid
uint64_t f_fsid
free file inodes for to non-root
Definition: sftp.h:191
sftp_rmdir
int sftp_rmdir(sftp_session sftp, const char *directory)
Remove a directoy.
Definition: sftp.c:2140
sftp_setstat
int sftp_setstat(sftp_session sftp, const char *file, sftp_attributes attr)
Set file attributes on a file, directory or symbolic link.
Definition: sftp.c:2380
sftp_utimes
int sftp_utimes(sftp_session sftp, const char *file, const struct timeval *times)
Change the last modification and access time of a file.
Definition: sftp.c:2480
sftp_statvfs_struct::f_ffree
uint64_t f_ffree
total file inodes
Definition: sftp.h:189
sftp_statvfs_struct
SFTP statvfs structure.
Definition: sftp.h:182
sftp_dir_eof
int sftp_dir_eof(sftp_dir dir)
Tell if the directory has reached EOF (End Of File).
Definition: sftp.c:1503
sftp_statvfs_struct::f_bfree
uint64_t f_bfree
number of blocks (unit f_frsize)
Definition: sftp.h:186
sftp_opendir
sftp_dir sftp_opendir(sftp_session session, const char *path)
Open a directory used to obtain directory entries.
Definition: sftp.c:859
sftp_seek64
int sftp_seek64(sftp_file file, uint64_t new_offset)
Seek to a specific location in a file.
Definition: sftp.c:2041
sftp_async_read
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.
Definition: sftp.c:1868
sftp_rename
int sftp_rename(sftp_session sftp, const char *original, const char *newname)
Rename or move a file or directory.
Definition: sftp.c:2300
sftp_statvfs_struct::f_files
uint64_t f_files
free blocks for non-root
Definition: sftp.h:188
sftp_new_channel
sftp_session sftp_new_channel(ssh_session session, ssh_channel channel)
Start a new sftp session with an existing channel.
Definition: sftp.c:153
sftp_statvfs
sftp_statvfs_t sftp_statvfs(sftp_session sftp, const char *path)
Get information about a mounted file system.
Definition: sftp.c:2705
sftp_server_version
int sftp_server_version(sftp_session sftp)
Get the version of the SFTP protocol supported by the server.
Definition: sftp.c:1394
sftp_chown
int sftp_chown(sftp_session sftp, const char *file, uid_t owner, gid_t group)
Change the file owner and group.
Definition: sftp.c:2457
sftp_file_set_nonblocking
void sftp_file_set_nonblocking(sftp_file handle)
Make the sftp communication for this file handle non blocking.
Definition: sftp.c:1717
sftp_new
sftp_session sftp_new(ssh_session session)
Start a new sftp session.
Definition: sftp.c:104
sftp_extensions_get_count
unsigned int sftp_extensions_get_count(sftp_session sftp)
Get the count of extensions provided by the server.
Definition: sftp.c:608
sftp_statvfs_struct::f_flag
uint64_t f_flag
file system id
Definition: sftp.h:192
sftp_readlink
char * sftp_readlink(sftp_session sftp, const char *path)
Read the value of a symbolic link.
Definition: sftp.c:2584
sftp_readdir
sftp_attributes sftp_readdir(sftp_session session, sftp_dir dir)
Get a single file attributes structure of a directory.
Definition: sftp.c:1399
sftp_extension_supported
int sftp_extension_supported(sftp_session sftp, const char *name, const char *data)
Check if the given extension is supported.
Definition: sftp.c:648
sftp_statvfs_struct::f_bavail
uint64_t f_bavail
free blocks in file system
Definition: sftp.h:187
sftp_statvfs_struct::f_favail
uint64_t f_favail
free file inodes
Definition: sftp.h:190
sftp_attributes_free
void sftp_attributes_free(sftp_attributes file)
Free a sftp attribute structure.
Definition: sftp.c:1508
sftp_get_error
int sftp_get_error(sftp_session sftp)
Get the last sftp error.
Definition: sftp.c:398
sftp_close
int sftp_close(sftp_file file)
Close an open file handle.
Definition: sftp.c:1588
sftp_server_init
int sftp_server_init(sftp_session sftp)
Intialize the sftp server.
Definition: sftp.c:199
sftp_async_read_begin
int sftp_async_read_begin(sftp_file file, uint32_t len)
Start an asynchronous read from a file using an opened sftp file handle.
Definition: sftp.c:1831
sftp_file_set_blocking
void sftp_file_set_blocking(sftp_file handle)
Make the sftp communication for this file handle blocking.
Definition: sftp.c:1720
sftp_statvfs_struct::f_namemax
uint64_t f_namemax
bit mask of f_flag values
Definition: sftp.h:193
sftp_stat
sftp_attributes sftp_stat(sftp_session session, const char *path)
Get information about a file or directory.
Definition: sftp.c:3038
sftp_tell64
uint64_t sftp_tell64(sftp_file file)
Report current byte position in file.
Definition: sftp.c:2057
sftp_rewind
void sftp_rewind(sftp_file file)
Rewinds the position of the file pointer to the beginning of the file.
Definition: sftp.c:2062
sftp_seek
int sftp_seek(sftp_file file, uint32_t new_offset)
Seek to a specific location in a file.
Definition: sftp.c:2030
sftp_fstat
sftp_attributes sftp_fstat(sftp_file file)
Get information about a file or directory from a file handle.
Definition: sftp.c:3046
sftp_write
ssize_t sftp_write(sftp_file file, const void *buf, size_t count)
Write to a file using an opened sftp file handle.
Definition: sftp.c:1950
sftp_canonicalize_path
char * sftp_canonicalize_path(sftp_session sftp, const char *path)
Canonicalize a sftp path.
Definition: sftp.c:2883
sftp_closedir
int sftp_closedir(sftp_dir dir)
Close a directory handle opened by sftp_opendir().
Definition: sftp.c:1603