libsshpp v0.1.7
Modern C++17 wrapper for libssh
Loading...
Searching...
No Matches
sshpp::server::Session Class Reference

One accepted server-side connection. See docs/design/08 §8.4. More...

#include <server_session.hpp>

Public Member Functions

 Session ()=default
 
 ~Session ()
 
 Session (Session &&) noexcept
 
Sessionoperator= (Session &&) noexcept
 
 Session (const Session &)=delete
 
 operator bool () const noexcept
 
native_session native_handle () const noexcept
 
Result< void > try_handle_key_exchange ()
 Performs the SSH transport handshake. Must be called before anything else.
 
void set_auth_methods (AuthMethodSet)
 
Result< void > try_disconnect (std::string_view reason={})
 
Result< std::string > try_client_banner () const
 
bool authenticated () const noexcept
 
const std::string & user () const noexcept
 
Result< std::optional< Message > > try_next_message (std::chrono::milliseconds timeout=std::chrono::milliseconds(-1))
 nullopt on timeout. Negative timeout blocks indefinitely.
 
Result< void > try_set_handler (std::shared_ptr< SessionHandler >)
 
Result< void > try_attach (Event &event)
 
Result< void > try_poll (std::chrono::milliseconds timeout)
 Convenience: try_attach()s a private Event on first use, then polls it.
 

Friends

class Bind
 
class Message
 
class detail::HandlerBridge
 

Detailed Description

One accepted server-side connection. See docs/design/08 §8.4.

Constructor & Destructor Documentation

◆ Session() [1/3]

sshpp::server::Session::Session ( )
default

◆ ~Session()

SSHPP_INLINE sshpp::server::Session::~Session ( )
default

◆ Session() [2/3]

SSHPP_INLINE sshpp::server::Session::Session ( Session &&  )
defaultnoexcept

◆ Session() [3/3]

sshpp::server::Session::Session ( const Session )
delete

Member Function Documentation

◆ operator=()

SSHPP_INLINE Session & sshpp::server::Session::operator= ( Session &&  )
defaultnoexcept

◆ operator bool()

sshpp::server::Session::operator bool ( ) const
inlineexplicitnoexcept

◆ native_handle()

native_session sshpp::server::Session::native_handle ( ) const
inlinenoexcept

◆ try_handle_key_exchange()

SSHPP_INLINE Result< void > sshpp::server::Session::try_handle_key_exchange ( )

Performs the SSH transport handshake. Must be called before anything else.

◆ set_auth_methods()

SSHPP_INLINE void sshpp::server::Session::set_auth_methods ( AuthMethodSet  methods)

◆ try_disconnect()

SSHPP_INLINE Result< void > sshpp::server::Session::try_disconnect ( std::string_view  reason = {})

◆ try_client_banner()

SSHPP_INLINE Result< std::string > sshpp::server::Session::try_client_banner ( ) const

◆ authenticated()

bool sshpp::server::Session::authenticated ( ) const
inlinenoexcept

◆ user()

const std::string & sshpp::server::Session::user ( ) const
inlinenoexcept

◆ try_next_message()

SSHPP_INLINE Result< std::optional< Message > > sshpp::server::Session::try_next_message ( std::chrono::milliseconds  timeout = std::chrono::milliseconds(-1))

nullopt on timeout. Negative timeout blocks indefinitely.

◆ try_set_handler()

SSHPP_INLINE Result< void > sshpp::server::Session::try_set_handler ( std::shared_ptr< SessionHandler handler)

Installs the server/channel callback trampolines and drives them via event on subsequent try_poll()/Eventtry_poll() calls. Mixing this with try_next_message() on the same session returns errc::invalid_argument.

◆ try_attach()

SSHPP_INLINE Result< void > sshpp::server::Session::try_attach ( Event event)

◆ try_poll()

SSHPP_INLINE Result< void > sshpp::server::Session::try_poll ( std::chrono::milliseconds  timeout)

Convenience: try_attach()s a private Event on first use, then polls it.

Friends And Related Symbol Documentation

◆ Bind

friend class Bind
friend

◆ Message

friend class Message
friend

◆ detail::HandlerBridge

friend class detail::HandlerBridge
friend

The documentation for this class was generated from the following files: