libssh  0.8.4
The SSH library
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 
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;
72 typedef struct sftp_session_struct* sftp_session;
74 typedef struct sftp_statvfs_struct* sftp_statvfs_t;
75 
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  sftp_packet read_packet;
88 };
89 
91  sftp_session sftp;
92  uint8_t type;
93  ssh_buffer payload;
94 };
95 
96 /* file handler */
98  sftp_session sftp;
99  char *name;
100  uint64_t offset;
101  ssh_string handle;
102  int eof;
103  int nonblocking;
104 };
105 
107  sftp_session sftp;
108  char *name;
109  ssh_string handle; /* handle to directory */
110  ssh_buffer buffer; /* contains raw attributes from server which haven't been parsed */
111  uint32_t count; /* counts the number of following attributes structures into buffer */
112  int eof; /* end of directory listing */
113 };
114 
116  sftp_session sftp;
117  uint8_t packet_type;
118  ssh_buffer payload;
119  uint32_t id;
120 };
121 
122 /* this is a bunch of all data that could be into a message */
124  sftp_session sftp;
125  uint8_t type;
126  uint32_t id;
127  char *filename; /* can be "path" */
128  uint32_t flags;
129  sftp_attributes attr;
130  ssh_string handle;
131  uint64_t offset;
132  uint32_t len;
133  int attr_num;
134  ssh_buffer attrbuf; /* used by sftp_reply_attrs */
135  ssh_string data; /* can be newpath of rename() */
136  ssh_buffer complete_message; /* complete message in case of retransmission*/
137  char *str_data; /* cstring version of data */
138  char *submessage; /* for extended messages */
139 };
140 
142  sftp_request_queue next;
143  sftp_message message;
144 };
145 
146 /* SSH_FXP_MESSAGE described into .7 page 26 */
148  uint32_t id;
149  uint32_t status;
150  ssh_string error_unused; /* not used anymore */
151  ssh_string lang_unused; /* not used anymore */
152  char *errormsg;
153  char *langmsg;
154 };
155 
157  char *name;
158  char *longname; /* ls -l output on openssh, not reliable else */
159  uint32_t flags;
160  uint8_t type;
161  uint64_t size;
162  uint32_t uid;
163  uint32_t gid;
164  char *owner; /* set if openssh and version 4 */
165  char *group; /* set if openssh and version 4 */
166  uint32_t permissions;
167  uint64_t atime64;
168  uint32_t atime;
169  uint32_t atime_nseconds;
170  uint64_t createtime;
171  uint32_t createtime_nseconds;
172  uint64_t mtime64;
173  uint32_t mtime;
174  uint32_t mtime_nseconds;
175  ssh_string acl;
176  uint32_t extended_count;
177  ssh_string extended_type;
178  ssh_string extended_data;
179 };
180 
185  uint64_t f_bsize;
186  uint64_t f_frsize;
187  uint64_t f_blocks;
188  uint64_t f_bfree;
189  uint64_t f_bavail;
190  uint64_t f_files;
191  uint64_t f_ffree;
192  uint64_t f_favail;
193  uint64_t f_fsid;
194  uint64_t f_flag;
195  uint64_t f_namemax;
196 };
197 
207 LIBSSH_API sftp_session sftp_new(ssh_session session);
208 
219 LIBSSH_API sftp_session sftp_new_channel(ssh_session session, ssh_channel channel);
220 
221 
227 LIBSSH_API void sftp_free(sftp_session sftp);
228 
238 LIBSSH_API int sftp_init(sftp_session sftp);
239 
252 LIBSSH_API int sftp_get_error(sftp_session sftp);
253 
262 LIBSSH_API unsigned int sftp_extensions_get_count(sftp_session sftp);
263 
273 LIBSSH_API const char *sftp_extensions_get_name(sftp_session sftp, unsigned int indexn);
274 
286 LIBSSH_API const char *sftp_extensions_get_data(sftp_session sftp, unsigned int indexn);
287 
305 LIBSSH_API int sftp_extension_supported(sftp_session sftp, const char *name,
306  const char *data);
307 
320 LIBSSH_API sftp_dir sftp_opendir(sftp_session session, const char *path);
321 
335 LIBSSH_API sftp_attributes sftp_readdir(sftp_session session, sftp_dir dir);
336 
346 LIBSSH_API int sftp_dir_eof(sftp_dir dir);
347 
360 LIBSSH_API sftp_attributes sftp_stat(sftp_session session, const char *path);
361 
377 LIBSSH_API sftp_attributes sftp_lstat(sftp_session session, const char *path);
378 
389 LIBSSH_API sftp_attributes sftp_fstat(sftp_file file);
390 
396 LIBSSH_API void sftp_attributes_free(sftp_attributes file);
397 
405 LIBSSH_API int sftp_closedir(sftp_dir dir);
406 
416 LIBSSH_API int sftp_close(sftp_file file);
417 
446 LIBSSH_API sftp_file sftp_open(sftp_session session, const char *file, int accesstype,
447  mode_t mode);
448 
454 LIBSSH_API void sftp_file_set_nonblocking(sftp_file handle);
455 
461 LIBSSH_API void sftp_file_set_blocking(sftp_file handle);
462 
477 LIBSSH_API ssize_t sftp_read(sftp_file file, void *buf, size_t count);
478 
510 LIBSSH_API int sftp_async_read_begin(sftp_file file, uint32_t len);
511 
535 LIBSSH_API int sftp_async_read(sftp_file file, void *data, uint32_t len, uint32_t id);
536 
553 LIBSSH_API ssize_t sftp_write(sftp_file file, const void *buf, size_t count);
554 
564 LIBSSH_API int sftp_seek(sftp_file file, uint32_t new_offset);
565 
576 LIBSSH_API int sftp_seek64(sftp_file file, uint64_t new_offset);
577 
587 LIBSSH_API unsigned long sftp_tell(sftp_file file);
588 
598 LIBSSH_API uint64_t sftp_tell64(sftp_file file);
599 
606 LIBSSH_API void sftp_rewind(sftp_file file);
607 
619 LIBSSH_API int sftp_unlink(sftp_session sftp, const char *file);
620 
632 LIBSSH_API int sftp_rmdir(sftp_session sftp, const char *directory);
633 
649 LIBSSH_API int sftp_mkdir(sftp_session sftp, const char *directory, mode_t mode);
650 
666 LIBSSH_API int sftp_rename(sftp_session sftp, const char *original, const char *newname);
667 
682 LIBSSH_API int sftp_setstat(sftp_session sftp, const char *file, sftp_attributes attr);
683 
699 LIBSSH_API int sftp_chown(sftp_session sftp, const char *file, uid_t owner, gid_t group);
700 
716 LIBSSH_API int sftp_chmod(sftp_session sftp, const char *file, mode_t mode);
717 
732 LIBSSH_API int sftp_utimes(sftp_session sftp, const char *file, const struct timeval *times);
733 
747 LIBSSH_API int sftp_symlink(sftp_session sftp, const char *target, const char *dest);
748 
760 LIBSSH_API char *sftp_readlink(sftp_session sftp, const char *path);
761 
773 LIBSSH_API sftp_statvfs_t sftp_statvfs(sftp_session sftp, const char *path);
774 
784 LIBSSH_API sftp_statvfs_t sftp_fstatvfs(sftp_file file);
785 
791 LIBSSH_API void sftp_statvfs_free(sftp_statvfs_t statvfs_o);
792 
807 LIBSSH_API int sftp_fsync(sftp_file file);
808 
818 LIBSSH_API char *sftp_canonicalize_path(sftp_session sftp, const char *path);
819 
827 LIBSSH_API int sftp_server_version(sftp_session sftp);
828 
829 #ifdef WITH_SERVER
830 
839 LIBSSH_API sftp_session sftp_server_new(ssh_session session, ssh_channel chan);
840 
848 LIBSSH_API int sftp_server_init(sftp_session sftp);
849 #endif /* WITH_SERVER */
850 
851 /* this is not a public interface */
852 #define SFTP_HANDLES 256
853 sftp_packet sftp_packet_read(sftp_session sftp);
854 int sftp_packet_write(sftp_session sftp,uint8_t type, ssh_buffer payload);
855 void sftp_packet_free(sftp_packet packet);
856 int buffer_add_attributes(ssh_buffer buffer, sftp_attributes attr);
857 sftp_attributes sftp_parse_attr(sftp_session session, ssh_buffer buf,int expectname);
858 /* sftpserver.c */
859 
860 LIBSSH_API sftp_client_message sftp_get_client_message(sftp_session sftp);
861 LIBSSH_API void sftp_client_message_free(sftp_client_message msg);
862 LIBSSH_API uint8_t sftp_client_message_get_type(sftp_client_message msg);
863 LIBSSH_API const char *sftp_client_message_get_filename(sftp_client_message msg);
864 LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
865 LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
866 LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
867 LIBSSH_API const char *sftp_client_message_get_submessage(sftp_client_message msg);
868 LIBSSH_API int sftp_send_client_message(sftp_session sftp, sftp_client_message msg);
869 LIBSSH_API int sftp_reply_name(sftp_client_message msg, const char *name,
870  sftp_attributes attr);
871 LIBSSH_API int sftp_reply_handle(sftp_client_message msg, ssh_string handle);
872 LIBSSH_API ssh_string sftp_handle_alloc(sftp_session sftp, void *info);
873 LIBSSH_API int sftp_reply_attr(sftp_client_message msg, sftp_attributes attr);
874 LIBSSH_API void *sftp_handle(sftp_session sftp, ssh_string handle);
875 LIBSSH_API int sftp_reply_status(sftp_client_message msg, uint32_t status, const char *message);
876 LIBSSH_API int sftp_reply_names_add(sftp_client_message msg, const char *file,
877  const char *longname, sftp_attributes attr);
878 LIBSSH_API int sftp_reply_names(sftp_client_message msg);
879 LIBSSH_API int sftp_reply_data(sftp_client_message msg, const void *data, int len);
880 LIBSSH_API void sftp_handle_remove(sftp_session sftp, void *handle);
881 
882 /* SFTP commands and constants */
883 #define SSH_FXP_INIT 1
884 #define SSH_FXP_VERSION 2
885 #define SSH_FXP_OPEN 3
886 #define SSH_FXP_CLOSE 4
887 #define SSH_FXP_READ 5
888 #define SSH_FXP_WRITE 6
889 #define SSH_FXP_LSTAT 7
890 #define SSH_FXP_FSTAT 8
891 #define SSH_FXP_SETSTAT 9
892 #define SSH_FXP_FSETSTAT 10
893 #define SSH_FXP_OPENDIR 11
894 #define SSH_FXP_READDIR 12
895 #define SSH_FXP_REMOVE 13
896 #define SSH_FXP_MKDIR 14
897 #define SSH_FXP_RMDIR 15
898 #define SSH_FXP_REALPATH 16
899 #define SSH_FXP_STAT 17
900 #define SSH_FXP_RENAME 18
901 #define SSH_FXP_READLINK 19
902 #define SSH_FXP_SYMLINK 20
903 
904 #define SSH_FXP_STATUS 101
905 #define SSH_FXP_HANDLE 102
906 #define SSH_FXP_DATA 103
907 #define SSH_FXP_NAME 104
908 #define SSH_FXP_ATTRS 105
909 
910 #define SSH_FXP_EXTENDED 200
911 #define SSH_FXP_EXTENDED_REPLY 201
912 
913 /* attributes */
914 /* sftp draft is completely braindead : version 3 and 4 have different flags for same constants */
915 /* and even worst, version 4 has same flag for 2 different constants */
916 /* follow up : i won't develop any sftp4 compliant library before having a clarification */
917 
918 #define SSH_FILEXFER_ATTR_SIZE 0x00000001
919 #define SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
920 #define SSH_FILEXFER_ATTR_ACCESSTIME 0x00000008
921 #define SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
922 #define SSH_FILEXFER_ATTR_CREATETIME 0x00000010
923 #define SSH_FILEXFER_ATTR_MODIFYTIME 0x00000020
924 #define SSH_FILEXFER_ATTR_ACL 0x00000040
925 #define SSH_FILEXFER_ATTR_OWNERGROUP 0x00000080
926 #define SSH_FILEXFER_ATTR_SUBSECOND_TIMES 0x00000100
927 #define SSH_FILEXFER_ATTR_EXTENDED 0x80000000
928 #define SSH_FILEXFER_ATTR_UIDGID 0x00000002
929 
930 /* types */
931 #define SSH_FILEXFER_TYPE_REGULAR 1
932 #define SSH_FILEXFER_TYPE_DIRECTORY 2
933 #define SSH_FILEXFER_TYPE_SYMLINK 3
934 #define SSH_FILEXFER_TYPE_SPECIAL 4
935 #define SSH_FILEXFER_TYPE_UNKNOWN 5
936 
945 #define SSH_FX_OK 0
946 
947 #define SSH_FX_EOF 1
948 
949 #define SSH_FX_NO_SUCH_FILE 2
950 
951 #define SSH_FX_PERMISSION_DENIED 3
952 
953 #define SSH_FX_FAILURE 4
954 
955 #define SSH_FX_BAD_MESSAGE 5
956 
957 #define SSH_FX_NO_CONNECTION 6
958 
959 #define SSH_FX_CONNECTION_LOST 7
960 
961 #define SSH_FX_OP_UNSUPPORTED 8
962 
963 #define SSH_FX_INVALID_HANDLE 9
964 
965 #define SSH_FX_NO_SUCH_PATH 10
966 
967 #define SSH_FX_FILE_ALREADY_EXISTS 11
968 
969 #define SSH_FX_WRITE_PROTECT 12
970 
971 #define SSH_FX_NO_MEDIA 13
972 
975 /* file flags */
976 #define SSH_FXF_READ 0x01
977 #define SSH_FXF_WRITE 0x02
978 #define SSH_FXF_APPEND 0x04
979 #define SSH_FXF_CREAT 0x08
980 #define SSH_FXF_TRUNC 0x10
981 #define SSH_FXF_EXCL 0x20
982 #define SSH_FXF_TEXT 0x40
983 
984 /* file type flags */
985 #define SSH_S_IFMT 00170000
986 #define SSH_S_IFSOCK 0140000
987 #define SSH_S_IFLNK 0120000
988 #define SSH_S_IFREG 0100000
989 #define SSH_S_IFBLK 0060000
990 #define SSH_S_IFDIR 0040000
991 #define SSH_S_IFCHR 0020000
992 #define SSH_S_IFIFO 0010000
993 
994 /* rename flags */
995 #define SSH_FXF_RENAME_OVERWRITE 0x00000001
996 #define SSH_FXF_RENAME_ATOMIC 0x00000002
997 #define SSH_FXF_RENAME_NATIVE 0x00000004
998 
999 #define SFTP_OPEN SSH_FXP_OPEN
1000 #define SFTP_CLOSE SSH_FXP_CLOSE
1001 #define SFTP_READ SSH_FXP_READ
1002 #define SFTP_WRITE SSH_FXP_WRITE
1003 #define SFTP_LSTAT SSH_FXP_LSTAT
1004 #define SFTP_FSTAT SSH_FXP_FSTAT
1005 #define SFTP_SETSTAT SSH_FXP_SETSTAT
1006 #define SFTP_FSETSTAT SSH_FXP_FSETSTAT
1007 #define SFTP_OPENDIR SSH_FXP_OPENDIR
1008 #define SFTP_READDIR SSH_FXP_READDIR
1009 #define SFTP_REMOVE SSH_FXP_REMOVE
1010 #define SFTP_MKDIR SSH_FXP_MKDIR
1011 #define SFTP_RMDIR SSH_FXP_RMDIR
1012 #define SFTP_REALPATH SSH_FXP_REALPATH
1013 #define SFTP_STAT SSH_FXP_STAT
1014 #define SFTP_RENAME SSH_FXP_RENAME
1015 #define SFTP_READLINK SSH_FXP_READLINK
1016 #define SFTP_SYMLINK SSH_FXP_SYMLINK
1017 #define SFTP_EXTENDED SSH_FXP_EXTENDED
1018 
1019 /* openssh flags */
1020 #define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */
1021 #define SSH_FXE_STATVFS_ST_NOSUID 0x2 /* no setuid */
1022 
1023 #ifdef __cplusplus
1024 }
1025 #endif
1026 
1027 #endif /* SFTP_H */
1028 
Definition: sftp.h:115
LIBSSH_API int sftp_unlink(sftp_session sftp, const char *file)
Unlink (delete) a file.
LIBSSH_API int sftp_dir_eof(sftp_dir dir)
Tell if the directory has reached EOF (End Of File).
LIBSSH_API int sftp_fsync(sftp_file file)
Synchronize a file&#39;s in-core state with storage device.
LIBSSH_API char * sftp_canonicalize_path(sftp_session sftp, const char *path)
Canonicalize a sftp path.
uint64_t f_bfree
Definition: sftp.h:188
LIBSSH_API sftp_dir sftp_opendir(sftp_session session, const char *path)
Open a directory used to obtain directory entries.
LIBSSH_API int sftp_rename(sftp_session sftp, const char *original, const char *newname)
Rename or move a file or directory.
LIBSSH_API int sftp_extension_supported(sftp_session sftp, const char *name, const char *data)
Check if the given extension is supported.
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 int sftp_utimes(sftp_session sftp, const char *file, const struct timeval *times)
Change the last modification and access time of a file.
Definition: channels.h:57
LIBSSH_API void sftp_statvfs_free(sftp_statvfs_t statvfs_o)
Free the memory of an allocated statvfs.
LIBSSH_API int sftp_rmdir(sftp_session sftp, const char *directory)
Remove a directoy.
Definition: sftp.h:141
uint64_t f_favail
Definition: sftp.h:192
Definition: sftp.h:106
Definition: session.h:102
LIBSSH_API void sftp_file_set_blocking(sftp_file handle)
Make the sftp communication for this file handle blocking.
LIBSSH_API int sftp_server_version(sftp_session sftp)
Get the version of the SFTP protocol supported by the server.
uint64_t f_files
Definition: sftp.h:190
LIBSSH_API int sftp_chown(sftp_session sftp, const char *file, uid_t owner, gid_t group)
Change the file owner and group.
uint64_t f_ffree
Definition: sftp.h:191
LIBSSH_API const char * sftp_extensions_get_data(sftp_session sftp, unsigned int indexn)
Get the data of the extension provided by the server.
SFTP statvfs structure.
Definition: sftp.h:184
LIBSSH_API sftp_session sftp_new(ssh_session session)
Start a new sftp session.
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_fstat(sftp_file file)
Get information about a file or directory from a file handle.
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 unsigned long sftp_tell(sftp_file file)
Report current byte position in file.
Definition: sftp.h:76
uint64_t f_fsid
Definition: sftp.h:193
Definition: sftp.h:123
LIBSSH_API char * sftp_readlink(sftp_session sftp, const char *path)
Read the value of a symbolic link.
Definition: sftp.h:147
uint64_t f_namemax
Definition: sftp.h:195
Definition: string.h:29
LIBSSH_API int sftp_seek(sftp_file file, uint32_t new_offset)
Seek to a specific location in a file.
LIBSSH_API int sftp_close(sftp_file file)
Close an open file handle.
LIBSSH_API sftp_session sftp_new_channel(ssh_session session, ssh_channel channel)
Start a new sftp session with an existing channel.
LIBSSH_API unsigned int sftp_extensions_get_count(sftp_session sftp)
Get the count of extensions provided by the server.
Definition: sftp.h:97
LIBSSH_API sftp_attributes sftp_readdir(sftp_session session, sftp_dir dir)
Get a single file attributes structure of a 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_get_error(sftp_session sftp)
Get the last sftp error.
LIBSSH_API int sftp_seek64(sftp_file file, uint64_t new_offset)
Seek to a specific location in a file. This is the 64bit version.
uint64_t f_bavail
Definition: sftp.h:189
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.
uint64_t f_frsize
Definition: sftp.h:186
LIBSSH_API int sftp_init(sftp_session sftp)
Initialize the sftp session with the server.
LIBSSH_API int sftp_closedir(sftp_dir dir)
Close a directory handle opened by sftp_opendir().
LIBSSH_API int sftp_symlink(sftp_session sftp, const char *target, const char *dest)
Create a symbolic link.
LIBSSH_API sftp_statvfs_t sftp_statvfs(sftp_session sftp, const char *path)
Get information about a mounted file system.
uint64_t f_blocks
Definition: sftp.h:187
LIBSSH_API void sftp_file_set_nonblocking(sftp_file handle)
Make the sftp communication for this file handle non blocking.
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.
Definition: sftp.h:156
LIBSSH_API void sftp_attributes_free(sftp_attributes file)
Free a sftp attribute structure.
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_statvfs_t sftp_fstatvfs(sftp_file file)
Get information about a mounted file system.
LIBSSH_API int sftp_chmod(sftp_session sftp, const char *file, mode_t mode)
Change permissions of a file.
LIBSSH_API sftp_file sftp_open(sftp_session session, const char *file, int accesstype, mode_t mode)
Open a file on the server.
uint64_t f_flag
Definition: sftp.h:194
LIBSSH_API uint64_t sftp_tell64(sftp_file file)
Report current byte position in file.
LIBSSH_API void sftp_free(sftp_session sftp)
Close and deallocate a sftp session.
Definition: sftp.h:90
LIBSSH_API sftp_attributes sftp_stat(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.
Definition: buffer.c:47
LIBSSH_API sftp_attributes sftp_lstat(sftp_session session, const char *path)
Get information about a file or directory.