3 * \brief Header: SFTP FS
6 #ifndef MC__VFS_SFTPFS_INTERNAL_H
7 #define MC__VFS_SFTPFS_INTERNAL_H
10 #include <libssh2_sftp.h>
12 #include "lib/vfs/vfs.h"
13 #include "lib/vfs/xdirentry.h"
15 /*** typedefs(not structures) and defined constants **********************************************/
17 #define SFTP_DEFAULT_PORT 22
19 /*** enums ***************************************************************************************/
29 /*** structures declarations (and typedefs of structures)*****************************************/
33 sftpfs_auth_type_t auth_type
;
34 sftpfs_auth_type_t config_auth_type
;
36 LIBSSH2_SESSION
*session
;
37 LIBSSH2_SFTP
*sftp_session
;
45 const char *fingerprint
;
46 } sftpfs_super_data_t
;
48 /*** global variables defined in .c file *********************************************************/
50 extern GString
*sftpfs_filename_buffer
;
51 extern struct vfs_class sftpfs_class
;
52 extern struct vfs_s_subclass sftpfs_subclass
;
54 /*** declarations of public functions ************************************************************/
56 void sftpfs_init_class (void);
57 void sftpfs_init_subclass (void);
58 void sftpfs_init_class_callbacks (void);
59 void sftpfs_init_subclass_callbacks (void);
60 void sftpfs_init_config_variables_patterns (void);
61 void sftpfs_deinit_config_variables_patterns (void);
63 gboolean
sftpfs_show_error (GError
** error
);
64 void sftpfs_ssherror_to_gliberror (sftpfs_super_data_t
* super_data
, int libssh_errno
,
66 int sftpfs_waitsocket (sftpfs_super_data_t
* super_data
, GError
** error
);
68 const char *sftpfs_fix_filename (const char *file_name
);
69 int sftpfs_lstat (const vfs_path_t
* vpath
, struct stat
*buf
, GError
** error
);
70 int sftpfs_stat (const vfs_path_t
* vpath
, struct stat
*buf
, GError
** error
);
71 int sftpfs_readlink (const vfs_path_t
* vpath
, char *buf
, size_t size
, GError
** error
);
72 int sftpfs_symlink (const vfs_path_t
* vpath1
, const vfs_path_t
* vpath2
, GError
** error
);
73 int sftpfs_chmod (const vfs_path_t
* vpath
, mode_t mode
, GError
** error
);
74 int sftpfs_unlink (const vfs_path_t
* vpath
, GError
** error
);
75 int sftpfs_rename (const vfs_path_t
* vpath1
, const vfs_path_t
* vpath2
, GError
** error
);
77 void sftpfs_fill_connection_data_from_config (struct vfs_s_super
*super
, GError
** error
);
78 int sftpfs_open_connection (struct vfs_s_super
*super
, GError
** error
);
79 void sftpfs_close_connection (struct vfs_s_super
*super
, const char *shutdown_message
,
82 void *sftpfs_opendir (const vfs_path_t
* vpath
, GError
** error
);
83 void *sftpfs_readdir (void *data
, GError
** error
);
84 int sftpfs_closedir (void *data
, GError
** error
);
85 int sftpfs_mkdir (const vfs_path_t
* vpath
, mode_t mode
, GError
** error
);
86 int sftpfs_rmdir (const vfs_path_t
* vpath
, GError
** error
);
88 gboolean
sftpfs_open_file (vfs_file_handler_t
* file_handler
, int flags
, mode_t mode
,
90 ssize_t
sftpfs_read_file (vfs_file_handler_t
* file_handler
, char *buffer
, size_t count
,
92 ssize_t
sftpfs_write_file (vfs_file_handler_t
* file_handler
, const char *buffer
, size_t count
,
94 int sftpfs_close_file (vfs_file_handler_t
* file_handler
, GError
** error
);
95 int sftpfs_fstat (void *data
, struct stat
*buf
, GError
** error
);
96 off_t
sftpfs_lseek (vfs_file_handler_t
* file_handler
, off_t offset
, int whence
, GError
** error
);
98 /*** inline functions ****************************************************************************/
100 #endif /* MC__VFS_SFTPFS_INTERNAL_H */