Telnet++
3.1.0.2
A C++ library for interacting with Telnet streams
|
An class that encapsulates one side of a Telnet option. More...
#include <option.hpp>
Public Member Functions | |
virtual | ~option ()=default |
Destructor. | |
constexpr telnetpp::option_type | option_code () const noexcept |
Returns the code for the option. | |
constexpr bool | active () const noexcept |
Returns whether the option is active. | |
constexpr void | activate () |
Begins the activation process for the option. | |
constexpr void | deactivate () |
Begins the deactivation process for the option. | |
constexpr void | negotiate (telnetpp::negotiation_type neg) |
Negotiate with the option. This should be called when the remote side either initiates a negotiation request or responds to an ongoing request. | |
constexpr void | subnegotiate (telnetpp::bytes content) |
Subnegotiate with the option. This should be called when a subnegotiation sequence has been received from the remote. | |
Public Attributes | |
boost::signals2::signal< void()> | on_state_changed |
Protected Member Functions | |
constexpr | option (telnetpp::session &sess, telnetpp::option_type code) noexcept |
Constructor. | |
void | write_text (telnetpp::bytes content) |
Write plain text to the session. | |
void | write_subnegotiation (telnetpp::bytes content) |
Write a subnegotiation to the session. | |
An class that encapsulates one side of a Telnet option.
A Telnet option comprises two essential parts: an activation sequence, whereby a client and a server agree upon whether the option is active or not, and a subnegotiation handler in which the option-specific protocol is exchanged.
For most options, only handle_subnegotiation need be overridden. This is where the option-specific protocol contained in the subnegotiations is received.
An option may require auxiliary classes in order to be useful. See the documentation accompanying those options for more information.
The easiest way to use an option is to install it in a session. A session is used to automatically route relevant messages to and from an option. See telnetpp::session for more information.
Most functions that telnetpp::option exposes could potentially require that data be transmitted to the remote. To allow the user to specify exactly how that occurs, telnetpp::option uses continuations: functions where the caller specifies how the result of the operation should be used.