Files
Client/Server/RylServerProject/RylServerLibrary/Network/Session/LimitUserByIP.h
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

51 lines
1.1 KiB
C++

#ifndef _GM_NETWORK_LIMIT_SESSION_BY_IP_
#define _GM_NETWORK_LIMIT_SESSION_BY_IP_
#include <vector>
#include <Thread/Lock.h>
#include <Network/Listener/Listener.h>
class CLimitUserByIP : public CValidateConnection
{
public:
enum AllowMode_t
{
ALLOW_ALL,
DENY_ALL,
ALLOW_SOME,
};
CLimitUserByIP(const char* szFileName);
virtual ~CLimitUserByIP();
virtual bool operator () (INET_Addr& localAddr, INET_Addr& remoteAddr);
bool LoadAllowIPList(const char* szFileName);
void ClearIPList();
void OperateMode(AllowMode_t eAllowMode);
AllowMode_t OperateMode();
void ReserveAllowIP(size_t nAllowIPNum) { m_AllowIPList.reserve(nAllowIPNum); }
bool AddAllowIP(unsigned long dwIP);
bool AddAllowIP(INET_Addr& address);
bool AddAllowIP(in_addr addr);
bool RemoveAllowIP(unsigned long dwIP);
bool RemoveAllowIP(INET_Addr& address);
bool RemoveAddAllowIP(in_addr addr);
private:
typedef CCSLock LimitLock;
typedef std::vector<unsigned long> IPList;
LimitLock m_LimitLock;
IPList m_AllowIPList;
AllowMode_t m_eAllowMode;
};
#endif