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

Runs a fixed callback per exec request; no local process is spawned. More...

#include <handlers.hpp>

Inheritance diagram for sshpp::server::CommandHandler:
[legend]
Collaboration diagram for sshpp::server::CommandHandler:
[legend]

Public Types

using Runner = std::function< int(std::string_view command, std::istream &in, std::ostream &out, std::ostream &err)>
 

Public Member Functions

 CommandHandler (Runner runner)
 
bool on_exec_request (Channel &, std::string_view command) override
 
std::size_t on_data (Channel &, ByteView, Stream) override
 Return the number of bytes consumed (libssh re-delivers the remainder).
 
void on_eof (Channel &) override
 
- Public Member Functions inherited from sshpp::server::ChannelHandler
virtual ~ChannelHandler ()=default
 
virtual bool on_pty_request (Channel &, std::string_view term, PtySize)
 
virtual bool on_pty_resize (Channel &, PtySize)
 
virtual bool on_shell_request (Channel &)
 
virtual bool on_subsystem_request (Channel &, std::string_view name)
 
virtual bool on_env_request (Channel &, std::string_view name, std::string_view value)
 
virtual void on_x11_request (Channel &, bool single_connection, std::string_view auth_protocol, std::string_view auth_cookie, std::uint32_t screen_number)
 
virtual void on_signal (Channel &, std::string_view signal_name)
 
virtual void on_close (Channel &)
 
virtual void on_writable (Channel &)
 Called when the channel's send window opens up again.
 

Detailed Description

Runs a fixed callback per exec request; no local process is spawned.

Member Typedef Documentation

◆ Runner

using sshpp::server::CommandHandler::Runner = std::function<int(std::string_view command, std::istream& in, std::ostream& out, std::ostream& err)>

Constructor & Destructor Documentation

◆ CommandHandler()

sshpp::server::CommandHandler::CommandHandler ( Runner  runner)
inlineexplicit

Member Function Documentation

◆ on_exec_request()

SSHPP_INLINE bool sshpp::server::CommandHandler::on_exec_request ( Channel ,
std::string_view  command 
)
overridevirtual

Reimplemented from sshpp::server::ChannelHandler.

◆ on_data()

SSHPP_INLINE std::size_t sshpp::server::CommandHandler::on_data ( Channel ,
ByteView  data,
Stream   
)
overridevirtual

Return the number of bytes consumed (libssh re-delivers the remainder).

Reimplemented from sshpp::server::ChannelHandler.

◆ on_eof()

SSHPP_INLINE void sshpp::server::CommandHandler::on_eof ( Channel channel)
overridevirtual

Reimplemented from sshpp::server::ChannelHandler.


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