Remove Nmake build system
[metze/wireshark/wip.git] / wiretap / file_wrappers.h
index 3122a5e50f920424350bb1c73d2acb9f79863cb2..a7003f8a74b31ab8cef7d5b80d2d512dcbd8e613 100644 (file)
@@ -1,6 +1,4 @@
 /* file_wrappers.h
- *
- * $Id$
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef __FILE_H__
-#define __FILE_H__
-
-extern gint64 file_seek(void *stream, gint64 offset, int whence, int *err);
-extern gint64 file_tell(void *stream);
-extern int file_error(void *fh);
-
-#ifdef HAVE_LIBZ
-
-extern FILE_T file_open(const char *path, const char *mode);
-#define filed_open gzdopen
-/* XX: gzread and gzwrite return number of *bytes* (not number of elements) */
-#define file_read(buf, bsize, count, file) gzread((file),(buf),(unsigned)((count)*(bsize)))
-#define file_write(buf, bsize, count, file) gzwrite((file),(buf),((count)*(bsize)))
-#define file_close gzclose
-#define file_getc gzgetc
-#define file_gets(buf, len, file) gzgets((file), (buf), (len))
-#define file_eof gzeof
-
-#else /* No zLib */
-
-#define file_open(path, mode) ws_fopen(path, mode)
-#define filed_open fdopen
-/* XX: file_read and file_write defined to return number of *bytes* to be consistent with gzread & gzwrite */
-#define file_read(buf, bsize, count, file) ((bsize) * fread((buf), (bsize), (count), (file)))
-#define file_write(buf, bsize, count, file) ((bsize) * fwrite((buf), (bsize), (count), (file)))
-#define file_close fclose
-#define file_getc fgetc
-#define file_gets fgets
-#define file_eof feof
-
-#endif /* HAVE_LIBZ */
+#ifndef __WTAP_FILE_WRAPPERS_H__
+#define __WTAP_FILE_WRAPPERS_H__
+
+#include <glib.h>
+#include "wtap.h"
+#include <wsutil/file_util.h>
+#include "ws_symbol_export.h"
+
+extern FILE_T file_open(const char *path);
+extern FILE_T file_fdopen(int fildes);
+extern void file_set_random_access(FILE_T stream, gboolean random_flag, GPtrArray *seek);
+WS_DLL_PUBLIC gint64 file_seek(FILE_T stream, gint64 offset, int whence, int *err);
+extern gboolean file_skip(FILE_T file, gint64 delta, int *err);
+WS_DLL_PUBLIC gint64 file_tell(FILE_T stream);
+extern gint64 file_tell_raw(FILE_T stream);
+extern int file_fstat(FILE_T stream, ws_statb64 *statb, int *err);
+WS_DLL_PUBLIC gboolean file_iscompressed(FILE_T stream);
+WS_DLL_PUBLIC int file_read(void *buf, unsigned int count, FILE_T file);
+WS_DLL_PUBLIC int file_peekc(FILE_T stream);
+WS_DLL_PUBLIC int file_getc(FILE_T stream);
+WS_DLL_PUBLIC char *file_gets(char *buf, int len, FILE_T stream);
+WS_DLL_PUBLIC int file_eof(FILE_T stream);
+WS_DLL_PUBLIC int file_error(FILE_T fh, gchar **err_info);
+extern void file_clearerr(FILE_T stream);
+extern void file_fdclose(FILE_T file);
+extern int file_fdreopen(FILE_T file, const char *path);
+extern void file_close(FILE_T file);
+
+#ifdef HAVE_ZLIB
+typedef struct wtap_writer *GZWFILE_T;
+
+extern GZWFILE_T gzwfile_open(const char *path);
+extern GZWFILE_T gzwfile_fdopen(int fd);
+extern guint gzwfile_write(GZWFILE_T state, const void *buf, guint len);
+extern int gzwfile_flush(GZWFILE_T state);
+extern int gzwfile_close(GZWFILE_T state, gboolean is_stdout);
+extern int gzwfile_geterr(GZWFILE_T state);
+#endif /* HAVE_ZLIB */
 
 #endif /* __FILE_H__ */