Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members

src/Agent.h

00001 /*
00002 K-10 Distributed Processing - Lium, Le Mans
00003 Copyright (C) 2006 Vincent JOUSSE
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
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 // nspr
00034 #include "prthread.h"
00035 
00036 // dnssd
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

Generated on Fri May 19 23:15:28 2006 for k10-agent by  doxygen 1.4.4