transmission: update from 2.13 to 2.22
[tomato.git] / release / src / router / libevent / include / event2 / bufferevent_struct.h
blob5626e968f59c785b01bcbc540aad6edc6e764456
1 /*
2 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3 * Copyright (c) 2007-2010 Niels Provos and Nick Mathewson
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.
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.
27 #ifndef _EVENT2_BUFFEREVENT_STRUCT_H_
28 #define _EVENT2_BUFFEREVENT_STRUCT_H_
30 /** @file bufferevent_struct.h
32 Data structures for bufferevents. Using these structures may hurt forward
33 compatibility with later versions of Libevent: be careful!
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 #include <event2/event-config.h>
42 #ifdef _EVENT_HAVE_SYS_TYPES_H
43 #include <sys/types.h>
44 #endif
45 #ifdef _EVENT_HAVE_SYS_TIME_H
46 #include <sys/time.h>
47 #endif
49 /* For int types. */
50 #include <event2/util.h>
51 /* For struct event */
52 #include <event2/event_struct.h>
54 struct event_watermark {
55 size_t low;
56 size_t high;
59 /**
60 Shared implementation of a bufferevent.
62 This type is exposed only because it was exposed in previous versions,
63 and some people's code may rely on manipulating it. Otherwise, you
64 should really not rely on the layout, size, or contents of this structure:
65 it is fairly volatile, and WILL change in future versions of the code.
66 **/
67 struct bufferevent {
68 /** Event base for which this bufferevent was created. */
69 struct event_base *ev_base;
70 /** Pointer to a table of function pointers to set up how this
71 bufferevent behaves. */
72 const struct bufferevent_ops *be_ops;
74 /** A read event that triggers when a timeout has happened or a socket
75 is ready to read data. Only used by some subtypes of
76 bufferevent. */
77 struct event ev_read;
78 /** A write event that triggers when a timeout has happened or a socket
79 is ready to write data. Only used by some subtypes of
80 bufferevent. */
81 struct event ev_write;
83 /** An input buffer. Only the bufferevent is allowed to add data to
84 this buffer, though the user is allowed to drain it. */
85 struct evbuffer *input;
87 /** An input buffer. Only the bufferevent is allowed to drain data
88 from this buffer, though the user is allowed to add it. */
89 struct evbuffer *output;
91 struct event_watermark wm_read;
92 struct event_watermark wm_write;
94 bufferevent_data_cb readcb;
95 bufferevent_data_cb writecb;
96 /* This should be called 'eventcb', but renaming it would break
97 * backward compatibility */
98 bufferevent_event_cb errorcb;
99 void *cbarg;
101 struct timeval timeout_read;
102 struct timeval timeout_write;
104 /** Events that are currently enabled: currently EV_READ and EV_WRITE
105 are supported. */
106 short enabled;
109 #ifdef __cplusplus
111 #endif
113 #endif /* _EVENT2_BUFFEREVENT_STRUCT_H_ */