00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _CODECLIENT_H_
00012 #define _CODECLIENT_H_
00013 #include "RNPlatform/Inc/DLLExportAPI.h"
00014 #include "RNPlatform/Inc/Encryption.h"
00015 #include "RNPlatform/Inc/ThreadClass.h"
00016 #include "RNPlatform/Inc/Thread.h"
00017 #include "RNXPSockets/Inc/XPSockets.h"
00018 #include "RNLobby/Inc/CodeServer.h"
00019 #include "RNPlatform/Inc/SysTime.h"
00020
00021 namespace RNReplicaNet
00022 {
00023
00024 namespace RNLobby
00025 {
00026
00028 class CodeClient : private ThreadClass , private Thread
00029 {
00030 public:
00031 CodeClient();
00032 virtual ~CodeClient();
00033
00041 bool Start(const char *code,const int nOnce1 = 0,const int nOnce2 = 0);
00042
00046 bool Stop(bool hardware = false);
00047
00050 bool GetCompleted(void);
00051
00054 CodeServer::Reply GetReply(void);
00055
00058 int GetUserSuppliedReply(void);
00059
00061 void GetNOnces(int &nOnce1,int &nOnce2);
00062
00067 void SetEncryptionKey(const void *data,const int length);
00068
00071 void SetServer(const XPAddress address);
00072
00073 private:
00074
00075 virtual int ThreadEntry(void);
00076 void CleanQuery(void);
00077
00078 Encryption::Key mCryptoKey;
00079
00080 volatile CodeServer::Reply mReply;
00081 volatile bool mGotReply;
00082 char *mCode;
00083 XPSocketUrgent *mSend;
00084 XPAddress mAddress;
00085 int mUserSuppliedReply;
00086 int mNOnce1;
00087 int mNOnce2;
00088 };
00089
00090 };
00091
00092 };
00093
00094 #endif