source: lib/libtraceio.h @ 8f45780

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 8f45780 was 8f45780, checked in by Perry Lorier <perry@…>, 16 years ago

Document this file so it ends up in doxygen

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/** @file
2 * Internal IO compatibility shim
3 */
4#ifndef LIBTRACEIO_H
5#define LIBTRACEIO_H 1
6#include "config.h"
7#ifdef HAVE_ZLIB
8#include <zlib.h>
9#else
10#include <stdio.h>
11#endif
12
13typedef struct libtrace_io_t libtrace_io_t;
14
15/** read a block from a file
16 * @param io    the io file object
17 * @param buf   the buffer to read into
18 * @param len   the number of bytes to read
19 *
20 * @returns -1 on error (with errno set), 0 on eof, otherwise the number of bytes
21 *      read.
22 */
23ssize_t libtrace_io_read(libtrace_io_t *io, void *buf, size_t len);
24/** open a file from a file descriptor (like fdopen(3))
25 * @param fd    file descriptor to read
26 * @param mode  text string to represent what mode to read the file in.
27 *
28 * @returns io object, or NULL on error.
29 */
30libtrace_io_t *libtrace_io_fdopen(int fd, const char *mode);
31/** open a file from a path name
32 * @param path  pathname to read
33 * @param mode  text string to represent what mode to read the file in.
34 *
35 * @returns io object, or NULL on error.
36 */
37libtrace_io_t *libtrace_io_open(const char *path, const char *mode);
38/** close a file and free all of it's resources.
39 * @param io    io object
40 *
41 * This function doesn't return anything.  In theory it could return an error
42 * but seriously, if it did return an error, what would you do about it?
43 */
44void libtrace_io_close(libtrace_io_t *io);
45
46/** write a block of data to a file
47 * @param io    libtrace io object to write to
48 * @param buf   buffer to write to
49 * @param len   number of bytes to write
50 *
51 * @returns the number of bytes successfully written, or -1 on error with
52 * errno set
53 */
54ssize_t libtrace_io_write(libtrace_io_t *io, const void *buf, size_t len);
55off_t libtrace_io_seek(libtrace_io_t *io, off_t offset, int whence);
56ssize_t libtrace_io_tell(libtrace_io_t *io);
57
58#endif
Note: See TracBrowser for help on using the repository browser.