X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FTermlib%2FTelnetTerminal.hh;h=650ce1f9288a48faf4cedb92cd0748d2e2803b3f;hb=09b4d2c4934a5ea35d208cd22573e0e877ad54c8;hp=0514c6388563d7537d296701710f85e2447c8e0c;hpb=4004cfae8ca0e03a40385560e14bba730a801464;p=senf.git diff --git a/Utils/Termlib/TelnetTerminal.hh b/Utils/Termlib/TelnetTerminal.hh index 0514c63..650ce1f 100644 --- a/Utils/Termlib/TelnetTerminal.hh +++ b/Utils/Termlib/TelnetTerminal.hh @@ -27,10 +27,9 @@ #define HH_SENF_Utils_Termlib_TelnetTerminal_ 1 // Custom includes -#include -#include #include "Telnet.hh" -#include "Terminfo.hh" +#include "AbstractTerminal.hh" +#include "../Logger.hh" //#include "TelnetTerminal.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -38,33 +37,52 @@ namespace senf { namespace term { + /** \brief AbstractTerminal interface implementation based on telnet + + This class provides a telnet server implementation implementing the AbstractTerminal + interface. + + TelnetTerminal provides one additional callback which needs to be implemented in a derived + class: v_setupFailed(). This member will be called, when not all required telnet options are + supported by the telnet client. In this case, the communication will be switched back into + line-oriented mode and v_setupFailed() is called. + + \ingroup telnet_group + */ class TelnetTerminal : public telnethandler::TerminalType, - public telnethandler::NAWS + public telnethandler::NAWS, + public AbstractTerminal { + SENF_LOG_CLASS_AREA(); public: - typedef KeyParser::keycode_t keycode_t; - - static unsigned const DEFAULT_KEY_TIMEOUT_MS = 500u; - TelnetTerminal(); + ///\name AbstractTerminal interface implementation + ///\{ + virtual void setCallbacks(AbstractTerminal::Callbacks & cb); + virtual std::string terminalType(); + virtual unsigned width(); + virtual unsigned height(); + virtual void write(char ch); + ///\} + protected: - virtual void v_setupComplete(); +# ifndef DOXYGEN private: - virtual void v_keyReceived(keycode_t key) = 0; +# endif + virtual void v_setupFailed() = 0; ///< Called when the telnet setup has failed - virtual void v_charReceived(char c); - void keySequenceTimeout(); - void processKeys(); + private: + virtual void v_setupComplete(); + virtual void v_charReceived(char ch); + virtual void v_windowSizeChanged(); - senf::term::Terminfo tifo_; - senf::term::KeyParser keyParser_; - std::string inputBuffer_; - senf::ClockService::clock_type keyTimeout_; - senf::scheduler::TimerEvent timer_; + AbstractTerminal::Callbacks * callbacks_; + bool setupFailed_; }; + }} ///////////////////////////////hh.e////////////////////////////////////////