senf::term::telnethandler::NAWS Class Referenceabstract

Implement NAWS (Negotiation About Window Size) option. More...

#include <senf/Utils/Termlib/Telnet.hh>

Inheritance diagram for senf::term::telnethandler::NAWS:

Public Member Functions

unsigned width () const
 Get current client window width. More...
 
unsigned height () const
 Get current client window height. More...
 
- Public Member Functions inherited from senf::term::BaseTelnetProtocol::TelnetHandler
virtual ~TelnetHandler ()
 
- Public Member Functions inherited from senf::term::BaseTelnetProtocol
void write (std::string const &s)
 Send string to peer. More...
 
void write (char c)
 Send single character to peer. More...
 
Handle handle ()
 Get socket handle. More...
 
void sendNOP ()
 Send NOP to peer. More...
 
void sendBRK ()
 Send BReaK to peer. More...
 
void sendIP ()
 Send InterruptProcess to peer. More...
 
void sendAO ()
 Send AbortOutput to peer. More...
 
void sendAYT ()
 Send AreYouThere to peer. More...
 
void sendEC ()
 Send EraseCharacter to peer. More...
 
void sendEL ()
 Send EraseLine to peer. More...
 
void sendGA ()
 Send GoAhead to peer. More...
 
void sendOptionParameters (option_type option, std::string const &data)
 Send extended option parameter to peer. More...
 
void requestLocalOption (option_type option, bool enabled=true)
 Request option to be enabled here. More...
 
void acceptLocalOption (option_type option, bool enabled=true)
 Accept a request for an option to be enabled here. More...
 
void requestPeerOption (option_type option, bool enabled=true)
 Request peer to enable an option. More...
 
void acceptPeerOption (option_type option, bool enabled=true)
 Accept a request by the peer to enable an option. More...
 
bool localOption (option_type option)
 true, if option locally enabled More...
 
bool peerOption (option_type option)
 true, if option enabled in peer More...
 

Static Public Attributes

static option_type const OPTION_CODE = telnetopt::NAWS
 
- Static Public Attributes inherited from senf::term::BaseTelnetProtocol
static unsigned const DEFAULT_REQUEST_TIMEOUT_MS = 500u
 

Protected Member Functions

 NAWS ()
 
virtual void v_windowSizeChanged ()=0
 Called, whenever window size changes. More...
 
- Protected Member Functions inherited from senf::term::BaseTelnetProtocol
 BaseTelnetProtocol (Handle handle)
 Construct telnet protocol handler. More...
 
 BaseTelnetProtocol ()
 Provided for TelnetHandler mixins only. More...
 
virtual ~BaseTelnetProtocol ()
 
template<class Handler >
void registerHandler (Handler *h, bool request=true)
 Register a TelnetHandler. More...
 
void incrementRequestCounter ()
 Increment request counter. More...
 
void decrementRequestCounter ()
 Decrement request counter. More...
 
bool requestsPending ()
 true, if there are pending requests More...
 
virtual void v_setupComplete ()=0
 Called, when no further requests are pending. More...
 
virtual void v_charReceived (char c)=0
 Called whenever a data character is received. More...
 
virtual void v_eof ()=0
 Called on input EOF. More...
 
virtual void v_handleNOP ()
 Called, when the peer sends a NOP. More...
 
virtual void v_handleBRK ()
 Called, when the peer sends a BReaK. More...
 
virtual void v_handleIP ()
 Called, when the peer sends an InterruptProcess. More...
 
virtual void v_handleAO ()
 Called, when the peer sends an AbortOutput. More...
 
virtual void v_handleAYT ()
 Called, when the peer sends an AreYouThere. More...
 
virtual void v_handleEC ()
 Called, when the peer sends an EraseCharacter. More...
 
virtual void v_handleEL ()
 Called, when the peer sends an EraseLine. More...
 
virtual void v_handleGA ()
 Called, when the peer sends a GoAhead. More...
 

Additional Inherited Members

- Public Types inherited from senf::term::BaseTelnetProtocol
typedef ClientSocketHandle< senf::MakeSocketPolicy< ConnectedCommunicationPolicy, StreamFramingPolicy, ReadablePolicy, WriteablePolicy >::policy > Handle
 Type of socket handle required. More...
 
typedef unsigned char option_type
 Type of telnet option numbers. More...
 

Detailed Description

Implement NAWS (Negotiation About Window Size) option.

This telnet handler implements the NAWS option. The client terminals window size will be requested during initialization. The current window size may always be accessed using the width() and height() members.

Whenever the window size is changed, the v_windowSizeChanged() function is called. This function must be implemented in a derived class.

See also
BaseTelnetProtocol for how to integrate this handler
RFC 1073 Telnet Window Size Option

Definition at line 404 of file Telnet.hh.

Constructor & Destructor Documentation

◆ NAWS()

senf::term::telnethandler::NAWS::NAWS ( )
protected

Definition at line 475 of file Telnet.cc.

Member Function Documentation

◆ height()

unsigned senf::term::telnethandler::NAWS::height ( ) const

Get current client window height.

◆ v_windowSizeChanged()

virtual void senf::term::telnethandler::NAWS::v_windowSizeChanged ( )
protectedpure virtual

Called, whenever window size changes.

This member is called for every window size change after initialization.

◆ width()

unsigned senf::term::telnethandler::NAWS::width ( ) const

Get current client window width.

Member Data Documentation

◆ OPTION_CODE

option_type const senf::term::telnethandler::NAWS::OPTION_CODE = telnetopt::NAWS
static

Definition at line 408 of file Telnet.hh.


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