libevent 2.1.13 Event notification library

Loading...
Searching...
No Matches
bufferevent.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27#ifndef EVENT2_BUFFEREVENT_H_INCLUDED_
28#define EVENT2_BUFFEREVENT_H_INCLUDED_
29
76
77#include <event2/visibility.h>
78
79#ifdef __cplusplus
80 extern "C" {
81#endif
82
83#include <event2/event-config.h>
84#ifdef EVENT__HAVE_SYS_TYPES_H
85#include <sys/types.h>
86#endif
87#ifdef EVENT__HAVE_SYS_TIME_H
88#include <sys/time.h>
89#endif
90
91/* For int types. */
92#include <event2/util.h>
93
100#define BEV_EVENT_READING 0x01
101#define BEV_EVENT_WRITING 0x02
102#define BEV_EVENT_EOF 0x10
103#define BEV_EVENT_ERROR 0x20
104#define BEV_EVENT_TIMEOUT 0x40
105#define BEV_EVENT_CONNECTED 0x80
107
113 struct bufferevent
114#ifdef EVENT_IN_DOXYGEN_
115{}
116#endif
117;
118 struct event_base;
119 struct evbuffer;
120 struct sockaddr;
121
135 typedef void (*bufferevent_data_cb)(struct bufferevent *bev, void *ctx);
136
154 typedef void (*bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx);
155
157 enum bufferevent_options {
160 BEV_OPT_CLOSE_ON_FREE = (1<<0),
161
164 BEV_OPT_THREADSAFE = (1<<1),
165
167 BEV_OPT_DEFER_CALLBACKS = (1<<2),
168
173 BEV_OPT_UNLOCK_CALLBACKS = (1<<3)
174};
175
189EVENT2_EXPORT_SYMBOL
190 struct bufferevent *bufferevent_socket_new(struct event_base *base, evutil_socket_t fd, int options);
191
211EVENT2_EXPORT_SYMBOL
212 int bufferevent_socket_connect(struct bufferevent *, const struct sockaddr *, int);
213
214 struct evdns_base;
241EVENT2_EXPORT_SYMBOL
242 int bufferevent_socket_connect_hostname(struct bufferevent *,
243 struct evdns_base *, int, const char *, int);
244
253EVENT2_EXPORT_SYMBOL
254 int bufferevent_socket_get_dns_error(struct bufferevent *bev);
255
267EVENT2_EXPORT_SYMBOL
268 int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev);
269
273EVENT2_EXPORT_SYMBOL
274 struct event_base *bufferevent_get_base(struct bufferevent *bev);
275
285EVENT2_EXPORT_SYMBOL
286 int bufferevent_priority_set(struct bufferevent *bufev, int pri);
287
293EVENT2_EXPORT_SYMBOL
294 int bufferevent_get_priority(const struct bufferevent *bufev);
295
304EVENT2_EXPORT_SYMBOL
305 void bufferevent_free(struct bufferevent *bufev);
306
307
322EVENT2_EXPORT_SYMBOL
323 void bufferevent_setcb(struct bufferevent *bufev,
324 bufferevent_data_cb readcb, bufferevent_data_cb writecb,
325 bufferevent_event_cb eventcb, void *cbarg);
326
341EVENT2_EXPORT_SYMBOL
342 void bufferevent_getcb(struct bufferevent *bufev,
343 bufferevent_data_cb *readcb_ptr,
344 bufferevent_data_cb *writecb_ptr,
345 bufferevent_event_cb *eventcb_ptr,
346 void **cbarg_ptr);
347
355EVENT2_EXPORT_SYMBOL
356 int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);
357
362EVENT2_EXPORT_SYMBOL
363 evutil_socket_t bufferevent_getfd(struct bufferevent *bufev);
364
369EVENT2_EXPORT_SYMBOL
370 struct bufferevent *bufferevent_get_underlying(struct bufferevent *bufev);
371
385EVENT2_EXPORT_SYMBOL
386 int bufferevent_write(struct bufferevent *bufev,
387 const void *data, size_t size);
388
389
399EVENT2_EXPORT_SYMBOL
400 int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf);
401
402
413EVENT2_EXPORT_SYMBOL
414 size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
415
424EVENT2_EXPORT_SYMBOL
425 int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf);
426
435
436EVENT2_EXPORT_SYMBOL
437 struct evbuffer *bufferevent_get_input(struct bufferevent *bufev);
438
450
451EVENT2_EXPORT_SYMBOL
452 struct evbuffer *bufferevent_get_output(struct bufferevent *bufev);
453
462EVENT2_EXPORT_SYMBOL
463 int bufferevent_enable(struct bufferevent *bufev, short event);
464
473EVENT2_EXPORT_SYMBOL
474 int bufferevent_disable(struct bufferevent *bufev, short event);
475
482EVENT2_EXPORT_SYMBOL
483 short bufferevent_get_enabled(struct bufferevent *bufev);
484
511EVENT2_EXPORT_SYMBOL
512 int bufferevent_set_timeouts(struct bufferevent *bufev,
513 const struct timeval *timeout_read, const struct timeval *timeout_write);
514
535
536EVENT2_EXPORT_SYMBOL
537 void bufferevent_setwatermark(struct bufferevent *bufev, short events,
538 size_t lowmark, size_t highmark);
539
550EVENT2_EXPORT_SYMBOL
551 int bufferevent_getwatermark(struct bufferevent *bufev, short events,
552 size_t *lowmark, size_t *highmark);
553
558EVENT2_EXPORT_SYMBOL
559 void bufferevent_lock(struct bufferevent *bufev);
560
565EVENT2_EXPORT_SYMBOL
566 void bufferevent_unlock(struct bufferevent *bufev);
567
568
577EVENT2_EXPORT_SYMBOL
578 void bufferevent_incref(struct bufferevent *bufev);
579
591EVENT2_EXPORT_SYMBOL
592 int bufferevent_decref(struct bufferevent *bufev);
593
598 enum bufferevent_flush_mode {
600 BEV_NORMAL = 0,
601
603 BEV_FLUSH = 1,
604
606 BEV_FINISHED = 2
607};
608
617EVENT2_EXPORT_SYMBOL
618 int bufferevent_flush(struct bufferevent *bufev,
619 short iotype,
620 enum bufferevent_flush_mode mode);
621
626 enum bufferevent_trigger_options {
628 BEV_TRIG_IGNORE_WATERMARKS = (1<<16),
629
631 BEV_TRIG_DEFER_CALLBACKS = BEV_OPT_DEFER_CALLBACKS
632
633 /* (Note: for internal reasons, these need to be disjoint from
634 * bufferevent_options, except when they mean the same thing. */
635};
636
648EVENT2_EXPORT_SYMBOL
649 void bufferevent_trigger(struct bufferevent *bufev, short iotype,
650 int options);
651
661EVENT2_EXPORT_SYMBOL
662 void bufferevent_trigger_event(struct bufferevent *bufev, short what,
663 int options);
664
673 enum bufferevent_filter_result {
675 BEV_OK = 0,
676
678 BEV_NEED_MORE = 1,
679
682 BEV_ERROR = 2
683};
684
703 typedef enum bufferevent_filter_result (*bufferevent_filter_cb)(
704 struct evbuffer *src, struct evbuffer *dst, ev_ssize_t dst_limit,
705 enum bufferevent_flush_mode mode, void *ctx);
706
720EVENT2_EXPORT_SYMBOL
721 struct bufferevent *
722 bufferevent_filter_new(struct bufferevent *underlying,
723 bufferevent_filter_cb input_filter,
724 bufferevent_filter_cb output_filter,
725 int options,
726 void (*free_context)(void *),
727 void *ctx);
729
740EVENT2_EXPORT_SYMBOL
741 int bufferevent_pair_new(struct event_base *base, int options,
742 struct bufferevent *pair[2]);
743
748EVENT2_EXPORT_SYMBOL
749 struct bufferevent *bufferevent_pair_get_partner(struct bufferevent *bev);
750
755 struct ev_token_bucket_cfg;
756
761 struct bufferevent_rate_limit_group;
762
764#define EV_RATE_LIMIT_MAX EV_SSIZE_MAX
765
782EVENT2_EXPORT_SYMBOL
783 struct ev_token_bucket_cfg *ev_token_bucket_cfg_new(
784 size_t read_rate, size_t read_burst,
785 size_t write_rate, size_t write_burst,
786 const struct timeval *tick_len);
787
793EVENT2_EXPORT_SYMBOL
794 void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg);
795
807EVENT2_EXPORT_SYMBOL
808 int bufferevent_set_rate_limit(struct bufferevent *bev,
809 struct ev_token_bucket_cfg *cfg);
810
828EVENT2_EXPORT_SYMBOL
829 struct bufferevent_rate_limit_group *bufferevent_rate_limit_group_new(
830 struct event_base *base,
831 const struct ev_token_bucket_cfg *cfg);
837EVENT2_EXPORT_SYMBOL
838 int bufferevent_rate_limit_group_set_cfg(
839 struct bufferevent_rate_limit_group *,
840 const struct ev_token_bucket_cfg *);
841
858EVENT2_EXPORT_SYMBOL
859 int bufferevent_rate_limit_group_set_min_share(
860 struct bufferevent_rate_limit_group *, size_t);
861
866EVENT2_EXPORT_SYMBOL
867 void bufferevent_rate_limit_group_free(struct bufferevent_rate_limit_group *);
868
879EVENT2_EXPORT_SYMBOL
880 int bufferevent_add_to_rate_limit_group(struct bufferevent *bev,
881 struct bufferevent_rate_limit_group *g);
882
884EVENT2_EXPORT_SYMBOL
885 int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev);
886
894EVENT2_EXPORT_SYMBOL
895 int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size);
896
904EVENT2_EXPORT_SYMBOL
905 int bufferevent_set_max_single_write(struct bufferevent *bev, size_t size);
906
908EVENT2_EXPORT_SYMBOL
909ev_ssize_t bufferevent_get_max_single_read(struct bufferevent *bev);
910
912EVENT2_EXPORT_SYMBOL
913ev_ssize_t bufferevent_get_max_single_write(struct bufferevent *bev);
914
926EVENT2_EXPORT_SYMBOL
927ev_ssize_t bufferevent_get_read_limit(struct bufferevent *bev);
928EVENT2_EXPORT_SYMBOL
929ev_ssize_t bufferevent_get_write_limit(struct bufferevent *bev);
931
932EVENT2_EXPORT_SYMBOL
933ev_ssize_t bufferevent_get_max_to_read(struct bufferevent *bev);
934EVENT2_EXPORT_SYMBOL
935ev_ssize_t bufferevent_get_max_to_write(struct bufferevent *bev);
936
937EVENT2_EXPORT_SYMBOL
938 const struct ev_token_bucket_cfg *bufferevent_get_token_bucket_cfg(const struct bufferevent * bev);
939
949EVENT2_EXPORT_SYMBOL
950ev_ssize_t bufferevent_rate_limit_group_get_read_limit(
951 struct bufferevent_rate_limit_group *);
952EVENT2_EXPORT_SYMBOL
953ev_ssize_t bufferevent_rate_limit_group_get_write_limit(
954 struct bufferevent_rate_limit_group *);
956
971EVENT2_EXPORT_SYMBOL
972 int bufferevent_decrement_read_limit(struct bufferevent *bev, ev_ssize_t decr);
973EVENT2_EXPORT_SYMBOL
974 int bufferevent_decrement_write_limit(struct bufferevent *bev, ev_ssize_t decr);
976
990EVENT2_EXPORT_SYMBOL
991 int bufferevent_rate_limit_group_decrement_read(
992 struct bufferevent_rate_limit_group *, ev_ssize_t);
993EVENT2_EXPORT_SYMBOL
994 int bufferevent_rate_limit_group_decrement_write(
995 struct bufferevent_rate_limit_group *, ev_ssize_t);
997
998
1005EVENT2_EXPORT_SYMBOL
1006 void bufferevent_rate_limit_group_get_totals(
1007 struct bufferevent_rate_limit_group *grp,
1008 ev_uint64_t *total_read_out, ev_uint64_t *total_written_out);
1009
1015EVENT2_EXPORT_SYMBOL
1016 void
1017 bufferevent_rate_limit_group_reset_totals(
1018 struct bufferevent_rate_limit_group *grp);
1019
1020#ifdef __cplusplus
1021}
1022#endif
1023
1024#endif /* EVENT2_BUFFEREVENT_H_INCLUDED_ */
bufferevent_get_priority
EVENT2_EXPORT_SYMBOL int bufferevent_get_priority(const struct bufferevent *bufev)
Return the priority of a bufferevent.
bufferevent_setcb
EVENT2_EXPORT_SYMBOL void bufferevent_setcb(struct bufferevent *bufev, bufferevent_data_cb readcb, bufferevent_data_cb writecb, bufferevent_event_cb eventcb, void *cbarg)
Changes the callbacks for a bufferevent.
bufferevent_rate_limit_group_reset_totals
EVENT2_EXPORT_SYMBOL void bufferevent_rate_limit_group_reset_totals(struct bufferevent_rate_limit_group *grp)
Reset the total bytes read/written on a group.
bufferevent_rate_limit_group_new
EVENT2_EXPORT_SYMBOL struct bufferevent_rate_limit_group * bufferevent_rate_limit_group_new(struct event_base *base, const struct ev_token_bucket_cfg *cfg)
Create a new rate-limit group for bufferevents.
bufferevent_filter_result
bufferevent_filter_result
Values that filters can return.
Definition bufferevent.h:673
BEV_ERROR
@ BEV_ERROR
the filter encountered a critical error, no further data can be processed.
Definition bufferevent.h:682
BEV_NEED_MORE
@ BEV_NEED_MORE
the filter needs to read more data before output
Definition bufferevent.h:678
BEV_OK
@ BEV_OK
everything is okay
Definition bufferevent.h:675
bufferevent_unlock
EVENT2_EXPORT_SYMBOL void bufferevent_unlock(struct bufferevent *bufev)
Release the lock on a bufferevent.
bufferevent_rate_limit_group_set_cfg
EVENT2_EXPORT_SYMBOL int bufferevent_rate_limit_group_set_cfg(struct bufferevent_rate_limit_group *, const struct ev_token_bucket_cfg *)
Change the rate-limiting settings for a given rate-limiting group.
bufferevent_incref
EVENT2_EXPORT_SYMBOL void bufferevent_incref(struct bufferevent *bufev)
Public interface to manually increase the reference count of a bufferevent this is useful in situatio...
bufferevent_priority_set
EVENT2_EXPORT_SYMBOL int bufferevent_priority_set(struct bufferevent *bufev, int pri)
Assign a priority to a bufferevent.
bufferevent_get_output
EVENT2_EXPORT_SYMBOL struct evbuffer * bufferevent_get_output(struct bufferevent *bufev)
Returns the output buffer.
bufferevent_get_max_single_read
EVENT2_EXPORT_SYMBOL ev_ssize_t bufferevent_get_max_single_read(struct bufferevent *bev)
Get the current size limit for single read operation.
bufferevent_decref
EVENT2_EXPORT_SYMBOL int bufferevent_decref(struct bufferevent *bufev)
Public interface to manually decrement the reference count of a bufferevent.
bufferevent_remove_from_rate_limit_group
EVENT2_EXPORT_SYMBOL int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev)
Remove 'bev' from its current rate-limit group (if any).
bufferevent_event_cb
void(* bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx)
An event/error callback for a bufferevent.
Definition bufferevent.h:154
bufferevent_rate_limit_group_set_min_share
EVENT2_EXPORT_SYMBOL int bufferevent_rate_limit_group_set_min_share(struct bufferevent_rate_limit_group *, size_t)
Change the smallest quantum we're willing to allocate to any single bufferevent in a group for readin...
bufferevent_add_to_rate_limit_group
EVENT2_EXPORT_SYMBOL int bufferevent_add_to_rate_limit_group(struct bufferevent *bev, struct bufferevent_rate_limit_group *g)
Add 'bev' to the list of bufferevents whose aggregate reading and writing is restricted by 'g'.
bufferevent_get_base
EVENT2_EXPORT_SYMBOL struct event_base * bufferevent_get_base(struct bufferevent *bev)
Return the event_base used by a bufferevent.
bufferevent_flush
EVENT2_EXPORT_SYMBOL int bufferevent_flush(struct bufferevent *bufev, short iotype, enum bufferevent_flush_mode mode)
Triggers the bufferevent to produce more data if possible.
bufferevent_disable
EVENT2_EXPORT_SYMBOL int bufferevent_disable(struct bufferevent *bufev, short event)
Disable a bufferevent.
bufferevent_getfd
EVENT2_EXPORT_SYMBOL evutil_socket_t bufferevent_getfd(struct bufferevent *bufev)
Returns the file descriptor associated with a bufferevent, or -1 if no file descriptor is associated ...
bufferevent_rate_limit_group_free
EVENT2_EXPORT_SYMBOL void bufferevent_rate_limit_group_free(struct bufferevent_rate_limit_group *)
Free a rate-limiting group.
bufferevent_socket_connect
EVENT2_EXPORT_SYMBOL int bufferevent_socket_connect(struct bufferevent *, const struct sockaddr *, int)
Launch a connect() attempt with a socket-based bufferevent.
bufferevent_setfd
EVENT2_EXPORT_SYMBOL int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd)
Changes the file descriptor on which the bufferevent operates.
bufferevent_pair_get_partner
EVENT2_EXPORT_SYMBOL struct bufferevent * bufferevent_pair_get_partner(struct bufferevent *bev)
Given one bufferevent returned by bufferevent_pair_new(), returns the other one if it still exists.
bufferevent_filter_new
EVENT2_EXPORT_SYMBOL struct bufferevent * bufferevent_filter_new(struct bufferevent *underlying, bufferevent_filter_cb input_filter, bufferevent_filter_cb output_filter, int options, void(*free_context)(void *), void *ctx)
Allocate a new filtering bufferevent on top of an existing bufferevent.
bufferevent_trigger_options
bufferevent_trigger_options
Flags for bufferevent_trigger(_event) that modify when and how to trigger the callback.
Definition bufferevent.h:626
BEV_TRIG_IGNORE_WATERMARKS
@ BEV_TRIG_IGNORE_WATERMARKS
trigger the callback regardless of the watermarks
Definition bufferevent.h:628
BEV_TRIG_DEFER_CALLBACKS
@ BEV_TRIG_DEFER_CALLBACKS
defer even if the callbacks are not
Definition bufferevent.h:631
bufferevent_write
EVENT2_EXPORT_SYMBOL int bufferevent_write(struct bufferevent *bufev, const void *data, size_t size)
Write data to a bufferevent buffer.
ev_token_bucket_cfg_free
EVENT2_EXPORT_SYMBOL void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg)
Free all storage held in 'cfg'.
ev_token_bucket_cfg_new
EVENT2_EXPORT_SYMBOL struct ev_token_bucket_cfg * ev_token_bucket_cfg_new(size_t read_rate, size_t read_burst, size_t write_rate, size_t write_burst, const struct timeval *tick_len)
Initialize and return a new object to configure the rate-limiting behavior of bufferevents.
bufferevent_lock
EVENT2_EXPORT_SYMBOL void bufferevent_lock(struct bufferevent *bufev)
Acquire the lock on a bufferevent.
bufferevent_free
EVENT2_EXPORT_SYMBOL void bufferevent_free(struct bufferevent *bufev)
Deallocate the storage associated with a bufferevent structure.
bufferevent_set_max_single_write
EVENT2_EXPORT_SYMBOL int bufferevent_set_max_single_write(struct bufferevent *bev, size_t size)
Set the size limit for single write operation.
bufferevent_read
EVENT2_EXPORT_SYMBOL size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size)
Read data from a bufferevent buffer.
bufferevent_options
bufferevent_options
Options that can be specified when creating a bufferevent.
Definition bufferevent.h:157
BEV_OPT_DEFER_CALLBACKS
@ BEV_OPT_DEFER_CALLBACKS
If set, callbacks are run deferred in the event loop.
Definition bufferevent.h:167
BEV_OPT_CLOSE_ON_FREE
@ BEV_OPT_CLOSE_ON_FREE
If set, we close the underlying file descriptor/bufferevent/whatever when this bufferevent is freed.
Definition bufferevent.h:160
BEV_OPT_UNLOCK_CALLBACKS
@ BEV_OPT_UNLOCK_CALLBACKS
If set, callbacks are executed without locks being held on the bufferevent.
Definition bufferevent.h:173
BEV_OPT_THREADSAFE
@ BEV_OPT_THREADSAFE
If set, and threading is enabled, operations on this bufferevent are protected by a lock.
Definition bufferevent.h:164
bufferevent_socket_get_dns_error
EVENT2_EXPORT_SYMBOL int bufferevent_socket_get_dns_error(struct bufferevent *bev)
Return the error code for the last failed DNS lookup attempt made by bufferevent_socket_connect_hostn...
bufferevent_enable
EVENT2_EXPORT_SYMBOL int bufferevent_enable(struct bufferevent *bufev, short event)
Enable a bufferevent.
bufferevent_get_enabled
EVENT2_EXPORT_SYMBOL short bufferevent_get_enabled(struct bufferevent *bufev)
Return the events that are enabled on a given bufferevent.
bufferevent_read_buffer
EVENT2_EXPORT_SYMBOL int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf)
Read data from a bufferevent buffer into an evbuffer.
bufferevent_flush_mode
bufferevent_flush_mode
Flags that can be passed into filters to let them know how to deal with the incoming data.
Definition bufferevent.h:598
BEV_FLUSH
@ BEV_FLUSH
want to checkpoint all data sent.
Definition bufferevent.h:603
BEV_NORMAL
@ BEV_NORMAL
usually set when processing data
Definition bufferevent.h:600
BEV_FINISHED
@ BEV_FINISHED
encountered EOF on read or done sending data
Definition bufferevent.h:606
bufferevent_set_max_single_read
EVENT2_EXPORT_SYMBOL int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size)
Set the size limit for single read operation.
bufferevent_pair_new
EVENT2_EXPORT_SYMBOL int bufferevent_pair_new(struct event_base *base, int options, struct bufferevent *pair[2])
Allocate a pair of linked bufferevents.
bufferevent_rate_limit_group_get_totals
EVENT2_EXPORT_SYMBOL void bufferevent_rate_limit_group_get_totals(struct bufferevent_rate_limit_group *grp, ev_uint64_t *total_read_out, ev_uint64_t *total_written_out)
Inspect the total bytes read/written on a group.
bufferevent_write_buffer
EVENT2_EXPORT_SYMBOL int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf)
Write data from an evbuffer to a bufferevent buffer.
bufferevent_get_max_single_write
EVENT2_EXPORT_SYMBOL ev_ssize_t bufferevent_get_max_single_write(struct bufferevent *bev)
Get the current size limit for single write operation.
bufferevent_base_set
EVENT2_EXPORT_SYMBOL int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev)
Assign a bufferevent to a specific event_base.
bufferevent_socket_new
EVENT2_EXPORT_SYMBOL struct bufferevent * bufferevent_socket_new(struct event_base *base, evutil_socket_t fd, int options)
Create a new socket bufferevent over an existing socket.
bufferevent_get_underlying
EVENT2_EXPORT_SYMBOL struct bufferevent * bufferevent_get_underlying(struct bufferevent *bufev)
Returns the underlying bufferevent associated with a bufferevent (if the bufferevent is a wrapper),...
bufferevent_data_cb
void(* bufferevent_data_cb)(struct bufferevent *bev, void *ctx)
A read or write callback for a bufferevent.
Definition bufferevent.h:135
bufferevent_set_rate_limit
EVENT2_EXPORT_SYMBOL int bufferevent_set_rate_limit(struct bufferevent *bev, struct ev_token_bucket_cfg *cfg)
Set the rate-limit of a the bufferevent 'bev' to the one specified in 'cfg'.
bufferevent_filter_cb
enum bufferevent_filter_result(* bufferevent_filter_cb)(struct evbuffer *src, struct evbuffer *dst, ev_ssize_t dst_limit, enum bufferevent_flush_mode mode, void *ctx)
A callback function to implement a filter for a bufferevent.
Definition bufferevent.h:703
bufferevent_setwatermark
EVENT2_EXPORT_SYMBOL void bufferevent_setwatermark(struct bufferevent *bufev, short events, size_t lowmark, size_t highmark)
Sets the watermarks for read and write events.
bufferevent_getwatermark
EVENT2_EXPORT_SYMBOL int bufferevent_getwatermark(struct bufferevent *bufev, short events, size_t *lowmark, size_t *highmark)
Retrieves the watermarks for read or write events.
bufferevent_trigger
EVENT2_EXPORT_SYMBOL void bufferevent_trigger(struct bufferevent *bufev, short iotype, int options)
Triggers bufferevent data callbacks.
bufferevent_get_input
EVENT2_EXPORT_SYMBOL struct evbuffer * bufferevent_get_input(struct bufferevent *bufev)
Returns the input buffer.
bufferevent_getcb
EVENT2_EXPORT_SYMBOL void bufferevent_getcb(struct bufferevent *bufev, bufferevent_data_cb *readcb_ptr, bufferevent_data_cb *writecb_ptr, bufferevent_event_cb *eventcb_ptr, void **cbarg_ptr)
Retrieves the callbacks for a bufferevent.
bufferevent_trigger_event
EVENT2_EXPORT_SYMBOL void bufferevent_trigger_event(struct bufferevent *bufev, short what, int options)
Triggers the bufferevent event callback.
bufferevent_set_timeouts
EVENT2_EXPORT_SYMBOL int bufferevent_set_timeouts(struct bufferevent *bufev, const struct timeval *timeout_read, const struct timeval *timeout_write)
Set the read and write timeout for a bufferevent.
bufferevent_socket_connect_hostname
EVENT2_EXPORT_SYMBOL int bufferevent_socket_connect_hostname(struct bufferevent *, struct evdns_base *, int, const char *, int)
Resolve the hostname 'hostname' and connect to it as with bufferevent_socket_connect().
bufferevent
An opaque type for handling buffered IO.
Definition bufferevent.h:115
evbuffer
An evbuffer is an opaque data type for efficiently buffering data to be sent or received on the netwo...
Definition buffer.h:99
event_base
Structure to hold information and state for a Libevent dispatch loop.
Definition event.h:219
event
Structure to represent a single event.
Definition event.h:278
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition util.h:310