Utils/Termlib: Extend the completion API
[senf.git] / Utils / Termlib / TelnetTerminal.hh
index 98cab31..09aea80 100644 (file)
@@ -29,6 +29,7 @@
 // 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();
-        virtual unsigned height();
+        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();
@@ -56,6 +80,7 @@ namespace term {
         virtual void v_windowSizeChanged();
 
         AbstractTerminal::Callbacks * callbacks_;
+        bool setupFailed_;
     };
 
 }}