1 |
michael |
3251 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 |
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
3 |
|
|
<title>PEAK Library: Write-buffered operations</title> |
4 |
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css"> |
5 |
|
|
</head><body> |
6 |
|
|
<!-- Generated by Doxygen 1.3.5 --> |
7 |
|
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="functions.html">Data Fields</a></div> |
8 |
|
|
<h1>Write-buffered operations<br> |
9 |
|
|
<small> |
10 |
|
|
[<a class="el" href="group__stream.html">Socket streams</a>]</small> |
11 |
|
|
</h1><hr><a name="_details"></a><h2>Detailed Description</h2> |
12 |
|
|
Write-buffered stream methods. |
13 |
|
|
<p> |
14 |
|
|
|
15 |
|
|
<p> |
16 |
|
|
<table border=0 cellpadding=0 cellspacing=0> |
17 |
|
|
<tr><td></td></tr> |
18 |
|
|
<tr><td colspan=2><br><h2>Typedefs</h2></td></tr> |
19 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef void(* </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga0">peak_stream_error_callback</a> )(<a class="el" href="group__stream.html#ga0">peak_stream</a> s, int error_type, void *context)</td></tr> |
20 |
|
|
|
21 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Error callback for write-buffered streams. <a href="#ga0"></a><br><br></td></tr> |
22 |
|
|
<tr><td colspan=2><br><h2>Enumerations</h2></td></tr> |
23 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>enum </td><td class="memItemRight" valign=bottom>{ <a class="el" href="group__stream__buf.html#gga8a18">PEAK_STREAM_ERR_MAX_MSGBUF_EXCEEDED</a> = -10001 |
24 |
|
|
}</td></tr> |
25 |
|
|
|
26 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Possible error codes passed to your stream error callback function. <a href="#ga8">More...</a><br><br></td></tr> |
27 |
|
|
<tr><td colspan=2><br><h2>Functions</h2></td></tr> |
28 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga1">peak_stream_set_buffered</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, int enable, size_t msg_size, size_t max_size, <a class="el" href="group__stream__buf.html#ga0">peak_stream_error_callback</a> cb)</td></tr> |
29 |
|
|
|
30 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Enable or disable buffered write mode for a specified stream. <a href="#ga1"></a><br><br></td></tr> |
31 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga2">peak_stream_msgbuf_get_info</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, size_t *msg_size, size_t *max_msgs, size_t *alloc_msgs, size_t *queue_msgs, size_t *queue_size)</td></tr> |
32 |
|
|
|
33 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get info on current buffered write mode settings. <a href="#ga2"></a><br><br></td></tr> |
34 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga3">peak_stream_write_buffered</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const void *buffer, size_t bufsize)</td></tr> |
35 |
|
|
|
36 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Copy and commit a buffer to the stream for writing. <a href="#ga3"></a><br><br></td></tr> |
37 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void * </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga4">peak_stream_msgbuf_new</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s)</td></tr> |
38 |
|
|
|
39 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get a new message buffer. <a href="#ga4"></a><br><br></td></tr> |
40 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga5">peak_stream_msgbuf_commit</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, void *buffer, int length)</td></tr> |
41 |
|
|
|
42 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Commit a message buffer. <a href="#ga5"></a><br><br></td></tr> |
43 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga6">peak_stream_msgbuf_make</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const char *format,...)</td></tr> |
44 |
|
|
|
45 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Make a formatted message buffer and commit it for writing. <a href="#ga6"></a><br><br></td></tr> |
46 |
|
|
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__buf.html#ga7">peak_stream_msgbuf_vmake</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const char *format, va_list vl)</td></tr> |
47 |
|
|
|
48 |
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Make a formatted message buffer and commit it for writing. <a href="#ga7"></a><br><br></td></tr> |
49 |
|
|
</table> |
50 |
|
|
<hr><h2>Typedef Documentation</h2> |
51 |
|
|
<a class="anchor" name="ga0" doxytag="stream.h::peak_stream_error_callback" ></a><p> |
52 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
53 |
|
|
<tr> |
54 |
|
|
<td class="mdRow"> |
55 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
56 |
|
|
<tr> |
57 |
|
|
<td class="md" nowrap valign="top"> typedef void(* <a class="el" href="group__stream__buf.html#ga0">peak_stream_error_callback</a>)(<a class="el" href="group__stream.html#ga0">peak_stream</a> s, int error_type, void *context) |
58 |
|
|
</table> |
59 |
|
|
</td> |
60 |
|
|
</tr> |
61 |
|
|
</table> |
62 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
63 |
|
|
<tr> |
64 |
|
|
<td> |
65 |
|
|
|
66 |
|
|
</td> |
67 |
|
|
<td> |
68 |
|
|
|
69 |
|
|
<p> |
70 |
|
|
Error callback for write-buffered streams. |
71 |
|
|
<p> |
72 |
|
|
Defines a pointer to your error handling callback function that will be triggered when a stream error happens.<br> |
73 |
|
|
Warning: NEVER release a stream inside this callback! </td> |
74 |
|
|
</tr> |
75 |
|
|
</table> |
76 |
|
|
<hr><h2>Enumeration Type Documentation</h2> |
77 |
|
|
<a class="anchor" name="ga8" doxytag="stream.h::@6" ></a><p> |
78 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
79 |
|
|
<tr> |
80 |
|
|
<td class="mdRow"> |
81 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
82 |
|
|
<tr> |
83 |
|
|
<td class="md" nowrap valign="top"> anonymous enum |
84 |
|
|
</table> |
85 |
|
|
</td> |
86 |
|
|
</tr> |
87 |
|
|
</table> |
88 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
89 |
|
|
<tr> |
90 |
|
|
<td> |
91 |
|
|
|
92 |
|
|
</td> |
93 |
|
|
<td> |
94 |
|
|
|
95 |
|
|
<p> |
96 |
|
|
Possible error codes passed to your stream error callback function. |
97 |
|
|
<p> |
98 |
|
|
These are currently only used with write-buffered configured streams. <dl compact><dt><b>Enumeration values: </b></dt><dd> |
99 |
|
|
<table border=0 cellspacing=2 cellpadding=0> |
100 |
|
|
<tr><td valign=top><em><a class="anchor" name="gga8a18" doxytag="PEAK_STREAM_ERR_MAX_MSGBUF_EXCEEDED" ></a>PEAK_STREAM_ERR_MAX_MSGBUF_EXCEEDED</em> </td><td> |
101 |
|
|
All allowed message buffers of a write-buffered stream have been consumed! </td></tr> |
102 |
|
|
</table> |
103 |
|
|
</dl> |
104 |
|
|
</td> |
105 |
|
|
</tr> |
106 |
|
|
</table> |
107 |
|
|
<hr><h2>Function Documentation</h2> |
108 |
|
|
<a class="anchor" name="ga5" doxytag="stream.h::peak_stream_msgbuf_commit" ></a><p> |
109 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
110 |
|
|
<tr> |
111 |
|
|
<td class="mdRow"> |
112 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
113 |
|
|
<tr> |
114 |
|
|
<td class="md" nowrap valign="top"> void peak_stream_msgbuf_commit </td> |
115 |
|
|
<td class="md" valign="top">( </td> |
116 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
117 |
|
|
<td class="mdname" nowrap> <em>s</em>, </td> |
118 |
|
|
</tr> |
119 |
|
|
<tr> |
120 |
|
|
<td></td> |
121 |
|
|
<td></td> |
122 |
|
|
<td class="md" nowrap>void * </td> |
123 |
|
|
<td class="mdname" nowrap> <em>buffer</em>, </td> |
124 |
|
|
</tr> |
125 |
|
|
<tr> |
126 |
|
|
<td></td> |
127 |
|
|
<td></td> |
128 |
|
|
<td class="md" nowrap>int </td> |
129 |
|
|
<td class="mdname" nowrap> <em>length</em></td> |
130 |
|
|
</tr> |
131 |
|
|
<tr> |
132 |
|
|
<td></td> |
133 |
|
|
<td class="md">) </td> |
134 |
|
|
<td class="md" colspan="2"></td> |
135 |
|
|
</tr> |
136 |
|
|
|
137 |
|
|
</table> |
138 |
|
|
</td> |
139 |
|
|
</tr> |
140 |
|
|
</table> |
141 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
142 |
|
|
<tr> |
143 |
|
|
<td> |
144 |
|
|
|
145 |
|
|
</td> |
146 |
|
|
<td> |
147 |
|
|
|
148 |
|
|
<p> |
149 |
|
|
Commit a message buffer. |
150 |
|
|
<p> |
151 |
|
|
After a message buffer (obtained with the help of <a class="el" href="group__stream__buf.html#ga57">peak_stream_msgbuf_new()</a>) has been filled partially or completely, you MUST call this function to commit the message for sending. This function is O(1).<p> |
152 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
153 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
154 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
155 |
|
|
<tr><td valign=top><em>buffer</em> </td><td>A filled buffer obtained with <a class="el" href="group__stream__buf.html#ga57">peak_stream_msgbuf_new()</a>. </td></tr> |
156 |
|
|
<tr><td valign=top><em>length</em> </td><td>Actual length of data you want to commit, you might use a value of 0 to properly cancel the allocated msgbuf, but obviously it's not something efficient to do.</td></tr> |
157 |
|
|
</table> |
158 |
|
|
</dl> |
159 |
|
|
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to a new msgbuf or NULL is max_msgs is reached internally. </dd></dl> |
160 |
|
|
</td> |
161 |
|
|
</tr> |
162 |
|
|
</table> |
163 |
|
|
<a class="anchor" name="ga2" doxytag="stream.h::peak_stream_msgbuf_get_info" ></a><p> |
164 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
165 |
|
|
<tr> |
166 |
|
|
<td class="mdRow"> |
167 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
168 |
|
|
<tr> |
169 |
|
|
<td class="md" nowrap valign="top"> void peak_stream_msgbuf_get_info </td> |
170 |
|
|
<td class="md" valign="top">( </td> |
171 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
172 |
|
|
<td class="mdname" nowrap> <em>s</em>, </td> |
173 |
|
|
</tr> |
174 |
|
|
<tr> |
175 |
|
|
<td></td> |
176 |
|
|
<td></td> |
177 |
|
|
<td class="md" nowrap>size_t * </td> |
178 |
|
|
<td class="mdname" nowrap> <em>msg_size</em>, </td> |
179 |
|
|
</tr> |
180 |
|
|
<tr> |
181 |
|
|
<td></td> |
182 |
|
|
<td></td> |
183 |
|
|
<td class="md" nowrap>size_t * </td> |
184 |
|
|
<td class="mdname" nowrap> <em>max_msgs</em>, </td> |
185 |
|
|
</tr> |
186 |
|
|
<tr> |
187 |
|
|
<td></td> |
188 |
|
|
<td></td> |
189 |
|
|
<td class="md" nowrap>size_t * </td> |
190 |
|
|
<td class="mdname" nowrap> <em>alloc_msgs</em>, </td> |
191 |
|
|
</tr> |
192 |
|
|
<tr> |
193 |
|
|
<td></td> |
194 |
|
|
<td></td> |
195 |
|
|
<td class="md" nowrap>size_t * </td> |
196 |
|
|
<td class="mdname" nowrap> <em>queue_msgs</em>, </td> |
197 |
|
|
</tr> |
198 |
|
|
<tr> |
199 |
|
|
<td></td> |
200 |
|
|
<td></td> |
201 |
|
|
<td class="md" nowrap>size_t * </td> |
202 |
|
|
<td class="mdname" nowrap> <em>queue_size</em></td> |
203 |
|
|
</tr> |
204 |
|
|
<tr> |
205 |
|
|
<td></td> |
206 |
|
|
<td class="md">) </td> |
207 |
|
|
<td class="md" colspan="2"></td> |
208 |
|
|
</tr> |
209 |
|
|
|
210 |
|
|
</table> |
211 |
|
|
</td> |
212 |
|
|
</tr> |
213 |
|
|
</table> |
214 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
215 |
|
|
<tr> |
216 |
|
|
<td> |
217 |
|
|
|
218 |
|
|
</td> |
219 |
|
|
<td> |
220 |
|
|
|
221 |
|
|
<p> |
222 |
|
|
Get info on current buffered write mode settings. |
223 |
|
|
<p> |
224 |
|
|
You may only call this function if the stream <em>s</em> is configured in write-buffered mode. <em>msg_size</em> and <em>max_msgs</em> can be configured using the <a class="el" href="group__stream__buf.html#ga54">peak_stream_set_buffered()</a> function.<p> |
225 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
226 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
227 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
228 |
|
|
<tr><td valign=top><em>msg_size</em> </td><td>If not <code>NULL</code>, the value pointed will contain the max size in bytes of each message buffers. </td></tr> |
229 |
|
|
<tr><td valign=top><em>max_msgs</em> </td><td>If not <code>NULL</code>, the value pointed will contain the maximum number of message. </td></tr> |
230 |
|
|
<tr><td valign=top><em>alloc_msgs</em> </td><td>If not <code>NULL</code>, the value pointed will contain the number of actual allocated message buffer (<em>alloc_msgs</em> <= <em>max_msgs</em>). </td></tr> |
231 |
|
|
<tr><td valign=top><em>queue_msgs</em> </td><td>If not <code>NULL</code>, the value pointed will contain the current number of message buffers queued (used). Obviously you can get the free count of message buffers with (<em>max_msgs</em> - <em>queue_msgs</em>). </td></tr> |
232 |
|
|
<tr><td valign=top><em>queue_size</em> </td><td>If not <code>NULL</code>, the value pointed will contain the current write queue size in bytes (also named "SendQ"). </td></tr> |
233 |
|
|
</table> |
234 |
|
|
</dl> |
235 |
|
|
</td> |
236 |
|
|
</tr> |
237 |
|
|
</table> |
238 |
|
|
<a class="anchor" name="ga6" doxytag="stream.h::peak_stream_msgbuf_make" ></a><p> |
239 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
240 |
|
|
<tr> |
241 |
|
|
<td class="mdRow"> |
242 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
243 |
|
|
<tr> |
244 |
|
|
<td class="md" nowrap valign="top"> void peak_stream_msgbuf_make </td> |
245 |
|
|
<td class="md" valign="top">( </td> |
246 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
247 |
|
|
<td class="mdname" nowrap> <em>s</em>, </td> |
248 |
|
|
</tr> |
249 |
|
|
<tr> |
250 |
|
|
<td></td> |
251 |
|
|
<td></td> |
252 |
|
|
<td class="md" nowrap>const char * </td> |
253 |
|
|
<td class="mdname" nowrap> <em>format</em>, </td> |
254 |
|
|
</tr> |
255 |
|
|
<tr> |
256 |
|
|
<td></td> |
257 |
|
|
<td></td> |
258 |
|
|
<td class="md" nowrap>... </td> |
259 |
|
|
<td class="mdname" nowrap></td> |
260 |
|
|
</tr> |
261 |
|
|
<tr> |
262 |
|
|
<td></td> |
263 |
|
|
<td class="md">) </td> |
264 |
|
|
<td class="md" colspan="2"></td> |
265 |
|
|
</tr> |
266 |
|
|
|
267 |
|
|
</table> |
268 |
|
|
</td> |
269 |
|
|
</tr> |
270 |
|
|
</table> |
271 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
272 |
|
|
<tr> |
273 |
|
|
<td> |
274 |
|
|
|
275 |
|
|
</td> |
276 |
|
|
<td> |
277 |
|
|
|
278 |
|
|
<p> |
279 |
|
|
Make a formatted message buffer and commit it for writing. |
280 |
|
|
<p> |
281 |
|
|
This convenience function allows you to write a formatted string to the stream in write-buffered mode.<p> |
282 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
283 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
284 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
285 |
|
|
<tr><td valign=top><em>format</em> </td><td>Format string. </td></tr> |
286 |
|
|
</table> |
287 |
|
|
</dl> |
288 |
|
|
</td> |
289 |
|
|
</tr> |
290 |
|
|
</table> |
291 |
|
|
<a class="anchor" name="ga4" doxytag="stream.h::peak_stream_msgbuf_new" ></a><p> |
292 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
293 |
|
|
<tr> |
294 |
|
|
<td class="mdRow"> |
295 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
296 |
|
|
<tr> |
297 |
|
|
<td class="md" nowrap valign="top"> void* peak_stream_msgbuf_new </td> |
298 |
|
|
<td class="md" valign="top">( </td> |
299 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
300 |
|
|
<td class="mdname1" valign="top" nowrap> <em>s</em> </td> |
301 |
|
|
<td class="md" valign="top"> ) </td> |
302 |
|
|
<td class="md" nowrap></td> |
303 |
|
|
</tr> |
304 |
|
|
|
305 |
|
|
</table> |
306 |
|
|
</td> |
307 |
|
|
</tr> |
308 |
|
|
</table> |
309 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
310 |
|
|
<tr> |
311 |
|
|
<td> |
312 |
|
|
|
313 |
|
|
</td> |
314 |
|
|
<td> |
315 |
|
|
|
316 |
|
|
<p> |
317 |
|
|
Get a new message buffer. |
318 |
|
|
<p> |
319 |
|
|
Low-level function to get a pointer to a new msgbuf, of msg_size bytes (previously configured with <a class="el" href="group__stream__buf.html#ga54">peak_stream_set_buffered()</a>). This function is usually O(1), except for the few first calls or it needs to do real allocations. You can fill it partially or completely and then you MUST call <a class="el" href="group__stream__buf.html#ga58">peak_stream_msgbuf_commit()</a> to commit the message for sending.<p> |
320 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
321 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
322 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference.</td></tr> |
323 |
|
|
</table> |
324 |
|
|
</dl> |
325 |
|
|
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to a new msgbuf or NULL is max_msgs is reached internally. </dd></dl> |
326 |
|
|
</td> |
327 |
|
|
</tr> |
328 |
|
|
</table> |
329 |
|
|
<a class="anchor" name="ga7" doxytag="stream.h::peak_stream_msgbuf_vmake" ></a><p> |
330 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
331 |
|
|
<tr> |
332 |
|
|
<td class="mdRow"> |
333 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
334 |
|
|
<tr> |
335 |
|
|
<td class="md" nowrap valign="top"> void peak_stream_msgbuf_vmake </td> |
336 |
|
|
<td class="md" valign="top">( </td> |
337 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
338 |
|
|
<td class="mdname" nowrap> <em>s</em>, </td> |
339 |
|
|
</tr> |
340 |
|
|
<tr> |
341 |
|
|
<td></td> |
342 |
|
|
<td></td> |
343 |
|
|
<td class="md" nowrap>const char * </td> |
344 |
|
|
<td class="mdname" nowrap> <em>format</em>, </td> |
345 |
|
|
</tr> |
346 |
|
|
<tr> |
347 |
|
|
<td></td> |
348 |
|
|
<td></td> |
349 |
|
|
<td class="md" nowrap>va_list </td> |
350 |
|
|
<td class="mdname" nowrap> <em>vl</em></td> |
351 |
|
|
</tr> |
352 |
|
|
<tr> |
353 |
|
|
<td></td> |
354 |
|
|
<td class="md">) </td> |
355 |
|
|
<td class="md" colspan="2"></td> |
356 |
|
|
</tr> |
357 |
|
|
|
358 |
|
|
</table> |
359 |
|
|
</td> |
360 |
|
|
</tr> |
361 |
|
|
</table> |
362 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
363 |
|
|
<tr> |
364 |
|
|
<td> |
365 |
|
|
|
366 |
|
|
</td> |
367 |
|
|
<td> |
368 |
|
|
|
369 |
|
|
<p> |
370 |
|
|
Make a formatted message buffer and commit it for writing. |
371 |
|
|
<p> |
372 |
|
|
This convenience function allows you to write a formatted string to the stream in write-buffered mode.<p> |
373 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
374 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
375 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
376 |
|
|
<tr><td valign=top><em>format</em> </td><td>Format string. </td></tr> |
377 |
|
|
<tr><td valign=top><em>vl</em> </td><td>Arguments. </td></tr> |
378 |
|
|
</table> |
379 |
|
|
</dl> |
380 |
|
|
</td> |
381 |
|
|
</tr> |
382 |
|
|
</table> |
383 |
|
|
<a class="anchor" name="ga1" doxytag="stream.h::peak_stream_set_buffered" ></a><p> |
384 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
385 |
|
|
<tr> |
386 |
|
|
<td class="mdRow"> |
387 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
388 |
|
|
<tr> |
389 |
|
|
<td class="md" nowrap valign="top"> void peak_stream_set_buffered </td> |
390 |
|
|
<td class="md" valign="top">( </td> |
391 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
392 |
|
|
<td class="mdname" nowrap> <em>s</em>, </td> |
393 |
|
|
</tr> |
394 |
|
|
<tr> |
395 |
|
|
<td></td> |
396 |
|
|
<td></td> |
397 |
|
|
<td class="md" nowrap>int </td> |
398 |
|
|
<td class="mdname" nowrap> <em>enable</em>, </td> |
399 |
|
|
</tr> |
400 |
|
|
<tr> |
401 |
|
|
<td></td> |
402 |
|
|
<td></td> |
403 |
|
|
<td class="md" nowrap>size_t </td> |
404 |
|
|
<td class="mdname" nowrap> <em>msg_size</em>, </td> |
405 |
|
|
</tr> |
406 |
|
|
<tr> |
407 |
|
|
<td></td> |
408 |
|
|
<td></td> |
409 |
|
|
<td class="md" nowrap>size_t </td> |
410 |
|
|
<td class="mdname" nowrap> <em>max_size</em>, </td> |
411 |
|
|
</tr> |
412 |
|
|
<tr> |
413 |
|
|
<td></td> |
414 |
|
|
<td></td> |
415 |
|
|
<td class="md" nowrap><a class="el" href="group__stream__buf.html#ga0">peak_stream_error_callback</a> </td> |
416 |
|
|
<td class="mdname" nowrap> <em>cb</em></td> |
417 |
|
|
</tr> |
418 |
|
|
<tr> |
419 |
|
|
<td></td> |
420 |
|
|
<td class="md">) </td> |
421 |
|
|
<td class="md" colspan="2"></td> |
422 |
|
|
</tr> |
423 |
|
|
|
424 |
|
|
</table> |
425 |
|
|
</td> |
426 |
|
|
</tr> |
427 |
|
|
</table> |
428 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
429 |
|
|
<tr> |
430 |
|
|
<td> |
431 |
|
|
|
432 |
|
|
</td> |
433 |
|
|
<td> |
434 |
|
|
|
435 |
|
|
<p> |
436 |
|
|
Enable or disable buffered write mode for a specified stream. |
437 |
|
|
<p> |
438 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
439 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
440 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
441 |
|
|
<tr><td valign=top><em>enable</em> </td><td>Enable (1) or disable (0) buffered mode ? </td></tr> |
442 |
|
|
<tr><td valign=top><em>msg_size</em> </td><td>Size in bytes of a single message. Take care when setting this when you want to write lines: it's the maximum number of characters a line can contain when using the peak_stream_msgbuf's API. Use 0 to get an optimized value if you don't use the peak_stream_msgbuf's API. </td></tr> |
443 |
|
|
<tr><td valign=top><em>max_size</em> </td><td>Set a limit of the total size in bytes of all messages, as you wish, depending on you needs and traffic. Also known as the SendQ's total size, but remember a few more bytes are allocated internally to implement the buffered writes. </td></tr> |
444 |
|
|
<tr><td valign=top><em>cb</em> </td><td>A pointer to your errors handling callback function for write-buffered related errors or NULL if you don't care. But be careful, the write stream isn't reliable anymore if you don't handle write-buffered errors because messages might be dropped in secret. </td></tr> |
445 |
|
|
</table> |
446 |
|
|
</dl> |
447 |
|
|
</td> |
448 |
|
|
</tr> |
449 |
|
|
</table> |
450 |
|
|
<a class="anchor" name="ga3" doxytag="stream.h::peak_stream_write_buffered" ></a><p> |
451 |
|
|
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
452 |
|
|
<tr> |
453 |
|
|
<td class="mdRow"> |
454 |
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
455 |
|
|
<tr> |
456 |
|
|
<td class="md" nowrap valign="top"> void peak_stream_write_buffered </td> |
457 |
|
|
<td class="md" valign="top">( </td> |
458 |
|
|
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
459 |
|
|
<td class="mdname" nowrap> <em>s</em>, </td> |
460 |
|
|
</tr> |
461 |
|
|
<tr> |
462 |
|
|
<td></td> |
463 |
|
|
<td></td> |
464 |
|
|
<td class="md" nowrap>const void * </td> |
465 |
|
|
<td class="mdname" nowrap> <em>buffer</em>, </td> |
466 |
|
|
</tr> |
467 |
|
|
<tr> |
468 |
|
|
<td></td> |
469 |
|
|
<td></td> |
470 |
|
|
<td class="md" nowrap>size_t </td> |
471 |
|
|
<td class="mdname" nowrap> <em>bufsize</em></td> |
472 |
|
|
</tr> |
473 |
|
|
<tr> |
474 |
|
|
<td></td> |
475 |
|
|
<td class="md">) </td> |
476 |
|
|
<td class="md" colspan="2"></td> |
477 |
|
|
</tr> |
478 |
|
|
|
479 |
|
|
</table> |
480 |
|
|
</td> |
481 |
|
|
</tr> |
482 |
|
|
</table> |
483 |
|
|
<table cellspacing=5 cellpadding=0 border=0> |
484 |
|
|
<tr> |
485 |
|
|
<td> |
486 |
|
|
|
487 |
|
|
</td> |
488 |
|
|
<td> |
489 |
|
|
|
490 |
|
|
<p> |
491 |
|
|
Copy and commit a buffer to the stream for writing. |
492 |
|
|
<p> |
493 |
|
|
This is the write-buffered version of <a class="el" href="group__stream__low.html#ga46">peak_stream_write()</a>. If max_msgs (previously configured with <a class="el" href="group__stream__buf.html#ga54">peak_stream_set_buffered()</a>) is not reached, this function will send the whole buffer without error.<br> |
494 |
|
|
If you want maximum efficiency and if it's adapted for you, please use the <a class="el" href="group__stream__buf.html#ga57">peak_stream_msgbuf_new()</a> and <a class="el" href="group__stream__buf.html#ga58">peak_stream_msgbuf_commit()</a> pair, as they provide zero-copy buffering.<p> |
495 |
|
|
<dl compact><dt><b>Parameters:</b></dt><dd> |
496 |
|
|
<table border="0" cellspacing="2" cellpadding="0"> |
497 |
|
|
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
498 |
|
|
<tr><td valign=top><em>buffer</em> </td><td>The bytes to write. </td></tr> |
499 |
|
|
<tr><td valign=top><em>bufsize</em> </td><td>Number of bytes to write.</td></tr> |
500 |
|
|
</table> |
501 |
|
|
</dl> |
502 |
|
|
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes which where written or -1 if an error occured. </dd></dl> |
503 |
|
|
</td> |
504 |
|
|
</tr> |
505 |
|
|
</table> |
506 |
|
|
<hr size="1"><address style="align: right;"><small>Generated on Sat Jan 17 21:41:54 2004 for the PEAK Library by |
507 |
|
|
<a href="http://www.doxygen.org/index.html"> |
508 |
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0" > |
509 |
|
|
</a></small> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=98146&type=1" width="88" height="31" align="middle" border="0" alt="SourceForge.net Logo" /></a></address> |
510 |
|
|
</body> |
511 |
|
|
</html> |
512 |
|
|
|