⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warsessionmanager.h

📁 ftpserver very good sample
💻 H
字号:
/** Built-in plugin to handle session-tracking, brute-force  * password attacks, DOS/Flood attacks, session logging,  * and interaction with firewalls.  */#ifndef WAR_SESSION_MANAGER_H#define WAR_SESSION_MANAGER_H/* SYSTEM INCLUDES */#ifndef WAR_MAP_INCLUDED#   define WAR_MAP_INCLUDED#   include <map>#endif/* PROJECT INCLUDES */#ifndef WAR_PLUGIN_SUPPORT_H#   include "WarPluginSupport.h"#endif#ifndef WAR_SOCKET_H#   include "WarSocket.h"#endif#ifndef WAR_IP_SHITLIST_H#   include "WarIpShitlisted.h"#endif#ifndef WAR_TIMER_GENERIC_EVENT_H#   include "WarTimerGenericEvent.h"#endif#ifndef WAR_SVR_ENUMS_H#   include "WarSvrEnums.h"#endif#ifndef WAR_CLIENT_SESSION_H#   include "WarClientSession.h"#endif#ifndef WAR_USER_AUTH_DATA_H#   include "WarUserAuthData.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarSvrEngineSocket;class WarSvrProtocol;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarSessionManager : public WarPluginSupport<WarSessionManager>, // Extendable with pluginspublic WarPluginModule, // This is a plugin modulepublic WarSvrEnums{public:    typedef WarTimerGenericEvent<WarSessionManager, WarSessionManager *> timer_class_t;    typedef WarPtrWrapper<timer_class_t> timer_ptr_t;    typedef std::map<int, WarIpShitlisted> shitlist_t;    typedef std::multimap<int /* IP */, WarTime /* When */> history_mmap_t;    typedef std::pair<int /* IP */, WarTime /* When */> connect_history_t;    typedef std::pair<int /*IP*/, WarTime> bad_pwd_entry_t;    typedef std::multimap<int /*IP*/, WarTime> bad_pwd_mmap_t;    typedef std::multiset<war_client_session_ptr_t> session_mset_t;    typedef std::map<const std::string, int> site_sessions_map_t;    typedef std::pair<const std::string, int> site_session_t;    typedef std::map<int /* host */, int /* cnt */> host_sessions_map_t;    typedef std::pair<int /* host */, int /* cnt */> host_session_t;		// Report formats	typedef std::list<WarClientSessionData> session_list_t;	typedef std::list<WarIpShitlisted> shitlist_list_t;	typedef std::pair<std::string, int> name_cnt_t;	typedef std::list<name_cnt_t> name_cnt_list_t;	    enum PluginEventsE    {        PLUGIN_EVENT_INVALID    };	    // LIFECYCLE        /**    * Default constructor.    */    WarSessionManager();        /**    * Destructor.    */    ~WarSessionManager();        // OPERATORS    // OPERATIONS	    void ShitlistIp(const WarIpShitlisted& badIp);	    // CALLBACK		virtual void OnClassInstance(WarPluginBaseSupport *pClassInstance,        const NotificationE notificationType)        throw(WarException); // Should not throw		void OnAccept(const WarError& status,        war_socket_t newSocket,        const WarNetAddress& remoteAddress,        const WarNetAddress& localAddress,        WarSvrEngineSocket *pListenSck)         throw (WarException);		void OnClientConnect(WarSvrProtocol *pSvrProtocol) 		throw (WarException);		void OnPostLogin(		const std::string& userName,		WarSvrProtocol *pSvrProtocol,		war_authdata_ptr_t& userDataPtr,		int& numFailedLoginAttepmts,		WarSvrEnums::WarLoginResultE& loginResult) 		throw (WarException);		void OnClientLogoff(		war_client_session_ptr_t& clientSession);		// ACCESS		static WarSessionManager& GetManager()		throw (WarException);		// INQUIRY		bool IsShitlisted(const struct in_addr& hostIp,		WarIpShitlisted *pMakeCopy = NULL);		void GetClientSessions(session_list_t& result);	void GetShitlist(shitlist_list_t& result);	void GetSites(name_cnt_list_t& result);	protected:private:    shitlist_t mIpShitlist;    history_mmap_t mShortTermHistory;    session_mset_t mSessions;    site_sessions_map_t mSiteLogins;    host_sessions_map_t mHostLogins;    bad_pwd_mmap_t mBadPwdHosts;    WarCriticalSection mLock;    int mShortTimeHistorySeconds;    int mNumConnectsBeforeFlood;    timer_ptr_t mTimerPtr;    int mNumClientConnections;	static WarSessionManager *mpManager;	    friend class WarTimerGenericEvent<WarSessionManager, WarSessionManager *>;    void OnTimer();};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_SESSION_MANAGER_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -