From Tomasz Mon via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8503 :
[metze/wireshark/wip.git] / wiretap / file_wrappers.h
1 /* file_wrappers.h
2  *
3  * $Id$
4  *
5  * Wiretap Library
6  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __FILE_H__
24 #define __FILE_H__
25
26 #include <glib.h>
27 #include <wtap.h>
28 #include <wsutil/file_util.h>
29 #include "ws_symbol_export.h"
30
31 extern FILE_T file_open(const char *path);
32 extern FILE_T file_fdopen(int fildes);
33 extern void file_set_random_access(FILE_T stream, gboolean random_flag, GPtrArray *seek);
34 WS_DLL_PUBLIC gint64 file_seek(FILE_T stream, gint64 offset, int whence, int *err);
35 extern gint64 file_skip(FILE_T file, gint64 delta, int *err);
36 WS_DLL_PUBLIC gint64 file_tell(FILE_T stream);
37 extern gint64 file_tell_raw(FILE_T stream);
38 extern int file_fstat(FILE_T stream, ws_statb64 *statb, int *err);
39 extern gboolean file_iscompressed(FILE_T stream);
40 WS_DLL_PUBLIC int file_read(void *buf, unsigned int count, FILE_T file);
41 WS_DLL_PUBLIC int file_getc(FILE_T stream);
42 WS_DLL_PUBLIC char *file_gets(char *buf, int len, FILE_T stream);
43 WS_DLL_PUBLIC int file_eof(FILE_T stream);
44 WS_DLL_PUBLIC int file_error(FILE_T fh, gchar **err_info);
45 extern void file_clearerr(FILE_T stream);
46 extern void file_fdclose(FILE_T file);
47 extern int file_fdreopen(FILE_T file, const char *path);
48 extern void file_close(FILE_T file);
49
50 #ifdef HAVE_LIBZ
51 typedef struct wtap_writer *GZWFILE_T;
52
53 extern GZWFILE_T gzwfile_open(const char *path);
54 extern GZWFILE_T gzwfile_fdopen(int fd);
55 extern guint gzwfile_write(GZWFILE_T state, const void *buf, guint len);
56 extern int gzwfile_flush(GZWFILE_T state);
57 extern int gzwfile_close(GZWFILE_T state);
58 extern int gzwfile_geterr(GZWFILE_T state);
59 #endif /* HAVE_LIBZ */
60
61 #endif /* __FILE_H__ */