00001 #ifndef _BASESOCKET_H
00002 #define _BASESOCKET_H
00003
00004 #include <TcpSocket.h>
00005
00006
00007 typedef enum {
00008 M2S_OPEN = 0,
00009 M2S_CLOSE,
00010 M2S_DATA,
00011
00012
00013
00014 } mastercmd_t;
00015
00016
00017 typedef enum {
00018 S2M_CONNECT = 0,
00019 S2M_DISCONNECTED,
00020 S2M_DATA,
00021
00022
00023
00024
00025
00026 } slavecmd_t;
00027
00028
00029 class BaseSocket : public TcpSocket
00030 {
00031 public:
00032 BaseSocket(ISocketHandler&);
00033 ~BaseSocket();
00034
00035 void SendCmd(unsigned short id,mastercmd_t,short = 0);
00036 void SendCmd(unsigned short id,slavecmd_t,short = 0);
00037
00038 void printmsg(unsigned short id,mastercmd_t,short len);
00039 void printmsg(unsigned short id,slavecmd_t,short len);
00040
00041 std::string GetText(mastercmd_t);
00042 std::string GetText(slavecmd_t);
00043
00044 protected:
00045 BaseSocket(const BaseSocket& s) : TcpSocket(s) {}
00046 BaseSocket& operator=(const BaseSocket& ) { return *this; }
00047
00048 };
00049
00050
00051
00052
00053 #endif // _BASESOCKET_H