deimos.event2.util

@file event2/util.h

Common convenience functions for cross-platform portability and related socket manipulations.

Public Imports

core.sys.posix.sys.time
public import core.sys.posix.sys.time : timeval;
core.sys.posix.sys.socket
public import core.sys.posix.sys.socket;
core.sys.windows.winsock2
public import core.sys.windows.winsock2;
std.c.windows.winsock
public import std.c.windows.winsock;

Members

Aliases

EVUTIL_CLOSESOCKET
alias EVUTIL_CLOSESOCKET = evutil_closesocket
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_SET_SOCKET_ERROR
alias EVUTIL_SET_SOCKET_ERROR = WSASetLastError

Replace the most recent socket error with errcode

EVUTIL_SOCKET_ERROR
alias EVUTIL_SOCKET_ERROR = WSAGetLastError

Return the most recent socket error. Not idempotent on all platforms.

EVUTIL_SOCKET_ERROR
alias EVUTIL_SOCKET_ERROR = errno
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_int16_t
alias ev_int16_t = short
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_int32_t
alias ev_int32_t = int
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_int64_t
alias ev_int64_t = long
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_int8_t
alias ev_int8_t = byte
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_intptr_t
alias ev_intptr_t = intptr_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_off_t
alias ev_off_t = ev_int64_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_off_t
alias ev_off_t = off_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_socklen_t
alias ev_socklen_t = int

@}

ev_socklen_t
alias ev_socklen_t = socklen_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_ssize_t
alias ev_ssize_t = ptrdiff_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_uint16_t
alias ev_uint16_t = ushort
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_uint32_t
alias ev_uint32_t = uint
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_uint64_t
alias ev_uint64_t = ulong

@name Standard integer types. * Integer type definitions for types that are supposed to be defined in the C99-specified stdint.h. Shamefully, some platforms do not include stdint.h, so we need to replace it. (If you are on a platform like this, your C headers are now over 10 years out of date. You should bug them to do something about this.) * We define: * <dl> <dt>ev_uint64_t, ev_uint32_t, ev_uint16_t, ev_uint8_t</dt> <dd>uinteger types of exactly 64, 32, 16, and 8 bits respectively.</dd> <dt>ev_int64_t, ev_int32_t, ev_int16_t, ev_int8_t</dt> <dd>signed integer types of exactly 64, 32, 16, and 8 bits respectively.</dd> <dt>ev_uintptr_t, ev_intptr_t</dt> <dd>unsigned/signed integers large enough to hold a pointer without loss of bits.</dd> <dt>ev_ssize_t</dt> <dd>A signed type of the same size as size_t</dd> <dt>ev_off_t</dt> <dd>A signed type typically used to represent offsets within a (potentially large) file</dd> * @{

ev_uint8_t
alias ev_uint8_t = ubyte
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ev_uintptr_t
alias ev_uintptr_t = uintptr_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
evutil_addrinfo
alias evutil_addrinfo = addrinfo
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
evutil_gettimeofday
alias evutil_gettimeofday = gettimeofday

Replacement for gettimeofday on platforms that lack it.

evutil_socket_error_to_string
alias evutil_socket_error_to_string = strerror
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
evutil_socket_t
alias evutil_socket_t = intptr_t

* A type wide enough to hold the output of "socket()" or "accept()". On * Windows, this is an intptr_t; elsewhere, it is an int.

evutil_socket_t
alias evutil_socket_t = int
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
timezone
alias timezone = void
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Functions

EVUTIL_SET_SOCKET_ERROR
void EVUTIL_SET_SOCKET_ERROR(int errcode)
Undocumented in source. Be warned that the author may not have intended to support it.
EVUTIL_SET_SOCKET_ERROR
auto EVUTIL_SET_SOCKET_ERROR(evutil_socket_t sock)
Undocumented in source. Be warned that the author may not have intended to support it.
WSASetLastError
void WSASetLastError(int iError)
Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.
evutil_ascii_strcasecmp
int evutil_ascii_strcasecmp(const(char)* str1, const(char)* str2)

As strcasecmp, but always compares the characters in locale-independent ASCII. That's useful if you're handling data in ASCII-based protocols.

evutil_ascii_strncasecmp
int evutil_ascii_strncasecmp(const(char)* str1, const(char)* str2, size_t n)

As strncasecmp, but always compares the characters in locale-independent ASCII. That's useful if you're handling data in ASCII-based protocols.

evutil_closesocket
int evutil_closesocket(evutil_socket_t sock)

Do the platform-specific call needed to close a socket returned from socket() or accept().

evutil_freeaddrinfo
void evutil_freeaddrinfo(evutil_addrinfo* ai)

Release storage allocated by evutil_getaddrinfo or evdns_getaddrinfo.

evutil_gai_strerror
const(char)* evutil_gai_strerror(int err)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
evutil_getaddrinfo
int evutil_getaddrinfo(const(char)* nodename, const(char)* servname, const(evutil_addrinfo)* hints_in_, evutil_addrinfo** res)

This function clones getaddrinfo for systems that don't have it. For full details, see RFC 3493, section 6.1.

evutil_gettimeofday
int evutil_gettimeofday(timeval* tv, timezone* tz)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
evutil_inet_ntop
const(char)* evutil_inet_ntop(int af, const(void)* src, char* dst, size_t len)

Replacement for inet_ntop for platforms which lack it.

evutil_inet_pton
int evutil_inet_pton(int af, const(char)* src, void* dst)

Replacement for inet_pton for platforms which lack it.

evutil_make_listen_socket_reuseable
int evutil_make_listen_socket_reuseable(evutil_socket_t sock)

Do platform-specific operations to make a listener socket reusable.

evutil_make_socket_closeonexec
int evutil_make_socket_closeonexec(evutil_socket_t sock)

Do platform-specific operations as needed to close a socket upon a successful execution of one of the exec*() functions.

evutil_make_socket_nonblocking
int evutil_make_socket_nonblocking(evutil_socket_t sock)

Do platform-specific operations as needed to make a socket nonblocking.

evutil_parse_sockaddr_port
int evutil_parse_sockaddr_port(const(char)* str, sockaddr* out_, int* outlen)

Parse an IPv4 or IPv6 address, with optional port, from a string.

evutil_secure_rng_add_bytes
void evutil_secure_rng_add_bytes(const(char)* dat, size_t datlen)

Seed the random number generator with extra random bytes.

evutil_secure_rng_get_bytes
void evutil_secure_rng_get_bytes(void* buf, size_t n)

Generate n bytes of secure pseudorandom data, and store them in buf.

evutil_secure_rng_init
int evutil_secure_rng_init()

Seed the secure random number generator if needed, and return 0 on success or -1 on failure.

evutil_snprintf
int evutil_snprintf(char* buf, size_t buflen, const(char)* format, ...)

Replacement for snprintf to get consistent behavior on platforms for which the return value of snprintf does not conform to C99.

evutil_sockaddr_cmp
int evutil_sockaddr_cmp(const(sockaddr)* sa1, const(sockaddr)* sa2, int include_port)

Compare two sockaddrs; return 0 if they are equal, or less than 0 if sa1 * preceeds sa2, or greater than 0 if sa1 follows sa2. If include_port is * true, consider the port as well as the address. Only implemented for * AF_INET and AF_INET6 addresses. The ordering is not guaranteed to remain * the same between Libevent versions.

evutil_socket_error_to_string
const(char)* evutil_socket_error_to_string(int errcode)

Convert a socket error to a string.

evutil_socket_geterror
int evutil_socket_geterror(evutil_socket_t sock)

Return the most recent socket error to occur on sock.

evutil_socketpair
int evutil_socketpair(int d, int type, int protocol, evutil_socket_t[2] sv)

Create two new sockets that are connected to each other.

evutil_strtoll
ev_int64_t evutil_strtoll(const(char)* s, char** endptr, int base)

Parse a 64-bit value from a string. Arguments are as for strtol.

evutil_timeradd
void evutil_timeradd(timeval* tvp, timeval* uvp, timeval* vvp)

@name Manipulation macros for struct timeval.

evutil_timerclear
void evutil_timerclear(timeval* tvp)
Undocumented in source. Be warned that the author may not have intended to support it.
evutil_timerisset
bool evutil_timerisset(timeval* tvp)

Return true iff the tvp is related to uvp according to the relational operator cmp. Recognized values for cmp are ==, <=, <, >=, and >.

evutil_timersub
void evutil_timersub(timeval* tvp, timeval* uvp, timeval* vvp)
Undocumented in source. Be warned that the author may not have intended to support it.
evutil_vsnprintf
int evutil_vsnprintf(char* buf, size_t buflen, const(char)* format, va_list ap)

Replacement for vsnprintf to get consistent behavior on platforms for which the return value of snprintf does not conform to C99.

Manifest constants

EVUTIL_AI_ADDRCONFIG
enum EVUTIL_AI_ADDRCONFIG;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_ADDRCONFIG
enum EVUTIL_AI_ADDRCONFIG;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_ALL
enum EVUTIL_AI_ALL;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_ALL
enum EVUTIL_AI_ALL;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_CANONNAME
enum EVUTIL_AI_CANONNAME;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_CANONNAME
enum EVUTIL_AI_CANONNAME;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_NUMERICHOST
enum EVUTIL_AI_NUMERICHOST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_NUMERICHOST
enum EVUTIL_AI_NUMERICHOST;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_NUMERICSERV
enum EVUTIL_AI_NUMERICSERV;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_NUMERICSERV
enum EVUTIL_AI_NUMERICSERV;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_PASSIVE
enum EVUTIL_AI_PASSIVE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_PASSIVE
enum EVUTIL_AI_PASSIVE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_V4MAPPED
enum EVUTIL_AI_V4MAPPED;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_AI_V4MAPPED
enum EVUTIL_AI_V4MAPPED;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_ADDRFAMILY
enum EVUTIL_EAI_ADDRFAMILY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_ADDRFAMILY
enum EVUTIL_EAI_ADDRFAMILY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_AGAIN
enum EVUTIL_EAI_AGAIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_AGAIN
enum EVUTIL_EAI_AGAIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_BADFLAGS
enum EVUTIL_EAI_BADFLAGS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_BADFLAGS
enum EVUTIL_EAI_BADFLAGS;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_CANCEL
enum EVUTIL_EAI_CANCEL;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_FAIL
enum EVUTIL_EAI_FAIL;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_FAIL
enum EVUTIL_EAI_FAIL;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_FAMILY
enum EVUTIL_EAI_FAMILY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_FAMILY
enum EVUTIL_EAI_FAMILY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_MEMORY
enum EVUTIL_EAI_MEMORY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_MEMORY
enum EVUTIL_EAI_MEMORY;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_NODATA
enum EVUTIL_EAI_NODATA;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_NODATA
enum EVUTIL_EAI_NODATA;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_NONAME
enum EVUTIL_EAI_NONAME;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_NONAME
enum EVUTIL_EAI_NONAME;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_SERVICE
enum EVUTIL_EAI_SERVICE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_SERVICE
enum EVUTIL_EAI_SERVICE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_SOCKTYPE
enum EVUTIL_EAI_SOCKTYPE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_SOCKTYPE
enum EVUTIL_EAI_SOCKTYPE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_SYSTEM
enum EVUTIL_EAI_SYSTEM;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EVUTIL_EAI_SYSTEM
enum EVUTIL_EAI_SYSTEM;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT16_MAX
enum EV_INT16_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT16_MIN
enum EV_INT16_MIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT32_MAX
enum EV_INT32_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT32_MIN
enum EV_INT32_MIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT64_MAX
enum EV_INT64_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT64_MIN
enum EV_INT64_MIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT8_MAX
enum EV_INT8_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_INT8_MIN
enum EV_INT8_MIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_SIZE_MAX
enum EV_SIZE_MAX;

@name Limits for SIZE_T and SSIZE_T

EV_SSIZE_MAX
enum EV_SSIZE_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_SSIZE_MIN
enum EV_SSIZE_MIN;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_UINT16_MAX
enum EV_UINT16_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_UINT32_MAX
enum EV_UINT32_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
EV_UINT64_MAX
enum EV_UINT64_MAX;

@name Limits for integer types

EV_UINT8_MAX
enum EV_UINT8_MAX;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

evutil_addrinfo
struct evutil_addrinfo

A definition of addrinfo for systems that lack it.

Templates

evutil_offsetof
template evutil_offsetof(type, string field)

Replacement for offsetof on platforms that don't define it.

Meta