00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AGENT_H
00021 #define AGENT_H
00022
00023 #include <deque>
00024
00025 #include "TaskManager.h"
00026 #include "SystemInformation.h"
00027 #include "ScriptSystemInformation.h"
00028 #include "NsprSystemInformation.h"
00029 #include "Resource.h"
00030
00031 #include "AgentService.h"
00032
00033
00034 #include "prthread.h"
00035
00036
00037 #include "RegistrationListener.h"
00038 #include "Manager.h"
00039 #include "Service.h"
00040
00052 using namespace net;
00053
00054 class Agent {
00055 friend void PR_CALLBACK dnssdProcess(void* aUserData);
00056 private :
00057 SystemInformation* mSysInfo;
00058 ScriptSystemInformation* mScriptSysInfo;
00059 NsprSystemInformation* mNsprSysInfo;
00060
00061 std::deque<SystemInformation*> mSystemInformations;
00062 std::map<std::string,int> mAvailableInformations;
00063
00067 PRThread* mThread;
00068
00072 dnssd::Service* mService;
00073
00077 dnssd::Manager* mManager;
00078
00082 std::map<std::string,std::string> mDnssdResources;
00083
00087 bool mDnssd;
00088
00092 std::string mIpAddress;
00093
00097 int mBindPort;
00098
00102 std::string mControllerIp;
00103
00107 std::string mMountPoint;
00108
00112 std::string mAgentPath;
00113
00117 TaskManager* mTaskManager;
00118
00122 AgentService* mSrv;
00123
00133 void updateAvailableInformations();
00134
00138 PRThread* Agent::createThread(PRThreadType type,
00139 void (*start)(void *arg),
00140 void *arg,
00141 PRThreadPriority priority,
00142 PRThreadScope scope,
00143 PRThreadState state,
00144 PRUint32 stackSize, PRInt32 index);
00145
00149 void launchNetwork();
00150
00154 bool checkDirectoryStructure();
00155
00156 public :
00157
00158 Agent(char* aInterface, char* aPort, char* aControllerIp, char* aMountPoint);
00159 ~Agent();
00160
00164 static const std::string kTMP_PATH;
00165
00169 static const std::string kSCRIPT_PATH;
00170
00174 static const std::string kSHARED_PATH;
00175
00179 static const std::string kTASK_PATH;
00180
00185 void updateDnssdInformations();
00186
00196 void addSystemInformation(SystemInformation* aSysInfo);
00197
00201 std::string getInformation(const std::string& aKey);
00202
00203
00207 bool isDnssd();
00208
00212 void setSrv(AgentService* aSrv);
00213
00217 AgentService* getSrv();
00218 };
00219
00220 #endif //AGENT_H