libfilezilla
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
socket.hpp File Reference

Socket classes for networking. More...

#include "libfilezilla.hpp"
#include "event_handler.hpp"
#include "iputils.hpp"
#include <memory>
#include <errno.h>
Include dependency graph for socket.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  socket_event_source
 All classes sending socket events should derive from this. More...
 
class  socket_base
 Common base clase for fz::socket and fz::listen_socket. More...
 
class  socket_descriptor
 Lightweight holder for socket descriptors. More...
 
class  listen_socket
 Simple Listen socket. More...
 
class  socket_interface
 Interface for sockets. More...
 
class  socket
 IPv6 capable, non-blocking socket class. More...
 
class  socket_layer
 A base class for socket layers. More...
 

Namespaces

 fz
 The namespace used by libfilezilla.
 

Macros

#define EISCONN   WSAEISCONN
 
#define EINPROGRESS   WSAEINPROGRESS
 
#define EAFNOSUPPORT   WSAEAFNOSUPPORT
 
#define EADDRINUSE   WSAEADDRINUSE
 
#define ENOBUFS   WSAENOBUFS
 
#define EPROTONOSUPPORT   WSAEPROTONOSUPPORT
 
#define EALREADY   WSAEALREADY
 
#define ECONNREFUSED   WSAECONNREFUSED
 
#define ENOTSOCK   WSAENOTSOCK
 
#define ETIMEDOUT   WSAETIMEDOUT
 
#define ENETUNREACH   WSAENETUNREACH
 
#define EHOSTUNREACH   WSAEHOSTUNREACH
 
#define ENOTCONN   WSAENOTCONN
 
#define ENETRESET   WSAENETRESET
 
#define EOPNOTSUPP   WSAEOPNOTSUPP
 
#define ESHUTDOWN   WSAESHUTDOWN
 
#define EMSGSIZE   WSAEMSGSIZE
 
#define ECONNABORTED   WSAECONNABORTED
 
#define ECONNRESET   WSAECONNRESET
 
#define EHOSTDOWN   WSAEHOSTDOWN
 

Typedefs

typedef simple_event< socket_event_type, socket_event_source *, socket_event_flag, int > socket_event
 
typedef simple_event< hostaddress_event_type, socket_event_source *, std::string > hostaddress_event
 

Enumerations

enum class  socket_event_flag { connection_next = 0x1 , connection = 0x2 , read = 0x4 , write = 0x8 }
 The type of a socket event. More...
 
enum class  listen_socket_state { none , listening }
 
enum class  socket_state : unsigned char {
  none , connecting , connected , shutting_down ,
  shut_down , closed , failed
}
 State transitions are monotonically increasing. More...
 

Functions

bool operator& (socket_event_flag lhs, socket_event_flag rhs)
 
socket_event_flag operator| (socket_event_flag lhs, socket_event_flag rhs)
 
socket_event_flag & operator|= (socket_event_flag &lhs, socket_event_flag rhs)
 
void remove_socket_events (event_handler *handler, socket_event_source const *const source)
 Remove all pending socket events from source sent to handler. More...
 
fz::socket_event_flag change_socket_event_handler (event_handler *old_handler, event_handler *new_handler, socket_event_source const *const source, fz::socket_event_flag remove)
 Changes all pending socket events from source. More...
 
std::string socket_error_string (int error)
 Gets a symbolic name for socket errors. More...
 
native_string socket_error_description (int error)
 Gets a human-readable, translated description of the error.
 

Detailed Description

Socket classes for networking.

Declares the fz::socket and fz::listen_socket classes, alongside supporting classes to handle socket events.