X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FTermlib%2FTelnetTerminal.hh;fp=senf%2FUtils%2FTermlib%2FTelnetTerminal.hh;h=09aea80847cbdd70d37824349dd7fbfaccf5ae6f;hb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;hp=0000000000000000000000000000000000000000;hpb=164fe477094d42463722584e527a02379ab5d985;p=senf.git diff --git a/senf/Utils/Termlib/TelnetTerminal.hh b/senf/Utils/Termlib/TelnetTerminal.hh new file mode 100644 index 0000000..09aea80 --- /dev/null +++ b/senf/Utils/Termlib/TelnetTerminal.hh @@ -0,0 +1,103 @@ +// $Id$ +// +// Copyright (C) 2009 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** \file + \brief TelnetTerminal public header */ + +#ifndef HH_SENF_Utils_Termlib_TelnetTerminal_ +#define HH_SENF_Utils_Termlib_TelnetTerminal_ 1 + +// Custom includes +#include "Telnet.hh" +#include "AbstractTerminal.hh" +#include "../Logger.hh" + +//#include "TelnetTerminal.mpp" +///////////////////////////////hh.p//////////////////////////////////////// + +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 AbstractTerminal + { + SENF_LOG_CLASS_AREA(); + public: + TelnetTerminal(); + + ///\name AbstractTerminal interface implementation + ///\{ + virtual void setCallbacks(AbstractTerminal::Callbacks & cb); + virtual std::string terminalType(); + virtual unsigned width() const; + virtual unsigned height() const; + virtual void write(char ch); + ///\} + + protected: + +# ifndef DOXYGEN + private: +# endif + virtual void v_setupFailed() = 0; ///< Called when the telnet setup has failed + + private: + virtual void v_setupComplete(); + virtual void v_charReceived(char ch); + virtual void v_windowSizeChanged(); + + AbstractTerminal::Callbacks * callbacks_; + bool setupFailed_; + }; + +}} + +///////////////////////////////hh.e//////////////////////////////////////// +//#include "TelnetTerminal.cci" +//#include "TelnetTerminal.ct" +//#include "TelnetTerminal.cti" +#endif + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: