Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Telnet.cci

Go to the documentation of this file.
00001 // $Id: Telnet.cci 1781 2011-04-11 12:10:19Z tho $
00002 //
00003 // Copyright (C) 2008
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 //#include "Telnet.ih"
00027 
00028 // Custom includes
00029 
00030 #define prefix_ inline
00031 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00032 
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 // senf::term::BaseTelnetProtocol::OptInfo
00035 
00036 prefix_ senf::term::BaseTelnetProtocol::OptInfo::OptInfo()
00037     : local (false), option (0u), wantState (DISABLED), optionState (NONE), enabled (false)
00038 {}
00039 
00040 prefix_ senf::term::BaseTelnetProtocol::OptInfo::OptInfo(bool l, option_type o)
00041     : local (l), option (o), wantState (DISABLED), optionState (NONE), enabled (false)
00042 {}
00043 
00044 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00045 // senf::term::BaseTelnetProtocol::TelnetHandler
00046 
00047 prefix_ senf::term::BaseTelnetProtocol::TelnetHandler::~TelnetHandler()
00048 {}
00049 
00050 prefix_ std::string const & senf::term::telnethandler::TerminalType::terminalType()
00051     const
00052 {
00053     return type_;
00054 }
00055 
00056 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00057 // senf::term::telnethandler::NAWS
00058 
00059 prefix_ unsigned senf::term::telnethandler::NAWS::width()
00060     const
00061 {
00062     return width_;
00063 }
00064 
00065 prefix_ unsigned senf::term::telnethandler::NAWS::height()
00066     const
00067 {
00068     return height_;
00069 }
00070 
00071 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00072 // senf::term::BaseTelnetProtocol
00073 
00074 prefix_ senf::term::BaseTelnetProtocol::~BaseTelnetProtocol()
00075 {}
00076 
00077 prefix_ senf::term::BaseTelnetProtocol::Handle senf::term::BaseTelnetProtocol::handle()
00078 {
00079     return handle_;
00080 }
00081 
00082 prefix_ void senf::term::BaseTelnetProtocol::incrementRequestCounter()
00083 {
00084     ++ pendingRequests_;
00085     timeout_.timeout(scheduler::eventTime() + requestTimeout_);
00086 }
00087 
00088 prefix_ bool senf::term::BaseTelnetProtocol::requestsPending()
00089 {
00090     return pendingRequests_ > 0u;
00091 }
00092 
00093 prefix_ void senf::term::BaseTelnetProtocol::sendNOP()
00094 {
00095     transmit(CMD_IAC);
00096     transmit(CMD_NOP);
00097 }
00098 
00099 prefix_ void senf::term::BaseTelnetProtocol::sendBRK()
00100 {
00101     transmit(CMD_IAC);
00102     transmit(CMD_BRK);
00103 }
00104 
00105 prefix_ void senf::term::BaseTelnetProtocol::sendIP()
00106 {
00107     transmit(CMD_IAC);
00108     transmit(CMD_IP);
00109 }
00110 
00111 prefix_ void senf::term::BaseTelnetProtocol::sendAO()
00112 {
00113     transmit(CMD_IAC);
00114     transmit(CMD_AO);
00115 }
00116 
00117 prefix_ void senf::term::BaseTelnetProtocol::sendAYT()
00118 {
00119     transmit(CMD_IAC);
00120     transmit(CMD_AYT);
00121 }
00122 
00123 prefix_ void senf::term::BaseTelnetProtocol::sendEC()
00124 {
00125     transmit(CMD_IAC);
00126     transmit(CMD_EC);
00127 }
00128 
00129 prefix_ void senf::term::BaseTelnetProtocol::sendEL()
00130 {
00131     transmit(CMD_IAC);
00132     transmit(CMD_EL);
00133 }
00134 
00135 prefix_ void senf::term::BaseTelnetProtocol::sendGA()
00136 {
00137     transmit(CMD_IAC);
00138     transmit(CMD_GA);
00139 }
00140 
00141 prefix_ void senf::term::BaseTelnetProtocol::requestLocalOption(option_type option,
00142                                                                            bool enabled)
00143 {
00144     request(getOption(true, option), enabled);
00145 }
00146 
00147 prefix_ void senf::term::BaseTelnetProtocol::acceptLocalOption(option_type option,
00148                                                                           bool enabled)
00149 {
00150     getOption(true, option).wantState = OptInfo::ACCEPTED;
00151 }
00152 
00153 prefix_ void senf::term::BaseTelnetProtocol::requestPeerOption(option_type option,
00154                                                                           bool enabled)
00155 {
00156     request(getOption(false, option), enabled);
00157 }
00158 
00159 prefix_ void senf::term::BaseTelnetProtocol::acceptPeerOption(option_type option,
00160                                                                          bool enabled)
00161 {
00162     getOption(false, option).wantState = OptInfo::ACCEPTED;
00163 }
00164 
00165 prefix_ bool senf::term::BaseTelnetProtocol::localOption(option_type option)
00166 {
00167     return getOption(true, option).enabled;
00168 }
00169 
00170 prefix_ bool senf::term::BaseTelnetProtocol::peerOption(option_type option)
00171 {
00172     return getOption(false, option).enabled;
00173 }
00174 
00175 prefix_ void senf::term::BaseTelnetProtocol::emit(char c)
00176 {
00177     v_charReceived(c);
00178 }
00179 
00180 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00181 #undef prefix_
00182 
00183 
00184 // Local Variables:
00185 // mode: c++
00186 // fill-column: 100
00187 // comment-column: 40
00188 // c-file-style: "senf"
00189 // indent-tabs-mode: nil
00190 // ispell-local-dictionary: "american"
00191 // compile-command: "scons -u test"
00192 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research