libfilezilla
Public Member Functions | Protected Member Functions | List of all members
socket_interface Class Referenceabstract

Interface for sockets. More...

#include <socket.hpp>

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

Public Member Functions

 socket_interface (socket_interface const &)=delete
 
socket_interfaceoperator= (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. More...
 
virtual int shutdown_read ()=0
 
- Public Member Functions inherited from socket_event_source
socket_event_sourceroot () const
 Gets the root source. More...
 

Protected Member Functions

 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_event_source
socket_event_source *const root_ {}
 

Detailed Description

Interface for sockets.

Can be used for layers, see fz::socket for the expected semantics.

Examples
https.cpp.

Member Function Documentation

◆ shutdown()

virtual int shutdown ( )
pure virtual

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 tls_layer, socket_layer, socket, compound_rate_limited_layer, and ascii_layer.

◆ shutdown_read()

virtual int shutdown_read ( )
pure virtual

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