libfilezilla
Public Member Functions | Protected Member Functions | List of all members
rate_limited_layer Class Referencefinal

A rate-limited socket layer. More...

#include <rate_limited_layer.hpp>

Inheritance diagram for rate_limited_layer:
Inheritance graph
[legend]
Collaboration diagram for rate_limited_layer:
Collaboration graph
[legend]

Public Member Functions

 rate_limited_layer (event_handler *handler, socket_interface &next_layer, rate_limiter *limiter=nullptr)
 
virtual int read (void *buffer, unsigned int size, int &error) override
 
virtual int write (void const *buffer, unsigned int size, int &error) override
 
virtual void set_event_handler (event_handler *handler, socket_event_flag retrigger_block=socket_event_flag{}) override
 The handler for any events generated (or forwarded) by this layer.
 
- Public Member Functions inherited from socket_layer
 socket_layer (event_handler *handler, socket_interface &next_layer, bool event_passthrough)
 
 socket_layer (socket_layer const &)=delete
 
socket_layeroperator= (socket_layer const &)=delete
 
virtual native_string peer_host () const override
 
virtual int peer_port (int &error) const override
 
socket_interfacenext ()
 The next layer further down. Usually another layer or the actual socket.
 
virtual int shutdown_read () override
 Check that all layers further down also have reached EOF. More...
 
virtual int connect (native_string const &host, unsigned int port, address_type family=address_type::unknown) override
 
virtual int shutdown () override
 Signals peers that we want to close the connections. More...
 
virtual socket_state get_state () const override
 
- Public Member Functions inherited from socket_interface
 socket_interface (socket_interface const &)=delete
 
socket_interfaceoperator= (socket_interface const &)=delete
 
template<typename T , std::enable_if_t< std::is_signed_v< T >, int > = 0>
int read (void *buffer, T size, int &error)
 
template<typename T , std::enable_if_t< std::is_unsigned_v< T > &&(sizeof(T) > sizeof(unsigned int)), int > = 0>
int read (void *buffer, T size, int &error)
 
template<typename T , std::enable_if_t< std::is_signed_v< T >, int > = 0>
int write (void const *buffer, T size, int &error)
 
template<typename T , std::enable_if_t< std::is_unsigned_v< T > &&(sizeof(T) > sizeof(unsigned int)), int > = 0>
int write (void const *buffer, T size, int &error)
 
- Public Member Functions inherited from socket_event_source
socket_event_sourceroot () const
 Gets the root source. More...
 

Protected Member Functions

virtual void wakeup (direction::type d) override
 Called in response to unlock_tree if tokens have become available. More...
 
- Protected Member Functions inherited from socket_layer
void forward_socket_event (socket_event_source *source, socket_event_flag t, int error)
 
void forward_hostaddress_event (socket_event_source *source, std::string const &address)
 
void set_event_passthrough (socket_event_flag retrigger_block=socket_event_flag{})
 
- Protected Member Functions inherited from socket_interface
 socket_interface (socket_event_source *root)
 
- Protected Member Functions inherited from socket_event_source
 socket_event_source (socket_event_source *root)
 

Additional Inherited Members

- Protected Attributes inherited from socket_layer
event_handlerevent_handler_ {}
 
socket_interfacenext_layer_
 
bool event_passthrough_ {}
 
- Protected Attributes inherited from socket_event_source
socket_event_source *const root_ {}
 

Detailed Description

A rate-limited socket layer.

This socket layer is a bucket that can be added to a

See also
rate_limiter.

Member Function Documentation

◆ wakeup()

virtual void wakeup ( direction::type  )
overrideprotectedvirtual

Called in response to unlock_tree if tokens have become available.

Override in derived classes to signal token availability to consumers.

Reimplemented from bucket.


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