4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief TelnetTerminal non-inline non-template implementation */
31 #include "TelnetTerminal.hh"
32 //#include "TelnetTerminal.ih"
36 //#include "TelnetTerminal.mpp"
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
40 prefix_ senf::term::TelnetTerminal::TelnetTerminal()
41 : setupFailed_ (false)
43 requestPeerOption(telnetopt::SUPPRESS_GO_AHEAD);
44 requestLocalOption(telnetopt::SUPPRESS_GO_AHEAD);
45 requestLocalOption(telnetopt::ECHO);
48 prefix_ void senf::term::TelnetTerminal::setCallbacks(AbstractTerminal::Callbacks & cb)
53 prefix_ std::string senf::term::TelnetTerminal::terminalType()
55 return telnethandler::TerminalType::terminalType();
58 prefix_ unsigned senf::term::TelnetTerminal::width()
61 return telnethandler::NAWS::width();
64 prefix_ unsigned senf::term::TelnetTerminal::height()
67 return telnethandler::NAWS::height();
70 prefix_ void senf::term::TelnetTerminal::write(char ch)
72 BaseTelnetProtocol::write(ch);
75 prefix_ void senf::term::TelnetTerminal::v_setupComplete()
81 else if (! (width() > 0
82 && ! terminalType().empty()
83 && localOption(telnetopt::SUPPRESS_GO_AHEAD)
84 && peerOption(telnetopt::SUPPRESS_GO_AHEAD)
85 && localOption(telnetopt::ECHO)
86 && (init = callbacks_->cb_init()))) {
88 SENF_LOG_BLOCK((senf::log::NOTICE)({
89 log << "TelnetTerminal setup failed:\n";
91 log << " missing telnet client NAWS support\n";
93 log << " size=" << width() << "x" << height() << "\n";
94 if (terminalType().empty())
95 log << " missing telnet client TERMINAL_TYPE support\n";
97 log << " TERM=" << terminalType() << "\n";
98 if (! localOption(telnetopt::SUPPRESS_GO_AHEAD) ||
99 ! peerOption(telnetopt::SUPPRESS_GO_AHEAD))
100 log << " missing telnet clinet SGO support\n";
101 if (! localOption(telnetopt::ECHO))
102 log << " missing telnet client ECHO support\n";
104 log << " terminal initialization (cb_init) failed\n";
108 requestPeerOption(telnetopt::SUPPRESS_GO_AHEAD, false);
109 requestLocalOption(telnetopt::SUPPRESS_GO_AHEAD, false);
110 requestLocalOption(telnetopt::ECHO, false);
111 requestPeerOption(telnetopt::TERMINAL_TYPE, false);
112 requestPeerOption(telnetopt::NAWS, false);
113 if (! requestsPending())
117 SENF_LOG((senf::log::NOTICE)(
118 "Initialized TelnetTerminal: TERM=" << terminalType()
119 << ", size=" << width() << "x" << height()));
122 prefix_ void senf::term::TelnetTerminal::v_charReceived(char ch)
124 callbacks_->cb_charReceived(ch);
127 prefix_ void senf::term::TelnetTerminal::v_windowSizeChanged()
129 callbacks_->cb_windowSizeChanged();
132 //-/////////////////////////////////////////////////////////////////////////////////////////////////
134 //#include "TelnetTerminal.mpp"
140 // comment-column: 40
141 // c-file-style: "senf"
142 // indent-tabs-mode: nil
143 // ispell-local-dictionary: "american"
144 // compile-command: "scons -u test"