00001 #ifndef CharonClientH
00002 #define CharonClientH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00038
00039
00040 #include "CoreMainHeader.h"
00041 #include "ExtObject.h"
00042 #include <scktcomp.hpp>
00043 #include "XMLNetFile.h"
00044
00045
00046
00047
00048 class CJob;
00049 class CCharonWatcher;
00050
00051
00052
00053
00055
00058 class NEMESIS_CORE_PACKAGE CCharonClient : CExtObject{
00059 public:
00060 __fastcall CCharonClient(void);
00061 __fastcall ~CCharonClient(void);
00062
00063
00064 bool __fastcall Init(void);
00065 bool __fastcall Disconnect(void);
00066
00067 inline const CSmallString& __fastcall GetCharonIP(void);
00068 inline const int __fastcall GetCharonPort(void);
00069 inline const int __fastcall GetCharonWatcherPort(void);
00070 bool __fastcall SetCharonNewSettings(const CSmallString& ip,int port);
00071
00072
00073 bool __fastcall SubmitJob(CJob* p_job);
00074 bool __fastcall SubmitJob(CJob* p_job,int comp_id,int queue_id);
00075 bool __fastcall SynchronizeJob(CJob* p_job);
00076 bool __fastcall PauseJob(CJob* p_job);
00077 bool __fastcall ResumeJob(CJob* p_job);
00078 bool __fastcall KillJob(CJob* p_job);
00079
00080 CXMLElement* __fastcall GetJobTicket(CJob* p_job);
00081
00082 bool __fastcall AddJobWatch(CJob* p_job);
00083 bool __fastcall RemoveJobWatch(CJob* p_job);
00084
00085 private:
00086 CSmallString CharonIP;
00087 int CharonPort;
00088 int CharonWatcherPort;
00089 int NumOfAttempt;
00090 CCharonWatcher* CharonWatcher;
00091 TClientSocket* ClientSocket;
00092 CXMLNetFile XMLNetFile;
00093
00094 bool __fastcall TryConnect(void);
00095
00096 void __fastcall SocketError(TObject* Sender, TCustomWinSocket* Socket, TErrorEvent ErrorEvent, int &ErrorCode);
00097 };
00098
00099
00100
00101 inline const CSmallString& __fastcall CCharonClient::GetCharonIP(void)
00102 {
00103 return(CharonIP);
00104 }
00105
00106
00107
00108 inline const int __fastcall CCharonClient::GetCharonPort(void)
00109 {
00110 return(CharonPort);
00111 }
00112
00113
00114
00115 inline const int __fastcall CCharonClient::GetCharonWatcherPort(void)
00116 {
00117 return(CharonWatcherPort);
00118 }
00119
00120
00121
00122
00123 extern NEMESIS_CORE_PACKAGE CCharonClient CharonClient;
00124
00125
00126
00127 #endif