2 #include "TelnetCommand.hpp"
5 static char IAC
[] = { 255, 0 };
7 TelnetCommand::TelnetCommand( const TelnetWPtr
& parent
)
13 TelnetCommand::~TelnetCommand()
17 void TelnetCommand::Reset()
19 memset( m_buf
, 0, sizeof( m_buf
) );
23 bool TelnetCommand::Parse( unsigned char byte
)
30 m_buf
[m_byte
++] = byte
;
32 TelnetPtr parent
= m_parent
.lock();
35 throw "TelnetCommand lost its Telnet";
49 else if( m_byte
== 2 )
55 case 242: // Data Mark
57 case 244: // Interrup Process
58 case 245: // Abort output
63 case 246: // Are You There
64 parent
->Write( "HELLO" );
68 case 247: // Erase character
69 parent
->EraseCharacter();
73 case 248: // Erase Line
95 char tmp
[] = { 255, 0, m_buf
[2], 0 };
100 tmp
[1] = 254; // DON'T
101 parent
->Write( tmp
);
109 tmp
[1] = 252; // WON'T
110 parent
->Write( tmp
);