Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

src/Controller.h

00001 /*
00002   K-10 Distributed Processing - Lium, Le Mans
00003   Copyright (C) 2006
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 CONTROLLER_H
00021 #define CONTROLLER_H
00022 
00023 #ifdef XP_UNIX
00024 #include <sys/mman.h>
00025 #endif
00026 #if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
00027 #include <pthread.h>
00028 #endif
00029 
00030 #ifdef WIN32
00031 #include <process.h>
00032 #endif
00033 
00034 #ifdef XP_MAC
00035 #include "prsem.h"
00036 #else
00037 #include "obsolete/prsem.h"
00038 #endif
00039 
00040 #ifdef XP_PC
00041 #define mode_t int
00042 #endif
00043 
00044 #include "PGQueue.h"
00045 #include "PGAgentInfo.h"
00046 #include "prthread.h"
00047 #include "prerror.h"
00048 #include "prnetdb.h"
00049 #include "prlog.h"
00050 #include "prmon.h"
00051 #include "prmem.h"
00052 #include "prio.h"
00053 #include "plgetopt.h"
00054 
00055 #include <iostream>
00056 #include <string>
00057 #include <map>
00058 
00059 #include "Manager.h"
00060 #include "Service.h"
00061 #include <stdio.h>
00062 
00063 #include "ControllerService.h"
00064 
00065 using namespace std;
00066 using namespace dnssd;
00067 using namespace net;
00068 
00069 #define TIME_AGING 10
00070 
00071 class Controller
00072 {
00073 protected:
00074   string mIp;//ip address of the controller
00075   int mPort; //port of the controller
00076   PRThread* mDnssdThread;
00077   PRThread* mNetworkThread;
00078   PGQueue * mQueue;
00079   ControllerService* mSrv;
00080   string mMailServerIp;
00081 
00082 public:
00091   Controller(string aBdName, string aUserName, string aUserPassword, string aServerIp, string aIpController, int aPortController,string aMailServerIp);
00092 
00098   PGQueue* getPGQueue();
00099 
00100   void setPGQueue(PGQueue* aPGQueue);
00101 
00105   void setSrv(ControllerService* aSrv);
00106 
00117   PRThread* createThread(PRThreadType type,
00118                          void (*start)(void *arg),
00119                          void *arg,
00120                          PRThreadPriority priority,
00121                          PRThreadScope scope,
00122                          PRThreadState state,
00123                          PRUint32 stackSize, PRInt32 index);
00124 
00129   void sendTask();
00130 
00135   friend void PR_CALLBACK networkThread(void* aController);
00136 
00137 
00138   ~Controller();
00139 };
00140 
00141 class ControllerAgentListener:public BrowseListener {
00142 private:
00143   PGQueue * mQueue;
00144   string mMailServerIp;
00145 
00146 public:
00147   ControllerAgentListener(PGQueue * aQueue,string aMailServerIp) {
00148     mQueue = aQueue; 
00149     mMailServerIp = aMailServerIp;
00150   }
00151   ~ControllerAgentListener() {delete(mQueue); }
00152 
00153   void serviceFound(Manager* aManager, 
00154                     Service* aService);
00155 
00156 };
00157 
00158 #endif
00159 
00160 

Generated on Fri May 19 22:56:55 2006 for k10-controller by  doxygen 1.4.4