Interface for sockets.
More...
#include <socket.hpp>
|
| socket_interface (socket_interface const &)=delete |
|
socket_interface & | operator= (socket_interface const &)=delete |
|
virtual int | read (void *buffer, unsigned int size, int &error)=0 |
|
virtual int | write (void const *buffer, unsigned int size, int &error)=0 |
|
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) |
|
virtual void | set_event_handler (event_handler *pEvtHandler, fz::socket_event_flag retrigger_block=fz::socket_event_flag{})=0 |
|
virtual native_string | peer_host () const =0 |
|
virtual int | peer_port (int &error) const =0 |
|
virtual int | connect (native_string const &host, unsigned int port, address_type family=address_type::unknown)=0 |
|
virtual fz::socket_state | get_state () const =0 |
|
virtual int | shutdown ()=0 |
| Signals peers that we want to close the connections.
|
|
virtual int | shutdown_read ()=0 |
|
socket_event_source * | root () const |
| Gets the root source.
|
|
Interface for sockets.
Can be used for layers, see fz::socket for the expected semantics.
- Examples
- https.cpp.
◆ connect()
virtual int connect |
( |
native_string const & | host, |
|
|
unsigned int | port, |
|
|
address_type | family = address_type::unknown ) |
|
pure virtual |
◆ peer_host()
◆ peer_port()
virtual int peer_port |
( |
int & | error | ) |
const |
|
pure virtual |
◆ read()
virtual int read |
( |
void * | buffer, |
|
|
unsigned int | size, |
|
|
int & | error ) |
|
pure virtual |
◆ set_event_handler()
◆ shutdown()
Signals peers that we want to close the connections.
Only disallows further sends, does not affect reading from the socket.
Returns 0 on success, an error code otherwise. If it returns EGAIN, shutdown is not yet complete. Call shutdown again after the next write event.
Implemented in ascii_layer, compound_rate_limited_layer, socket, socket_layer, and tls_layer.
◆ shutdown_read()
virtual int shutdown_read |
( |
| ) |
|
|
pure virtual |
◆ write()
virtual int write |
( |
void const * | buffer, |
|
|
unsigned int | size, |
|
|
int & | error ) |
|
pure virtual |
The documentation for this class was generated from the following file: