X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FTermlib%2FTelnet.hh;h=04100e20c8c050c35d06372c4bdc6fedb6cedfd0;hb=e3179a2123ad51d0d9eb63834a581145c4f77c92;hp=e127a95eda030f086290347712ff726652df2454;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/Termlib/Telnet.hh b/senf/Utils/Termlib/Telnet.hh index e127a95..04100e2 100644 --- a/senf/Utils/Termlib/Telnet.hh +++ b/senf/Utils/Termlib/Telnet.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -29,12 +29,11 @@ // Custom includes #include #include -#include #include #include //#include "Telnet.mpp" -///////////////////////////////hh.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace senf { namespace term { @@ -102,7 +101,7 @@ namespace term { \c v_handleOptionParameters() member is called. \code - class MyTelnetHandler + class MyTelnetHandler : public senf::term::BaseTelnetProtocol::TelnetHandler { public: @@ -113,14 +112,14 @@ namespace term { protected: MyTelnetHandler() { registerHandler(this); } - + private: virtual void v_init() { sendOptionParameters(OPTION_CODE, "my special subnegotiation"); incrementRequestCounter(); } - + virtual void v_handleOptionParameters(std::string const & data) { if (data == "another special subnegotiation") @@ -139,8 +138,8 @@ namespace term { static unsigned const DEFAULT_REQUEST_TIMEOUT_MS = 500u; typedef ClientSocketHandle::policy> Handle; ///< Type of socket handle required @@ -165,7 +164,7 @@ namespace term { void sendEC(); ///< Send EraseCharacter to peer void sendEL(); ///< Send EraseLine to peer void sendGA(); ///< Send GoAhead to peer - + void sendOptionParameters(option_type option, std::string const & data); ///< Send extended option parameter to peer /**< This will send \a data as extended option parameter of @@ -189,7 +188,7 @@ namespace term { bool localOption(option_type option); ///< \c true, if \a option locally enabled bool peerOption(option_type option); ///< \c true, if \a option enabled in peer - + protected: explicit BaseTelnetProtocol(Handle handle); ///< Construct telnet protocol handler BaseTelnetProtocol(); ///< Provided for TelnetHandler mixins only @@ -235,7 +234,7 @@ namespace term { virtual void v_handleEC(); ///< Called, when the peer sends an EraseCharacter virtual void v_handleEL(); ///< Called, when the peer sends an EraseLine virtual void v_handleGA(); ///< Called, when the peer sends a GoAhead - + private: void handleChar(char c); void handleNormalChar(char c); @@ -258,7 +257,7 @@ namespace term { void writeHandler(int state); void timeout(); - enum Command { + enum Command { CMD_NONE = 0, CMD_SE = 240, CMD_NOP = 241, @@ -286,7 +285,7 @@ namespace term { OptInfo(); OptInfo(bool local, option_type option); - /////////////////////////////////////////////////////////////// + //-//////////////////////////////////////////////////////////// bool const local; option_type const option; @@ -294,7 +293,7 @@ namespace term { WantState wantState; OptionState optionState; bool enabled; - + }; OptInfo & getOption(bool local, option_type option); @@ -312,7 +311,7 @@ namespace term { typedef std::vector SendQueue; SendQueue sendQueue_; - enum CharState { NORMAL, IAC_SEEN, EXPECT_OPTION, CR_SEEN, + enum CharState { NORMAL, IAC_SEEN, EXPECT_OPTION, CR_SEEN, SB_OPTION, SB_DATA, SB_IAC_SEEN }; CharState charState_; @@ -320,8 +319,8 @@ namespace term { option_type option_; std::string data_; - senf::scheduler::FdEvent inputEvent_; - senf::scheduler::FdEvent outputEvent_; + scheduler::FdEvent inputEvent_; + scheduler::FdEvent outputEvent_; unsigned pendingRequests_; @@ -332,7 +331,7 @@ namespace term { }; /** \brief Telnet handler base class - + \see BaseTelnetProtocol */ struct BaseTelnetProtocol::TelnetHandler @@ -348,7 +347,7 @@ namespace term { See http://www.iana.org/assignments/telnet-options for a list of options - \ingroup telnet_group + \ingroup telnet_group */ namespace telnetopt { BaseTelnetProtocol::option_type const ECHO = 1u; } namespace telnetopt { BaseTelnetProtocol::option_type const TRANSMIT_BINARY = 0u; } @@ -365,7 +364,7 @@ namespace telnethandler { /** \brief Implement TERMINAL_TYPE option This telnet handler implements the TERMINAL_TYPE option. The handler automatically requests - the first terminal type during initialization. Further terminal types may then be reqeusted + the first terminal type during initialization. Further terminal types may then be requested by calling nextTerminalType(). The last received terminal type will be returned by the terminalType() member. @@ -383,7 +382,7 @@ namespace telnethandler { void nextTerminalType(); ///< Request another terminal type std::string const & terminalType() const; ///< Return current terminal type - + protected: TerminalType(); @@ -395,18 +394,18 @@ namespace telnethandler { }; /** \brief 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. - + 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 BaseTelnetProtocol for how to integrate this handler \n RFC 1073 Telnet Window Size Option */ - class NAWS + class NAWS : public BaseTelnetProtocol::TelnetHandler { public: @@ -417,7 +416,7 @@ namespace telnethandler { protected: NAWS(); - + # ifndef DOXYGEN private: # endif @@ -432,12 +431,12 @@ namespace telnethandler { unsigned width_; unsigned height_; }; - + } }} -///////////////////////////////hh.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #include "Telnet.cci" //#include "Telnet.ct"