libevent :: NativeBufferEvent :: input_buffer
The input buffer associated toself
libevent :: NativeBufferEvent :: output_buffer
The output buffer associated toself
libevent :: NativeBufferEvent :: read_buffer
Read data from this bufferlibevent :: NativeBufferEvent :: setcb
Set callbacks toread_callback_native
, write_callback
and event_callback
of conn
libevent :: NativeBufferEvent :: socket
Socket-basedNativeBufferEvent
that reads and writes data onto a network
libevent :: NativeBufferEvent :: write_buffer
Write data to this bufferlibevent $ NativeBufferEvent :: SELF
Type of this instance, automatically specialized in every classcore :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Pointer :: defaultinit
core :: Object :: defaultinit
libevent :: NativeBufferEvent :: input_buffer
The input buffer associated toself
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Pointer :: native_equals
libevent :: NativeBufferEvent :: output_buffer
The output buffer associated toself
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Pointer :: premultiply_alpha
Multiply RGB values by their alpha valuelibevent :: NativeBufferEvent :: read_buffer
Read data from this bufferlibevent :: NativeBufferEvent :: setcb
Set callbacks toread_callback_native
, write_callback
and event_callback
of conn
libevent :: NativeBufferEvent :: socket
Socket-basedNativeBufferEvent
that reads and writes data onto a network
libevent :: NativeBufferEvent :: write_buffer
Write data to this buffer
# A buffer event structure, strongly associated to a connection, an input buffer and an output_buffer
extern class NativeBufferEvent `{ struct bufferevent * `}
# Socket-based `NativeBufferEvent` that reads and writes data onto a network
new socket(base: NativeEventBase, fd, options: Int) `{
return bufferevent_socket_new(base, fd, options);
`}
# Enable a bufferevent.
fun enable(operation: Int) `{
bufferevent_enable(self, operation);
`}
# Set callbacks to `read_callback_native`, `write_callback` and `event_callback` of `conn`
fun setcb(conn: Connection) import Connection.read_callback_native,
Connection.write_callback, Connection.event_callback, CString `{
Connection_incr_ref(conn);
bufferevent_setcb(self,
(bufferevent_data_cb)c_read_cb,
(bufferevent_data_cb)c_write_cb,
(bufferevent_event_cb)c_event_cb, conn);
`}
# Write `length` bytes of `line`
fun write(line: CString, length: Int): Int `{
return bufferevent_write(self, line, length);
`}
# Write the byte `value`
fun write_byte(value: Int): Int `{
unsigned char byt = (unsigned char)value;
return bufferevent_write(self, &byt, 1);
`}
redef fun free `{ bufferevent_free(self); `}
# The output buffer associated to `self`
fun output_buffer: OutputNativeEvBuffer `{ return bufferevent_get_output(self); `}
# The input buffer associated to `self`
fun input_buffer: InputNativeEvBuffer `{ return bufferevent_get_input(self); `}
# Read data from this buffer
fun read_buffer(buf: NativeEvBuffer): Int `{ return bufferevent_read_buffer(self, buf); `}
# Write data to this buffer
fun write_buffer(buf: NativeEvBuffer): Int `{ return bufferevent_write_buffer(self, buf); `}
end
lib/libevent/libevent.nit:341,1--388,3