70 lines
1.3 KiB
C++
70 lines
1.3 KiB
C++
#ifndef SESSIONWATCH_H_
|
|
#define SESSIONWATCH_H_
|
|
|
|
#ifdef _WIN32
|
|
#include <base/Ping.h>
|
|
#endif
|
|
|
|
#include <iXcom-TCP2/iXcomDefine.h>
|
|
#include <tag/Tag.h>
|
|
#include <log4cplus/LOG.h>
|
|
#include <glob/ConfigMag.h>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
|
|
using namespace std;
|
|
using namespace log4cplus;
|
|
using namespace iXcomTCP2;
|
|
|
|
namespace baosight
|
|
{
|
|
#define SESSION_CLIENT "BACK_TO_WATCHCLIENT_"
|
|
#define SESSION_SERVER "BACK_TO_WATCHSERVER_"
|
|
|
|
enum SessionDir
|
|
{
|
|
BOTH = 0,
|
|
CLIENT = 1,
|
|
SERVER = 2,
|
|
UNKNOWN
|
|
}; //回线的方向
|
|
|
|
struct LineInfo
|
|
{
|
|
int lineNo; //回线号
|
|
SessionDir fact; //客户端,服务器端
|
|
string dir; //方向
|
|
}; //回线信息
|
|
|
|
class SessionWatch
|
|
{
|
|
public:
|
|
SessionWatch();
|
|
virtual ~SessionWatch();
|
|
public:
|
|
void StartWatch();
|
|
void PingRemote();
|
|
void InformStatus();
|
|
private:
|
|
int WatchAllSession();
|
|
int GetSessionStatus(int lineNo,stSessionInfo& session);
|
|
private:
|
|
void InitWatchLine();
|
|
void ChangeLineStatus( int lineno, const stSessionInfo *st);
|
|
private:
|
|
stSessionsInfo m_sessionInfo; /* Read from current sessions status */
|
|
stSessionInfo *mp_presession; /* save for previous sessions status */
|
|
stSessionInfo stSession;
|
|
int m_initStatus;
|
|
vector<LineInfo> m_watchLine;
|
|
vector<string> m_watchPing;
|
|
string m_pingpre;
|
|
//string m_pingcur;
|
|
ConfigMag* mp_config;
|
|
TAGVALUEMAP tagPairs;
|
|
};
|
|
}
|
|
#endif
|
|
|