aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-10 16:53:32 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-10 16:53:32 +0000
commitf27f61ac9eed53604cfef4cedf21a5b06f248f33 (patch)
treedff9a94892f320ecb4b7e2f02551ba4b52120ded /wiretap/file_wrappers.c
parent8b8082442d72cffa8ab5dcf6edae539558ea1bc2 (diff)
Move the definition of the structure pointed to by a FILE_T into
wiretap/file_wrappers.c; nothing outside of file_wrappers.c needs to know what it looks like, it just passes around pointers to it. svn path=/trunk/; revision=36538
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r--wiretap/file_wrappers.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 124a0a1952..13c8278387 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -18,7 +18,6 @@
* 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.
- *
*/
/* file_access interface based heavily on zlib gzread.c and gzlib.c from zlib
@@ -63,12 +62,38 @@
/* #define GZBUFSIZE 8192 */
#define GZBUFSIZE 4096
-/* values for gz_state compression */
-#define UNKNOWN 0 /* look for a gzip header */
-#define UNCOMPRESSED 1 /* copy input directly */
+struct wtap_reader {
+ int fd; /* file descriptor */
+ gint64 pos; /* current position in uncompressed data */
+ unsigned size; /* buffer size */
+ unsigned char *in; /* input buffer */
+ unsigned char *out; /* output buffer (double-sized when reading) */
+ unsigned char *next; /* next output data to deliver or write */
+
+ unsigned have; /* amount of output data unused at next */
+ int eof; /* true if end of input file reached */
+ gint64 start; /* where the gzip data started, for rewinding */
+ gint64 raw; /* where the raw data started, for seeking */
+ int compression; /* 0: ?, 1: uncompressed, 2: zlib */
+ /* seek request */
+ gint64 skip; /* amount to skip (already rewound if backwards) */
+ int seek; /* true if seek request pending */
+ /* error information */
+ int err; /* error code */
+
+ unsigned int avail_in; /* number of bytes available at next_in */
+ unsigned char *next_in; /* next input byte */
+#ifdef HAVE_LIBZ
+ /* zlib inflate stream */
+ z_stream strm; /* stream structure in-place (not a pointer) */
+#endif
+};
+/* values for gz_state compression */
+#define UNKNOWN 0 /* look for a gzip header */
+#define UNCOMPRESSED 1 /* copy input directly */
#ifdef HAVE_LIBZ
-#define ZLIB 2 /* decompress a zlib stream */
+#define ZLIB 2 /* decompress a zlib stream */
#endif
/* XXX, lseek64() instead of ws_lseek()? */
@@ -372,7 +397,7 @@ filed_open(int fd)
return NULL;
/* allocate gzFile structure to return */
- state = g_try_malloc(sizeof(wtap_reader));
+ state = g_try_malloc(sizeof *state);
if (state == NULL)
return NULL;