diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-09-02 17:38:28 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-09-02 17:38:28 +0200 |
commit | e1c83be32d5435d3c2bbc1468b24ba8c0728bac3 (patch) | |
tree | de85217613aa2e95eceadc6452602bf93e07f96b /ProtoProxy/Connection.h | |
parent | ToLua does not like the override keyword :( (diff) | |
download | cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.tar cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.tar.gz cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.tar.bz2 cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.tar.lz cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.tar.xz cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.tar.zst cuberite-e1c83be32d5435d3c2bbc1468b24ba8c0728bac3.zip |
Diffstat (limited to 'ProtoProxy/Connection.h')
-rw-r--r-- | ProtoProxy/Connection.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ProtoProxy/Connection.h b/ProtoProxy/Connection.h new file mode 100644 index 000000000..decf42435 --- /dev/null +++ b/ProtoProxy/Connection.h @@ -0,0 +1,59 @@ +
+// Connection.h
+
+// Interfaces to the cConnection class representing a single pair of connected sockets
+
+
+
+
+
+#pragma once
+
+#include <time.h>
+
+
+
+
+
+class cServer;
+
+
+
+
+
+class cConnection
+{
+ cCriticalSection m_CSLog;
+ FILE * m_LogFile;
+
+ cServer & m_Server;
+ SOCKET m_ClientSocket;
+ SOCKET m_ServerSocket;
+
+ clock_t m_BeginTick; // Tick when the relative time was first retrieved (used for GetRelativeTime())
+
+public:
+ cConnection(SOCKET a_ClientSocket, cServer & a_Server);
+ ~cConnection();
+
+ void Run(void);
+
+ void Log(const char * a_Format, ...);
+ void DataLog(const void * a_Data, int a_Size, const char * a_Format, ...);
+
+protected:
+ bool ConnectToServer(void);
+
+ /// Relays data from server to client; returns false if connection aborted
+ bool RelayFromServer(void);
+
+ /// Relays data from client to server; returns false if connection aborted
+ bool RelayFromClient(void);
+
+ /// Returns the time relative to the first call of this function, in the fractional seconds elapsed
+ double GetRelativeTime(void);
+} ;
+
+
+
+
|