00001 //********************************************************************** 00002 // 00003 // REGCOM: Regimental Command 00004 // Copyright (C) 2008 Randi J. Relander 00005 // <rjrelander@users.sourceforge.net> 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 3 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public 00018 // License along with this program. If not, see 00019 // <http://www.gnu.org/licenses/>. 00020 // 00021 //********************************************************************** 00022 00023 #ifndef REGCOM_NETWORK_COMMON_TELNET_BUFFER_H 00024 #define REGCOM_NETWORK_COMMON_TELNET_BUFFER_H 00025 00026 // SYSTEM INCLUDES 00027 #include <string> 00028 00029 // PROJECT INCLUDES 00030 #include "regcom/network/TcpSocket.h" 00031 #include "regcom/common/ErrorCode.h" 00032 00033 // NAMESPACES 00034 namespace regcom { 00035 namespace network { 00036 00038 // CLASS: TelnetBuffer 00045 class TelnetBuffer 00046 { 00047 public: 00048 00049 // PUBLIC METHODS 00050 00052 TelnetBuffer(); 00053 00055 virtual ~TelnetBuffer(); 00056 00058 common::ErrorCodeType Receive(TcpSocket& rSocket); 00059 00061 const std::string& GetBuffer() const { return m_Buffer; } 00062 00063 private: 00064 00066 enum EscapeState 00067 { 00068 ESCAPE_STATE_IDLE, 00069 ESCAPE_STATE_CSI, 00070 ESCAPE_STATE_CMD, 00071 ESCAPE_STATE_STR, 00072 ESCAPE_STATE_INT, 00073 }; 00074 00076 void ProcessCharacter(char ch, TcpSocket& rSocket); 00077 00079 void ProcessControlCharacter(char ch, TcpSocket& rSocket); 00080 00082 void ProcessEscapeSequence(char ch, TcpSocket& rSocket); 00083 00084 // MEMBER VARIABLES 00085 00087 std::string m_Buffer; 00088 00090 TcpSocket* m_pSocket; 00091 00093 bool m_Receiving; 00094 00096 EscapeState m_EscapeState; 00097 }; 00098 00099 } // namespace network 00100 } // namespace regcom 00101 00102 #endif
Navigation
Home Page
Screen Shots
Developers
Documentation
Doxygen
Namespace List
Class List
Class Hierarchy
File List
Todo List
Links
SDL Library
License
SourceForge Project
Forums
Download
Regimental Command
Copyright © 2008
Randi J. Relander