00001 00002 00003 00004 00005 00006 00007 00008 #include "NativeFeatureIncludes.h" 00009 #if _RAKNET_SUPPORT_TelnetTransport==1 00010 00011 #ifndef __TELNET_TRANSPORT 00012 #define __TELNET_TRANSPORT 00013 00014 #include "TransportInterface.h" 00015 #include "DS_List.h" 00016 #include "Export.h" 00017 class TCPInterface; 00018 struct TelnetClient; 00019 00024 class RAK_DLL_EXPORT TelnetTransport : public TransportInterface 00025 { 00026 public: 00027 TelnetTransport(); 00028 virtual ~TelnetTransport(); 00029 bool Start(unsigned short port, bool serverMode); 00030 void Stop(void); 00031 void Send( SystemAddress systemAddress, const char *data, ... ); 00032 void CloseConnection( SystemAddress systemAddress ); 00033 Packet* Receive( void ); 00034 void DeallocatePacket( Packet *packet ); 00035 SystemAddress HasNewIncomingConnection(void); 00036 SystemAddress HasLostConnection(void); 00037 CommandParserInterface* GetCommandParser(void); 00038 void SetSendSuffix(const char *suffix); 00039 void SetSendPrefix(const char *prefix); 00040 protected: 00041 00042 struct TelnetClient 00043 { 00044 SystemAddress systemAddress; 00045 char textInput[REMOTE_MAX_TEXT_INPUT]; 00046 char lastSentTextInput[REMOTE_MAX_TEXT_INPUT]; 00047 unsigned cursorPosition; 00048 }; 00049 00050 TCPInterface *tcpInterface; 00051 void AutoAllocate(void); 00052 bool ReassembleLine(TelnetTransport::TelnetClient* telnetClient, unsigned char c); 00053 00054 // Crap this sucks but because windows telnet won't send line at a time, I have to reconstruct the lines at the server per player 00055 DataStructures::List<TelnetClient*> remoteClients; 00056 00057 char *sendSuffix, *sendPrefix; 00058 00059 }; 00060 00061 #endif 00062 00063 #endif // _RAKNET_SUPPORT_*