4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief TelnetTerminal non-inline non-template implementation */
26 #include "TelnetTerminal.hh"
27 //#include "TelnetTerminal.ih"
30 #include <senf/Utils/membind.hh>
32 //#include "TelnetTerminal.mpp"
34 ///////////////////////////////cc.p////////////////////////////////////////
36 prefix_ senf::term::TelnetTerminal::TelnetTerminal()
37 : keyTimeout_ (senf::ClockService::milliseconds(DEFAULT_KEY_TIMEOUT_MS)),
38 timer_ ("senf::term::TelnetTerminal::keySequenceTimeout",
39 senf::membind(&TelnetTerminal::keySequenceTimeout, this))
41 requestPeerOption(telnetopt::SUPPRESS_GO_AHEAD);
42 requestLocalOption(telnetopt::SUPPRESS_GO_AHEAD);
43 requestLocalOption(telnetopt::ECHO);
46 prefix_ void senf::term::TelnetTerminal::v_setupComplete()
48 tifo_.load(terminalType());
49 keyParser_.load(tifo_);
52 prefix_ void senf::term::TelnetTerminal::v_charReceived(char c)
55 timer_.timeout(senf::scheduler::eventTime() + keyTimeout_);
59 prefix_ void senf::term::TelnetTerminal::keySequenceTimeout()
61 while (!inputBuffer_.empty()) {
63 v_keyReceived(keycode_t(inputBuffer_[0]));
64 inputBuffer_.erase(0, 1);
68 prefix_ void senf::term::TelnetTerminal::processKeys()
71 std::pair<senf::term::KeyParser::keycode_t, std::string::size_type> result
72 (keyParser_.lookup(inputBuffer_));
73 if (result.first == senf::term::KeyParser::Incomplete)
75 v_keyReceived(result.first);
76 inputBuffer_.erase(0, result.second);
77 } while (! inputBuffer_.empty());
81 ///////////////////////////////cc.e////////////////////////////////////////
83 //#include "TelnetTerminal.mpp"
90 // c-file-style: "senf"
91 // indent-tabs-mode: nil
92 // ispell-local-dictionary: "american"
93 // compile-command: "scons -u test"