Event

Table of Contents

The Event class

Introduction

Event class represents and event firing on a file descriptor being ready to read from or write to; a file descriptor becoming ready to read from or write to(edge-triggered I/O only); a timeout expiring; a signal occuring; a user-triggered event.

Every event is associated with EventBase . However, event will never fire until it is added (via Event::add ). An added event remains in pending state until the registered event occurs, thus turning it to active state. To handle events user may register a callback which is called when event becomes active. If event is configured persistent , it remains pending. If it is not persistent, it stops being pending when it's callback runs. Event::del method deletes event, thus making it non-pending. By means of Event::add method it could be added again.

Class synopsis

Event
final class Event {
/* Constants */
const integer Event::ET = 32 ;
const integer Event::PERSIST = 16 ;
const integer Event::READ = 2 ;
const integer Event::WRITE = 4 ;
const integer Event::SIGNAL = 8 ;
const integer Event::TIMEOUT = 1 ;
/* Properties */
public readonly bool $pending ;
/* Methods */
public bool add ([ double $timeout ] )
public bool addSignal ([ double $timeout ] )
public bool addTimer ([ double $timeout ] )
public __construct ( EventBase $base , mixed $fd , int $what , callable $cb [, mixed $arg = NULL ] )
public bool del ( void )
public bool delSignal ( void )
public bool delTimer ( void )
public void free ( void )
public static array getSupportedMethods ( void )
public bool pending ( int $flags )
public bool set ( EventBase $base , mixed $fd [, int $what [, callable $cb [, mixed $arg ]]] )
public bool setPriority ( int $priority )
public bool setTimer ( EventBase $base , callable $cb [, mixed $arg ] )
public static Event signal ( EventBase $base , int $signum , callable $cb [, mixed $arg ] )
public static Event timer ( EventBase $base , callable $cb [, mixed $arg ] )
}

Properties

pending

Whether event is pending. See About event persistence .

Predefined Constants

Event::ET

Indicates that the event should be edge-triggered, if the underlying event base backend supports edge-triggered events. This affects the semantics of Event::READ and Event::WRITE .

Event::PERSIST

Indicates that the event is persistent. See About event persistence .

Event::READ

This flag indicates an event that becomes active when the provided file descriptor(usually a stream resource, or socket) is ready for reading.

Event::WRITE

This flag indicates an event that becomes active when the provided file descriptor(usually a stream resource, or socket) is ready for reading.

Event::SIGNAL

Used to implement signal detection. See "Constructing signal events" below.

Event::TIMEOUT

This flag indicates an event that becomes active after a timeout elapses.

The Event::TIMEOUT flag is ignored when constructing an event: one can either set a timeout when event is added , or not. It is set in the $what argument to the callback function when a timeout has occurred.

The EventBase class

Introduction

EventBase class represents libevent's event base structure. It holds a set of events and can poll to determine which events are active.

Each event base has a method , or a backend that it uses to determine which events are ready. The recognized methods are: select , poll , epoll , kqueue , devpoll , evport and win32 .

To configure event base to use, or avoid specific backend EventConfig class can be used.

Warning

Do NOT destroy the EventBase object as long as resources of the associated Event objects are not released. Otherwise, it will lead to unpredictable results!

Class synopsis

EventBase
final class EventBase {
/* Constants */
const integer EventBase::LOOP_ONCE = 1 ;
const integer EventBase::LOOP_NONBLOCK = 2 ;
const integer EventBase::NOLOCK = 1 ;
const integer EventBase::STARTUP_IOCP = 4 ;
const integer EventBase::NO_CACHE_TIME = 8 ;
const integer EventBase::EPOLL_USE_CHANGELIST = 16 ;
/* Methods */
public __construct ([ EventConfig $cfg ] )
public void dispatch ( void )
public bool exit ([ double $timeout ] )
public void free ( void )
public int getFeatures ( void )
public string getMethod ( void )
public double getTimeOfDayCached ( void )
public bool gotExit ( void )
public bool gotStop ( void )
public bool loop ([ int $flags ] )
public bool priorityInit ( int $n_priorities )
public bool reInit ( void )
public bool stop ( void )
}

Predefined Constants

EventBase::LOOP_ONCE

Flag used with EventBase::loop method which means: "block until libevent has an active event, then exit once all active events have had their callbacks run".

EventBase::LOOP_NONBLOCK

Flag used with EventBase::loop method which means: "do not block: see which events are ready now, run the callbacks of the highest-priority ones, then exit".

EventBase::NOLOCK

Configuration flag. Do not allocate a lock for the event base, even if we have locking set up".

EventBase::STARTUP_IOCP

Windows-only configuration flag. Enables the IOCP dispatcher at startup.

EventBase::NO_CACHE_TIME

Configuration flag. Instead of checking the current time every time the event loop is ready to run timeout callbacks, check after each timeout callback.

EventBase::EPOLL_USE_CHANGELIST

If we are using the epoll backend, this flag says that it is safe to use Libevent's internal change-list code to batch up adds and deletes in order to try to do as few syscalls as possible.

Setting this flag can make code run faster, but it may trigger a Linux bug: it is not safe to use this flag if one has any fds cloned by dup(), or its variants. Doing so will produce strange and hard-to-diagnose bugs.

This flag can also be activated by settnig the EVENT_EPOLL_USE_CHANGELIST environment variable.

This flag has no effect if one winds up using a backend other than epoll .

The EventBuffer class

Introduction

EventBuffer represents Libevent's "evbuffer", an utility functionality for buffered I/O.

Event buffers are meant to be generally useful for doing the "buffer" part of buffered network I/O.

Class synopsis

EventBuffer
class EventBuffer {
/* Constants */
const integer EventBuffer::EOL_ANY = 0 ;
const integer EventBuffer::EOL_CRLF = 1 ;
const integer EventBuffer::EOL_CRLF_STRICT = 2 ;
const integer EventBuffer::EOL_LF = 3 ;
const integer EventBuffer::PTR_SET = 0 ;
const integer EventBuffer::PTR_ADD = 1 ;
/* Properties */
public readonly int $length ;
public readonly int $contiguous_space ;
/* Methods */
public bool add ( string $data )
public bool addBuffer ( EventBuffer $buf )
public int appendFrom ( EventBuffer $buf , int $len )
public __construct ( void )
public int copyout ( string &$data , int $max_bytes )
public bool drain ( int $len )
public void enableLocking ( void )
public bool expand ( int $len )
public bool freeze ( bool $at_front )
public void lock ( void )
public bool prepend ( string $data )
public bool prependBuffer ( EventBuffer $buf )
public string pullup ( int $size )
public string read ( int $max_bytes )
public int read ( mixed $fd , int $howmuch )
public string readLine ( int $eol_style )
public mixed search ( string $what [, int $start = -1 [, int $end = -1 ]] )
public mixed searchEol ([ int $start = -1 [, int $eol_style = EventBuffer::EOL_ANY ]] )
public string substr ( int $start [, int $length ] )
public bool unfreeze ( bool $at_front )
public bool unlock ( void )
public int write ( mixed $fd [, int $howmuch ] )
}

Properties

length

The number of bytes stored in an event buffer.

contiguous_space

The number of bytes stored contiguously at the front of the buffer. The bytes in a buffer may be stored in multiple separate chunks of memory; the property returns the number of bytes currently stored in the first chunk.

Predefined Constants

EventBuffer::EOL_ANY

The end of line is any sequence of any number of carriage return and linefeed characters. This format is not very useful; it exists mainly for backward compatibility.

EventBuffer::EOL_CRLF

The end of the line is an optional carriage return, followed by a linefeed. (In other words, it is either a "\r\n" or a "\n" .) This format is useful in parsing text-based Internet protocols, since the standards generally prescribe a "\r\n" line-terminator, but nonconformant clients sometimes say just "\n" .

EventBuffer::EOL_CRLF_STRICT

The end of a line is a single carriage return, followed by a single linefeed. (This is also known as "\r\n" . The ASCII values are 0x0D 0x0A ).

EventBuffer::EOL_LF

The end of a line is a single linefeed character. (This is also known as "\n" . It is ASCII value is 0x0A .)

EventBuffer::PTR_SET

Flag used as argument of EventBuffer::setPosition method. If this flag specified, the position pointer is moved to an absolute position within the buffer.

EventBuffer::PTR_ADD

The same as EventBuffer::PTR_SET , except this flag causes EventBuffer::setPosition method to move position forward up to the specified number of bytes(instead of setting absolute position).

The EventBufferEvent class

Introduction

Represents Libevent's buffer event.

Usually an application wants to perform some amount of data buffering in addition to just responding to events. When we want to write data, for example, the usual pattern looks like:

  1. Decide that we want to write some data to a connection; put that data in a buffer.

  2. Wait for the connection to become writable

  3. Write as much of the data as we can

  4. Remember how much we wrote, and if we still have more data to write, wait for the connection to become writable again.

This buffered I/O pattern is common enough that Libevent provides a generic mechanism for it. A "buffer event" consists of an underlying transport (like a socket), a read buffer, and a write buffer. Instead of regular events, which give callbacks when the underlying transport is ready to be read or written, a buffer event invokes its user-supplied callbacks when it has read or written enough data.

Class synopsis

EventBufferEvent
final class EventBufferEvent {
/* Constants */
const integer EventBufferEvent::READING = 1 ;
const integer EventBufferEvent::WRITING = 2 ;
const integer EventBufferEvent::EOF = 16 ;
const integer EventBufferEvent::ERROR = 32 ;
const integer EventBufferEvent::TIMEOUT = 64 ;
const integer EventBufferEvent::CONNECTED = 128 ;
const integer EventBufferEvent::OPT_CLOSE_ON_FREE = 1 ;
const integer EventBufferEvent::OPT_THREADSAFE = 2 ;
const integer EventBufferEvent::OPT_DEFER_CALLBACKS = 4 ;
const integer EventBufferEvent::OPT_UNLOCK_CALLBACKS = 8 ;
const integer EventBufferEvent::SSL_OPEN = 0 ;
const integer EventBufferEvent::SSL_CONNECTING = 1 ;
const integer EventBufferEvent::SSL_ACCEPTING = 2 ;
/* Properties */
public integer $fd ;
public integer $priority ;
public readonly EventBuffer $input ;
public readonly EventBuffer $output ;
/* Methods */
public void close ( void )
public bool connect ( string $addr )
public bool connectHost ( EventDnsBase $dns_base , string $hostname , int $port [, int $family = EventUtil::AF_UNSPEC ] )
public __construct ( EventBase $base [, mixed $socket = NULL [, int $options = 0 [, callable $readcb = NULL [, callable $writecb = NULL [, callable $eventcb = NULL ]]]]] )
public static array createPair ( EventBase $base [, int $options = 0 ] )
public bool disable ( int $events )
public bool enable ( int $events )
public void free ( void )
public string getDnsErrorString ( void )
public int getEnabled ( void )
public EventBuffer getInput ( void )
public EventBuffer getOutput ( void )
public string read ( int $size )
public bool readBuffer ( EventBuffer $buf )
public void setCallbacks ( callable $readcb , callable $writecb , callable $eventcb [, string $arg ] )
public bool setPriority ( int $priority )
public bool setTimeouts ( float $timeout_read , float $timeout_write )
public void setWatermark ( int $events , int $lowmark , int $highmark )
public string sslError ( void )
public static EventBufferEvent sslFilter ( EventBase $base , EventBufferEvent $underlying , EventSslContext $ctx , int $state [, int $options = 0 ] )
public string sslGetCipherInfo ( void )
public string sslGetCipherName ( void )
public string sslGetCipherVersion ( void )
public string sslGetProtocol ( void )
public void sslRenegotiate ( void )
public static EventBufferEvent sslSocket ( EventBase $base , mixed $socket , EventSslContext $ctx , int $state [, int $options ] )
public bool write ( string $data )
public bool writeBuffer ( EventBuffer $buf )
}

Properties

fd

Numeric file descriptor associated with the buffer event. Normally represents a bound socket. Equals to NULL, if there is no file descriptor(socket) associated with the buffer event.

priority

The priority of the events used to implement the buffer event.

input

Underlying input buffer object( EventBuffer )

output

Underlying output buffer object( EventBuffer )

Predefined Constants

EventBufferEvent::READING

An event occured during a read operation on the bufferevent. See the other flags for which event it was.

EventBufferEvent::WRITING

An event occured during a write operation on the bufferevent. See the other flags for which event it was.

EventBufferEvent::EOF

Got an end-of-file indication on the buffer event.

EventBufferEvent::ERROR

An error occurred during a bufferevent operation. For more information on what the error was, call EventUtil::getLastSocketErrno and/or EventUtil::getLastSocketError .

EventBufferEvent::TIMEOUT

EventBufferEvent::CONNECTED

Finished a requested connection on the bufferevent.

EventBufferEvent::OPT_CLOSE_ON_FREE

When the buffer event is freed, close the underlying transport. This will close an underlying socket, free an underlying buffer event, etc.

EventBufferEvent::OPT_THREADSAFE

Automatically allocate locks for the bufferevent, so that it’s safe to use from multiple threads.

EventBufferEvent::OPT_DEFER_CALLBACKS

When this flag is set, the bufferevent defers all of its callbacks. See » Fast portable non-blocking network programming with Libevent, Deferred callbacks .

EventBufferEvent::OPT_UNLOCK_CALLBACKS

By default, when the bufferevent is set up to be threadsafe, the buffer event’s locks are held whenever the any user-provided callback is invoked. Setting this option makes Libevent release the buffer event’s lock when it’s invoking the callbacks.

EventBufferEvent::SSL_OPEN

The SSL handshake is done

EventBufferEvent::SSL_CONNECTING

SSL is currently performing negotiation as a client

EventBufferEvent::SSL_ACCEPTING

SSL is currently performing negotiation as a server

The EventConfig class

Introduction

Represents configuration structure which could be used in construction of the EventBase .

Class synopsis

EventConfig
final class EventConfig {
/* Constants */
const integer EventConfig::FEATURE_ET = 1 ;
const integer EventConfig::FEATURE_O1 = 2 ;
const integer EventConfig::FEATURE_FDS = 4 ;
/* Methods */
public bool avoidMethod ( string $method )
public __construct ( void )
public bool requireFeatures ( int $feature )
public void setMaxDispatchInterval ( int $max_interval , int $max_callbacks , int $min_priority )
}

Predefined Constants

EventConfig::FEATURE_ET

Requires a backend method that supports edge-triggered I/O.

EventConfig::FEATURE_O1

Requires a backend method where adding or deleting a single event, or having a single event become active, is an O(1) operation.

EventConfig::FEATURE_FDS

Requires a backend method that can support arbitrary file descriptor types, and not just sockets.

The EventDnsBase class

Introduction

Represents Libevent's DNS base structure. Used to resolve DNS asyncronously, parse configuration files like resolv.conf etc.

Class synopsis

EventDnsBase
final class EventDnsBase {
/* Constants */
const integer EventDnsBase::OPTION_SEARCH = 1 ;
const integer EventDnsBase::OPTION_NAMESERVERS = 2 ;
const integer EventDnsBase::OPTION_MISC = 4 ;
const integer EventDnsBase::OPTION_HOSTSFILE = 8 ;
const integer EventDnsBase::OPTIONS_ALL = 15 ;
/* Methods */
public bool addNameserverIp ( string $ip )
public void addSearch ( string $domain )
public void clearSearch ( void )
public __construct ( EventBase $base , bool $initialize )
public int countNameservers ( void )
public bool loadHosts ( string $hosts )
public bool parseResolvConf ( int $flags , string $filename )
public bool setOption ( string $option , string $value )
public bool setSearchNdots ( int $ndots )
}

Predefined Constants

Tells to read the domain and search fields from the resolv.conf file and the ndots option, and use them to decide which domains(if any) to search for hostnames that aren’t fully-qualified.

EventDnsBase::OPTION_NAMESERVERS

Tells to learn the nameservers from the resolv.conf file.

EventDnsBase::OPTION_MISC

EventDnsBase::OPTION_HOSTSFILE

Tells to read a list of hosts from /etc/hosts as part of loading the resolv.conf file.

EventDnsBase::OPTIONS_ALL

Tells to learn as much as it can from the resolv.conf file.

The EventHttp class

Introduction

Represents HTTP server.

Class synopsis

EventHttp
final class EventHttp {
/* Methods */
public bool accept ( mixed $socket )
public bool addServerAlias ( string $alias )
public void bind ( string $address , int $port )
public __construct ( EventBase $base [, EventSslContext $ctx = NULL ] )
public bool removeServerAlias ( string $alias )
public void setAllowedMethods ( int $methods )
public void setCallback ( string $path , string $cb [, string $arg ] )
public void setDefaultCallback ( string $cb [, string $arg ] )
public void setMaxBodySize ( int $value )
public void setMaxHeadersSize ( int $value )
public void setTimeout ( int $value )
}

The EventHttpConnection class

Introduction

Represents an HTTP connection.

Class synopsis

EventHttpConnection
class EventHttpConnection {
/* Methods */
public __construct ( EventBase $base , EventDnsBase $dns_base , string $address , int $port [, EventSslContext $ctx = NULL ] )
public EventBase getBase ( void )
public void getPeer ( string &$address , int &$port )
public bool makeRequest ( EventHttpRequest $req , int $type , string $uri )
public void setCloseCallback ( callable $callback [, mixed $data ] )
public void setLocalAddress ( string $address )
public void setLocalPort ( int $port )
public void setMaxBodySize ( string $max_size )
public void setMaxHeadersSize ( string $max_size )
public void setRetries ( int $retries )
public void setTimeout ( int $timeout )
}

The EventHttpRequest class

Introduction

Represents an HTTP request.

Class synopsis

EventHttpRequest
class EventHttpRequest {
/* Constants */
const integer EventHttpRequest::CMD_GET = 1 ;
const integer EventHttpRequest::CMD_POST = 2 ;
const integer EventHttpRequest::CMD_HEAD = 4 ;
const integer EventHttpRequest::CMD_PUT = 8 ;
const integer EventHttpRequest::CMD_DELETE = 16 ;
const integer EventHttpRequest::CMD_OPTIONS = 32 ;
const integer EventHttpRequest::CMD_TRACE = 64 ;
const integer EventHttpRequest::CMD_CONNECT = 128 ;
const integer EventHttpRequest::CMD_PATCH = 256 ;
const integer EventHttpRequest::INPUT_HEADER = 1 ;
const integer EventHttpRequest::OUTPUT_HEADER = 2 ;
/* Methods */
public bool addHeader ( string $key , string $value , int $type )
public void cancel ( void )
public void clearHeaders ( void )
public void closeConnection ( void )
public __construct ( callable $callback [, mixed $data = NULL ] )
public void findHeader ( string $key , string $type )
public void free ( void )
public EventBufferEvent closeConnection ( void )
public void getCommand ( void )
public EventHttpConnection closeConnection ( void )
public string getHost ( void )
public EventBuffer getInputBuffer ( void )
public array getInputHeaders ( void )
public EventBuffer getOutputBuffer ( void )
public void getOutputHeaders ( void )
public int getResponseCode ( void )
public string getUri ( void )
public void removeHeader ( string $key , string $type )
public void sendError ( int $error [, string $reason = NULL ] )
public void sendReply ( int $code , string $reason [, EventBuffer $buf ] )
public void sendReplyChunk ( EventBuffer $buf )
public void sendReplyEnd ( void )
public void sendReplyStart ( int $code , string $reason )
}

Predefined Constants

EventHttpRequest::CMD_GET

GET method(command)

EventHttpRequest::CMD_POST

POST method(command)

EventHttpRequest::CMD_HEAD

HEAD method(command)

EventHttpRequest::CMD_PUT

PUT method(command)

EventHttpRequest::CMD_DELETE

DELETE command(method)

EventHttpRequest::CMD_OPTIONS

OPTIONS method(command)

EventHttpRequest::CMD_TRACE

TRACE method(command)

EventHttpRequest::CMD_CONNECT

CONNECT method(command)

EventHttpRequest::CMD_PATCH

PATCH method(command)

EventHttpRequest::INPUT_HEADER

Request input header type.

EventHttpRequest::OUTPUT_HEADER

Request output header type.

The EventListener class

Introduction

Represents a connection listener.

Class synopsis

EventListener
final class EventListener {
/* Constants */
const integer EventListener::OPT_LEAVE_SOCKETS_BLOCKING = 1 ;
const integer EventListener::OPT_CLOSE_ON_FREE = 2 ;
const integer EventListener::OPT_CLOSE_ON_EXEC = 4 ;
const integer EventListener::OPT_REUSEABLE = 8 ;
const integer EventListener::OPT_THREADSAFE = 16 ;
/* Properties */
public readonly int $fd ;
/* Methods */
public __construct ( EventBase $base , callable $cb , mixed $data , int $flags , int $backlog , mixed $target )
public bool disable ( void )
public bool enable ( void )
public void getBase ( void )
public static bool getSocketName ( string &$address [, mixed &$port ] )
public void setCallback ( callable $cb [, mixed $arg = NULL ] )
public void setErrorCallback ( string $cb )
}

Properties

fd

Numeric file descriptor of the underlying socket. (Added in event-1.6.0 .)

Predefined Constants

EventListener::OPT_LEAVE_SOCKETS_BLOCKING

By default Libevent turns underlying file descriptors, or sockets, to non-blocking mode. This flag tells to leave them non-blocking.

EventListener::OPT_CLOSE_ON_FREE

If this option is set, the connection listener closes its underlying socket when the EventListener object is freed.

EventListener::OPT_CLOSE_ON_EXEC

If this option is set, the connection listener sets the close-on-exec flag on the underlying listener socket. See platform documentation for fcntl and FD_CLOEXEC for more information.

EventListener::OPT_REUSEABLE

By default on some platforms, once a listener socket is closed, no other socket can bind to the same port until a while has passed. Setting this option makes Libevent mark the socket as reusable, so that once it is closed, another socket can be opened to listen on the same port.

EventListener::OPT_THREADSAFE

Allocate locks for the listener, so that it’s safe to use it from multiple threads.

The EventSslContext class

Introduction

Represents SSL_CTX structure. Provides methods and properties to configure the SSL context.

Class synopsis

EventSslContext
final class EventSslContext {
/* Constants */
const integer EventSslContext::SSLv2_CLIENT_METHOD = 1 ;
const integer EventSslContext::SSLv3_CLIENT_METHOD = 2 ;
const integer EventSslContext::SSLv23_CLIENT_METHOD = 3 ;
const integer EventSslContext::TLS_CLIENT_METHOD = 4 ;
const integer EventSslContext::SSLv2_SERVER_METHOD = 5 ;
const integer EventSslContext::SSLv3_SERVER_METHOD = 6 ;
const integer EventSslContext::SSLv23_SERVER_METHOD = 7 ;
const integer EventSslContext::TLS_SERVER_METHOD = 8 ;
const integer EventSslContext::OPT_LOCAL_CERT = 1 ;
const integer EventSslContext::OPT_LOCAL_PK = 2 ;
const integer EventSslContext::OPT_PASSPHRASE = 3 ;
const integer EventSslContext::OPT_CA_FILE = 4 ;
const integer EventSslContext::OPT_CA_PATH = 5 ;
const integer EventSslContext::OPT_ALLOW_SELF_SIGNED = 6 ;
const integer EventSslContext::OPT_VERIFY_PEER = 7 ;
const integer EventSslContext::OPT_VERIFY_DEPTH = 8 ;
const integer EventSslContext::OPT_CIPHERS = 9 ;
/* Properties */
public string $local_cert ;
public string $local_pk ;
/* Methods */
public __construct ( string $method , string $options )
}

Properties

local_cert

Path to local certificate file on filesystem. It must be a PEM-encoded file which contains certificate. It can optionally contain the certificate chain of issuers.

local_pk

Path to local private key file

Predefined Constants

EventSslContext::SSLv2_CLIENT_METHOD

SSLv2 client method. See SSL_CTX_new(3) man page.

EventSslContext::SSLv3_CLIENT_METHOD

SSLv3 client method. See SSL_CTX_new(3) man page.

EventSslContext::SSLv23_CLIENT_METHOD

SSLv23 client method. See SSL_CTX_new(3) man page.

EventSslContext::TLS_CLIENT_METHOD

TLS client method. See SSL_CTX_new(3) man page.

EventSslContext::SSLv2_SERVER_METHOD

SSLv2 server method. See SSL_CTX_new(3) man page.

EventSslContext::SSLv3_SERVER_METHOD

SSLv3 server method. See SSL_CTX_new(3) man page.

EventSslContext::SSLv23_SERVER_METHOD

SSLv23 server method. See SSL_CTX_new(3) man page.

EventSslContext::TLS_SERVER_METHOD

TLS server method. See SSL_CTX_new(3) man page.

EventSslContext::OPT_LOCAL_CERT

Key for an item of the options' array used in EventSslContext::__construct . The option points to path of local certificate.

EventSslContext::OPT_LOCAL_PK

Key for an item of the options' array used in EventSslContext::__construct . The option points to path of the private key.

EventSslContext::OPT_PASSPHRASE

Key for an item of the options' array used in EventSslContext::__construct . Represents passphrase of the certificate.

EventSslContext::OPT_CA_FILE

Key for an item of the options' array used in EventSslContext::__construct . Represents path of the certificate authority file.

EventSslContext::OPT_CA_PATH

Key for an item of the options' array used in EventSslContext::__construct . Represents path where the certificate authority file should be searched for.

EventSslContext::OPT_ALLOW_SELF_SIGNED

Key for an item of the options' array used in EventSslContext::__construct . Represents option that allows self-signed certificates.

EventSslContext::OPT_VERIFY_PEER

Key for an item of the options' array used in EventSslContext::__construct . Represents option that tells Event to verify peer.

EventSslContext::OPT_VERIFY_DEPTH

Key for an item of the options' array used in EventSslContext::__construct . Represents maximum depth for the certificate chain verification that shall be allowed for the SSL context.

EventSslContext::OPT_CIPHERS

Key for an item of the options' array used in EventSslContext::__construct . Represents the cipher list for the SSL context.

The EventUtil class

Introduction

EventUtil is a singleton with supplimentary methods and constants.

Class synopsis

EventUtil
final class EventUtil {
/* Constants */
const integer EventUtil::AF_INET = 2 ;
const integer EventUtil::AF_INET6 = 10 ;
const integer EventUtil::AF_UNSPEC = 0 ;
const integer EventUtil::LIBEVENT_VERSION_NUMBER = 33559808 ;
const integer EventUtil::SO_DEBUG = 1 ;
const integer EventUtil::SO_REUSEADDR = 2 ;
const integer EventUtil::SO_KEEPALIVE = 9 ;
const integer EventUtil::SO_DONTROUTE = 5 ;
const integer EventUtil::SO_LINGER = 13 ;
const integer EventUtil::SO_BROADCAST = 6 ;
const integer EventUtil::SO_OOBINLINE = 10 ;
const integer EventUtil::SO_SNDBUF = 7 ;
const integer EventUtil::SO_RCVBUF = 8 ;
const integer EventUtil::SO_SNDLOWAT = 19 ;
const integer EventUtil::SO_RCVLOWAT = 18 ;
const integer EventUtil::SO_SNDTIMEO = 21 ;
const integer EventUtil::SO_RCVTIMEO = 20 ;
const integer EventUtil::SO_TYPE = 3 ;
const integer EventUtil::SO_ERROR = 4 ;
const integer EventUtil::SOL_SOCKET = 1 ;
const integer EventUtil::SOL_TCP = 6 ;
const integer EventUtil::SOL_UDP = 17 ;
const integer EventUtil::IPPROTO_IP = 0 ;
const integer EventUtil::IPPROTO_IPV6 = 41 ;
/* Methods */
abstract public __construct ( void )
public static int getLastSocketErrno ([ mixed $socket = NULL ] )
public static string getLastSocketError ([ mixed $socket ] )
public static int getSocketFd ( mixed $socket )
public static bool getSocketName ( mixed $socket , string &$address [, mixed &$port ] )
public static bool setSocketOption ( mixed $socket , int $level , int $optname , mixed $optval )
public static void sslRandPoll ( void )
}

Predefined Constants

EventUtil::AF_INET

IPv4 address family

EventUtil::AF_INET6

IPv6 address family

EventUtil::AF_UNSPEC

Unspecified IP address family

EventUtil::SO_DEBUG

Socket option. Enable socket debugging. Only allowed for processes with the CAP_NET_ADMIN capability or an effective user ID of 0 . (Added in event-1.6.0.)

EventUtil::SO_REUSEADDR

Socket option. Indicates that the rules used in validating addresses supplied in a bind(2) call should allow reuse of local addresses. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_KEEPALIVE

Socket option. Enable sending of keep-alive messages on connection-oriented sockets. Expects an integer boolean flag. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_DONTROUTE

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_LINGER

Socket option. When enabled, a close(2) or shutdown(2) will not return until all queued messages for the socket have been successfully sent or the linger timeout has been reached. Otherwise, the call returns immediately and the closing is done in the background. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_BROADCAST

Socket option. Reports whether transmission of broadcast messages is supported. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_OOBINLINE

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_SNDBUF

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_RCVBUF

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_SNDLOWAT

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_RCVLOWAT

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_SNDTIMEO

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_RCVTIMEO

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_TYPE

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SO_ERROR

Socket option. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SOL_SOCKET

Socket option level. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SOL_TCP

Socket option level. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::SOL_UDP

Socket option level. See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::IPPROTO_IP

See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::IPPROTO_IPV6

See the socket(7) manual page. (Added in event-1.6.0.)

EventUtil::LIBEVENT_VERSION_NUMBER

Libevent' version number at the time when Event extension had been compiled with the library.