Loading...
Searching...
No Matches
Sftp.hpp
Go to the documentation of this file.
7// In no event will the authors be held liable for any damages arising from the use of this software.
71 Success,
72 Disconnected,
73 Timeout,
74 Refused,
75 Error,
78 BannerReceive,
79 BannerSend,
80 InvalidMac,
81 AllocationFailure,
82 SocketSend,
83 KeyExchangeFailure,
84 HostKeyInitialization,
85 HostKeySign,
86 DecryptError,
87 ProtocolError,
88 PasswordExpired,
89 FileError,
90 MethodNone,
91 AuthenticationFailed,
92 PublicKeyUnverified,
93 ChannelOutOfOrder,
94 ChannelFailure,
95 ChannelRequestDenied,
96 ChannelUnknown,
97 ChannelWindowExceeded,
98 ChannelPacketExceeded,
99 ChannelClosed,
100 ChannelEofSent,
101 ScpProtocol,
102 ZlibError,
103 RequestDenied,
104 MethodNotSupported,
105 InvalidData,
106 PublicKeyProtocol,
107 BufferTooSmall,
108 BadUse,
109 CompressError,
110 OutOfBoundary,
111 AgentProtocol,
112 SocketRecv,
113 EncryptError,
114 BadSocket,
115 KnownHosts,
116 ChannelWindowFull,
117 KeyFileAuthenticationFailed,
120 EndOfFile,
121 NoSuchFile,
122 PermissionDenied,
123 Failure,
124 BadMessage,
125 NoConnection,
126 ConnectionLost,
127 OperationUnsupported,
128 InvalidHandle,
129 NoSuchPath,
130 FileAlreadyExists,
131 WriteProtect,
132 NoMedia,
133 NoSpaceOnFileSystem,
134 QuotaExceeded,
135 UnknownPrincipal,
136 LockConflict,
137 DirectoryNotEmpty,
138 NotADirectory,
139 InvalidFilename,
140 LinkLoop,
141 SftpError
387 [[nodiscard]] Result connect(IpAddress server, unsigned short port = 22, const TimeoutWithPredicate& timeout = Time::Zero);
554 [[nodiscard]] PathResult resolvePath(const std::filesystem::path& path, const TimeoutWithPredicate& timeout = Time::Zero);
631 std::filesystem::perms permissions = (std::filesystem::perms::owner_all | std::filesystem::perms::group_read |
650 [[nodiscard]] Result deleteDirectory(const std::filesystem::path& path, const TimeoutWithPredicate& timeout = Time::Zero);
693 [[nodiscard]] Result deleteFile(const std::filesystem::path& path, const TimeoutWithPredicate& timeout = Time::Zero);
const Attributes & getAttributes() const
Get the attributes.
AttributesResult(const Result &result, Attributes attributes)
Constructor.
const std::vector< Attributes > & getListing() const
Get the directory listing.
ListingResult(const Result &result, std::vector< Attributes > listing)
Constructor.
PathResult(const Result &result, std::filesystem::path path)
Constructor.
ListingResult getDirectoryListing(const std::filesystem::path &path, const TimeoutWithPredicate &timeout=Time::Zero)
Get the contents of the given directory.
Result connect(IpAddress server, unsigned short port=22, const TimeoutWithPredicate &timeout=Time::Zero)
Connect to the specified SFTP server.
Result login(std::string_view name, std::string_view password, const TimeoutWithPredicate &timeout=Time::Zero)
Log in using a username and a password.
std::optional< SessionInfo > getSessionInfo() const
Get SSH session information.
AttributesResult getAttributes(const std::filesystem::path &path, bool followLinks=true, const TimeoutWithPredicate &timeout=Time::Zero)
Get the attributes of a remote file or directory.
Result deleteDirectory(const std::filesystem::path &path, const TimeoutWithPredicate &timeout=Time::Zero)
Remove an existing directory.
Result upload(const std::filesystem::path &remotePath, const std::function< bool(void *data, std::size_t &size)> &callback, std::filesystem::perms permissions=(std::filesystem::perms::owner_read|std::filesystem::perms::owner_write|std::filesystem::perms::group_read|std::filesystem::perms::others_read), bool truncate=true, bool append=false, std::uint64_t offset=0, const TimeoutWithPredicate &timeout=Time::Zero)
Upload a file to the server.
Result login(std::string_view name, const char *publicKeyData, std::size_t publicKeyLength, const char *privateKeyData, std::size_t privateKeyLength, const char *privateKeyPassphrase="", const TimeoutWithPredicate &timeout=Time::Zero)
Log in using a public/private key pair.
Result rename(const std::filesystem::path &oldPath, const std::filesystem::path &newPath, bool overwrite=false, const TimeoutWithPredicate &timeout=Time::Zero)
Rename an existing file or directory.
Result login(std::string_view name, std::string_view publicKeyData, std::string_view privateKeyData, std::string_view privateKeyPassphrase={}, const TimeoutWithPredicate &timeout=Time::Zero)
Log in using a public/private key pair.
PathResult getWorkingDirectory(const TimeoutWithPredicate &timeout=Time::Zero)
Get the current working directory on the server.
PathResult resolvePath(const std::filesystem::path &path, const TimeoutWithPredicate &timeout=Time::Zero)
Resolve a remote path into an absolute remote path.
Result disconnect(const TimeoutWithPredicate &timeout=Time::Zero)
Disconnect the connection with the server.
Result createDirectory(const std::filesystem::path &path, std::filesystem::perms permissions=(std::filesystem::perms::owner_all|std::filesystem::perms::group_read|std::filesystem::perms::group_exec|std::filesystem::perms::others_read|std::filesystem::perms::others_exec), const TimeoutWithPredicate &timeout=Time::Zero)
Create a new directory.
Result deleteFile(const std::filesystem::path &path, const TimeoutWithPredicate &timeout=Time::Zero)
Remove an existing file.
Result download(const std::filesystem::path &remotePath, const std::function< bool(const void *data, std::size_t size)> &callback, std::uint64_t offset=0, const TimeoutWithPredicate &timeout=Time::Zero)
Download a file from the server.
Utility class providing hybrid functionality of a timeout and a continuation predicate.
Definition TimeoutWithPredicate.hpp:45
Definition AudioResource.hpp:36
std::optional< std::filesystem::file_time_type > modificationTime
Last modification time.
Definition Sftp.hpp:235
Structure containing information about an active SFTP session.
Definition Sftp.hpp:305
std::string serverToClientCompressionAlgorithm
Server to client compression algorithm used in the session (RFC 4253).
Definition Sftp.hpp:337
std::string clientToServerCompressionAlgorithm
Client to server compression algorithm used in the session (RFC 4253).
Definition Sftp.hpp:336
std::string serverToClientEncryptionAlgorithm
Server to client encryption algorithm used in the session (RFC 4253).
Definition Sftp.hpp:333
std::string clientToServerEncryptionAlgorithm
Client to server encryption algorithm used in the session (RFC 4253).
Definition Sftp.hpp:332
std::string keyExchangeAlgorithm
Key exchange algorithm used in the session (RFC 4253).
Definition Sftp.hpp:330
std::string clientToServerMacAlgorithm
Client to server message authentication code algorithm used in the session (RFC 4253).
Definition Sftp.hpp:334
std::string hostKeyAlgorithm
Host key algorithm used in the session (RFC 4253).
Definition Sftp.hpp:331
std::string serverToClientMacAlgorithm
Server to client message authentication code algorithm used in the session (RFC 4253).
Definition Sftp.hpp:335