Telnet++  3.1.0.2
A C++ library for interacting with Telnet streams
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
telnetpp::option< LocalPositive, LocalNegative, RemotePositive, RemoteNegative > Class Template Referenceabstract

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
 

Static Public Attributes

static constexpr auto local_positive = LocalPositive
 
static constexpr auto local_negative = LocalNegative
 
static constexpr auto remote_positive = RemotePositive
 
static constexpr auto remote_negative = RemoteNegative
 

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.
 

Detailed Description

template<telnetpp::command_type LocalPositive, telnetpp::command_type LocalNegative, telnetpp::command_type RemotePositive, telnetpp::command_type RemoteNegative>
class telnetpp::option< LocalPositive, LocalNegative, RemotePositive, RemoteNegative >

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.

Inheritance

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.

Usage

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.

Note

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.


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