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

#include <sftp_subsystem.hpp>

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

Classes

struct  Options
 

Public Member Functions

 SftpSubsystemHandler (Options options)
 
 ~SftpSubsystemHandler () override
 
Result< void > try_serve (Channel &channel) const
 
bool on_subsystem_request (Channel &, std::string_view name) override
 
void on_close (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_exec_request (Channel &, std::string_view command)
 
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 std::size_t on_data (Channel &, ByteView, Stream)
 Return the number of bytes consumed (libssh re-delivers the remainder).
 
virtual void on_eof (Channel &)
 
virtual void on_writable (Channel &)
 Called when the channel's send window opens up again.
 

Detailed Description

Serves SFTP (protocol version 3) over an already-open channel, confined to root. See docs/design/08 §8.7.

Concurrency: try_serve() performs raw, blocking reads/writes on the given channel from the calling thread. If that thread is different from the one driving the session's Event/message loop, the underlying Session must not be used concurrently from both without external synchronization (same caveat as LocalForward/RemoteForward's pump threads).

Constructor & Destructor Documentation

◆ SftpSubsystemHandler()

sshpp::server::SftpSubsystemHandler::SftpSubsystemHandler ( Options  options)
inlineexplicit

◆ ~SftpSubsystemHandler()

SSHPP_INLINE sshpp::server::SftpSubsystemHandler::~SftpSubsystemHandler ( )
override

Member Function Documentation

◆ try_serve()

SSHPP_INLINE Result< void > sshpp::server::SftpSubsystemHandler::try_serve ( Channel channel) const

Runs the SFTP server loop until the client closes the subsystem channel or an unrecoverable protocol error occurs. Blocks.

◆ on_subsystem_request()

SSHPP_INLINE bool sshpp::server::SftpSubsystemHandler::on_subsystem_request ( Channel channel,
std::string_view  name 
)
overridevirtual

Reimplemented from sshpp::server::ChannelHandler.

◆ on_close()

SSHPP_INLINE void sshpp::server::SftpSubsystemHandler::on_close ( Channel )
overridevirtual

Reimplemented from sshpp::server::ChannelHandler.


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