| 1 |
<!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: Non-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>Non-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 |
Low level read/write primitives. |
| 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>Defines</h2></td></tr> |
| 19 |
<tr><td class="memItemLeft" nowrap align=right valign=top>#define </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga6">WRITE_FORMAT_BUFFER_SIZE</a> 1024</td></tr> |
| 20 |
|
| 21 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Internal library format buffer size. <a href="#ga6"></a><br><br></td></tr> |
| 22 |
<tr><td colspan=2><br><h2>Functions</h2></td></tr> |
| 23 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga0">peak_stream_read</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, void *buffer, size_t bufsize)</td></tr> |
| 24 |
|
| 25 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read bytes on a stream. <a href="#ga0"></a><br><br></td></tr> |
| 26 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga1">peak_stream_recvfrom</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, void *buffer, size_t bufsize, struct sockaddr *from, int *fromlen)</td></tr> |
| 27 |
|
| 28 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read bytes on a stream (advanced). <a href="#ga1"></a><br><br></td></tr> |
| 29 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga2">peak_stream_write</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const void *buffer, size_t bufsize)</td></tr> |
| 30 |
|
| 31 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write bytes to a stream. <a href="#ga2"></a><br><br></td></tr> |
| 32 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga3">peak_stream_write_format</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const char *format,...)</td></tr> |
| 33 |
|
| 34 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Format string and write bytes to a stream. <a href="#ga3"></a><br><br></td></tr> |
| 35 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga4">peak_stream_write_vformat</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const char *format, va_list vl)</td></tr> |
| 36 |
|
| 37 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Format string with arguments and write bytes to a stream. <a href="#ga4"></a><br><br></td></tr> |
| 38 |
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="group__stream__low.html#ga5">peak_stream_writev</a> (<a class="el" href="group__stream.html#ga0">peak_stream</a> s, const struct iovec *iov, int iovcnt)</td></tr> |
| 39 |
|
| 40 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Gather data from iov array and write the bytes to a stream. <a href="#ga5"></a><br><br></td></tr> |
| 41 |
</table> |
| 42 |
<hr><h2>Define Documentation</h2> |
| 43 |
<a class="anchor" name="ga6" doxytag="stream.h::WRITE_FORMAT_BUFFER_SIZE" ></a><p> |
| 44 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 45 |
<tr> |
| 46 |
<td class="mdRow"> |
| 47 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 48 |
<tr> |
| 49 |
<td class="md" nowrap valign="top"> #define WRITE_FORMAT_BUFFER_SIZE 1024 |
| 50 |
</table> |
| 51 |
</td> |
| 52 |
</tr> |
| 53 |
</table> |
| 54 |
<table cellspacing=5 cellpadding=0 border=0> |
| 55 |
<tr> |
| 56 |
<td> |
| 57 |
|
| 58 |
</td> |
| 59 |
<td> |
| 60 |
|
| 61 |
<p> |
| 62 |
Internal library format buffer size. |
| 63 |
<p> |
| 64 |
The length of a message formatted with <a class="el" href="group__stream__low.html#ga47">peak_stream_write_format()</a> or <a class="el" href="group__stream__low.html#ga48">peak_stream_write_vformat()</a> cannot be highter than that. </td> |
| 65 |
</tr> |
| 66 |
</table> |
| 67 |
<hr><h2>Function Documentation</h2> |
| 68 |
<a class="anchor" name="ga0" doxytag="stream.h::peak_stream_read" ></a><p> |
| 69 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 70 |
<tr> |
| 71 |
<td class="mdRow"> |
| 72 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 73 |
<tr> |
| 74 |
<td class="md" nowrap valign="top"> int peak_stream_read </td> |
| 75 |
<td class="md" valign="top">( </td> |
| 76 |
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
| 77 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 78 |
</tr> |
| 79 |
<tr> |
| 80 |
<td></td> |
| 81 |
<td></td> |
| 82 |
<td class="md" nowrap>void * </td> |
| 83 |
<td class="mdname" nowrap> <em>buffer</em>, </td> |
| 84 |
</tr> |
| 85 |
<tr> |
| 86 |
<td></td> |
| 87 |
<td></td> |
| 88 |
<td class="md" nowrap>size_t </td> |
| 89 |
<td class="mdname" nowrap> <em>bufsize</em></td> |
| 90 |
</tr> |
| 91 |
<tr> |
| 92 |
<td></td> |
| 93 |
<td class="md">) </td> |
| 94 |
<td class="md" colspan="2"></td> |
| 95 |
</tr> |
| 96 |
|
| 97 |
</table> |
| 98 |
</td> |
| 99 |
</tr> |
| 100 |
</table> |
| 101 |
<table cellspacing=5 cellpadding=0 border=0> |
| 102 |
<tr> |
| 103 |
<td> |
| 104 |
|
| 105 |
</td> |
| 106 |
<td> |
| 107 |
|
| 108 |
<p> |
| 109 |
Read bytes on a stream. |
| 110 |
<p> |
| 111 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 112 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 113 |
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
| 114 |
<tr><td valign=top><em>buffer</em> </td><td>Pointer to an allocated buffer. </td></tr> |
| 115 |
<tr><td valign=top><em>bufsize</em> </td><td>Size of the allocated buffer.</td></tr> |
| 116 |
</table> |
| 117 |
</dl> |
| 118 |
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes actually read or -1 is an error occured. </dd></dl> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
</table> |
| 122 |
<a class="anchor" name="ga1" doxytag="stream.h::peak_stream_recvfrom" ></a><p> |
| 123 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 124 |
<tr> |
| 125 |
<td class="mdRow"> |
| 126 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 127 |
<tr> |
| 128 |
<td class="md" nowrap valign="top"> int peak_stream_recvfrom </td> |
| 129 |
<td class="md" valign="top">( </td> |
| 130 |
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
| 131 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 132 |
</tr> |
| 133 |
<tr> |
| 134 |
<td></td> |
| 135 |
<td></td> |
| 136 |
<td class="md" nowrap>void * </td> |
| 137 |
<td class="mdname" nowrap> <em>buffer</em>, </td> |
| 138 |
</tr> |
| 139 |
<tr> |
| 140 |
<td></td> |
| 141 |
<td></td> |
| 142 |
<td class="md" nowrap>size_t </td> |
| 143 |
<td class="mdname" nowrap> <em>bufsize</em>, </td> |
| 144 |
</tr> |
| 145 |
<tr> |
| 146 |
<td></td> |
| 147 |
<td></td> |
| 148 |
<td class="md" nowrap>struct sockaddr * </td> |
| 149 |
<td class="mdname" nowrap> <em>from</em>, </td> |
| 150 |
</tr> |
| 151 |
<tr> |
| 152 |
<td></td> |
| 153 |
<td></td> |
| 154 |
<td class="md" nowrap>int * </td> |
| 155 |
<td class="mdname" nowrap> <em>fromlen</em></td> |
| 156 |
</tr> |
| 157 |
<tr> |
| 158 |
<td></td> |
| 159 |
<td class="md">) </td> |
| 160 |
<td class="md" colspan="2"></td> |
| 161 |
</tr> |
| 162 |
|
| 163 |
</table> |
| 164 |
</td> |
| 165 |
</tr> |
| 166 |
</table> |
| 167 |
<table cellspacing=5 cellpadding=0 border=0> |
| 168 |
<tr> |
| 169 |
<td> |
| 170 |
|
| 171 |
</td> |
| 172 |
<td> |
| 173 |
|
| 174 |
<p> |
| 175 |
Read bytes on a stream (advanced). |
| 176 |
<p> |
| 177 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 178 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 179 |
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
| 180 |
<tr><td valign=top><em>buffer</em> </td><td>Pointer to an allocated buffer. </td></tr> |
| 181 |
<tr><td valign=top><em>bufsize</em> </td><td>Size of the allocated buffer. </td></tr> |
| 182 |
<tr><td valign=top><em>from</em> </td><td>Buffer to a sockaddr structure or NULL. </td></tr> |
| 183 |
<tr><td valign=top><em>fromlen</em> </td><td>Length of the "from" buffer.</td></tr> |
| 184 |
</table> |
| 185 |
</dl> |
| 186 |
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes actually read or -1 is an error occured. </dd></dl> |
| 187 |
</td> |
| 188 |
</tr> |
| 189 |
</table> |
| 190 |
<a class="anchor" name="ga2" doxytag="stream.h::peak_stream_write" ></a><p> |
| 191 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 192 |
<tr> |
| 193 |
<td class="mdRow"> |
| 194 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 195 |
<tr> |
| 196 |
<td class="md" nowrap valign="top"> int peak_stream_write </td> |
| 197 |
<td class="md" valign="top">( </td> |
| 198 |
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
| 199 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 200 |
</tr> |
| 201 |
<tr> |
| 202 |
<td></td> |
| 203 |
<td></td> |
| 204 |
<td class="md" nowrap>const void * </td> |
| 205 |
<td class="mdname" nowrap> <em>buffer</em>, </td> |
| 206 |
</tr> |
| 207 |
<tr> |
| 208 |
<td></td> |
| 209 |
<td></td> |
| 210 |
<td class="md" nowrap>size_t </td> |
| 211 |
<td class="mdname" nowrap> <em>bufsize</em></td> |
| 212 |
</tr> |
| 213 |
<tr> |
| 214 |
<td></td> |
| 215 |
<td class="md">) </td> |
| 216 |
<td class="md" colspan="2"></td> |
| 217 |
</tr> |
| 218 |
|
| 219 |
</table> |
| 220 |
</td> |
| 221 |
</tr> |
| 222 |
</table> |
| 223 |
<table cellspacing=5 cellpadding=0 border=0> |
| 224 |
<tr> |
| 225 |
<td> |
| 226 |
|
| 227 |
</td> |
| 228 |
<td> |
| 229 |
|
| 230 |
<p> |
| 231 |
Write bytes to a stream. |
| 232 |
<p> |
| 233 |
Warning: this function doesn't do write-buffered. For that feature, you need to configure the stream for it, using <a class="el" href="group__stream__buf.html#ga54">peak_stream_set_buffered()</a> and then use <a class="el" href="group__stream__buf.html#ga56">peak_stream_write_buffered()</a>.<p> |
| 234 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 235 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 236 |
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
| 237 |
<tr><td valign=top><em>buffer</em> </td><td>The bytes to write. </td></tr> |
| 238 |
<tr><td valign=top><em>bufsize</em> </td><td>Number of bytes to write.</td></tr> |
| 239 |
</table> |
| 240 |
</dl> |
| 241 |
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes which where written or -1 if an error occured. </dd></dl> |
| 242 |
</td> |
| 243 |
</tr> |
| 244 |
</table> |
| 245 |
<a class="anchor" name="ga3" doxytag="stream.h::peak_stream_write_format" ></a><p> |
| 246 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 247 |
<tr> |
| 248 |
<td class="mdRow"> |
| 249 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 250 |
<tr> |
| 251 |
<td class="md" nowrap valign="top"> int peak_stream_write_format </td> |
| 252 |
<td class="md" valign="top">( </td> |
| 253 |
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
| 254 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 255 |
</tr> |
| 256 |
<tr> |
| 257 |
<td></td> |
| 258 |
<td></td> |
| 259 |
<td class="md" nowrap>const char * </td> |
| 260 |
<td class="mdname" nowrap> <em>format</em>, </td> |
| 261 |
</tr> |
| 262 |
<tr> |
| 263 |
<td></td> |
| 264 |
<td></td> |
| 265 |
<td class="md" nowrap>... </td> |
| 266 |
<td class="mdname" nowrap></td> |
| 267 |
</tr> |
| 268 |
<tr> |
| 269 |
<td></td> |
| 270 |
<td class="md">) </td> |
| 271 |
<td class="md" colspan="2"></td> |
| 272 |
</tr> |
| 273 |
|
| 274 |
</table> |
| 275 |
</td> |
| 276 |
</tr> |
| 277 |
</table> |
| 278 |
<table cellspacing=5 cellpadding=0 border=0> |
| 279 |
<tr> |
| 280 |
<td> |
| 281 |
|
| 282 |
</td> |
| 283 |
<td> |
| 284 |
|
| 285 |
<p> |
| 286 |
Format string and write bytes to a stream. |
| 287 |
<p> |
| 288 |
Warning: this function doesn't do write-buffered. For that feature, you need to configure the stream for it, using <a class="el" href="group__stream__buf.html#ga54">peak_stream_set_buffered()</a> and then use <a class="el" href="group__stream__buf.html#ga59">peak_stream_msgbuf_make()</a>.<p> |
| 289 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 290 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 291 |
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
| 292 |
<tr><td valign=top><em>format</em> </td><td>The format followed by the arguments.</td></tr> |
| 293 |
</table> |
| 294 |
</dl> |
| 295 |
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes which where written or -1 if an error occured. </dd></dl> |
| 296 |
</td> |
| 297 |
</tr> |
| 298 |
</table> |
| 299 |
<a class="anchor" name="ga4" doxytag="stream.h::peak_stream_write_vformat" ></a><p> |
| 300 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 301 |
<tr> |
| 302 |
<td class="mdRow"> |
| 303 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 304 |
<tr> |
| 305 |
<td class="md" nowrap valign="top"> int peak_stream_write_vformat </td> |
| 306 |
<td class="md" valign="top">( </td> |
| 307 |
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
| 308 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 309 |
</tr> |
| 310 |
<tr> |
| 311 |
<td></td> |
| 312 |
<td></td> |
| 313 |
<td class="md" nowrap>const char * </td> |
| 314 |
<td class="mdname" nowrap> <em>format</em>, </td> |
| 315 |
</tr> |
| 316 |
<tr> |
| 317 |
<td></td> |
| 318 |
<td></td> |
| 319 |
<td class="md" nowrap>va_list </td> |
| 320 |
<td class="mdname" nowrap> <em>vl</em></td> |
| 321 |
</tr> |
| 322 |
<tr> |
| 323 |
<td></td> |
| 324 |
<td class="md">) </td> |
| 325 |
<td class="md" colspan="2"></td> |
| 326 |
</tr> |
| 327 |
|
| 328 |
</table> |
| 329 |
</td> |
| 330 |
</tr> |
| 331 |
</table> |
| 332 |
<table cellspacing=5 cellpadding=0 border=0> |
| 333 |
<tr> |
| 334 |
<td> |
| 335 |
|
| 336 |
</td> |
| 337 |
<td> |
| 338 |
|
| 339 |
<p> |
| 340 |
Format string with arguments and write bytes to a stream. |
| 341 |
<p> |
| 342 |
Warning: this function doesn't do write-buffered. For that feature, you need to configure the stream for it, using <a class="el" href="group__stream__buf.html#ga54">peak_stream_set_buffered()</a> and then use <a class="el" href="group__stream__buf.html#ga60">peak_stream_msgbuf_vmake()</a>.<p> |
| 343 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 344 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 345 |
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
| 346 |
<tr><td valign=top><em>format</em> </td><td>The format followed by the arguments. </td></tr> |
| 347 |
<tr><td valign=top><em>vl</em> </td><td>The arguments.</td></tr> |
| 348 |
</table> |
| 349 |
</dl> |
| 350 |
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes which where written or -1 if an error occured. </dd></dl> |
| 351 |
</td> |
| 352 |
</tr> |
| 353 |
</table> |
| 354 |
<a class="anchor" name="ga5" doxytag="stream.h::peak_stream_writev" ></a><p> |
| 355 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 356 |
<tr> |
| 357 |
<td class="mdRow"> |
| 358 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 359 |
<tr> |
| 360 |
<td class="md" nowrap valign="top"> int peak_stream_writev </td> |
| 361 |
<td class="md" valign="top">( </td> |
| 362 |
<td class="md" nowrap valign="top"><a class="el" href="group__stream.html#ga0">peak_stream</a> </td> |
| 363 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 364 |
</tr> |
| 365 |
<tr> |
| 366 |
<td></td> |
| 367 |
<td></td> |
| 368 |
<td class="md" nowrap>const struct iovec * </td> |
| 369 |
<td class="mdname" nowrap> <em>iov</em>, </td> |
| 370 |
</tr> |
| 371 |
<tr> |
| 372 |
<td></td> |
| 373 |
<td></td> |
| 374 |
<td class="md" nowrap>int </td> |
| 375 |
<td class="mdname" nowrap> <em>iovcnt</em></td> |
| 376 |
</tr> |
| 377 |
<tr> |
| 378 |
<td></td> |
| 379 |
<td class="md">) </td> |
| 380 |
<td class="md" colspan="2"></td> |
| 381 |
</tr> |
| 382 |
|
| 383 |
</table> |
| 384 |
</td> |
| 385 |
</tr> |
| 386 |
</table> |
| 387 |
<table cellspacing=5 cellpadding=0 border=0> |
| 388 |
<tr> |
| 389 |
<td> |
| 390 |
|
| 391 |
</td> |
| 392 |
<td> |
| 393 |
|
| 394 |
<p> |
| 395 |
Gather data from iov array and write the bytes to a stream. |
| 396 |
<p> |
| 397 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 398 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 399 |
<tr><td valign=top><em>s</em> </td><td>The stream reference. </td></tr> |
| 400 |
<tr><td valign=top><em>iov</em> </td><td>A pointer to one or more iovec structures. </td></tr> |
| 401 |
<tr><td valign=top><em>iovcnt</em> </td><td>Number of iovec structures provided.</td></tr> |
| 402 |
</table> |
| 403 |
</dl> |
| 404 |
<dl compact><dt><b>Returns:</b></dt><dd>The number of bytes which where written or -1 if an error occured. </dd></dl> |
| 405 |
</td> |
| 406 |
</tr> |
| 407 |
</table> |
| 408 |
<hr size="1"><address style="align: right;"><small>Generated on Sat Jan 17 21:41:54 2004 for the PEAK Library by |
| 409 |
<a href="http://www.doxygen.org/index.html"> |
| 410 |
<img src="doxygen.png" alt="doxygen" align="middle" border="0" > |
| 411 |
</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> |
| 412 |
</body> |
| 413 |
</html> |
| 414 |
|