3 #include "telnetpp/core.hpp"
4 #include "telnetpp/element.hpp"
146 template <
typename Channel>
149 channel_ = std::unique_ptr<channel_concept>(
150 std::make_unique<channel_model<Channel>>(channel));
161 [[nodiscard]]
bool is_alive()
const;
179 void async_read(std::function<
void(telnetpp::bytes)>
const &callback);
192 telnetpp::command_type cmd,
214 struct channel_concept
219 virtual ~channel_concept() =
default;
225 virtual void async_read(std::function<
void(bytes)>
const &) = 0;
230 virtual void write(bytes data) = 0;
235 [[nodiscard]]
virtual bool is_alive()
const = 0;
240 virtual void close() = 0;
243 template <
typename Channel>
244 struct channel_model final : channel_concept
249 explicit channel_model(Channel &channel) : channel_{channel}
257 void async_read(std::function<
void(bytes)>
const &callback)
override
259 channel_.async_read(callback);
265 void write(bytes data)
override
267 channel_.write(data);
273 [[nodiscard]]
bool is_alive()
const override
275 return channel_.is_alive();
281 void close()
override
291 std::unique_ptr<channel_concept> channel_;
292 std::unique_ptr<impl> pimpl_;
A class that represents a Telnet option's client side. That is, the side that receives WILL and WONT ...
Definition: client_option.hpp:35
A class that encapsulates the value of a Telnet command.
Definition: command.hpp:13
A common type that can contain any Telnet operation, such as a command, negotiation,...
An class that encapsulates one side of a Telnet option.
Definition: option.hpp:46
A class that represents a Telnet option's server side. That is, the side that receives DO and DONT ne...
Definition: server_option.hpp:35
An abstraction for a Telnet session.
Definition: session.hpp:141
session(Channel &channel)
Constructor.
Definition: session.hpp:147