libevent  2.2.1
Event notification library
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 
78 #include <event2/visibility.h>
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 #include <event2/event-config.h>
85 #ifdef EVENT__HAVE_SYS_TYPES_H
86 #include <sys/types.h>
87 #endif
88 #ifdef EVENT__HAVE_SYS_TIME_H
89 #include <sys/time.h>
90 #endif
91 
92 /* For int types. */
93 #include <event2/util.h>
94 
101 #define BEV_EVENT_READING 0x01
102 #define BEV_EVENT_WRITING 0x02
103 #define BEV_EVENT_EOF 0x10
104 #define BEV_EVENT_ERROR 0x20
105 #define BEV_EVENT_TIMEOUT 0x40
106 #define BEV_EVENT_CONNECTED 0x80
114 struct bufferevent
115 #ifdef EVENT_IN_DOXYGEN_
116 {}
117 #endif
118 ;
119 struct event_base;
120 struct evbuffer;
121 struct sockaddr;
122 
136 typedef void (*bufferevent_data_cb)(struct bufferevent *bev, void *ctx);
137 
155 typedef void (*bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx);
156 
162 
166 
169 
175 };
176 
190 EVENT2_EXPORT_SYMBOL
191 struct bufferevent *bufferevent_socket_new(struct event_base *base, evutil_socket_t fd, int options);
192 
212 EVENT2_EXPORT_SYMBOL
213 int bufferevent_socket_connect(struct bufferevent *bufev, const struct sockaddr *addr, int socklen);
214 
215 struct evdns_base;
233 EVENT2_EXPORT_SYMBOL
235  struct evdns_base *evdns_base, int family, const char *hostname, int port);
236 
262 EVENT2_EXPORT_SYMBOL
264  struct evdns_base *evdns_base, const struct evutil_addrinfo *hints_in, const char *hostname, int port);
265 
266 
275 EVENT2_EXPORT_SYMBOL
277 
289 EVENT2_EXPORT_SYMBOL
290 int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev);
291 
295 EVENT2_EXPORT_SYMBOL
296 struct event_base *bufferevent_get_base(struct bufferevent *bev);
297 
307 EVENT2_EXPORT_SYMBOL
308 int bufferevent_priority_set(struct bufferevent *bufev, int pri);
309 
315 EVENT2_EXPORT_SYMBOL
316 int bufferevent_get_priority(const struct bufferevent *bufev);
317 
326 EVENT2_EXPORT_SYMBOL
327 void bufferevent_free(struct bufferevent *bufev);
328 
329 
344 EVENT2_EXPORT_SYMBOL
345 void bufferevent_setcb(struct bufferevent *bufev,
347  bufferevent_event_cb eventcb, void *cbarg);
348 
363 EVENT2_EXPORT_SYMBOL
364 void bufferevent_getcb(struct bufferevent *bufev,
365  bufferevent_data_cb *readcb_ptr,
366  bufferevent_data_cb *writecb_ptr,
367  bufferevent_event_cb *eventcb_ptr,
368  void **cbarg_ptr);
369 
377 EVENT2_EXPORT_SYMBOL
378 int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);
379 
389 EVENT2_EXPORT_SYMBOL
390 int bufferevent_replacefd(struct bufferevent *bufev, evutil_socket_t fd);
391 
396 EVENT2_EXPORT_SYMBOL
398 
403 EVENT2_EXPORT_SYMBOL
404 struct bufferevent *bufferevent_get_underlying(struct bufferevent *bufev);
405 
419 EVENT2_EXPORT_SYMBOL
420 int bufferevent_write(struct bufferevent *bufev,
421  const void *data, size_t size);
422 
423 
433 EVENT2_EXPORT_SYMBOL
434 int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf);
435 
436 
448 EVENT2_EXPORT_SYMBOL
449 size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
450 
459 EVENT2_EXPORT_SYMBOL
460 int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf);
461 
471 EVENT2_EXPORT_SYMBOL
472 struct evbuffer *bufferevent_get_input(struct bufferevent *bufev);
473 
486 EVENT2_EXPORT_SYMBOL
487 struct evbuffer *bufferevent_get_output(struct bufferevent *bufev);
488 
497 EVENT2_EXPORT_SYMBOL
498 int bufferevent_enable(struct bufferevent *bufev, short event);
499 
508 EVENT2_EXPORT_SYMBOL
509 int bufferevent_disable(struct bufferevent *bufev, short event);
510 
517 EVENT2_EXPORT_SYMBOL
518 short bufferevent_get_enabled(struct bufferevent *bufev);
519 
546 EVENT2_EXPORT_SYMBOL
547 int bufferevent_set_timeouts(struct bufferevent *bufev,
548  const struct timeval *timeout_read, const struct timeval *timeout_write);
549 
571 EVENT2_EXPORT_SYMBOL
572 void bufferevent_setwatermark(struct bufferevent *bufev, short events,
573  size_t lowmark, size_t highmark);
574 
585 EVENT2_EXPORT_SYMBOL
586 int bufferevent_getwatermark(struct bufferevent *bufev, short events,
587  size_t *lowmark, size_t *highmark);
588 
593 EVENT2_EXPORT_SYMBOL
594 void bufferevent_lock(struct bufferevent *bufev);
595 
600 EVENT2_EXPORT_SYMBOL
601 void bufferevent_unlock(struct bufferevent *bufev);
602 
603 
612 EVENT2_EXPORT_SYMBOL
613 void bufferevent_incref(struct bufferevent *bufev);
614 
626 EVENT2_EXPORT_SYMBOL
627 int bufferevent_decref(struct bufferevent *bufev);
628 
636 
639 
642 };
643 
652 EVENT2_EXPORT_SYMBOL
653 int bufferevent_flush(struct bufferevent *bufev,
654  short iotype,
655  enum bufferevent_flush_mode mode);
656 
664 
667 
668  /* (Note: for internal reasons, these need to be disjoint from
669  * bufferevent_options, except when they mean the same thing. */
670 };
671 
683 EVENT2_EXPORT_SYMBOL
684 void bufferevent_trigger(struct bufferevent *bufev, short iotype,
685  int options);
686 
696 EVENT2_EXPORT_SYMBOL
697 void bufferevent_trigger_event(struct bufferevent *bufev, short what,
698  int options);
699 
710  BEV_OK = 0,
711 
714 
718 };
719 
739  struct evbuffer *src, struct evbuffer *dst, ev_ssize_t dst_limit,
740  enum bufferevent_flush_mode mode, void *ctx);
741 
755 EVENT2_EXPORT_SYMBOL
756 struct bufferevent *
757 bufferevent_filter_new(struct bufferevent *underlying,
758  bufferevent_filter_cb input_filter,
759  bufferevent_filter_cb output_filter,
760  int options,
761  void (*free_context)(void *),
762  void *ctx);
775 EVENT2_EXPORT_SYMBOL
776 int bufferevent_pair_new(struct event_base *base, int options,
777  struct bufferevent *pair[2]);
778 
783 EVENT2_EXPORT_SYMBOL
785 
790 struct ev_token_bucket_cfg;
791 
796 struct bufferevent_rate_limit_group;
797 
799 #define EV_RATE_LIMIT_MAX EV_SSIZE_MAX
800 
817 EVENT2_EXPORT_SYMBOL
818 struct ev_token_bucket_cfg *ev_token_bucket_cfg_new(
819  size_t read_rate, size_t read_burst,
820  size_t write_rate, size_t write_burst,
821  const struct timeval *tick_len);
822 
828 EVENT2_EXPORT_SYMBOL
829 void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg);
830 
842 EVENT2_EXPORT_SYMBOL
844  struct ev_token_bucket_cfg *cfg);
845 
863 EVENT2_EXPORT_SYMBOL
864 struct bufferevent_rate_limit_group *bufferevent_rate_limit_group_new(
865  struct event_base *base,
866  const struct ev_token_bucket_cfg *cfg);
872 EVENT2_EXPORT_SYMBOL
874  struct bufferevent_rate_limit_group *,
875  const struct ev_token_bucket_cfg *);
876 
893 EVENT2_EXPORT_SYMBOL
895  struct bufferevent_rate_limit_group *, size_t);
896 
901 EVENT2_EXPORT_SYMBOL
902 void bufferevent_rate_limit_group_free(struct bufferevent_rate_limit_group *);
903 
914 EVENT2_EXPORT_SYMBOL
916  struct bufferevent_rate_limit_group *g);
917 
919 EVENT2_EXPORT_SYMBOL
921 
931 EVENT2_EXPORT_SYMBOL
932 int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size);
933 
941 EVENT2_EXPORT_SYMBOL
942 int bufferevent_set_max_single_write(struct bufferevent *bev, size_t size);
943 
945 EVENT2_EXPORT_SYMBOL
946 ev_ssize_t bufferevent_get_max_single_read(struct bufferevent *bev);
947 
949 EVENT2_EXPORT_SYMBOL
950 ev_ssize_t bufferevent_get_max_single_write(struct bufferevent *bev);
951 
963 EVENT2_EXPORT_SYMBOL
964 ev_ssize_t bufferevent_get_read_limit(struct bufferevent *bev);
965 EVENT2_EXPORT_SYMBOL
966 ev_ssize_t bufferevent_get_write_limit(struct bufferevent *bev);
969 EVENT2_EXPORT_SYMBOL
970 ev_ssize_t bufferevent_get_max_to_read(struct bufferevent *bev);
971 EVENT2_EXPORT_SYMBOL
972 ev_ssize_t bufferevent_get_max_to_write(struct bufferevent *bev);
973 
974 EVENT2_EXPORT_SYMBOL
975 const struct ev_token_bucket_cfg *bufferevent_get_token_bucket_cfg(const struct bufferevent * bev);
976 
986 EVENT2_EXPORT_SYMBOL
987 ev_ssize_t bufferevent_rate_limit_group_get_read_limit(
988  struct bufferevent_rate_limit_group *);
989 EVENT2_EXPORT_SYMBOL
990 ev_ssize_t bufferevent_rate_limit_group_get_write_limit(
991  struct bufferevent_rate_limit_group *);
1008 EVENT2_EXPORT_SYMBOL
1009 int bufferevent_decrement_read_limit(struct bufferevent *bev, ev_ssize_t decr);
1010 EVENT2_EXPORT_SYMBOL
1011 int bufferevent_decrement_write_limit(struct bufferevent *bev, ev_ssize_t decr);
1027 EVENT2_EXPORT_SYMBOL
1028 int bufferevent_rate_limit_group_decrement_read(
1029  struct bufferevent_rate_limit_group *, ev_ssize_t);
1030 EVENT2_EXPORT_SYMBOL
1031 int bufferevent_rate_limit_group_decrement_write(
1032  struct bufferevent_rate_limit_group *, ev_ssize_t);
1042 EVENT2_EXPORT_SYMBOL
1044  struct bufferevent_rate_limit_group *grp,
1045  ev_uint64_t *total_read_out, ev_uint64_t *total_written_out);
1046 
1052 EVENT2_EXPORT_SYMBOL
1053 void
1055  struct bufferevent_rate_limit_group *grp);
1056 
1057 #ifdef __cplusplus
1058 }
1059 #endif
1060 
1061 #endif /* EVENT2_BUFFEREVENT_H_INCLUDED_ */
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.
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'.
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:161
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_socket_connect_hostname
EVENT2_EXPORT_SYMBOL int bufferevent_socket_connect_hostname(struct bufferevent *bufev, struct evdns_base *evdns_base, int family, const char *hostname, int port)
Resolve the hostname 'hostname' and connect to it as with bufferevent_socket_connect().
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_get_output
EVENT2_EXPORT_SYMBOL struct evbuffer * bufferevent_get_output(struct bufferevent *bufev)
Returns the output buffer.
BEV_TRIG_IGNORE_WATERMARKS
@ BEV_TRIG_IGNORE_WATERMARKS
trigger the callback regardless of the watermarks
Definition: bufferevent.h:663
bufferevent_priority_set
EVENT2_EXPORT_SYMBOL int bufferevent_priority_set(struct bufferevent *bufev, int pri)
Assign a priority to a bufferevent.
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.
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_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:633
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_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_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_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_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_hostname_hints
EVENT2_EXPORT_SYMBOL int bufferevent_socket_connect_hostname_hints(struct bufferevent *bufev, struct evdns_base *evdns_base, const struct evutil_addrinfo *hints_in, const char *hostname, int port)
Resolve the hostname 'hostname' and connect to it as with bufferevent_socket_connect().
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_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_base_set
EVENT2_EXPORT_SYMBOL int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev)
Assign a bufferevent to a specific event_base.
event_base
Structure to hold information and state for a Libevent dispatch loop.
Definition: event.h:219
bufferevent_enable
EVENT2_EXPORT_SYMBOL int bufferevent_enable(struct bufferevent *bufev, short event)
Enable a bufferevent.
bufferevent_trigger_options
bufferevent_trigger_options
Flags for bufferevent_trigger(_event) that modify when and how to trigger the callback.
Definition: bufferevent.h:661
event
Structure to represent a single event.
Definition: event.h:276
BEV_OPT_THREADSAFE
@ BEV_OPT_THREADSAFE
If set, and threading is enabled, operations on this bufferevent are protected by a lock.
Definition: bufferevent.h:165
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.
BEV_FLUSH
@ BEV_FLUSH
want to checkpoint all data sent.
Definition: bufferevent.h:638
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_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_get_input
EVENT2_EXPORT_SYMBOL struct evbuffer * bufferevent_get_input(struct bufferevent *bufev)
Returns the input buffer.
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:738
bufferevent_get_base
EVENT2_EXPORT_SYMBOL struct event_base * bufferevent_get_base(struct bufferevent *bev)
Return the event_base used by a bufferevent.
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
An opaque type for handling buffered IO.
Definition: bufferevent.h:114
bufferevent_lock
EVENT2_EXPORT_SYMBOL void bufferevent_lock(struct bufferevent *bufev)
Acquire the lock on a bufferevent.
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_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_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.
evbuffer
An evbuffer is an opaque data type for efficiently buffering data to be sent or received on the netwo...
Definition: buffer.h:97
bufferevent_get_enabled
EVENT2_EXPORT_SYMBOL short bufferevent_get_enabled(struct bufferevent *bufev)
Return the events that are enabled on a given bufferevent.
bufferevent_socket_connect
EVENT2_EXPORT_SYMBOL int bufferevent_socket_connect(struct bufferevent *bufev, const struct sockaddr *addr, int socklen)
Launch a connect() attempt with a socket-based 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_unlock
EVENT2_EXPORT_SYMBOL void bufferevent_unlock(struct bufferevent *bufev)
Release the lock on 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_get_priority
EVENT2_EXPORT_SYMBOL int bufferevent_get_priority(const struct bufferevent *bufev)
Return the priority of a bufferevent.
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_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_trigger
EVENT2_EXPORT_SYMBOL void bufferevent_trigger(struct bufferevent *bufev, short iotype, int options)
Triggers bufferevent data callbacks.
bufferevent_event_cb
void(* bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx)
An event/error callback for a bufferevent.
Definition: bufferevent.h:155
bufferevent_data_cb
void(* bufferevent_data_cb)(struct bufferevent *bev, void *ctx)
A read or write callback for a bufferevent.
Definition: bufferevent.h:136
bufferevent_trigger_event
EVENT2_EXPORT_SYMBOL void bufferevent_trigger_event(struct bufferevent *bufev, short what, int options)
Triggers the bufferevent event callback.
BEV_FINISHED
@ BEV_FINISHED
encountered EOF on read or done sending data
Definition: bufferevent.h:641
bufferevent_read
EVENT2_EXPORT_SYMBOL size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size)
Read data from a bufferevent buffer.
bufferevent_decref
EVENT2_EXPORT_SYMBOL int bufferevent_decref(struct bufferevent *bufev)
Public interface to manually decrement the reference count of a bufferevent.
BEV_NEED_MORE
@ BEV_NEED_MORE
the filter needs to read more data before output
Definition: bufferevent.h:713
BEV_OPT_UNLOCK_CALLBACKS
@ BEV_OPT_UNLOCK_CALLBACKS
If set, callbacks are executed without locks being held on the bufferevent.
Definition: bufferevent.h:174
bufferevent_replacefd
EVENT2_EXPORT_SYMBOL int bufferevent_replacefd(struct bufferevent *bufev, evutil_socket_t fd)
Replaces the file descriptor on which the bufferevent operates.
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.
BEV_NORMAL
@ BEV_NORMAL
usually set when processing data
Definition: bufferevent.h:635
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_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.
BEV_OPT_DEFER_CALLBACKS
@ BEV_OPT_DEFER_CALLBACKS
If set, callbacks are run deferred in the event loop.
Definition: bufferevent.h:168
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_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_free
EVENT2_EXPORT_SYMBOL void bufferevent_free(struct bufferevent *bufev)
Deallocate the storage associated with a bufferevent structure.
bufferevent_options
bufferevent_options
Options that can be specified when creating a bufferevent.
Definition: bufferevent.h:158
BEV_ERROR
@ BEV_ERROR
the filter encountered a critical error, no further data can be processed.
Definition: bufferevent.h:717
BEV_OK
@ BEV_OK
everything is okay
Definition: bufferevent.h:710
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
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'.
evutil_addrinfo
A definition of struct addrinfo for systems that lack it.
Definition: util.h:731
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_filter_result
bufferevent_filter_result
Values that filters can return.
Definition: bufferevent.h:708
bufferevent_write
EVENT2_EXPORT_SYMBOL int bufferevent_write(struct bufferevent *bufev, const void *data, size_t size)
Write data to a bufferevent buffer.
bufferevent_disable
EVENT2_EXPORT_SYMBOL int bufferevent_disable(struct bufferevent *bufev, short event)
Disable a bufferevent.
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.
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition: util.h:325
BEV_TRIG_DEFER_CALLBACKS
@ BEV_TRIG_DEFER_CALLBACKS
defer even if the callbacks are not
Definition: bufferevent.h:666