Definition in file sock.h.
#include <sys/socket.h>
#include <sys/un.h>
#include <event/event.h>
Include dependency graph for sock.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | _ev_sockaddr_s |
Socket address structure. More... | |
struct | _ev_sock_s |
Socket generator structure. More... | |
Defines | |
#define | SHUT_RD |
Shut down socket reads. | |
#define | SHUT_WR |
Shut down socket writes. | |
#define | SHUT_RDWR |
Shut down socket reads and writes. | |
#define | SOCK_ADDRBUFV4_LEN |
Socket address buffer size (IPv4). | |
#define | SOCK_ADDRSTRV4_LEN |
Socket address string length (IPv4). | |
#define | SOCK_ADDRBUFV6_LEN |
Socket address buffer size (IPv6). | |
#define | SOCK_ADDRSTRV6_LEN |
Socket address string length (IPv6). | |
#define | SOCK_LOCALADDR_LEN |
Local domain socket address length. | |
#define | sa_type(sa) |
Socket address type. | |
#define | sa_ipaddrbuf(sa) |
Socket address buffer. | |
#define | sa_ipaddrport(sa) |
Socket address port. | |
#define | sa_localaddr(sa) |
Local socket address. | |
#define | _sa_ipbuf8(sa, idx) |
Extract a single byte from the IP address buffer. | |
#define | _sa_ipbuf16(sa, idx) |
Extract a certain portion of the IP address buffer as a 16-bit integer. | |
#define | _sa_ipbuf32(sa, idx) |
Extract a certain portion of the IP address buffer as a 32-bit integer. | |
#define | _sa_ipmask(bits, sa, idx, mask) |
Extract a certain portion of the IP address buffer as the specified type and AND a mask. | |
#define | sa_is_ipv4(sa) |
Test if an ev_sockaddr_t is an IPv4 address. | |
#define | sa_is_ipv6(sa) |
Test if an ev_sockaddr_t is an IPv6 address. | |
#define | sa_is_local(sa) |
Test if an ev_sockaddr_t is a local address. | |
#define | sa_is_unspec(sa) |
Test if an ev_sockaddr_t contains the unspecified address. | |
#define | sa_is_loopback(sa) |
Test if an ev_sockaddr_t contains the loopback address. | |
#define | sa_is_v4mapped(sa) |
Test if an ev_sockaddr_t contains an IPv4-mapped IPv6 address. | |
#define | sa_is_v4compat(sa) |
Test if an ev_sockaddr_t contains an IPv4-compatible IPv6 address. | |
#define | sa_is_v4encap(sa) |
Test if an ev_sockaddr_t contains an encapsulated IPv4 address. | |
#define | _sa_ip4mask(sa, mask) |
Select the IPv4 component of an address and apply a mask. | |
#define | sa_is_classa(sa) |
Test if an ev_sockaddr_t contains a class A IPv4 address. | |
#define | sa_is_classb(sa) |
Test if an ev_sockaddr_t contains a class B IPv4 address. | |
#define | sa_is_classc(sa) |
Test if an ev_sockaddr_t contains a class C IPv4 address. | |
#define | sa_is_classd(sa) |
Test if an ev_sockaddr_t contains a class D IPv4 address. | |
#define | sa_is_experimental(sa) |
Test if an ev_sockaddr_t contains an experimental IPv4 address. | |
#define | sa_is_broadcast(sa) |
Test if an ev_sockaddr_t contains the IPv4 broadcast address. | |
#define | sa_is_multicast(sa) |
Test if an ev_sockaddr_t contains a multicast address. | |
#define | sa_is_linklocal(sa) |
Test if an ev_sockaddr_t contains a link-local IPv6 address. | |
#define | sa_is_sitelocal(sa) |
Test if an ev_sockaddr_t contains a site-local IPv6 address. | |
#define | _sa_ip4mc_local(sa) |
Test if an IPv4 multicast address is local. | |
#define | sa_mc_nodelocal(sa) |
Test if an ev_sockaddr_t contains a node-local multicast address. | |
#define | sa_mc_linklocal(sa) |
Test if an ev_sockaddr_t contains a link-local multicast address. | |
#define | sa_mc_sitelocal(sa) |
Test if an ev_sockaddr_t contains a site-local multicast address. | |
#define | sa_mc_orglocal(sa) |
Test if an ev_sockaddr_t contains a org-local multicast address. | |
#define | sa_mc_global(sa) |
Test if an ev_sockaddr_t contains a global multicast address. | |
#define | EV_SOCK_MAGIC |
Socket generator magic number. | |
#define | EV_SOCK_READ |
Socket readable event flag. | |
#define | EV_SOCK_WRITE |
Socket writable event flag. | |
#define | EV_SOCK_EVMASK |
Socket event mask. | |
#define | _so_decev(flags, shift) |
Decode event flag set. | |
#define | _so_encev(flags, shift) |
Encode event flag set. | |
#define | _so_set(sock, flags) |
Set event flags. | |
#define | _so_clr(sock, flags) |
Clear event flags. | |
#define | _EV_SOCK_UEVENTS |
User events shift. | |
#define | _EV_SOCK_EEVENTS |
Engine events shift. | |
#define | _EV_SOCK_BLOCKED |
Blocked flags shift. | |
#define | _EV_SOCK_CLOSED |
Closed flags shift. | |
#define | so_uevents(sock) |
User events. | |
#define | so_eevents(sock) |
Engine events. | |
#define | so_blocked(sock) |
Blocked flags. | |
#define | so_closed(sock) |
Closed flags. | |
#define | EV_SOCK_TYPE |
Socket type valid. | |
#define | EV_SOCK_STATE |
Socket state valid. | |
#define | EV_SOCK_LOCAL |
Socket local address valid. | |
#define | EV_SOCK_REMOTE |
Socket remote address valid. | |
#define | so_verify(sock) |
Socket generator verification macro. | |
#define | so_type(sock) |
Socket type. | |
#define | so_state(sock) |
Socket state. | |
#define | so_sockname(sock) |
Socket name. | |
#define | so_peername(sock) |
Socket peer name. | |
#define | so_flags(sock) |
Socket flags. | |
#define | so_fd(sock) |
Socket file descriptor. | |
#define | SOCKADDR_ATOP_NOPORT |
Omit port from presentation format. | |
Typedefs | |
typedef _ev_sockaddr_s | ev_sockaddr_t |
Socket address. | |
typedef _ev_sock_s | ev_sock_t |
Socket generator. | |
typedef _ev_sockattr_t * | ev_sockattr_t |
Socket attributes. | |
Enumerations | |
enum | ev_socktype_t { ST_NONE, ST_STREAM, ST_DGRAM, ST_SEQPACKET, ST_PIPE } |
Socket types. More... | |
enum | ev_sockstate_t { SS_NONE, SS_CONNECTING, SS_LISTENING, SS_CONNECTED, SS_UNCONNECTED, SS_CLOSED } |
Socket states. More... | |
enum | ev_satype_t { AT_NONE, AT_IPv6, AT_IPv4, AT_LOCAL } |
Socket address types. More... | |
Functions | |
ev_err_t | sa_type_set (ev_sockaddr_t *sa, ev_satype_t type) |
Set address type. | |
ev_err_t | sa_ipaddrbuf_set (ev_sockaddr_t *sa, const unsigned char *address) |
Fill address buffer. | |
ev_err_t | sa_ipaddrport_set (ev_sockaddr_t *sa, unsigned short port) |
Set address port. | |
ev_err_t | sa_localaddr_set (ev_sockaddr_t *sa, const char *address) |
Set local domain address. | |
ev_err_t | sockaddr_ptoa (ev_sockaddr_t *sa, const char *address, int alen) |
Fill an ev_sockaddr_t from a presentation format. | |
ev_err_t | sockaddr_atop (const ev_sockaddr_t *sa, char *buf, int size, ev_flags_t flags) |
Build presentation format of an ev_sockaddr_t. | |
ev_err_t | sockaddr_import (ev_sockaddr_t *sa, const struct sockaddr *addr) |
Import an ev_sockaddr_t from a struct sockaddr . | |
ev_err_t | sockaddr_export (const ev_sockaddr_t *sa, struct sockaddr *addr, int *len) |
Export an ev_sockaddr_t to a struct sockaddr . | |
ev_err_t | socket_open (ev_ctx_t *ctx, ev_socktype_t type, const ev_sockaddr_t *local, const ev_sockaddr_t *remote, ev_flags_t events, const ev_sockattr_t *attr, ev_call_t call, void *data, ev_sock_t **sock_p) |
Open a socket. | |
ev_err_t | socket_fdopen (ev_ctx_t *ctx, int fd, ev_socktype_t type, ev_sockstate_t state, const ev_sockaddr_t *local, const ev_sockaddr_t *remote, ev_flags_t events, const ev_sockattr_t *attr, ev_call_t call, void *data, ev_sock_t **sock_p) |
Create an ev_sock_t for an open socket. | |
ev_err_t | socket_pair (ev_ctx_t *ctx, ev_socktype_t type, ev_flags_t events1, const ev_sockattr_t *attr1, ev_call_t call1, void *data1, ev_flags_t events2, const ev_sockattr_t *attr2, ev_call_t call2, void *data2, ev_sock_t **sock1_p, ev_sock_t **sock2_p) |
Open a pair of sockets or a pipe. | |
ev_err_t | socket_connect (ev_ctx_t *ctx, ev_sock_t *sock, const ev_sockaddr_t *addr) |
Connect a socket. | |
ev_err_t | socket_close (ev_ctx_t *ctx, ev_sock_t *sock) |
Close a socket. | |
ev_err_t | socket_shutdown (ev_ctx_t *ctx, ev_sock_t *sock, int how) |
Shutdown one direction of a socket. | |
ev_err_t | socket_events (ev_ctx_t *ctx, ev_sock_t *sock, ev_flags_t events) |
Change socket event set. | |
ev_err_t | socket_destroy (ev_ctx_t *ctx, ev_sock_t *sock) |
Destroy a socket. |