serverManage.h

00001 #ifndef SERVER_MANAGE_H
00002 #define SERVER_MANAGE_H
00003 
00004 /*
00005   サーバ処理
00006   Satofumi KAMIMURA
00007   $Id$
00008 */
00009 
00010 #include <string>
00011 #include <vector>
00012 #include "tcpipServer.h"
00013 
00014 
00015 class ServerManage {
00016   enum {
00017     FirstTimeout = 30,
00018     MetaServerUpdateInterval = 60,
00019   };
00020   bool activated;
00021   bool meta_nortify;
00022   std::string meta_host;
00023   std::string meta_page;
00024   int server_port;
00025   TcpipServer* con;
00026   std::vector<TcpipDevice*> con_users;
00027   std::vector<std::string> user_packet;
00028 
00029   void nortifyToMetaServer(void);
00030   std::string createPacket(unsigned char packet_type,
00031                            const unsigned char* data);
00032   void setOtherUser(int index, std::string packet);
00033   void handlePacket(int index, TcpipDevice* con);
00034   void clearPacket(void);
00035   void sendPacket(void);
00036   void processServerTask(void);
00037   ServerManage(void);
00038 
00039 public:
00040   ServerManage(const char* host, const char* page);
00041   ~ServerManage(void);
00042   std::string getOwnIP(void);
00043   bool activate(unsigned short port);
00044   bool isActivated(void);
00045   void processFork(unsigned short port, bool nortify);
00046 };
00047 
00048 #endif /* !SERVER_MANAGE_H */
00049 

Generated on Mon Apr 13 22:52:03 2009 by  doxygen 1.5.7.1