Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
RateLimiter Class Reference

#include <ratelimiter.h>

Inheritance diagram for RateLimiter:
Collaboration diagram for RateLimiter:

Public Member Functions

bool RateCheck (const CSocketAddress &addr)
 
 RateLimiter (size_t tablesize, bool isUsingLock)
 
virtual ~RateLimiter ()
 

Static Public Attributes

static const uint64_t MAX_RATE = 3600
 
static const uint64_t MIN_COUNT_FOR_CONSIDERATION = 60
 
static const time_t RESET_INTERVAL_SECONDS = 120
 
static const time_t PENALTY_TIME_SECONDS = 3600
 

Protected Member Functions

virtual time_t get_time ()
 
uint64_t get_rate (const RateTracker *pRT)
 
bool RateCheckImpl (const CSocketAddress &addr)
 

Protected Attributes

FastHashDynamic< RateTrackerAddress, RateTracker_table
 
bool _isUsingLock
 
pthread_mutex_t _mutex
 

Detailed Description

Definition at line 41 of file ratelimiter.h.

Constructor & Destructor Documentation

RateLimiter::RateLimiter ( size_t  tablesize,
bool  isUsingLock 
)

Definition at line 7 of file ratelimiter.cpp.

RateLimiter::~RateLimiter ( )
virtual

Definition at line 14 of file ratelimiter.cpp.

Member Function Documentation

uint64_t RateLimiter::get_rate ( const RateTracker pRT)
protected

Definition at line 25 of file ratelimiter.cpp.

time_t RateLimiter::get_time ( )
protectedvirtual

Reimplemented in RateLimiterMockTime.

Definition at line 20 of file ratelimiter.cpp.

bool RateLimiter::RateCheck ( const CSocketAddress addr)

Definition at line 44 of file ratelimiter.cpp.

bool RateLimiter::RateCheckImpl ( const CSocketAddress addr)
protected

Definition at line 62 of file ratelimiter.cpp.

Member Data Documentation

bool RateLimiter::_isUsingLock
protected

Definition at line 50 of file ratelimiter.h.

pthread_mutex_t RateLimiter::_mutex
protected

Definition at line 52 of file ratelimiter.h.

FastHashDynamic<RateTrackerAddress, RateTracker> RateLimiter::_table
protected

Definition at line 48 of file ratelimiter.h.

const uint64_t RateLimiter::MAX_RATE = 3600
static

Definition at line 58 of file ratelimiter.h.

const uint64_t RateLimiter::MIN_COUNT_FOR_CONSIDERATION = 60
static

Definition at line 59 of file ratelimiter.h.

const time_t RateLimiter::PENALTY_TIME_SECONDS = 3600
static

Definition at line 61 of file ratelimiter.h.

const time_t RateLimiter::RESET_INTERVAL_SECONDS = 120
static

Definition at line 60 of file ratelimiter.h.


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