Property definitions

libevent $ NativeBufferEvent :: defaultinit
# 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