The EventBuffer class
EventBuffer represents Libevent's "evbuffer", an utility functionality for buffered I/O.
Intro
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
Properties
lengthThe number of bytes stored in an event buffer.
contiguous_spaceThe 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_ANYThe 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_CRLFThe 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_STRICTThe end of a line is a single carriage return, followed by a single linefeed. (This is also known as
"\r\n". The ASCII values are0x0D0x0A).EventBuffer::EOL_LFThe end of a line is a single linefeed character. (This is also known as
"\n". It is ASCII value is0x0A.)EventBuffer::PTR_SETFlag used as argument of
EventBuffer::setPositionmethod. If this flag specified, the position pointer is moved to an absolute position within the buffer.EventBuffer::PTR_ADDThe same as
EventBuffer::PTR_SET, except this flag causesEventBuffer::setPositionmethod to move position forward up to the specified number of bytes(instead of setting absolute position).
Eventbuffer