File: filedescriptor.h.html

package info (click to toggle)
rudiments 0.32-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,932 kB
  • ctags: 3,047
  • sloc: cpp: 23,013; sh: 7,769; ansic: 1,769; makefile: 1,057; xml: 169; perl: 19
file content (559 lines) | stat: -rw-r--r-- 58,825 bytes parent folder | download | duplicates (2)
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<html>
<head>
<title>~/src/firstworks/rudiments-0.31/include/rudiments/filedescriptor.h.html</title>
<meta name="Generator" content="Vim/7.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<font color="#0000ff">// Copyright (c) 2002 David Muse</font>
<font color="#0000ff">// See the COPYING file for more information.</font>

<font color="#a020f0">#ifndef RUDIMENTS_FILEDESCRIPTOR_H</font>
<font color="#a020f0">#define RUDIMENTS_FILEDESCRIPTOR_H</font>

<font color="#a020f0">#include </font><font color="#ff00ff">&lt;rudiments/private/filedescriptorincludes.h&gt;</font>

<font color="#0000ff">// The filedescriptor class is a base class for other classes that utilize</font>
<font color="#0000ff">// file descriptors.</font>

<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
<font color="#2e8b57"><b>namespace</b></font> rudiments {
<font color="#a020f0">#endif</font>

<font color="#2e8b57"><b>class</b></font> listener;

<font color="#2e8b57"><b>class</b></font> filedescriptorprivate;

<font color="#2e8b57"><b>class</b></font> filedescriptor {
        <font color="#a52a2a"><b>public</b></font>:
                        filedescriptor();
                                <font color="#0000ff">// Creates an uninitialized filedescriptor.</font>
                        filedescriptor(<font color="#2e8b57"><b>const</b></font> filedescriptor &amp;f);
                filedescriptor  &amp;<font color="#a52a2a"><b>operator</b></font>=(<font color="#2e8b57"><b>const</b></font> filedescriptor &amp;f);
                <font color="#2e8b57"><b>virtual</b></font>       ~filedescriptor();
                                <font color="#0000ff">// Calls close() if it hasn't already been</font>
                                <font color="#0000ff">// called.</font>


                <font color="#2e8b57"><b>virtual</b></font>       <font color="#2e8b57"><b>bool</b></font>  close();
                                <font color="#0000ff">// Closes the file descriptor.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>

                <font color="#2e8b57"><b>int</b></font>   getFileDescriptor() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Returns the file descriptor.</font>
                <font color="#2e8b57"><b>void</b></font>  setFileDescriptor(<font color="#2e8b57"><b>int</b></font> filedesc);
                                <font color="#0000ff">// Sets the file descriptor associated with</font>
                                <font color="#0000ff">// the class to &quot;filedesc&quot;.</font>

                <font color="#2e8b57"><b>int</b></font>   duplicate() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Duplicates the file descriptor and returns</font>
                                <font color="#0000ff">// the handle of the duplicate descriptor.  The</font>
                                <font color="#0000ff">// old and new descriptors may be used</font>
                                <font color="#0000ff">// interchangeably, they share locks, position</font>
                                <font color="#0000ff">// pointers, flags (except the close-on-exec</font>
                                <font color="#0000ff">// flag), etc.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Returns the lowest-numbered unused descriptor</font>
                                <font color="#0000ff">// on success or -1 on failure.</font>
                <font color="#2e8b57"><b>bool</b></font>  duplicate(<font color="#2e8b57"><b>int</b></font> newfd) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Sets file descriptor handle &quot;newfd&quot; to be a</font>
                                <font color="#0000ff">// duplicate of this file descriptor.  If</font>
                                <font color="#0000ff">// &quot;newfd&quot; is already open, it will be closed</font>
                                <font color="#0000ff">// first.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>

<font color="#a020f0">                #ifdef RUDIMENTS_HAS_SSL</font>
                <font color="#2e8b57"><b>void</b></font>  setSSLContext(SSL_CTX *ctx);
                                <font color="#0000ff">// Associates SSL context &quot;ctx&quot; with the</font>
                                <font color="#0000ff">// filedescriptor.  Passing in a NULL for &quot;ctx&quot;</font>
                                <font color="#0000ff">// has the additional side effect of calling</font>
                                <font color="#0000ff">// deInitializeSSL() below.</font>
                SSL_CTX *getSSLContext();
                                <font color="#0000ff">// Returns the SSL context currently associated</font>
                                <font color="#0000ff">// with the filedescriptor or NULL if none</font>
                                <font color="#0000ff">// is currently associated.</font>
                <font color="#2e8b57"><b>bool</b></font>  initializeSSL();
                                <font color="#0000ff">// Should be called after calling</font>
                                <font color="#0000ff">// setSSLContext() and one of open(),</font>
                                <font color="#0000ff">// create() or connect() (from socket child</font>
                                <font color="#0000ff">// classes). Causes the appropriate SSL</font>
                                <font color="#0000ff">// function to be called instead of or in</font>
                                <font color="#0000ff">// concert with read(), write(), connect(),</font>
                                <font color="#0000ff">// accept() and close() methods.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Returns true on success and false on failure</font>
                SSL     *getSSL() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Returns a pointer to the currently</font>
                                <font color="#0000ff">// initialized SSL handle or NULL if</font>
                                <font color="#0000ff">// initializeSSL() has not been called or</font>
                                <font color="#0000ff">// failed.</font>
                <font color="#2e8b57"><b>void</b></font>  deInitializeSSL();
                                <font color="#0000ff">// Causes read(), write(), connect(), accept()</font>
                                <font color="#0000ff">// and close() methods to be performed</font>
                                <font color="#0000ff">// without the accompanying SSL-specific</font>
                                <font color="#0000ff">// functions.</font>

                <font color="#2e8b57"><b>int</b></font>   getSSLResult() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Returns the result code of the previously</font>
                                <font color="#0000ff">// executed SSL command.  If a method fails</font>
                                <font color="#0000ff">// but errno is 0 then an SSL-related error</font>
                                <font color="#0000ff">// occurred.  You may call SSL_get_error()</font>
                                <font color="#0000ff">// on the result of this method to determine</font>
                                <font color="#0000ff">// the exact error.</font>
<font color="#a020f0">                #endif</font>

                <font color="#2e8b57"><b>virtual</b></font> <font color="#2e8b57"><b>bool</b></font>  useNonBlockingMode() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Puts the file descriptor in non-blocking</font>
                                <font color="#0000ff">// mode.  Returns true on success and false on</font>
                                <font color="#0000ff">// failure.</font>
                <font color="#2e8b57"><b>virtual</b></font> <font color="#2e8b57"><b>bool</b></font>  useBlockingMode() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Puts the file descriptor in blocking mode.</font>
                                <font color="#0000ff">// Returns true on success and false on</font>
                                <font color="#0000ff">// failure.</font>
                <font color="#2e8b57"><b>bool</b></font>          isUsingNonBlockingMode() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Returns true if the file descriptor is in</font>
                                <font color="#0000ff">// non-blocking mode and false otherwise.</font>

                <font color="#0000ff">// Write methods - write data to the file descriptor.</font>
                <font color="#0000ff">// These methods return the number of bytes that were</font>
                <font color="#0000ff">// successfully written or RESULT_ERROR if an error occurred.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>uint16_t</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>uint32_t</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>uint64_t</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>int16_t</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>int32_t</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>int64_t</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>float</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>double</b></font> number) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> character) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;character&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>char</b></font> character) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;character&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>bool</b></font> value) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;value&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *string) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;string&quot; to the file descriptor.  Note</font>
                                <font color="#0000ff">// that &quot;string&quot; must be NULL-terminated.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *string) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;string&quot; to the file descriptor.  Note</font>
                                <font color="#0000ff">// that &quot;string&quot; must be NULL-terminated.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *string, <font color="#2e8b57"><b>size_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;size&quot; bytes from &quot;string&quot; to the file</font>
                                <font color="#0000ff">// descriptor.  Note that it is possible to</font>
                                <font color="#0000ff">// write beyond the string's NULL terminator</font>
                                <font color="#0000ff">// using this method.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *string, <font color="#2e8b57"><b>size_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;size&quot; bytes from &quot;string&quot; to the file</font>
                                <font color="#0000ff">// descriptor.  Note that it is possible to</font>
                                <font color="#0000ff">// write beyond the string's NULL terminator</font>
                                <font color="#0000ff">// using this method.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>void</b></font> *buffer, <font color="#2e8b57"><b>size_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;size&quot; bytes from &quot;buffer&quot; to the file</font>
                                <font color="#0000ff">// descriptor.</font>


                <font color="#0000ff">// Write methods - write data to the file descriptor with a</font>
                <font color="#0000ff">// timeout of &quot;sec&quot; seconds and &quot;usec&quot; microseconds.</font>
                <font color="#0000ff">// These methods return the number of bytes that were</font>
                <font color="#0000ff">// successfully written, RESULT_ERROR if an error occurred or</font>
                <font color="#0000ff">// RESULT_TIMEOUT if a timeout occurred.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>uint16_t</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>uint32_t</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>uint64_t</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>int16_t</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>int32_t</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>int64_t</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>float</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>double</b></font> number, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;number&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> character,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;character&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>char</b></font> character, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;character&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>bool</b></font> value, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;value&quot; to the file descriptor.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *string,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;string&quot; to the file descriptor.  Note</font>
                                <font color="#0000ff">// that &quot;string&quot; must be NULL-terminated.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *string,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;string&quot; to the file descriptor.  Note</font>
                                <font color="#0000ff">// that &quot;string&quot; must be NULL-terminated.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *string, <font color="#2e8b57"><b>size_t</b></font> size,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;size&quot; bytes from &quot;string&quot; to the file</font>
                                <font color="#0000ff">// descriptor.  Note that it is possible to</font>
                                <font color="#0000ff">// write beyond the string's NULL terminator</font>
                                <font color="#0000ff">// using this method.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> *string, <font color="#2e8b57"><b>size_t</b></font> size,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;size&quot; bytes from &quot;string&quot; to the file</font>
                                <font color="#0000ff">// descriptor.  Note that it is possible to</font>
                                <font color="#0000ff">// write beyond the string's NULL terminator</font>
                                <font color="#0000ff">// using this method.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       write(<font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>void</b></font> *buffer, <font color="#2e8b57"><b>size_t</b></font> size,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Write &quot;size&quot; bytes from &quot;buffer&quot; to the file</font>
                                <font color="#0000ff">// descriptor.</font>


                <font color="#0000ff">// Read methods - read data from the file descriptor.</font>
                <font color="#0000ff">// These methods return the number of bytes that were</font>
                <font color="#0000ff">// successfully read or RESULT_ERROR if an error occurred.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>uint16_t</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(uint16_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>uint32_t</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(uint32_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>uint64_t</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(uint64_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>int16_t</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(int16_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>int32_t</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(int32_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>int64_t</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(int64_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>float</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(float) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>double</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(double) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(unsigned char) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>char</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(char) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>bool</b></font> *buffer) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(bool) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *buffer, <font color="#2e8b57"><b>size_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads &quot;size&quot; bytes from the file descriptor</font>
                                <font color="#0000ff">// into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>char</b></font> *buffer, <font color="#2e8b57"><b>size_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads &quot;size&quot; bytes from the file descriptor</font>
                                <font color="#0000ff">// into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>void</b></font> *buf, <font color="#2e8b57"><b>size_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads &quot;size&quot; bytes from the file descriptor</font>
                                <font color="#0000ff">// into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>char</b></font> **buffer, <font color="#2e8b57"><b>char</b></font> *terminator) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads from the file desciptor into &quot;buffer&quot;</font>
                                <font color="#0000ff">// until &quot;terminator&quot; is encountered.  Note</font>
                                <font color="#0000ff">// that &quot;buffer&quot; is allocated internally and</font>
                                <font color="#0000ff">// must be freed by the calling program.</font>


                <font color="#0000ff">// Read methods - read data from the file descriptor with a</font>
                <font color="#0000ff">// timeout of &quot;sec&quot; seconds and &quot;usec&quot; microseconds.</font>
                <font color="#0000ff">// These methods return the number of bytes that were</font>
                <font color="#0000ff">// successfully read, RESULT_ERROR if an error occurred or</font>
                <font color="#0000ff">// RESULT_TIMEOUT if a timeout occurred.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>uint16_t</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(uint16_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>uint32_t</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(uint32_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>uint64_t</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(uint64_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>int16_t</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(int16_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>int32_t</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(int32_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>int64_t</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(int64_t) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>float</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(float) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>double</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(double) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *buffer,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(unsigned char) bytes</font>
                                <font color="#0000ff">// from the file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>char</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(char) bytes from the file</font>
                                <font color="#0000ff">// descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>bool</b></font> *buffer, <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads sizeof(bool) bytes from the</font>
                                <font color="#0000ff">// file descriptor into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>unsigned</b></font> <font color="#2e8b57"><b>char</b></font> *buffer, <font color="#2e8b57"><b>size_t</b></font> size,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads &quot;size&quot; bytes from the file descriptor</font>
                                <font color="#0000ff">// into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>char</b></font> *buffer, <font color="#2e8b57"><b>size_t</b></font> size,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads &quot;size&quot; bytes from the file descriptor</font>
                                <font color="#0000ff">// into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>void</b></font> *buf, <font color="#2e8b57"><b>size_t</b></font> size,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads &quot;size&quot; bytes from the file descriptor</font>
                                <font color="#0000ff">// into &quot;buffer&quot;.</font>
                <font color="#2e8b57"><b>ssize_t</b></font>       read(<font color="#2e8b57"><b>char</b></font> **buffer, <font color="#2e8b57"><b>char</b></font> *terminator,
                                        <font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Reads from the file desciptor into &quot;buffer&quot;</font>
                                <font color="#0000ff">// until &quot;terminator&quot; is encountered.  Note</font>
                                <font color="#0000ff">// that &quot;buffer&quot; is allocated internally and</font>
                                <font color="#0000ff">// must be freed by the calling program.</font>


                <font color="#0000ff">// Wait methods.</font>
                <font color="#2e8b57"><b>int</b></font>   waitForNonBlockingRead(<font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Causes the application to wait until a read()</font>
                                <font color="#0000ff">// will proceed without blocking or until &quot;sec&quot;</font>
                                <font color="#0000ff">// seconds and &quot;usec&quot; microseconds have elapsed.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Entering -1 for either parameter causes the</font>
                                <font color="#0000ff">// method to wait indefinitely.  </font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Entering 0 for both parameters causes the</font>
                                <font color="#0000ff">// method to fall through immediately unless a</font>
                                <font color="#0000ff">// data is immediately available.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Returns RESULT_ERROR on error, RESULT_TIMEOUT</font>
                                <font color="#0000ff">// on timeout and otherwise returns the number</font>
                                <font color="#0000ff">// of file descriptors that are ready to be</font>
                                <font color="#0000ff">// read from.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// This will usually be 1, indicating that the</font>
                                <font color="#0000ff">// file descriptor represented by the class is</font>
                                <font color="#0000ff">// ready to be read from.  However, if</font>
                                <font color="#0000ff">// useListener() has been called, it may be</font>
                                <font color="#0000ff">// greater than 1, indicating that a set of</font>
                                <font color="#0000ff">// file descriptors that the listener is</font>
                                <font color="#0000ff">// listening on are all ready to be read from.</font>
                <font color="#2e8b57"><b>int</b></font>   waitForNonBlockingWrite(<font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Causes the application to wait until a</font>
                                <font color="#0000ff">// write() will proceed without blocking or</font>
                                <font color="#0000ff">// until &quot;sec&quot; seconds and &quot;usec&quot; microseconds</font>
                                <font color="#0000ff">// have elapsed.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Entering -1 for either parameter causes the</font>
                                <font color="#0000ff">// method to wait indefinitely.  </font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Entering 0 for both parameters causes the</font>
                                <font color="#0000ff">// method to fall through immediately unless a</font>
                                <font color="#0000ff">// data is immediately available.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Returns RESULT_ERROR on error, RESULT_TIMEOUT</font>
                                <font color="#0000ff">// on timeout and otherwise returns the number</font>
                                <font color="#0000ff">// of file descriptors that are ready to be</font>
                                <font color="#0000ff">// written to.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// This will usually be 1, indicating that the</font>
                                <font color="#0000ff">// file descriptor represented by the class is</font>
                                <font color="#0000ff">// ready to be written to.  However, if</font>
                                <font color="#0000ff">// useListener() has been called, it may be</font>
                                <font color="#0000ff">// greater than 1, indicating that a set of</font>
                                <font color="#0000ff">// file descriptors that the listener is</font>
                                <font color="#0000ff">// listening on are all ready to be written to.</font>


                <font color="#0000ff">// By default, if a read or write is occurring and a signal</font>
                <font color="#0000ff">// interrupts it, the read or write returns with errno set to</font>
                <font color="#0000ff">// EINTR and must be retried.  These methods override that</font>
                <font color="#0000ff">// behavior.</font>
                <font color="#2e8b57"><b>void</b></font>  retryInterruptedReads();
                        <font color="#0000ff">// Causes reads to automatically retry if interrupted</font>
                        <font color="#0000ff">// by a signal.</font>
                <font color="#2e8b57"><b>void</b></font>  dontRetryInterruptedReads();
                        <font color="#0000ff">// Causes reads not to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.</font>
                <font color="#2e8b57"><b>void</b></font>  retryInterruptedWrites();
                        <font color="#0000ff">// Causes writes to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.  This is the default.</font>
                <font color="#2e8b57"><b>void</b></font>  dontRetryInterruptedWrites();
                        <font color="#0000ff">// Causes writes not to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.</font>
                <font color="#2e8b57"><b>void</b></font>  retryInterruptedWaits();
                        <font color="#0000ff">// Causes waits to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.  This is the default.</font>
                <font color="#2e8b57"><b>void</b></font>  dontRetryInterruptedWaits();
                        <font color="#0000ff">// Causes waits not to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.</font>
                <font color="#2e8b57"><b>void</b></font>  retryInterruptedFcntl();
                        <font color="#0000ff">// Causes fcntl() to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.  This is the default.</font>
                <font color="#2e8b57"><b>void</b></font>  dontRetryInterruptedFcntl();
                        <font color="#0000ff">// Causes fcntl() not to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.</font>
                <font color="#2e8b57"><b>void</b></font>  retryInterruptedIoctl();
                        <font color="#0000ff">// Causes ioctl() to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.  This is the default.</font>
                <font color="#2e8b57"><b>void</b></font>  dontRetryInterruptedIoctl();
                        <font color="#0000ff">// Causes ioctl() not to automatically retry if</font>
                        <font color="#0000ff">// interrupted by a signal.</font>


                <font color="#0000ff">// By default, read() will attempt to read the specified number</font>
                <font color="#0000ff">// of bytes from the file descriptor, in several passes if</font>
                <font color="#0000ff">// necessary.  No single pass will try to read more than</font>
                <font color="#0000ff">// SSIZE_MAX bytes.  These methods override that behavior.</font>
                <font color="#2e8b57"><b>void</b></font>  allowShortReads();
                        <font color="#0000ff">// Causes a read to return the number of bytes that</font>
                        <font color="#0000ff">// were read in a single pass from the file descriptor.</font>
                        <font color="#0000ff">// Note that reads longer than SSIZE_MAX will always</font>
                        <font color="#0000ff">// return SSIZE_MAX or fewer bytes.  This is useful,</font>
                        <font color="#0000ff">// for example, when reading from devices which block</font>
                        <font color="#0000ff">// rather than returning 0 for EOF.</font>
                <font color="#2e8b57"><b>void</b></font>  dontAllowShortReads();
                        <font color="#0000ff">// Causes a read to attempt to read the specified</font>
                        <font color="#0000ff">// number of bytes from the file descriptor, in several</font>
                        <font color="#0000ff">// passes if necessary.</font>

                <font color="#0000ff">// By default, write() will attempt to write the specified</font>
                <font color="#0000ff">// number of bytes from the file descriptor, in several passes</font>
                <font color="#0000ff">// if necessary.  No single pass will try to read more than</font>
                <font color="#0000ff">// SSIZE_MAX bytes.  These methods override that behavior.</font>
                <font color="#2e8b57"><b>void</b></font>  allowShortWrites();
                        <font color="#0000ff">// Causes a write to return the number of bytes that</font>
                        <font color="#0000ff">// were written in a single pass from the file</font>
                        <font color="#0000ff">// descriptor.  Note that writes longer than SSIZE_MAX</font>
                        <font color="#0000ff">// will always return SSIZE_MAX or fewer bytes.  This</font>
                        <font color="#0000ff">// is useful, for example, when writing to devices</font>
                        <font color="#0000ff">// which block rather than returning 0 for EOF.</font>
                <font color="#2e8b57"><b>void</b></font>  dontAllowShortWrites();
                        <font color="#0000ff">// Causes a write to attempt to write the specified</font>
                        <font color="#0000ff">// number of bytes from the file descriptor, in several</font>
                        <font color="#0000ff">// passes if necessary.</font>


                <font color="#0000ff">// By default, calls to waitForNonBlockingRead() and</font>
                <font color="#0000ff">// waitForNonBlockingWrite() will wait using the select()</font>
                <font color="#0000ff">// system call.  These methods override that behavior.</font>
                <font color="#2e8b57"><b>void</b></font>  useListener(listener *lstnr);
                        <font color="#0000ff">// Causes calls to waitForNonBlockingRead() and</font>
                        <font color="#0000ff">// waitForNonBlockingWrite() to in turn call</font>
                        <font color="#0000ff">// lstnr-&gt;waitForNonBlockingRead() or</font>
                        <font color="#0000ff">// lstnr-&gt;waitForNonBlockingWrite().</font>
                <font color="#2e8b57"><b>void</b></font>  dontUseListener();
                        <font color="#0000ff">// Causes calls to waitForNonBlockingRead() and</font>
                        <font color="#0000ff">// waitForNonBlockingWrite() to use select().</font>
                        <font color="#0000ff">// This is the default.</font>
                listener        *getListener();
                        <font color="#0000ff">// Returns the listener set previously by useListener() </font>
                        <font color="#0000ff">// or NULL if none has been set.</font>
                <font color="#2e8b57"><b>void</b></font>  useListenerInsideReads();
                <font color="#2e8b57"><b>void</b></font>  dontUseListenerInsideReads();
                        <font color="#0000ff">// </font><span style="background-color: #ffff00"><font color="#0000ff">FIXME</font></span><font color="#0000ff">: document this</font>
                <font color="#2e8b57"><b>void</b></font>  useListenerInsideWrites();
                <font color="#2e8b57"><b>void</b></font>  dontUseListenerInsideWrites();
                        <font color="#0000ff">// </font><span style="background-color: #ffff00"><font color="#0000ff">FIXME</font></span><font color="#0000ff">: document this</font>


                <font color="#2e8b57"><b>virtual</b></font> <font color="#2e8b57"><b>bool</b></font>  passFileDescriptor(<font color="#2e8b57"><b>int</b></font> descriptor) <font color="#2e8b57"><b>const</b></font>;
                <font color="#2e8b57"><b>virtual</b></font> <font color="#2e8b57"><b>bool</b></font>  receiveFileDescriptor(<font color="#2e8b57"><b>int</b></font> *descriptor) <font color="#2e8b57"><b>const</b></font>;

                <font color="#2e8b57"><b>void</b></font>  translateByteOrder();
                <font color="#2e8b57"><b>void</b></font>  dontTranslateByteOrder();

                <font color="#2e8b57"><b>int</b></font>   fcntl(<font color="#2e8b57"><b>int</b></font> command, <font color="#2e8b57"><b>long</b></font> arg) <font color="#2e8b57"><b>const</b></font>;
                <font color="#2e8b57"><b>int</b></font>   ioctl(<font color="#2e8b57"><b>int</b></font> command, <font color="#2e8b57"><b>void</b></font> *arg) <font color="#2e8b57"><b>const</b></font>;
                        <font color="#0000ff">// Interfaces for performing varions miscellaneous</font>
                        <font color="#0000ff">// operations on the file descriptor.</font>

                <font color="#2e8b57"><b>bool</b></font>  useNaglesAlgorithm();
                        <font color="#0000ff">// Causes small write()'s to be collected up and</font>
                        <font color="#0000ff">// sent together when the buffer is full or when</font>
                        <font color="#0000ff">// a maximum of 0.2 seconds has gone by.  This is</font>
                        <font color="#0000ff">// the default. (enables Nagle's algorithm)</font>
                        <font color="#0000ff">//</font>
                        <font color="#0000ff">// Returns true on success and false on failure.</font>
                <font color="#2e8b57"><b>bool</b></font>  dontUseNaglesAlgorithm();
                        <font color="#0000ff">// Causes all write()'s to be sent immediately.</font>
                        <font color="#0000ff">// (disables Nagle's algorithm)</font>
                        <font color="#0000ff">//</font>
                        <font color="#0000ff">// Returns true on success and false on failure.</font>

                <font color="#2e8b57"><b>bool</b></font>  getTcpWriteBufferSize(<font color="#2e8b57"><b>int</b></font> *size);
                <font color="#2e8b57"><b>bool</b></font>  setTcpWriteBufferSize(<font color="#2e8b57"><b>int</b></font> size);
                <font color="#2e8b57"><b>bool</b></font>  getTcpReadBufferSize(<font color="#2e8b57"><b>int</b></font> *size);
                <font color="#2e8b57"><b>bool</b></font>  setTcpReadBufferSize(<font color="#2e8b57"><b>int</b></font> size);

                <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font>    *getType() <font color="#2e8b57"><b>const</b></font>;

                <font color="#2e8b57"><b>char</b></font>          *getPeerAddress() <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Returns the IP address of the client at</font>
                                <font color="#0000ff">// the other end of the connection if </font>
                                <font color="#0000ff">// the filedescriptor is an inet socket or</font>
                                <font color="#0000ff">// NULL otherwise.</font>
                                <font color="#0000ff">//</font>
                                <font color="#0000ff">// Note that the buffer for the address is</font>
                                <font color="#0000ff">// allocated internally and must be freed by</font>
                                <font color="#0000ff">// the calling program.</font>


                <font color="#0000ff">// If an application does many small writes, the overhead of</font>
                <font color="#0000ff">// all of those ::write() system calls can slow the application</font>
                <font color="#0000ff">// down substantially.  To address that issue, the</font>
                <font color="#0000ff">// filedescriptor class can buffer data passed in to any of it's</font>
                <font color="#0000ff">// write() methods and only make ::write() system calls when</font>
                <font color="#0000ff">// the buffer is full or when it's flushed manually.  Note that</font>
                <font color="#0000ff">// when using buffered writes, the data is not actually written</font>
                <font color="#0000ff">// to the file descriptor until the buffer is full or until</font>
                <font color="#0000ff">// it's flushed manually.</font>
                <font color="#2e8b57"><b>bool</b></font>          setWriteBufferSize(<font color="#2e8b57"><b>ssize_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Discards the current write buffer and sets</font>
                                <font color="#0000ff">// the size of the write buffer to &quot;size&quot;.  A</font>
                                <font color="#0000ff">// size of 0 means don't buffer writes at all.</font>
                                <font color="#0000ff">// A size less than 0 will return false.</font>
                <font color="#2e8b57"><b>bool</b></font>          flushWriteBuffer(<font color="#2e8b57"><b>long</b></font> sec, <font color="#2e8b57"><b>long</b></font> usec) <font color="#2e8b57"><b>const</b></font>;
                                <font color="#0000ff">// Causes the contents of the write buffer to</font>
                                <font color="#0000ff">// be written to the filedescriptor immediately.</font>


                <font color="#2e8b57"><b>bool</b></font>          setReadBufferSize(<font color="#2e8b57"><b>ssize_t</b></font> size) <font color="#2e8b57"><b>const</b></font>;

                <font color="#0000ff">// These methods manipulate or return the close-on-exec status</font>
                <font color="#0000ff">// of the file descriptor.  If close-on-exec is false (the</font>
                <font color="#0000ff">// default), then the file descriptor will remain open across</font>
                <font color="#0000ff">// an execve() call, otherwise it will be closed.</font>
                <font color="#2e8b57"><b>bool</b></font>          closeOnExec();
                                <font color="#0000ff">// sets the close-on-exec status to true</font>
                <font color="#2e8b57"><b>bool</b></font>          dontCloseOnExec();
                                <font color="#0000ff">// sets the close-on-exec status to false</font>
                <font color="#2e8b57"><b>bool</b></font>          getCloseOnExec();
                                <font color="#0000ff">// Returns true if the close-on-exec status</font>
                                <font color="#0000ff">// is set true and false otherwise.</font>

<font color="#a020f0">        #include </font><font color="#ff00ff">&lt;rudiments/private/filedescriptor.h&gt;</font>
};

<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
}
<font color="#a020f0">#endif</font>

<font color="#a020f0">#endif</font>
</pre>
</body>
</html>