SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TelnetTransport.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
19
20
21 #include "NativeFeatureIncludes.h"
22 #if _RAKNET_SUPPORT_TelnetTransport==1 && _RAKNET_SUPPORT_TCPInterface==1
23
24 #ifndef __TELNET_TRANSPORT
25 #define __TELNET_TRANSPORT
26
27 #include "TransportInterface.h"
28 #include "DS_List.h"
29 #include "Export.h"
30
31 namespace SLNet
32 {
34 class TCPInterface;
35 struct TelnetClient;
36
41 class RAK_DLL_EXPORT TelnetTransport : public TransportInterface
42 {
43 public:
44 // GetInstance() and DestroyInstance(instance*)
45 STATIC_FACTORY_DECLARATIONS(TelnetTransport)
46
47 TelnetTransport();
48 virtual ~TelnetTransport();
49 bool Start(unsigned short port, bool serverMode);
50 void Stop(void);
51 void Send( SystemAddress systemAddress, const char *data, ... );
52 void CloseConnection( SystemAddress systemAddress );
53 Packet* Receive( void );
54 void DeallocatePacket( Packet *packet );
55 SystemAddress HasNewIncomingConnection(void);
56 SystemAddress HasLostConnection(void);
57 CommandParserInterface* GetCommandParser(void);
58 void SetSendSuffix(const char *suffix);
59 void SetSendPrefix(const char *prefix);
60 protected:
61
62 struct TelnetClient
63 {
64 SystemAddress systemAddress;
65 char textInput[REMOTE_MAX_TEXT_INPUT];
66 char lastSentTextInput[REMOTE_MAX_TEXT_INPUT];
67 unsigned cursorPosition;
68 };
69
70 TCPInterface *tcpInterface;
71 void AutoAllocate(void);
72 bool ReassembleLine(TelnetTransport::TelnetClient* telnetClient, unsigned char c);
73
74 // 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
75 DataStructures::List<TelnetClient*> remoteClients;
76
77 char *sendSuffix, *sendPrefix;
78
79 };
80
81 } // namespace SLNet
82
83 #endif
84
85 #endif // _RAKNET_SUPPORT_*