00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _SERVER_H_
00009 #define _SERVER_H_
00010
00011 #include <list>
00012 #include <vector>
00013 #include <cc++/socket.h>
00014 #include <iostream>
00015 #include <sys/types.h>
00016 #include <dirent.h>
00017 #include "ConnectionHandler.h"
00018 #include "Game.h"
00019 #include "TFactory.h"
00020 #include "TFactoryException.h"
00021
00022 #ifdef CCXX_NAMESPACES
00023 using namespace std;
00024 using namespace ost;
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class Server : public TCPSocket {
00046 public:
00047 Server(const InetAddress &, const tpport_t, const string);
00048 void run(const timeout_t = TIMEOUT_INF);
00049 virtual ~Server(void);
00050
00051 private:
00052
00053
00054 list <ConnectionHandler *> connHandPool;
00055
00056 vector <Game *> activeGames;
00057
00058
00059
00060 vector < pair< string, TFactory<Game*> *> *> availableGames;
00061
00062 string pluginGameDirPath;
00063
00064 bool onAccept(const InetHostAddress &, const tpport_t);
00065 void loadPlugInGames(void);
00066 static int SharedObjectLibrarySelector(const struct dirent *);
00067 };
00068
00069
00070 #endif //_SERVER_H_