Don't use the zlib I/O routines for writing compressed files, either;
[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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  */
23
24 #ifndef __FILE_H__
25 #define __FILE_H__
26
27 extern gint64 file_seek(FILE_T stream, gint64 offset, int whence, int *err);
28 extern gint64 file_tell(FILE_T stream);
29 extern int file_error(FILE_T fh);
30
31 extern FILE_T file_open(const char *path);
32 extern FILE_T filed_open(int fildes);
33 extern int file_read(void *buf, unsigned int count, FILE_T file);
34 extern int file_close(FILE_T file);
35 extern int file_getc(FILE_T stream);
36 extern char *file_gets(char *buf, int len, FILE_T stream);
37 extern int file_eof(FILE_T stream);
38 extern void file_clearerr(FILE_T stream);
39
40 #ifdef HAVE_LIBZ
41 typedef struct wtap_writer *GZWFILE_T;
42
43 extern GZWFILE_T gzwfile_open(const char *path);
44 extern GZWFILE_T gzwfile_fdopen(int fd);
45 extern unsigned gzwfile_write(GZWFILE_T state, const void *buf, unsigned len);
46 extern int gzwfile_flush(GZWFILE_T state);
47 extern int gzwfile_close(GZWFILE_T state);
48 extern int gzwfile_geterr(GZWFILE_T state);
49 #endif /* HAVE_LIBZ */
50
51 #endif /* __FILE_H__ */