Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::dosguard::DOSGuardInterface Class Referenceabstract

The interface of a denial of service guard. More...

#include <DOSGuardInterface.hpp>

Inheritance diagram for web::dosguard::DOSGuardInterface:
Collaboration diagram for web::dosguard::DOSGuardInterface:

Public Member Functions

virtual bool isWhiteListed (std::string_view const ip) const noexcept=0
 Check whether an ip address is in the whitelist or not.
 
virtual bool isOk (std::string const &ip) const noexcept=0
 Check whether an ip address is currently rate limited or not.
 
virtual void increment (std::string const &ip) noexcept=0
 Increment connection count for the given ip address.
 
virtual void decrement (std::string const &ip) noexcept=0
 Decrement connection count for the given ip address.
 
virtual bool add (std::string const &ip, uint32_t numObjects) noexcept=0
 Adds numObjects of usage for the given ip address.
 
virtual bool request (std::string const &ip) noexcept=0
 Adds one request for the given ip address.
 
- Public Member Functions inherited from web::dosguard::BaseDOSGuard
virtual void clear () noexcept=0
 Clears implementation-defined counters.
 

Detailed Description

The interface of a denial of service guard.

Member Function Documentation

◆ add()

virtual bool web::dosguard::DOSGuardInterface::add ( std::string const & ip,
uint32_t numObjects )
pure virtualnoexcept

Adds numObjects of usage for the given ip address.

If the total sums up to a value equal or larger than maxFetches_ the operation is no longer allowed and false is returned; true is returned otherwise.

Parameters
ip
numObjects
Returns
true
false

Implemented in web::dosguard::DOSGuard.

◆ decrement()

virtual void web::dosguard::DOSGuardInterface::decrement ( std::string const & ip)
pure virtualnoexcept

Decrement connection count for the given ip address.

Parameters
ip

Implemented in web::dosguard::DOSGuard.

◆ increment()

virtual void web::dosguard::DOSGuardInterface::increment ( std::string const & ip)
pure virtualnoexcept

Increment connection count for the given ip address.

Parameters
ip

Implemented in web::dosguard::DOSGuard.

◆ isOk()

virtual bool web::dosguard::DOSGuardInterface::isOk ( std::string const & ip) const
nodiscardpure virtualnoexcept

Check whether an ip address is currently rate limited or not.

Parameters
ipThe ip address to check
Returns
true If not rate limited
false If rate limited and the request should not be processed

Implemented in web::dosguard::DOSGuard.

◆ isWhiteListed()

virtual bool web::dosguard::DOSGuardInterface::isWhiteListed ( std::string_view const ip) const
nodiscardpure virtualnoexcept

Check whether an ip address is in the whitelist or not.

Parameters
ipThe ip address to check
Returns
true
false

Implemented in web::dosguard::DOSGuard.

◆ request()

virtual bool web::dosguard::DOSGuardInterface::request ( std::string const & ip)
pure virtualnoexcept

Adds one request for the given ip address.

Parameters
ip
Returns
If the total sums up to a value equal or larger than maxRequestCount_ the operation is no longer allowed and false is returned; true is returned otherwise.

Implemented in web::dosguard::DOSGuard.


The documentation for this class was generated from the following file: