📄 policy.h
字号:
/******************************************************
funtion: initialize the module's policy.
date : 2007-12
corp : kinghi
******************************************************/
#ifndef AFX_POLICY_H__E17D0B8C_16DB_4008_ABFF_1FAE2CE4D270__INCLUDED_
#define AFX_POLICY_H__E17D0B8C_16DB_4008_ABFF_1FAE2CE4D270__INCLUDED_
#include <vector> //.h not standard c++ library
#include "cstytime.h"
#include "db_operator.h"
#include "define.h"
using namespace std;
//keyword and it's filter rule:
struct CkeyWord{
string strKeyWord;
FiltRule eFiltRule;
};
struct CHttpPubPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bAuth; //是否身份认证
bool bTime; //是否时间段过滤
bool bKeyWordFlt; //是否关键字过滤
bool bUse; //whether to use this service
CStyTime tTimeSegt; //时间段过滤
vector<CkeyWord> tKeyWordVec; //kew word,only content type here,yes?
vector<CkeyWord> tUrlVec; //url filter
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CHttpProxyPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bAuth; //是否身份认证
bool bTime; //是否时间过滤
bool bKeyWordFlt; //whether to filter the key words
bool bUrl; //是否URL过滤
bool bIP; //是否服务器ip过滤
bool bPort; //是否服务器端口过滤
bool bUse; //whether to Use this services
CStyTime tTimeSegt;//时间段容器
vector<CkeyWord> tKeyWordvec;//是否关键字过滤
vector<CkeyWord> tUrlVec; //过滤表
vector<CkeyWord> tIPVec; //服务器ip过滤表
vector<CkeyWord> tPortVec; //服务器端口过滤表
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CSmtpPubPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bWithAttach; //是否允许发送附件
bool bAuth; //是否身份认证
bool bTime; //time segment for user to use this serviece
bool bSubject; //是否主题过滤
bool bEmailAddress; //是否地址过滤
bool bAttachName; //是否附件名过滤
bool bContent; //是否内容过滤
bool bUse; //use this serviece or not
CStyTime tTimeSegt; //时间段过滤
vector<CkeyWord> tSubjectVec;//subject filter.
vector<CkeyWord> tSenderAddrVec; //address filter
vector<CkeyWord> tRcptAddrVec; //address filter
vector<CkeyWord> tCcAddrVec; //address filter
vector<CkeyWord> tBccAddrVec; //address filter
vector<CkeyWord> tAtthNameVec; //attachment name filter
vector<CkeyWord> tContentVec; //email content filter
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CSmtpProxyPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bWithAttach; //是否允许发送附件
bool bAuth; //是否身份认证
bool bTime; //time segment for user to use this serviece
bool bSubject; //是否主题过滤
bool bEmailAddress; //是否地址过滤
bool bAttachName; //是否附件名过滤
bool bContent; //是否内容过滤
bool bUse; //use this serviece or not
CStyTime tTimeSegt; //时间段过滤
vector<CkeyWord> tSubjectVec;//subject filter.
vector<CkeyWord> tSenderAddrVec; //address filter
vector<CkeyWord> tRcptAddrVec; //address filter
vector<CkeyWord> tCcAddrVec; //address filter
vector<CkeyWord> tBccAddrVec; //address filter
vector<CkeyWord> tAtthNameVec; //attachment name filter
vector<CkeyWord> tContentVec; //email content filter
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CPop3PubPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bWithAttach; //是否允许发送附件
bool bAuth; //是否身份认证
bool bTime;
bool bSubject; //是否主题过滤
bool bEmailAddress; //是否地址过滤
bool bAttachName; //是否附件名过滤
bool bContent; //是否内容过滤
bool bUse;
CStyTime tTimeSegt;
vector<CkeyWord> tSubjectVec;
vector<CkeyWord> tSenderAddrVec;
vector<CkeyWord> tRcptAddrVec;
vector<CkeyWord> tCcAddrVec;
vector<CkeyWord> tBccAddrVec;
vector<CkeyWord> tAtthNameVec;
vector<CkeyWord> tContentVec;
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CPop3ProxyPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bWithAttach; //是否允许发送附件
bool bAuth; //是否身份认证
bool bTime; //time segment for user to use this serviece
bool bSubject; //是否主题过滤
bool bEmailAddress; //是否地址过滤
bool bAttachName; //是否附件名过滤
bool bContent; //是否内容过滤
bool bUse; //use this serviece or not
CStyTime tTimeSegt; //时间段过滤
vector<CkeyWord> tSubjectVec;//subject filter.
vector<CkeyWord> tSenderAddrVec; //address filter
vector<CkeyWord> tRcptAddrVec; //address filter
vector<CkeyWord> tCcAddrVec; //address filter
vector<CkeyWord> tBccAddrVec; //address filter
vector<CkeyWord> tAtthNameVec; //attachment name filter
vector<CkeyWord> tContentVec; //email content filter
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CFtpPubPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bAuth; //是否身份认证
bool bTime; //是否时间过滤
vector<CkeyWord> tUrlmap; //过滤表
//time segment:
CStyTime tTimeSegt;
int Load(CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CFtpProxyPolicy {
u_short TimeOut; //会话超时时
bool bRecord; //是否记录内容
bool bAuth; //是否身份认证
bool bTime; //是否时间过滤
bool bUrl; //是否URL过滤
bool bIP; //是否服务器ip过滤
bool bPort; //是否服务器端口过滤
bool bUse;
//seveice time segment for the user .
CStyTime tTimeSegt;
vector<CkeyWord> tUrlVec; //过滤表
vector<CkeyWord> tIPVec; //服务器ip过滤表
vector<CkeyWord> tPortVec; //服务器端口过滤表
int Load (CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CSockProxyPolicy {
u_short TimeOut; //会话超时时
bool bAuth; //是否身份认证
bool bTime; //是否时间过滤
bool bUse; //whether to use this service
//time segment control
CStyTime tTimeSegt;//bitset(7*24)
int Load ( CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CDBPubPolicy {//DB无代理,只有发布
u_short TimeOut; //会话超时时
bool bAuth; //是否身份认证
bool bTime; //是否时间过滤
bool bUse; //whether to use this service
//time segment control
CStyTime tTimeSegt;
int Load (CDB_Operator* objDbOpPtr, char **pResult );
void Clear ();
};
struct CPolicy {
bool bVirusCheck; //是否病毒检查
CHttpPubPolicy tHttpPubPolicy; //HTTP发布过滤策略
CHttpProxyPolicy tHttpProxyPolicy; //HTTP代理过滤策略
CSmtpPubPolicy tSmtpPubPolicy;
CSmtpProxyPolicy tSmtpProxyPolicy;
CPop3PubPolicy tPop3PubPolicy;
CPop3ProxyPolicy tPop3ProxyPolicy;
CFtpPubPolicy tFtpPubPolicy;
CFtpProxyPolicy tFtpProxyPolicy;
CSockProxyPolicy tSockProxyPolicy;
CDBPubPolicy tDBPubPolicy;
};
//key word filter function called
int fltKeyWord(CDB_Operator*,vector<CkeyWord>&,KeyWordType,PluginType,FuncType);
//user time control.
int fltTime(CDB_Operator*,CStyTime&,PluginType,FuncType);
//url filter
int fltUrl(CDB_Operator*,vector<CkeyWord>&,PluginType,FuncType);
//ip filter
int fltIP(CDB_Operator*,vector<CkeyWord>&,PluginType,FuncType);
//port filter
int fltPort(CDB_Operator*,vector<CkeyWord>&,PluginType,FuncType);
//address filter
int fltAddress(CDB_Operator*,vector<CkeyWord>&,EmlAddrType,PluginType,FuncType);
int InitPolicy(CPolicy& stPolicy); //装载所有策略
#endif //AFX_POLICY_H__E17D0B8C_16DB_4008_ABFF_1FAE2CE4D270__INCLUDED_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -