-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbufferevent__compat_8h.html
247 lines (238 loc) · 17 KB
/
bufferevent__compat_8h.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libevent: event2/bufferevent_compat.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libevent
 <span id="projectnumber">2.2.1</span>
</div>
<div id="projectbrief">Event notification library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_db160b4728e6067cf5f9cc14ec42c79d.html">event2</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">bufferevent_compat.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Deprecated versions of the functions in <a class="el" href="bufferevent_8h.html" title="Functions for buffering data for network sending or receiving.">bufferevent.h</a>: provided only for backwards compatibility.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include <event2/visibility.h></code><br />
</div>
<p><a href="bufferevent__compat_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:afedf9edc6f996732b04bcd059dc83a23"><td class="memItemLeft" align="right" valign="top"><a id="afedf9edc6f996732b04bcd059dc83a23"></a>
#define </td><td class="memItemRight" valign="bottom"><b>EVBUFFER_EOF</b>   <a class="el" href="bufferevent_8h.html#a4d7d8c93cf62e6f3d37c0cbac75aebcc">BEV_EVENT_EOF</a></td></tr>
<tr class="separator:afedf9edc6f996732b04bcd059dc83a23"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ace6271abfaba605b8eed08ac2f3b0c45"><td class="memItemLeft" align="right" valign="top"><a id="ace6271abfaba605b8eed08ac2f3b0c45"></a>
#define </td><td class="memItemRight" valign="bottom"><b>EVBUFFER_ERROR</b>   <a class="el" href="bufferevent_8h.html#a5f112d7a064258bdabf8d5182a3bf5e4">BEV_EVENT_ERROR</a></td></tr>
<tr class="separator:ace6271abfaba605b8eed08ac2f3b0c45"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a189bf30c83f32cffebdc0dcb65f41350"><td class="memItemLeft" align="right" valign="top"><a id="a189bf30c83f32cffebdc0dcb65f41350"></a>
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="bufferevent__compat_8h.html#a189bf30c83f32cffebdc0dcb65f41350">EVBUFFER_INPUT</a>(x)   <a class="el" href="bufferevent_8h.html#a3ddbf50178b96b3f243ddc83d67e88b0">bufferevent_get_input</a>(x)</td></tr>
<tr class="memdesc:a189bf30c83f32cffebdc0dcb65f41350"><td class="mdescLeft"> </td><td class="mdescRight">macro for getting access to the input buffer of a bufferevent <br /></td></tr>
<tr class="separator:a189bf30c83f32cffebdc0dcb65f41350"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6e7bfa5494417540589e9ae582a2bccd"><td class="memItemLeft" align="right" valign="top"><a id="a6e7bfa5494417540589e9ae582a2bccd"></a>
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="bufferevent__compat_8h.html#a6e7bfa5494417540589e9ae582a2bccd">EVBUFFER_OUTPUT</a>(x)   <a class="el" href="bufferevent_8h.html#ac6e45fa1fc577c4f0e6c4689e72c0a15">bufferevent_get_output</a>(x)</td></tr>
<tr class="memdesc:a6e7bfa5494417540589e9ae582a2bccd"><td class="mdescLeft"> </td><td class="mdescRight">macro for getting access to the output buffer of a bufferevent <br /></td></tr>
<tr class="separator:a6e7bfa5494417540589e9ae582a2bccd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afcf503b22891daa1b18d6efc9de02d61"><td class="memItemLeft" align="right" valign="top"><a id="afcf503b22891daa1b18d6efc9de02d61"></a>
#define </td><td class="memItemRight" valign="bottom"><b>EVBUFFER_READ</b>   <a class="el" href="bufferevent_8h.html#a504816ca8678e4f3d0bee2700fda524d">BEV_EVENT_READING</a></td></tr>
<tr class="separator:afcf503b22891daa1b18d6efc9de02d61"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acb2fb0bad27c0c012c281799355c9462"><td class="memItemLeft" align="right" valign="top"><a id="acb2fb0bad27c0c012c281799355c9462"></a>
#define </td><td class="memItemRight" valign="bottom"><b>EVBUFFER_TIMEOUT</b>   <a class="el" href="bufferevent_8h.html#aa537428e3ac2c8d2dbb4ec041f09347f">BEV_EVENT_TIMEOUT</a></td></tr>
<tr class="separator:acb2fb0bad27c0c012c281799355c9462"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8da7a6da254f89c736148285cab7b8d8"><td class="memItemLeft" align="right" valign="top"><a id="a8da7a6da254f89c736148285cab7b8d8"></a>
#define </td><td class="memItemRight" valign="bottom"><b>EVBUFFER_WRITE</b>   <a class="el" href="bufferevent_8h.html#a557afaa0ce75e6bbb71fdcd68c35d077">BEV_EVENT_WRITING</a></td></tr>
<tr class="separator:a8da7a6da254f89c736148285cab7b8d8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6cac7c9fd47752fca8fc538333636cc3"><td class="memItemLeft" align="right" valign="top"><a id="a6cac7c9fd47752fca8fc538333636cc3"></a>
#define </td><td class="memItemRight" valign="bottom"><b>evbuffercb</b>   <a class="el" href="bufferevent_8h.html#ad0b9fa4a6c8f03b2fe5a9929a7f2cd59">bufferevent_data_cb</a></td></tr>
<tr class="separator:a6cac7c9fd47752fca8fc538333636cc3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a36cebc3feb83ff2c58c4a9f7999c8888"><td class="memItemLeft" align="right" valign="top"><a id="a36cebc3feb83ff2c58c4a9f7999c8888"></a>
#define </td><td class="memItemRight" valign="bottom"><b>everrorcb</b>   <a class="el" href="bufferevent_8h.html#a3b0191b460511796e5281474cd704ec4">bufferevent_event_cb</a></td></tr>
<tr class="separator:a36cebc3feb83ff2c58c4a9f7999c8888"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a621af7017b3a7fe2ab1de902297ceb94"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL struct <a class="el" href="structbufferevent.html">bufferevent</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="bufferevent__compat_8h.html#a621af7017b3a7fe2ab1de902297ceb94">bufferevent_new</a> (<a class="el" href="util_8h.html#a7ef0023565082a65020f6e56be59fd0b">evutil_socket_t</a> fd, evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg)</td></tr>
<tr class="memdesc:a621af7017b3a7fe2ab1de902297ceb94"><td class="mdescLeft"> </td><td class="mdescRight">Create a new bufferevent for an fd. <a href="bufferevent__compat_8h.html#a621af7017b3a7fe2ab1de902297ceb94">More...</a><br /></td></tr>
<tr class="separator:a621af7017b3a7fe2ab1de902297ceb94"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5e48aa6b7217987a51cc02b56e0f7297"><td class="memItemLeft" align="right" valign="top">EVENT2_EXPORT_SYMBOL void </td><td class="memItemRight" valign="bottom"><a class="el" href="bufferevent__compat_8h.html#a5e48aa6b7217987a51cc02b56e0f7297">bufferevent_settimeout</a> (struct <a class="el" href="structbufferevent.html">bufferevent</a> *bufev, int timeout_read, int timeout_write)</td></tr>
<tr class="memdesc:a5e48aa6b7217987a51cc02b56e0f7297"><td class="mdescLeft"> </td><td class="mdescRight">Set the read and write timeout for a buffered event. <a href="bufferevent__compat_8h.html#a5e48aa6b7217987a51cc02b56e0f7297">More...</a><br /></td></tr>
<tr class="separator:a5e48aa6b7217987a51cc02b56e0f7297"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Deprecated versions of the functions in <a class="el" href="bufferevent_8h.html" title="Functions for buffering data for network sending or receiving.">bufferevent.h</a>: provided only for backwards compatibility. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a621af7017b3a7fe2ab1de902297ceb94"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a621af7017b3a7fe2ab1de902297ceb94">◆ </a></span>bufferevent_new()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL struct <a class="el" href="structbufferevent.html">bufferevent</a>* bufferevent_new </td>
<td>(</td>
<td class="paramtype"><a class="el" href="util_8h.html#a7ef0023565082a65020f6e56be59fd0b">evutil_socket_t</a> </td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">evbuffercb </td>
<td class="paramname"><em>readcb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">evbuffercb </td>
<td class="paramname"><em>writecb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">everrorcb </td>
<td class="paramname"><em>errorcb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>cbarg</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Create a new bufferevent for an fd. </p>
<p>This function is deprecated. Use <a class="el" href="bufferevent_8h.html#a71181be5ab504e26f866dd3d91494854" title="Create a new socket bufferevent over an existing socket.">bufferevent_socket_new()</a> and <a class="el" href="bufferevent_8h.html#a031df52978c5237b70fb8ae7df572c97" title="Changes the callbacks for a bufferevent.">bufferevent_setcb()</a> instead.</p>
<p>Libevent provides an abstraction on top of the regular event callbacks. This abstraction is called a buffered event. A buffered event provides input and output buffers that get filled and drained automatically. The user of a buffered event no longer deals directly with the I/O, but instead is reading from input and writing to output buffers.</p>
<p>Once initialized, the bufferevent structure can be used repeatedly with <a class="el" href="bufferevent_8h.html#aa8a5dd2436494afd374213b99102265b" title="Enable a bufferevent.">bufferevent_enable()</a> and <a class="el" href="bufferevent_8h.html#a4f3974def824e73a6861d94cff71e7c6" title="Disable a bufferevent.">bufferevent_disable()</a>.</p>
<p>When read enabled the bufferevent will try to read from the file descriptor and call the read callback. The write callback is executed whenever the output buffer is drained below the write low watermark, which is 0 by default.</p>
<p>If multiple bases are in use, <a class="el" href="bufferevent_8h.html#acb59fdb64642f73a96c84adeb97311cb" title="Assign a bufferevent to a specific event_base.">bufferevent_base_set()</a> must be called before enabling the bufferevent for the first time.</p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000003">Deprecated:</a></b></dt><dd>This function is deprecated because it uses the current event base, and as such can be error prone for multithreaded programs. Use <a class="el" href="bufferevent_8h.html#a71181be5ab504e26f866dd3d91494854" title="Create a new socket bufferevent over an existing socket.">bufferevent_socket_new()</a> instead.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fd</td><td>the file descriptor from which data is read and written to. This file descriptor is not allowed to be a pipe(2). </td></tr>
<tr><td class="paramname">readcb</td><td>callback to invoke when there is data to be read, or NULL if no callback is desired </td></tr>
<tr><td class="paramname">writecb</td><td>callback to invoke when the file descriptor is ready for writing, or NULL if no callback is desired </td></tr>
<tr><td class="paramname">errorcb</td><td>callback to invoke when there is an error on the file descriptor </td></tr>
<tr><td class="paramname">cbarg</td><td>an argument that will be supplied to each of the callbacks (readcb, writecb, and errorcb) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly allocated bufferevent struct, or NULL if an error occurred </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="bufferevent_8h.html#acb59fdb64642f73a96c84adeb97311cb" title="Assign a bufferevent to a specific event_base.">bufferevent_base_set()</a>, <a class="el" href="bufferevent_8h.html#a8baa699f526f237c0d33f618f073c1cc" title="Deallocate the storage associated with a bufferevent structure.">bufferevent_free()</a> </dd></dl>
</div>
</div>
<a id="a5e48aa6b7217987a51cc02b56e0f7297"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e48aa6b7217987a51cc02b56e0f7297">◆ </a></span>bufferevent_settimeout()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">EVENT2_EXPORT_SYMBOL void bufferevent_settimeout </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structbufferevent.html">bufferevent</a> * </td>
<td class="paramname"><em>bufev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>timeout_read</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>timeout_write</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the read and write timeout for a buffered event. </p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000004">Deprecated:</a></b></dt><dd>Use bufferevent_set_timeouts instead.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">bufev</td><td>the bufferevent to be modified </td></tr>
<tr><td class="paramname">timeout_read</td><td>the read timeout </td></tr>
<tr><td class="paramname">timeout_write</td><td>the write timeout </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>