Event目次
The Event classはじめに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 occurring; 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. クラス概要
Event
final
class Event
{
/* 定数 */
const
int
Event::ET = 32;
const
int
Event::PERSIST = 16;
const
int
Event::READ = 2;
const
int
Event::WRITE = 4;
const
int
Event::SIGNAL = 8;
const
int
Event::TIMEOUT = 1;
/* プロパティ */
public
readonly
bool
$pending;
/* メソッド */
public
bool add(
float
$timeout
= ?)public
__construct(
EventBase $base
,mixed $fd
,int $what
,callable $cb
,mixed $arg
= NULL
) public
bool del()
public
void free()
public
static
array getSupportedMethods()
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
= ?)プロパティ
定義済み定数
The EventBase classはじめに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:
To configure event base to use, or avoid specific backend EventConfig class can be used. 警告
Do
NOT
destroy the
EventBase
object as long as resources of the associated
クラス概要
EventBase
final
class EventBase
{
/* 定数 */
const
int
EventBase::LOOP_ONCE = 1;
const
int
EventBase::LOOP_NONBLOCK = 2;
const
int
EventBase::NOLOCK = 1;
const
int
EventBase::STARTUP_IOCP = 4;
const
int
EventBase::NO_CACHE_TIME = 8;
const
int
EventBase::EPOLL_USE_CHANGELIST = 16;
/* メソッド */
public
__construct(
EventConfig
$cfg
= ?)public
void dispatch()
public
bool exit(
float
$timeout
= ?)public
void free()
public
int getFeatures()
public
string getMethod()
public
float getTimeOfDayCached()
public
bool gotExit()
public
bool gotStop()
public
bool loop(
int
$flags
= ?)public
bool priorityInit(
int
$n_priorities
)public
bool reInit()
public
bool stop()
}定義済み定数
The EventBuffer classはじめに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. クラス概要
EventBuffer
class EventBuffer
{
/* 定数 */
const
int
EventBuffer::EOL_ANY = 0;
const
int
EventBuffer::EOL_CRLF = 1;
const
int
EventBuffer::EOL_CRLF_STRICT = 2;
const
int
EventBuffer::EOL_LF = 3;
const
int
EventBuffer::PTR_SET = 0;
const
int
EventBuffer::PTR_ADD = 1;
/* プロパティ */
public
readonly
int
$length;
public
readonly
int
$contiguous_space;
/* メソッド */
public
bool add(
string
$data
)public
bool addBuffer(
EventBuffer
$buf
)public
int appendFrom(
EventBuffer
$buf
,
int
$len
)public
__construct()
public
int copyout(
string
&$data
,
int
$max_bytes
)public
bool drain(
int
$len
)public
void enableLocking()
public
bool expand(
int
$len
)public
bool freeze(
bool
$at_front
)public
void lock()
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()
public
int write(
mixed
}$fd
,
int
$howmuch
= ?)プロパティ
定義済み定数
The EventBufferEvent classはじめに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:
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. クラス概要
EventBufferEvent
final
class EventBufferEvent
{
/* 定数 */
const
int
EventBufferEvent::READING = 1;
const
int
EventBufferEvent::WRITING = 2;
const
int
EventBufferEvent::EOF = 16;
const
int
EventBufferEvent::ERROR = 32;
const
int
EventBufferEvent::TIMEOUT = 64;
const
int
EventBufferEvent::CONNECTED = 128;
const
int
EventBufferEvent::OPT_CLOSE_ON_FREE = 1;
const
int
EventBufferEvent::OPT_THREADSAFE = 2;
const
int
EventBufferEvent::OPT_DEFER_CALLBACKS = 4;
const
int
EventBufferEvent::OPT_UNLOCK_CALLBACKS = 8;
const
int
EventBufferEvent::SSL_OPEN = 0;
const
int
EventBufferEvent::SSL_CONNECTING = 1;
const
int
EventBufferEvent::SSL_ACCEPTING = 2;
/* プロパティ */
public
int
$fd;
public
int
$priority;
public
readonly
EventBuffer
$input;
public
readonly
EventBuffer
$output;
/* メソッド */
public
void close()
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
,mixed $arg
= null
) public
static
array createPair(
EventBase
$base
,
int
$options
= 0
)public
bool disable(
int
$events
)public
bool enable(
int
$events
)public
void free()
public
string getDnsErrorString()
public
int getEnabled()
public
EventBuffer getInput()
public
EventBuffer getOutput()
public
string read(
int
$size
)public
bool readBuffer(
EventBuffer
$buf
)public
void setCallbacks(
callable $readcb
,callable $writecb
,callable $eventcb
,mixed $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()
public
static
EventBufferEvent sslFilter(
EventBase $base
,EventBufferEvent $underlying
,EventSslContext $ctx
,int $state
,int $options
= 0
) public
string sslGetCipherInfo()
public
string sslGetCipherName()
public
string sslGetCipherVersion()
public
string sslGetProtocol()
public
void sslRenegotiate()
public
static
EventBufferEvent sslSocket(
EventBase $base
,mixed $socket
,EventSslContext $ctx
,int $state
,int $options
= ?) public
bool write(
string
$data
)public
bool writeBuffer(
EventBuffer
}$buf
)プロパティ
定義済み定数
The EventConfig classはじめにRepresents configuration structure which could be used in construction of the EventBase . クラス概要
EventConfig
final
class EventConfig
{
/* 定数 */
const
int
EventConfig::FEATURE_ET = 1;
const
int
EventConfig::FEATURE_O1 = 2;
const
int
EventConfig::FEATURE_FDS = 4;
/* メソッド */
public
bool avoidMethod(
string
$method
)public
__construct()
public
bool requireFeatures(
int
$feature
)public
bool setFlags(
int
$flags
)public
void setMaxDispatchInterval(
int
}$max_interval
,
int
$max_callbacks
,
int
$min_priority
)定義済み定数
The EventDnsBase classはじめにRepresents Libevent's DNS base structure. Used to resolve DNS asyncronously, parse configuration files like resolv.conf etc. クラス概要
EventDnsBase
final
class EventDnsBase
{
/* 定数 */
const
int
EventDnsBase::OPTION_SEARCH = 1;
const
int
EventDnsBase::OPTION_NAMESERVERS = 2;
const
int
EventDnsBase::OPTION_MISC = 4;
const
int
EventDnsBase::OPTION_HOSTSFILE = 8;
const
int
EventDnsBase::OPTIONS_ALL = 15;
const
int
EventDnsBase::DISABLE_WHEN_INACTIVE = 32768;
const
int
EventDnsBase::INITIALIZE_NAMESERVERS = 1;
const
int
EventDnsBase::NAMESERVERS_NO_DEFAULT = 65536;
/* メソッド */
public
__construct(
EventBase
$base
,
intbool
$initialize
)public
bool addNameserverIp(
string
$ip
)public
void addSearch(
string
$domain
)public
void clearSearch()
public
int countNameservers()
public
bool loadHosts(
string
$hosts
)public
bool parseResolvConf(
int
$flags
,
string
$filename
)public
bool setOption(
string
$option
,
string
$value
)public
bool setSearchNdots(
int
}$ndots
)定義済み定数
The EventHttp classはじめにRepresents HTTP server. クラス概要
EventHttp
final
class EventHttp
{
/* メソッド */
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はじめにRepresents an HTTP connection. クラス概要
EventHttpConnection
class EventHttpConnection
{
/* メソッド */
public
__construct(
EventBase $base
,EventDnsBase $dns_base
,string $address
,int $port
,EventSslContext $ctx
= null
) public
EventBase getBase()
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はじめにRepresents an HTTP request. クラス概要
EventHttpRequest
class EventHttpRequest
{
/* 定数 */
const
int
EventHttpRequest::CMD_GET = 1;
const
int
EventHttpRequest::CMD_POST = 2;
const
int
EventHttpRequest::CMD_HEAD = 4;
const
int
EventHttpRequest::CMD_PUT = 8;
const
int
EventHttpRequest::CMD_DELETE = 16;
const
int
EventHttpRequest::CMD_OPTIONS = 32;
const
int
EventHttpRequest::CMD_TRACE = 64;
const
int
EventHttpRequest::CMD_CONNECT = 128;
const
int
EventHttpRequest::CMD_PATCH = 256;
const
int
EventHttpRequest::INPUT_HEADER = 1;
const
int
EventHttpRequest::OUTPUT_HEADER = 2;
/* メソッド */
public
bool addHeader(
string
$key
,
string
$value
,
int
$type
)public
void cancel()
public
void clearHeaders()
public
void closeConnection()
public
__construct(
callable
$callback
,
mixed
$data
= null
)public
void findHeader(
string
$key
,
string
$type
)public
void free()
public
EventBufferEvent closeConnection()
public
void getCommand()
public
EventHttpConnection closeConnection()
public
string getHost()
public
EventBuffer getInputBuffer()
public
array getInputHeaders()
public
EventBuffer getOutputBuffer()
public
void getOutputHeaders()
public
int getResponseCode()
public
string getUri()
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()
public
void sendReplyStart(
int
}$code
,
string
$reason
)定義済み定数
The EventListener classはじめにRepresents a connection listener. クラス概要
EventListener
final
class EventListener
{
/* 定数 */
const
int
EventListener::OPT_LEAVE_SOCKETS_BLOCKING = 1;
const
int
EventListener::OPT_CLOSE_ON_FREE = 2;
const
int
EventListener::OPT_CLOSE_ON_EXEC = 4;
const
int
EventListener::OPT_REUSEABLE = 8;
const
int
EventListener::OPT_THREADSAFE = 16;
/* プロパティ */
public
readonly
int
$fd;
/* メソッド */
public
__construct(
EventBase $base
,callable $cb
,mixed $data
,int $flags
,int $backlog
,mixed $target
) public
bool disable()
public
bool enable()
public
void getBase()
public
static
bool getSocketName(
string
&$address
,
mixed
&$port
= ?)public
void setCallback(
callable
$cb
,
mixed
$arg
= null
)public
void setErrorCallback(
string
}$cb
)プロパティ
定義済み定数
The EventSslContext classはじめに
Represents
クラス概要
EventSslContext
final
class EventSslContext
{
/* 定数 */
const
int
EventSslContext::SSLv2_CLIENT_METHOD = 1;
const
int
EventSslContext::SSLv3_CLIENT_METHOD = 2;
const
int
EventSslContext::SSLv23_CLIENT_METHOD = 3;
const
int
EventSslContext::TLS_CLIENT_METHOD = 4;
const
int
EventSslContext::SSLv2_SERVER_METHOD = 5;
const
int
EventSslContext::SSLv3_SERVER_METHOD = 6;
const
int
EventSslContext::SSLv23_SERVER_METHOD = 7;
const
int
EventSslContext::TLS_SERVER_METHOD = 8;
const
int
EventSslContext::OPT_LOCAL_CERT = 1;
const
int
EventSslContext::OPT_LOCAL_PK = 2;
const
int
EventSslContext::OPT_PASSPHRASE = 3;
const
int
EventSslContext::OPT_CA_FILE = 4;
const
int
EventSslContext::OPT_CA_PATH = 5;
const
int
EventSslContext::OPT_ALLOW_SELF_SIGNED = 6;
const
int
EventSslContext::OPT_VERIFY_PEER = 7;
const
int
EventSslContext::OPT_VERIFY_DEPTH = 8;
const
int
EventSslContext::OPT_CIPHERS = 9;
/* プロパティ */
public
string
$local_cert;
public
string
$local_pk;
/* メソッド */
public
__construct(
string
}$method
,
string
$options
)プロパティ
定義済み定数
The EventUtil classはじめにEventUtil is a singleton with supplimentary methods and constants. クラス概要
EventUtil
final
class EventUtil
{
/* 定数 */
const
int
EventUtil::AF_INET = 2;
const
int
EventUtil::AF_INET6 = 10;
const
int
EventUtil::AF_UNSPEC = 0;
const
int
EventUtil::LIBEVENT_VERSION_NUMBER = 33559808;
const
int
EventUtil::SO_DEBUG = 1;
const
int
EventUtil::SO_REUSEADDR = 2;
const
int
EventUtil::SO_KEEPALIVE = 9;
const
int
EventUtil::SO_DONTROUTE = 5;
const
int
EventUtil::SO_LINGER = 13;
const
int
EventUtil::SO_BROADCAST = 6;
const
int
EventUtil::SO_OOBINLINE = 10;
const
int
EventUtil::SO_SNDBUF = 7;
const
int
EventUtil::SO_RCVBUF = 8;
const
int
EventUtil::SO_SNDLOWAT = 19;
const
int
EventUtil::SO_RCVLOWAT = 18;
const
int
EventUtil::SO_SNDTIMEO = 21;
const
int
EventUtil::SO_RCVTIMEO = 20;
const
int
EventUtil::SO_TYPE = 3;
const
int
EventUtil::SO_ERROR = 4;
const
int
EventUtil::SOL_SOCKET = 1;
const
int
EventUtil::SOL_TCP = 6;
const
int
EventUtil::SOL_UDP = 17;
const
int
EventUtil::IPPROTO_IP = 0;
const
int
EventUtil::IPPROTO_IPV6 = 41;
/* メソッド */
abstract
public
__construct()
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()
}定義済み定数
The EventException classはじめにA EventException is thrown when the Event extension methods encounter invalid user input or identify an unrecoverable error. This exception serves as a signal for developers to handle exceptional situations gracefully. クラス概要
EventException
extends
RuntimeException
/* 継承したプロパティ */
protected
string
$message = "";
private
string
$string = "";
protected
int
$code;
protected
string
$file = "";
protected
int
$line;
private
array
$trace = [];
private
Throwablenull
$previous = null;
/* 継承したメソッド */
public Error::__construct(string
$message = "", int $code = 0, Throwablenull $previous = null )final public string Error::getMessage()
final public Throwablenull Error::getPrevious()
final public int Error::getCode()
final public string Error::getFile()
final public int Error::getLine()
final public array Error::getTrace()
final public string Error::getTraceAsString()
public string Error::__toString()
private void Error::__clone()
|