aboutsummaryrefslogtreecommitdiff
path: root/src/query.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/query.hh')
-rw-r--r--src/query.hh39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/query.hh b/src/query.hh
index a69413a..8bdd527 100644
--- a/src/query.hh
+++ b/src/query.hh
@@ -4,8 +4,43 @@
#include "common.hh"
#include "threads.hh"
+enum : int {
+ QUERY_OK = 0,
+ QUERY_ERROR = 1,
+ QUERY_FAILED = 3,
+};
+
struct TQueryManagerConnection{
TQueryManagerConnection(int QueryBufferSize);
+ ~TQueryManagerConnection(void);
+
+ void connect(void);
+ void disconnect(void);
+ int write(const uint8 *Buffer, int Size);
+ int read(uint8 *Buffer, int Size, int Timeout);
+ bool isConnected(void){
+ return this->Socket != -1;
+ }
+
+ void prepareQuery(int QueryType);
+ void sendFlag(bool Flag);
+ void sendByte(uint8 Byte);
+ void sendWord(uint16 Word);
+ void sendQuad(uint32 Quad);
+ void sendString(const char *String);
+ void sendBytes(const uint8 *Buffer, int Count);
+
+ bool getFlag(void);
+ uint8 getByte(void);
+ uint16 getWord(void);
+ uint32 getQuad(void);
+ void getString(char *Buffer, int MaxLength);
+ void getBytes(uint8 *Buffer, int Count);
+
+ int executeQuery(int Timeout, bool AutoReconnect);
+
+//==
+
int loadWorldConfig(int *WorldType, int *RebootTime,
int *IPAddress, int *Port,
int *MaxPlayers, int *PremiumPlayerBuffer,
@@ -71,10 +106,6 @@ struct TQueryManagerConnection{
int insertHouseOwner(uint16 HouseID, uint32 OwnerID, int PaidUntil);
int updateHouseOwner(uint16 HouseID, uint32 OwnerID, int PaidUntil);
- bool isConnected(void){
- return this->Socket >= 0;
- }
-
// DATA
// =================
int BufferSize;