Packets/80211Bundle: Complete radiotap dump (incl. unit-test)
[senf.git] / senf / Utils / Termlib / Telnet.cc
index df86304..9efb101 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 //
-// Copyright (C) 2008 
+// Copyright (C) 2008
 // Fraunhofer Institute for Open Communication Systems (FOKUS)
 // Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
@@ -38,7 +38,7 @@
 prefix_ senf::term::BaseTelnetProtocol::BaseTelnetProtocol(Handle handle)
     : handle_ (handle), charState_ (NORMAL), command_ (CMD_NONE), option_ (0),
       inputEvent_ ("senf::term::BaseTelnetProtocol::input",
-                   senf::membind(&BaseTelnetProtocol::readHandler, this), handle, 
+                   senf::membind(&BaseTelnetProtocol::readHandler, this), handle,
                    senf::scheduler::FdEvent::EV_READ),
       outputEvent_ ("senf::term::BaseTelnetProtocol::output",
                     senf::membind(&BaseTelnetProtocol::writeHandler, this), handle,
@@ -57,7 +57,10 @@ prefix_ senf::term::BaseTelnetProtocol::BaseTelnetProtocol()
       requestTimeout_ (ClockService::milliseconds(DEFAULT_REQUEST_TIMEOUT_MS)),
       timeout_ ("senf::term::BaseTelnetProtocol::timeout", 0)
 {
-    SENF_ASSERT( false );
+    SENF_ASSERT( false,
+                 "Missing BaseTelnetProtocol constructor call in derived class "
+                 "(BaseTelnetProtocol is a VIRTUAL base and MUST be constructed explicitly "
+                 "in the most derived class." );
 }
 
 prefix_ void senf::term::BaseTelnetProtocol::write(std::string const & s)
@@ -173,7 +176,7 @@ prefix_ void senf::term::BaseTelnetProtocol::handleNormalChar(char c)
 
 prefix_ void senf::term::BaseTelnetProtocol::handleCommand(char c)
 {
-    switch (c) {
+    switch (static_cast<unsigned char>(c)) {
     case CMD_SE:
         // Ignore spurious SE commands .. they should only occur while in subnegotiation mode
         charState_ = NORMAL;
@@ -212,7 +215,7 @@ prefix_ void senf::term::BaseTelnetProtocol::handleCommand(char c)
         handleChar(c);
         break;
     }
-}        
+}
 
 prefix_ void senf::term::BaseTelnetProtocol::handleOption(char c)
 {
@@ -257,7 +260,7 @@ prefix_ void senf::term::BaseTelnetProtocol::handleSBData(char c)
 
 prefix_ void senf::term::BaseTelnetProtocol::handleSBIAC(char c)
 {
-    switch (c) {
+    switch (static_cast<unsigned char>(c)) {
     case CMD_IAC:
         data_.push_back(c);
         charState_ = SB_DATA;
@@ -343,14 +346,14 @@ prefix_ void senf::term::BaseTelnetProtocol::readHandler(int state)
 }
 
 prefix_ void senf::term::BaseTelnetProtocol::writeHandler(int state)
-{ 
+{
     if (state != senf::scheduler::FdEvent::EV_WRITE) {
         outputEvent_.disable();
         inputEvent_.disable();
         v_eof();
         return;
     }
-    sendQueue_.erase(sendQueue_.begin(), 
+    sendQueue_.erase(sendQueue_.begin(),
                      handle_.write(boost::make_iterator_range(
                                        sendQueue_.begin(), sendQueue_.end())));
     if (sendQueue_.empty())
@@ -403,7 +406,7 @@ prefix_ void senf::term::BaseTelnetProtocol::response(OptInfo & info, bool enabl
     }
     else if (enabled != info.enabled) {
         // Request to change the current state
-        if (!enabled || 
+        if (!enabled ||
             (enabled && (info.wantState == OptInfo::WANTED || info.wantState == OptInfo::ACCEPTED))) {
             // accept the request
             info.optionState = OptInfo::ACKNOWLEDGED;