![]() |
MHandler.hGo to the documentation of this file.00001 #ifndef _MASTERHANDLER_H 00002 #define _MASTERHANDLER_H 00003 00004 #include <SocketHandler.h> 00005 00006 00007 class MasterSocket; 00008 //class ProxyInSocket; 00009 class StdLog; 00010 00011 class MHandler : public SocketHandler 00012 { 00013 public: 00014 struct SERVICE { 00015 SERVICE(port_t p,const std::string& h,port_t& p2) : port(p), remote_host(h), remote_port(p2) { 00016 } 00017 port_t port; 00018 std::string remote_host; 00019 port_t remote_port; 00020 }; 00021 typedef std::list<SERVICE *> service_v; 00022 00023 public: 00024 MHandler(StdLog * = NULL); 00025 ~MHandler(); 00026 00027 MasterSocket *GetMasterSocket(); 00028 // ProxyInSocket *GetProxySocket(unsigned short id); 00029 00030 void SendToExt(unsigned short,const char *,size_t); 00031 void CloseExtConn(unsigned short); 00032 00033 void LoadConfig(); 00034 void SaveConfig(); 00035 00036 void SetListenPort(port_t x) { m_listen_port = x; } 00037 port_t GetListenPort() { return m_listen_port; } 00038 /* 00039 void SetProxyPort(port_t x) { m_proxy_port = x; } 00040 port_t GetProxyPort() { return m_proxy_port; } 00041 */ 00042 void StartServices(); 00043 service_v& GetServices() { return m_services; } 00044 void AddService(port_t port,const std::string& remote_host,port_t remote_port); 00045 void StartService(SERVICE *); 00046 00047 void SetValidIP(const std::string& x) { m_valid_ip = x; } 00048 const std::string& GetValidIP() { return m_valid_ip; } 00049 00050 unsigned short GetUniqueID(); 00051 00052 void SetAdminPort(port_t x) { m_admin_port = x; } 00053 port_t GetAdminPort() { return m_admin_port; } 00054 00055 private: 00056 MHandler(const MHandler& ) {} // copy constructor 00057 MHandler& operator=(const MHandler& ) { return *this; } // assignment operator 00058 service_v m_services; 00059 port_t m_listen_port; 00060 // port_t m_proxy_port; 00061 std::string m_valid_ip; 00062 static unsigned short m_unique_id; 00063 port_t m_admin_port; 00064 }; 00065 00066 00067 00068 00069 #endif // _MASTERHANDLER_H |