libsshpp v0.1.7
Modern C++17 wrapper for libssh
Loading...
Searching...
No Matches
sshpp::sftp Namespace Reference

Namespaces

namespace  internal
 

Classes

struct  Attributes
 Value-type copy of libssh's sftp_attributes. See docs/design/06 §6.1. More...
 
struct  AttributeUpdate
 Partial attributes for setstat: only engaged fields are transmitted. More...
 
class  Directory
 An open SFTP directory handle. See docs/design/06 §6.4. More...
 
class  DirectoryIterator
 InputIterator over a Directory. Skips "." and ".." by default. More...
 
class  DirectoryRange
 Range adapter: for (const auto& e : sftp::DirectoryRange{std::move(dir)}). More...
 
class  File
 A single open SFTP file handle. See docs/design/06 §6.3. More...
 
struct  Limits
 
struct  Progress
 
class  Sftp
 The SFTP subsystem session. See docs/design/06 §6.2. More...
 
struct  TransferOptions
 
struct  TreeStats
 

Typedefs

using ProgressCallback = std::function< bool(const Progress &)>
 Return false to abort the transfer (yields errc::cancelled).
 

Enumerations

enum class  Overwrite { fail , replace }
 
enum class  FileType {
  regular , directory , symlink , special ,
  unknown , socket , char_device , block_device ,
  fifo
}
 
enum class  OpenMode : unsigned {
  read = 1u << 0 , write = 1u << 1 , read_write = read | write , create = 1u << 2 ,
  truncate = 1u << 3 , append = 1u << 4 , exclusive = 1u << 5
}
 

Functions

SSHPP_INLINE Result< std::uint64_t > try_download (Sftp &sftp, const RemotePath &remote, const std::filesystem::path &local, TransferOptions opts)
 
SSHPP_INLINE Result< std::uint64_t > try_upload (Sftp &sftp, const std::filesystem::path &local, const RemotePath &remote, TransferOptions opts)
 
SSHPP_INLINE Result< std::string > try_read_file (Sftp &sftp, const RemotePath &path, std::size_t limit)
 
SSHPP_INLINE Result< void > try_write_file (Sftp &sftp, const RemotePath &path, ByteView data, std::filesystem::perms perms)
 
SSHPP_INLINE Result< TreeStatstry_download_tree (Sftp &sftp, const RemotePath &remote, const std::filesystem::path &local, TransferOptions opts)
 
SSHPP_INLINE Result< DirectoryRangeentries (Sftp &, const RemotePath &)
 Range adapter: for (const auto& e : sshpp::sftp::entries(s, "/var/log").value()).
 
SSHPP_API OpenMode operator| (OpenMode a, OpenMode b) noexcept
 
SSHPP_API bool has_flag (OpenMode v, OpenMode flag) noexcept
 

Typedef Documentation

◆ ProgressCallback

using sshpp::sftp::ProgressCallback = typedef std::function<bool(const Progress&)>

Return false to abort the transfer (yields errc::cancelled).

Enumeration Type Documentation

◆ Overwrite

enum class sshpp::sftp::Overwrite
strong
Enumerator
fail 
replace 

◆ FileType

enum class sshpp::sftp::FileType
strong
Enumerator
regular 
directory 
symlink 
special 
unknown 
socket 
char_device 
block_device 
fifo 

◆ OpenMode

enum class sshpp::sftp::OpenMode : unsigned
strong
Enumerator
read 
write 
read_write 
create 
truncate 
append 
exclusive 

Function Documentation

◆ try_download()

SSHPP_API Result< std::uint64_t > sshpp::sftp::try_download ( Sftp sftp,
const RemotePath remote,
const std::filesystem::path &  local,
TransferOptions  opts 
)

◆ try_upload()

SSHPP_API Result< std::uint64_t > sshpp::sftp::try_upload ( Sftp sftp,
const std::filesystem::path &  local,
const RemotePath remote,
TransferOptions  opts 
)

◆ try_read_file()

SSHPP_API Result< std::string > sshpp::sftp::try_read_file ( Sftp sftp,
const RemotePath path,
std::size_t  limit 
)

◆ try_write_file()

SSHPP_API Result< void > sshpp::sftp::try_write_file ( Sftp sftp,
const RemotePath path,
ByteView  data,
std::filesystem::perms  perms 
)

◆ try_download_tree()

SSHPP_API Result< TreeStats > sshpp::sftp::try_download_tree ( Sftp ,
const RemotePath remote,
const std::filesystem::path &  local,
TransferOptions  = {} 
)

Downloads a remote directory tree. Every remote entry name is validated to contain no '/', no "..", and no NUL before being joined to local; symlinks are skipped (counted in TreeStats::skipped), never followed. See docs/design/06 §6.5.

◆ entries()

SSHPP_API Result< DirectoryRange > sshpp::sftp::entries ( Sftp sftp,
const RemotePath path 
)

Range adapter: for (const auto& e : sshpp::sftp::entries(s, "/var/log").value()).

◆ operator|()

SSHPP_API OpenMode sshpp::sftp::operator| ( OpenMode  a,
OpenMode  b 
)
inlinenoexcept

◆ has_flag()

SSHPP_API bool sshpp::sftp::has_flag ( OpenMode  v,
OpenMode  flag 
)
inlinenoexcept