Libevent Code Doxygen document
bufferevent_struct.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_STRUCT_H_INCLUDED_
28 #define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
29 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #include <event2/event-config.h>
45 #ifdef EVENT__HAVE_SYS_TYPES_H
46 #include <sys/types.h>
47 #endif
48 #ifdef EVENT__HAVE_SYS_TIME_H
49 #include <sys/time.h>
50 #endif
51 
52 /* For int types. */
53 #include <event2/util.h>
54 /* For struct event */
55 #include <event2/event_struct.h>
56 
58  size_t low;
59  size_t high;
60 };
61 
70 struct bufferevent {
75  const struct bufferevent_ops *be_ops;
76 
80  struct event ev_read;
84  struct event ev_write;
85 
88  struct evbuffer *input;
89 
92  struct evbuffer *output;
93 
94  struct event_watermark wm_read;
95  struct event_watermark wm_write;
96 
97  bufferevent_data_cb readcb;
98  bufferevent_data_cb writecb;
99  /* This should be called 'eventcb', but renaming it would break
100  * backward compatibility */
101  bufferevent_event_cb errorcb;
102  void *cbarg;
103 
104  struct timeval timeout_read;
105  struct timeval timeout_write;
106 
109  short enabled;
110 };
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
void(* bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx)
Definition: bufferevent.h:150
void(* bufferevent_data_cb)(struct bufferevent *bev, void *ctx)
Definition: bufferevent.h:131
Definition: bufferevent-internal.h:253
Definition: bufferevent_struct.h:70
short enabled
Definition: bufferevent_struct.h:109
struct event ev_write
Definition: bufferevent_struct.h:84
struct event ev_read
Definition: bufferevent_struct.h:80
const struct bufferevent_ops * be_ops
Definition: bufferevent_struct.h:75
struct evbuffer * input
Definition: bufferevent_struct.h:88
struct event_base * ev_base
Definition: bufferevent_struct.h:72
struct evbuffer * output
Definition: bufferevent_struct.h:92
Definition: evbuffer-internal.h:80
Definition: event-internal.h:208
Definition: bufferevent_struct.h:57
Definition: event_struct.h:123