#pragma once #define CLIENT_CONNECTED -3 #define CLIENT_DISCONNECTED -2 #define EVENT_TIME_SENT -4 #define TOGGLE_CLIENT_ENCRYPTION -90 #define KICK_CLIENT -91 #define NETMESS_BOOL_DEL 1 #define NETMESS_BOOL_TIMERECV 2 #define NETMESS_BOOL_DELAYEDSEND 4 #define NETMESS_NOT_ENCRYPTED 8 //NetMessage structure /* This structure is used for passing information between this class and the calling application. It is used for sending/receiving packets and for instructing the server to execute a command. */ #pragma pack(push, 1) struct NetMessage { //The client ID number that this data came from short networkId; //A pointer to the raw binary data read in unsigned char* pData; //This is somewhat special. It normally specifies how many bytes of data //is to be sent or was read. It is also used to send important messages //to the calling application which can choose to process them. //It is set to -2(CLIENT_DISCONNECTED) when the server is telling the //calling application that a client has disconnected and should delete //all local client information or what needs to be done. //-3(CLIENT_CONNECTED) is sent when a client connects. This event is only //sent if "NotifyOnConnect" is true in the server config. //-4(EVENT_TIME_SENT) is sent when the calling app has requested exact sending //time in ms. Extra1 holds the time, extra2 holds the packet id short dataSize; //contains the time in ms the server recieved the packet or sent it unsigned long extra1; //When sent with timeSentRev=true extra2 holds the packet identifier, the calling app //uses this to identify the packet. unsigned char extra2; //delete the data pointed to by data* unsigned char flags; //0=bool del //1=bool timeSentRecv //2=tracer //3=Delayed send //4=The data is not encrypted short unused; NetMessage() { networkId=0; pData=0; dataSize=0; extra1=0; extra2=0; flags=0; } NetMessage(int id) { networkId=id; pData=0; dataSize=0; extra1=0; extra2=0; flags=0; } NetMessage(int dataSize1, int id, int extra12, int extra22) { networkId=id; pData=0; dataSize=dataSize1; extra1=extra12; extra2=extra22; flags=0; } NetMessage(unsigned char* pData2, int dataSize2, int id) { networkId=id; dataSize=dataSize2; pData=pData2; extra1=0; extra2=0; flags=0; } void Set(int dataSize2, unsigned char *pData2) { dataSize=dataSize2; pData=pData2; } }; #pragma pack(pop)