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

Namespaces

namespace  auth
 
namespace  detail
 
namespace  scp
 
namespace  server
 
namespace  sftp
 

Classes

class  AcceptAnyHostKeyPolicy
 Accept everything. Requires the i_understand_this_is_insecure() tag. More...
 
class  Authenticator
 Authentication strategy interface. See docs/design/04 §4.4. More...
 
class  AuthError
 
struct  AuthMethods
 
class  BasicByteSpan
 A minimal span-like non-owning view over contiguous bytes (C++17 has no std::span). More...
 
class  BidirectionalPump
 
class  ByteView
 Input byte range. Implicitly constructible from std::string_view / std::vector<std::byte>. More...
 
class  CallbackHostKeyPolicy
 Delegates to a user callback (e.g. a GUI prompt). More...
 
class  CancelledError
 
class  Channel
 
class  ChannelError
 
class  ConnectionError
 
class  Error
 
struct  ErrorInfo
 
class  Event
 Poll-loop integration seam around ssh_event. See docs/design/05 §5.5. More...
 
class  Exec
 
struct  ExecResult
 
struct  ExitState
 
struct  Features
 
class  Fingerprint
 
class  ForwardingError
 
struct  ForwardStats
 
class  HostKeyError
 
class  HostKeyVerifier
 Policy object consulted by Session::verify_host_key(). See docs/design/04 §4.6. More...
 
struct  IncomingForward
 ssh -R originator/listener primitive: server listens, hands us inbound channels. More...
 
struct  InsecureOptIn
 
class  Key
 
class  KeyError
 
class  KnownHosts
 
struct  KnownHostsEntry
 
class  Library
 
class  LocalForward
 
struct  LogRecord
 
class  MutableByteView
 Output byte range (caller-owned, mutable buffer to write into). More...
 
struct  NegotiatedAlgorithms
 
struct  PassphraseRequest
 Request passed to a passphrase/password prompt callback. More...
 
class  PinnedHostKeyPolicy
 Pin one or more fingerprints; ignores known_hosts entirely. More...
 
struct  PtySize
 
class  RemoteForward
 ssh -R equivalent: accept loop that connects each inbound channel to a local endpoint. More...
 
class  RemoteForwardListener
 
class  RemotePath
 
class  Result
 
class  Result< void >
 
class  ScpError
 
class  SecureString
 
class  ServerError
 
class  Session
 
struct  SessionOptions
 
class  SftpError
 
class  Shell
 
class  SocksProxy
 
struct  SourceLocation
 Minimal std::source_location-like shim (this library targets C++17). More...
 
class  StrictHostKeyPolicy
 Reject anything not already in known_hosts. The only safe default. More...
 
struct  TcpEndpoint
 
class  TimeoutError
 
class  TofuHostKeyPolicy
 Accept-and-remember on first use; reject on change (OpenSSH accept-new). More...
 
struct  UnixEndpoint
 
class  UsageError
 
class  X11Forwarder
 
struct  X11Request
 

Typedefs

using native_session = ::ssh_session_struct *
 
using native_channel = ::ssh_channel_struct *
 
using native_key = ::ssh_key_struct *
 
using native_bind = ::ssh_bind_struct *
 
using native_message = ::ssh_message_struct *
 
using native_event = ::ssh_event_struct *
 
using native_sftp = ::sftp_session_struct *
 
using native_sftp_file = ::sftp_file_struct *
 
using native_sftp_dir = ::sftp_dir_struct *
 
using native_scp = ::ssh_scp_struct *
 
using native_connector = ::ssh_connector_struct *
 
using native_sftp_aio = ::sftp_aio_struct *
 
using OutputSink = std::function< void(Stream, ByteView)>
 
using ForwardTarget = std::variant< TcpEndpoint, UnixEndpoint >
 
using PublicKey = Key
 
using PassphraseCallback = std::function< Result< SecureString >(const PassphraseRequest &)>
 
using PasswordCallback = std::function< Result< SecureString >()>
 
using LogCallback = std::function< void(const LogRecord &)>
 

Enumerations

enum class  AuthStatus {
  success , denied , partial , info_required ,
  again , error
}
 
enum class  Stream { stdout_ , stderr_ }
 
enum class  Signal {
  abrt , alrm , fpe , hup ,
  ill , int_ , kill , pipe ,
  quit , segv , term , usr1 ,
  usr2
}
 
enum class  errc : int {
  ok = 0 , fatal , request_denied , interrupted ,
  would_block , timed_out , cancelled , not_connected ,
  already_connected , connection_lost , protocol_error , banner_exchange_failed ,
  key_exchange_failed , rekey_failed , host_key_unknown , host_key_changed ,
  host_key_type_mismatch , host_key_rejected , known_hosts_io_error , auth_denied ,
  auth_partial , auth_method_unavailable , auth_no_more_methods , passphrase_required ,
  passphrase_incorrect , agent_unavailable , gssapi_error , key_import_failed ,
  key_export_failed , key_generation_failed , unsupported_key_type , channel_open_failed ,
  channel_closed , channel_eof , channel_request_failed , pty_request_failed ,
  sftp_unavailable , scp_error , forwarding_failed , x11_failed ,
  invalid_handle , invalid_argument , unsupported_operation , out_of_memory ,
  unknown
}
 
enum class  sftp_errc : int {
  ok = 0 , eof = 1 , no_such_file = 2 , permission_denied = 3 ,
  failure = 4 , bad_message = 5 , no_connection = 6 , connection_lost = 7 ,
  op_unsupported = 8 , invalid_handle = 9 , no_such_path = 10 , file_already_exists = 11 ,
  write_protect = 12 , no_media = 13 , invalid_parameter = 14
}
 
enum class  KeyType {
  unknown , dss , rsa , rsa1 ,
  ecdsa_p256 , ecdsa_p384 , ecdsa_p521 , ed25519 ,
  dss_cert01 , rsa_cert01 , ecdsa_p256_cert01 , ecdsa_p384_cert01 ,
  ecdsa_p521_cert01 , ed25519_cert01 , sk_ecdsa , sk_ed25519 ,
  sk_ecdsa_cert01 , sk_ed25519_cert01
}
 
enum class  HashType { md5 , sha1 , sha256 }
 
enum class  KnownHostsStatus {
  ok , changed , other_type , not_found ,
  unknown , error
}
 
enum class  LogLevel {
  none = 0 , warning , info , debug ,
  trace
}
 
enum class  StrictHostKeyChecking { off , on }
 
enum class  Locking { none , internal }
 
enum class  Compression { off , on , zlib , zlib_openssh }
 
enum class  Ownership { owning , borrowed }
 

Functions

SSHPP_INLINE const std::error_category & ssh_category () noexcept
 
SSHPP_INLINE const std::error_category & sftp_category () noexcept
 
SSHPP_INLINE std::error_code make_error_code (errc e) noexcept
 
SSHPP_INLINE std::error_code make_error_code (sftp_errc e) noexcept
 
SSHPP_INLINE void throw_error (ErrorInfo info)
 
SSHPP_INLINE std::string shell_quote (std::string_view arg)
 Escapes a single argument for a POSIX shell.
 
SSHPP_INLINE Result< Channelopen_direct (Session &session, const ForwardTarget &remote, TcpEndpoint origin)
 
InsecureOptIn i_understand_this_is_insecure ()
 

Typedef Documentation

◆ native_session

using sshpp::native_session = typedef ::ssh_session_struct*

◆ native_channel

using sshpp::native_channel = typedef ::ssh_channel_struct*

◆ native_key

using sshpp::native_key = typedef ::ssh_key_struct*

◆ native_bind

using sshpp::native_bind = typedef ::ssh_bind_struct*

◆ native_message

using sshpp::native_message = typedef ::ssh_message_struct*

◆ native_event

using sshpp::native_event = typedef ::ssh_event_struct*

◆ native_sftp

using sshpp::native_sftp = typedef ::sftp_session_struct*

◆ native_sftp_file

using sshpp::native_sftp_file = typedef ::sftp_file_struct*

◆ native_sftp_dir

using sshpp::native_sftp_dir = typedef ::sftp_dir_struct*

◆ native_scp

using sshpp::native_scp = typedef ::ssh_scp_struct*

◆ native_connector

using sshpp::native_connector = typedef ::ssh_connector_struct*

◆ native_sftp_aio

using sshpp::native_sftp_aio = typedef ::sftp_aio_struct*

◆ OutputSink

using sshpp::OutputSink = typedef std::function<void(Stream, ByteView)>

◆ ForwardTarget

using sshpp::ForwardTarget = typedef std::variant<TcpEndpoint, UnixEndpoint>

◆ PublicKey

◆ PassphraseCallback

using sshpp::PassphraseCallback = typedef std::function<Result<SecureString>(const PassphraseRequest&)>

◆ PasswordCallback

using sshpp::PasswordCallback = typedef std::function<Result<SecureString>()>

◆ LogCallback

using sshpp::LogCallback = typedef std::function<void(const LogRecord&)>

Enumeration Type Documentation

◆ AuthStatus

enum class sshpp::AuthStatus
strong
Enumerator
success 
denied 
partial 
info_required 
again 
error 

◆ Stream

enum class sshpp::Stream
strong
Enumerator
stdout_ 
stderr_ 

◆ Signal

enum class sshpp::Signal
strong
Enumerator
abrt 
alrm 
fpe 
hup 
ill 
int_ 
kill 
pipe 
quit 
segv 
term 
usr1 
usr2 

◆ errc

enum class sshpp::errc : int
strong
Enumerator
ok 
fatal 
request_denied 
interrupted 
would_block 
timed_out 
cancelled 
not_connected 
already_connected 
connection_lost 
protocol_error 
banner_exchange_failed 
key_exchange_failed 
rekey_failed 
host_key_unknown 
host_key_changed 
host_key_type_mismatch 
host_key_rejected 
known_hosts_io_error 
auth_denied 
auth_partial 
auth_method_unavailable 
auth_no_more_methods 
passphrase_required 
passphrase_incorrect 
agent_unavailable 
gssapi_error 
key_import_failed 
key_export_failed 
key_generation_failed 
unsupported_key_type 
channel_open_failed 
channel_closed 
channel_eof 
channel_request_failed 
pty_request_failed 
sftp_unavailable 
scp_error 
forwarding_failed 
x11_failed 
invalid_handle 
invalid_argument 
unsupported_operation 
out_of_memory 
unknown 

◆ sftp_errc

enum class sshpp::sftp_errc : int
strong
Enumerator
ok 
eof 
no_such_file 
permission_denied 
failure 
bad_message 
no_connection 
connection_lost 
op_unsupported 
invalid_handle 
no_such_path 
file_already_exists 
write_protect 
no_media 
invalid_parameter 

◆ KeyType

enum class sshpp::KeyType
strong
Enumerator
unknown 
dss 
rsa 
rsa1 
ecdsa_p256 
ecdsa_p384 
ecdsa_p521 
ed25519 
dss_cert01 
rsa_cert01 
ecdsa_p256_cert01 
ecdsa_p384_cert01 
ecdsa_p521_cert01 
ed25519_cert01 
sk_ecdsa 
sk_ed25519 
sk_ecdsa_cert01 
sk_ed25519_cert01 

◆ HashType

enum class sshpp::HashType
strong
Enumerator
md5 
sha1 
sha256 

◆ KnownHostsStatus

enum class sshpp::KnownHostsStatus
strong
Enumerator
ok 
changed 
other_type 
not_found 
unknown 
error 

◆ LogLevel

enum class sshpp::LogLevel
strong
Enumerator
none 
warning 
info 
debug 
trace 

◆ StrictHostKeyChecking

enum class sshpp::StrictHostKeyChecking
strong
Enumerator
off 
on 

◆ Locking

enum class sshpp::Locking
strong
Enumerator
none 
internal 

◆ Compression

enum class sshpp::Compression
strong
Enumerator
off 
on 
zlib 
zlib_openssh 

◆ Ownership

enum class sshpp::Ownership
strong

Whether a wrapper type owns (frees) the native handle it holds, or merely borrows it (e.g. a channel handed to a server callback that libssh still owns).

Enumerator
owning 
borrowed 

Function Documentation

◆ ssh_category()

SSHPP_API const std::error_category & sshpp::ssh_category ( )
noexcept

◆ sftp_category()

SSHPP_API const std::error_category & sshpp::sftp_category ( )
noexcept

◆ make_error_code() [1/2]

SSHPP_API std::error_code sshpp::make_error_code ( errc  e)
noexcept

◆ make_error_code() [2/2]

SSHPP_API std::error_code sshpp::make_error_code ( sftp_errc  e)
noexcept

◆ throw_error()

SSHPP_API void sshpp::throw_error ( ErrorInfo  info)

Throws the exception subclass matching info.code's category/value. The single place that translates an ErrorInfo into a thrown exception.

◆ shell_quote()

SSHPP_API std::string sshpp::shell_quote ( std::string_view  arg)

Escapes a single argument for a POSIX shell.

◆ open_direct()

SSHPP_API Result< Channel > sshpp::open_direct ( Session ,
const ForwardTarget remote,
TcpEndpoint  origin = {"127.0.0.1", 0} 
)

Primitive: one channel to one remote endpoint (direct-tcpip / direct-streamlocal). No local listener involved.

◆ i_understand_this_is_insecure()

InsecureOptIn sshpp::i_understand_this_is_insecure ( )
inline