source: lib/libtraceio.h @ 8d504c1

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

Fix problems with zlib in the new build environment

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