OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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-2010 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_
28 #define _EVENT2_BUFFEREVENT_STRUCT_H_
29
30 /** @file event2/bufferevent_struct.h
31
32 Data structures for bufferevents. Using these structures may hurt forward
33 compatibility with later versions of Libevent: be careful!
34
35 @deprecated Use of bufferevent_struct.h is completely deprecated; these
36 structures are only exposed for backward compatibility with programs
37 written before Libevent 2.0 that used them.
38 */
39
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
57 struct event_watermark {
58 size_t low;
59 size_t high;
60 };
61
62 /**
63 Shared implementation of a bufferevent.
64
65 This type is exposed only because it was exposed in previous versions,
66 and some people's code may rely on manipulating it. Otherwise, you
67 should really not rely on the layout, size, or contents of this structure:
68 it is fairly volatile, and WILL change in future versions of the code.
69 **/
70 struct bufferevent {
71 /** Event base for which this bufferevent was created. */
72 struct event_base *ev_base;
73 /** Pointer to a table of function pointers to set up how this
74 bufferevent behaves. */
75 const struct bufferevent_ops *be_ops;
76
77 /** A read event that triggers when a timeout has happened or a socket
78 is ready to read data. Only used by some subtypes of
79 bufferevent. */
80 struct event ev_read;
81 /** A write event that triggers when a timeout has happened or a socket
82 is ready to write data. Only used by some subtypes of
83 bufferevent. */
84 struct event ev_write;
85
86 /** An input buffer. Only the bufferevent is allowed to add data to
87 this buffer, though the user is allowed to drain it. */
88 struct evbuffer *input;
89
90 /** An input buffer. Only the bufferevent is allowed to drain data
91 from this buffer, though the user is allowed to add it. */
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
107 /** Events that are currently enabled: currently EV_READ and EV_WRITE
108 are supported. */
109 short enabled;
110 };
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif /* _EVENT2_BUFFEREVENT_STRUCT_H_ */
bufferevent_event_cb
void(* bufferevent_event_cb)(struct bufferevent *bev, short what, void *ctx)
An event/error callback for a bufferevent.
Definition: bufferevent.h:145
event
Structure to represent a single event.
Definition: event_struct.h:87
event_watermark
Definition: bufferevent_struct.h:57
bufferevent::be_ops
const struct bufferevent_ops * be_ops
Pointer to a table of function pointers to set up how this bufferevent behaves.
Definition: bufferevent_struct.h:75
evbuffer
Definition: evbuffer-internal.h:78
event_struct.h
Structures used by event.h.
bufferevent::ev_write
struct event ev_write
A write event that triggers when a timeout has happened or a socket is ready to write data...
Definition: bufferevent_struct.h:84
bufferevent::input
struct evbuffer * input
An input buffer.
Definition: bufferevent_struct.h:88
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
bufferevent::ev_base
struct event_base * ev_base
Event base for which this bufferevent was created.
Definition: bufferevent_struct.h:72
bufferevent::enabled
short enabled
Events that are currently enabled: currently EV_READ and EV_WRITE are supported.
Definition: bufferevent_struct.h:109
bufferevent::output
struct evbuffer * output
An input buffer.
Definition: bufferevent_struct.h:92
bufferevent_data_cb
void(* bufferevent_data_cb)(struct bufferevent *bev, void *ctx)
A read or write callback for a bufferevent.
Definition: bufferevent.h:129
bufferevent
Shared implementation of a bufferevent.
Definition: bufferevent_struct.h:70
event_base
Definition: event-internal.h:167
bufferevent_ops
Implementation table for a bufferevent: holds function pointers and other information to make the var...
Definition: bufferevent-internal.h:211
bufferevent::ev_read
struct event ev_read
A read event that triggers when a timeout has happened or a socket is ready to read data...
Definition: bufferevent_struct.h:80