#include <RateLimitedSocket.h>
Inheritance diagram for oasys::RateLimitedSocket:
Note that the rate is configured in bits per second.
Definition at line 57 of file RateLimitedSocket.h.
Public Member Functions | |
RateLimitedSocket (const char *logpath, u_int32_t rate, IPSocket *socket=NULL) | |
Constructor. | |
int | send (const char *bp, size_t len, int flags) |
Send the given data on the socket iff the rate controller indicates that there is space. | |
int | sendto (char *bp, size_t len, int flags, in_addr_t addr, u_int16_t port) |
Send the given data on the socket iff the rate controller indicates that there is space. | |
TokenBucket * | bucket () |
Accessors. | |
IPSocket * | socket () |
Accessors. | |
void | set_socket (IPSocket *sock) |
Setters. | |
Protected Attributes | |
TokenBucket | bucket_ |
IPSocket * | socket_ |
oasys::RateLimitedSocket::RateLimitedSocket | ( | const char * | logpath, | |
u_int32_t | rate, | |||
IPSocket * | socket = NULL | |||
) |
int oasys::RateLimitedSocket::send | ( | const char * | bp, | |
size_t | len, | |||
int | flags | |||
) |
Send the given data on the socket iff the rate controller indicates that there is space.
Definition at line 55 of file RateLimitedSocket.cc.
References ASSERT, bucket_, oasys::TokenBucket::drain(), oasys::IORATELIMIT, log_debug, oasys::TokenBucket::rate(), oasys::IPSocket::send(), socket_, and oasys::TokenBucket::tokens().
int oasys::RateLimitedSocket::sendto | ( | char * | bp, | |
size_t | len, | |||
int | flags, | |||
in_addr_t | addr, | |||
u_int16_t | port | |||
) |
Send the given data on the socket iff the rate controller indicates that there is space.
Definition at line 76 of file RateLimitedSocket.cc.
References ASSERT, bucket_, oasys::TokenBucket::drain(), oasys::IORATELIMIT, log_debug, oasys::TokenBucket::rate(), oasys::IPSocket::sendto(), socket_, and oasys::TokenBucket::tokens().
TokenBucket* oasys::RateLimitedSocket::bucket | ( | ) | [inline] |
Accessors.
Definition at line 89 of file RateLimitedSocket.h.
References bucket_.
Referenced by dtn::UDPConvergenceLayer::Sender::init().
IPSocket* oasys::RateLimitedSocket::socket | ( | ) | [inline] |
void oasys::RateLimitedSocket::set_socket | ( | IPSocket * | sock | ) | [inline] |
TokenBucket oasys::RateLimitedSocket::bucket_ [protected] |
IPSocket* oasys::RateLimitedSocket::socket_ [protected] |
Definition at line 99 of file RateLimitedSocket.h.
Referenced by send(), sendto(), set_socket(), and socket().