00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SOCKETS_MinderSocket_H
00024 #define _SOCKETS_MinderSocket_H
00025 #include "sockets-config.h"
00026 #ifdef HAVE_OPENSSL
00027
00028 #include "TcpSocket.h"
00029 #include "MinionSocket.h"
00030
00031
00032 #ifdef SOCKETS_NAMESPACE
00033 namespace SOCKETS_NAMESPACE {
00034 #endif
00035
00036
00039 class MinderSocket : public TcpSocket
00040 {
00041 public:
00042 MinderSocket(ISocketHandler& ,const std::string& );
00043 ~MinderSocket();
00044
00045 void SetLocalIpPort(const std::string& x,port_t p) { local_ip = x; local_port = p; }
00046
00047 void Function(const std::string& str) { m_function = str; }
00048 void SendHello();
00049 void SetExtraInfo(long x) { m_extra_info = x; }
00050
00051 virtual MinionSocket *CreateMinionSocket(const std::string& ,ipaddr_t,port_t) = 0;
00052
00053 virtual int GetMaxConnections() = 0;
00054 virtual void OnSwitchDatabase(const std::string& ) = 0;
00055
00056 static char g_UpdateHost[256];
00057 static port_t g_UpdatePort;
00058 static char g_UpdateUrl[256];
00059
00060 protected:
00061 void OnLine(const std::string& line);
00062 void OnConnect();
00063
00064 private:
00065 MinderSocket& operator=(const MinderSocket& ) { return *this; }
00066 std::string m_app;
00067 std::string local_ip;
00068 port_t local_port;
00069 ipaddr_t my_ip;
00070 port_t my_port;
00071 std::string m_function;
00072 long m_extra_info;
00073 };
00074
00075
00076 #ifdef SOCKETS_NAMESPACE
00077 }
00078 #endif
00079
00080 #endif // HAVE_OPENSSL
00081 #endif // _SOCKETS_MinderSocket_H