aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_access.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r--wiretap/file_access.c263
1 files changed, 117 insertions, 146 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index ec83e87aa6..9a9a34d7c4 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -36,7 +36,6 @@
#include <wsutil/file_util.h>
-#include "wftap-int.h"
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
@@ -674,13 +673,12 @@ static gboolean heuristic_uses_extension(unsigned int i, const char *extension)
so that it can do sequential I/O to a capture file that's being
written to as new packets arrive independently of random I/O done
to display protocol trees for packets when they're selected. */
-wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_info,
+wtap* wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_info,
gboolean do_random)
{
int fd;
ws_statb64 statb;
wtap *wth;
- wftap *wfth;
unsigned int i;
gboolean use_stdin = FALSE;
gchar *extension;
@@ -744,79 +742,76 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
}
errno = ENOMEM;
- wfth = (wftap *)g_malloc0(sizeof(wtap));
+ wth = (wtap *)g_malloc0(sizeof(wtap));
/* Open the file */
errno = WTAP_ERR_CANT_OPEN;
if (use_stdin) {
/*
* We dup FD 0, so that we don't have to worry about
- * a file_close of wfth->fh closing the standard
+ * a file_close of wth->fh closing the standard
* input of the process.
*/
fd = ws_dup(0);
if (fd < 0) {
*err = errno;
- g_free(wfth);
+ g_free(wth);
return NULL;
}
#ifdef _WIN32
if (_setmode(fd, O_BINARY) == -1) {
/* "Shouldn't happen" */
*err = errno;
- g_free(wfth);
+ g_free(wth);
return NULL;
}
#endif
- if (!(wfth->fh = file_fdopen(fd))) {
+ if (!(wth->fh = file_fdopen(fd))) {
*err = errno;
ws_close(fd);
- g_free(wfth);
+ g_free(wth);
return NULL;
}
} else {
- if (!(wfth->fh = file_open(filename))) {
+ if (!(wth->fh = file_open(filename))) {
*err = errno;
- g_free(wfth);
+ g_free(wth);
return NULL;
}
}
if (do_random) {
- if (!(wfth->random_fh = file_open(filename))) {
+ if (!(wth->random_fh = file_open(filename))) {
*err = errno;
- file_close(wfth->fh);
- g_free(wfth);
+ file_close(wth->fh);
+ g_free(wth);
return NULL;
}
} else
- wfth->random_fh = NULL;
-
- wth = (wtap *)g_malloc0(sizeof(wtap));
- wfth->tap_specific_data = wth;
+ wth->random_fh = NULL;
/* initialization */
- wfth->file_encap = WTAP_ENCAP_UNKNOWN;
- wfth->subtype_sequential_close = NULL;
- wfth->subtype_close = NULL;
- wfth->tsprecision = WTAP_FILE_TSPREC_USEC;
- wfth->priv = NULL;
- wfth->wslua_data = NULL;
-
- if (wfth->random_fh) {
- wfth->fast_seek = g_ptr_array_new();
-
- file_set_random_access(wfth->fh, FALSE, wfth->fast_seek);
- file_set_random_access(wfth->random_fh, TRUE, wfth->fast_seek);
+ wth->file_encap = WTAP_ENCAP_UNKNOWN;
+ wth->subtype_sequential_close = NULL;
+ wth->subtype_close = NULL;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
+ wth->priv = NULL;
+ wth->wslua_data = NULL;
+
+ if (wth->random_fh) {
+ wth->fast_seek = g_ptr_array_new();
+
+ file_set_random_access(wth->fh, FALSE, wth->fast_seek);
+ file_set_random_access(wth->random_fh, TRUE, wth->fast_seek);
}
/* 'type' is 1 greater than the array index */
if (type != WTAP_TYPE_AUTO && type <= open_info_arr->len) {
int result;
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
@@ -824,14 +819,14 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
* to the file reader, kinda like the priv member but not free'd later.
* It's ok for this to copy a NULL.
*/
- wfth->wslua_data = open_routines[type - 1].wslua_data;
+ wth->wslua_data = open_routines[type - 1].wslua_data;
- result = (*open_routines[type - 1].open_routine)(wfth, err, err_info);
+ result = (*open_routines[type - 1].open_routine)(wth, err, err_info);
switch (result) {
case -1:
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -853,9 +848,9 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
to start reading at the beginning.
Initialize the data offset while we're at it. */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
@@ -863,13 +858,13 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
* to the file reader, kinda like the priv member but not free'd later.
* It's ok for this to copy a NULL.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth, err, err_info)) {
+ switch ((*open_routines[i].open_routine)(wth, err, err_info)) {
case -1:
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -891,25 +886,25 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
/* Does this type use that extension? */
if (heuristic_uses_extension(i, extension)) {
/* Yes. */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
/* Set wth with wslua data if any - this is how we pass the data
* to the file reader, kind of like priv but not free'd later.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth,
+ switch ((*open_routines[i].open_routine)(wth,
err, err_info)) {
case -1:
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -929,25 +924,25 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
/* Does this type use that extension? */
if (!heuristic_uses_extension(i, extension)) {
/* No. */
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
/* Set wth with wslua data if any - this is how we pass the data
* to the file reader, kind of like priv but not free'd later.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth,
+ switch ((*open_routines[i].open_routine)(wth,
err, err_info)) {
case -1:
/* I/O error - give up */
g_free(extension);
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -966,22 +961,22 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
/* No - try all the heuristics types in order. */
for (i = heuristic_open_routine_idx; i < open_info_arr->len; i++) {
- if (file_seek(wfth->fh, 0, SEEK_SET, err) == -1) {
+ if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) {
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
}
/* Set wth with wslua data if any - this is how we pass the data
* to the file reader, kind of like priv but not free'd later.
*/
- wfth->wslua_data = open_routines[i].wslua_data;
+ wth->wslua_data = open_routines[i].wslua_data;
- switch ((*open_routines[i].open_routine)(wfth, err, err_info)) {
+ switch ((*open_routines[i].open_routine)(wth, err, err_info)) {
case -1:
/* I/O error - give up */
- wtap_close(wfth);
+ wtap_close(wth);
return NULL;
case 0:
@@ -998,22 +993,22 @@ wftap* wtap_open_offline(const char *filename, unsigned int type, int *err, char
fail:
/* Well, it's not one of the types of file we know about. */
- wtap_close(wfth);
+ wtap_close(wth);
*err = WTAP_ERR_FILE_UNKNOWN_FORMAT;
return NULL;
success:
- wfth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
- buffer_init(wfth->frame_buffer, 1500);
+ wth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
+ buffer_init(wth->frame_buffer, 1500);
- if(wfth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
+ if(wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
wtapng_if_descr_t descr;
- descr.wtap_encap = wfth->file_encap;
+ descr.wtap_encap = wth->file_encap;
descr.time_units_per_second = 1000000; /* default microsecond resolution */
- descr.link_type = wtap_wtap_encap_to_pcap_encap(wfth->file_encap);
- descr.snap_len = wfth->snapshot_length;
+ descr.link_type = wtap_wtap_encap_to_pcap_encap(wth->file_encap);
+ descr.snap_len = wth->snapshot_length;
descr.opt_comment = NULL;
descr.if_name = NULL;
descr.if_description = NULL;
@@ -1031,7 +1026,7 @@ success:
g_array_append_val(wth->interface_data, descr);
}
- return wfth;
+ return wth;
}
/*
@@ -1047,7 +1042,7 @@ success:
* reopens the random stream.
*/
gboolean
-wftap_fdreopen(wftap *wfth, const char *filename, int *err)
+wtap_fdreopen(wtap *wth, const char *filename, int *err)
{
ws_statb64 statb;
@@ -1089,7 +1084,7 @@ wftap_fdreopen(wftap *wfth, const char *filename, int *err)
/* Open the file */
errno = WTAP_ERR_CANT_OPEN;
- if (!file_fdreopen(wfth->random_fh, filename)) {
+ if (!file_fdreopen(wth->random_fh, filename)) {
*err = errno;
return FALSE;
}
@@ -1961,40 +1956,31 @@ gboolean wtap_dump_supports_comment_types(int file_type_subtype, guint32 comment
}
static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean comressed, int *err);
-static wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int snaplen,
+static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err);
-static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
+static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err);
-static WFILE_T wftap_dump_file_open(wftap_dumper *wdh, const char *filename);
-static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd);
-static int wtap_dump_file_close(wftap_dumper *wdh);
+static WFILE_T wtap_dump_file_open(wtap_dumper *wdh, const char *filename);
+static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh, int fd);
+static int wtap_dump_file_close(wtap_dumper *wdh);
-wftap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
+wtap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
int snaplen, gboolean compressed, int *err)
{
return wtap_dump_open_ng(filename, file_type_subtype, encap,snaplen, compressed, NULL, NULL, err);
}
-static wftap_dumper *
+static wtap_dumper *
wtap_dump_init_dumper(int file_type_subtype, int encap, int snaplen, gboolean compressed,
wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
{
- wftap_dumper *wfdh;
- wtap_dumper* wdh;
+ wtap_dumper *wdh;
/* Allocate a data structure for the output stream. */
- wfdh = wtap_dump_alloc_wfdh(file_type_subtype, encap, snaplen, compressed, err);
- if (wfdh == NULL)
+ wdh = wtap_dump_alloc_wdh(file_type_subtype, encap, snaplen, compressed, err);
+ if (wdh == NULL)
return NULL; /* couldn't allocate it */
- wdh = (wtap_dumper *)g_malloc0(sizeof (wtap_dumper));
- if (wdh == NULL) {
- *err = errno;
- g_free(wfdh);
- return NULL;
- }
- wfdh->tap_specific_data = wdh;
-
/* Set Section Header Block data */
wdh->shb_hdr = shb_hdr;
/* Set Interface Description Block data */
@@ -2024,14 +2010,13 @@ wtap_dump_init_dumper(int file_type_subtype, int encap, int snaplen, gboolean co
wdh->interface_data= g_array_new(FALSE, FALSE, sizeof(wtapng_if_descr_t));
g_array_append_val(wdh->interface_data, descr);
}
- return wfdh;
+ return wdh;
}
-wftap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
+wtap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
int snaplen, gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
{
- wftap_dumper *wfdh;
- wtap_dumper* wdh;
+ wtap_dumper *wdh;
WFILE_T fh;
/* Check whether we can open a capture file with that file type
@@ -2040,19 +2025,16 @@ wftap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int
return NULL;
/* Allocate and initialize a data structure for the output stream. */
- wfdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
+ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
shb_hdr, idb_inf, err);
- if (wfdh == NULL)
+ if (wdh == NULL)
return NULL;
- wdh = wfdh->tap_specific_data;
-
/* "-" means stdout */
if (strcmp(filename, "-") == 0) {
if (compressed) {
*err = EINVAL; /* XXX - return a Wiretap error code for this */
g_free(wdh);
- g_free(wfdh);
return NULL; /* compress won't work on stdout */
}
#ifdef _WIN32
@@ -2060,49 +2042,46 @@ wftap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int
/* "Should not happen" */
*err = errno;
g_free(wdh);
- g_free(wfdh);
return NULL; /* couldn't put standard output in binary mode */
}
#endif
- wfdh->fh = stdout;
+ wdh->fh = stdout;
} else {
/* In case "fopen()" fails but doesn't set "errno", set "errno"
to a generic "the open failed" error. */
errno = WTAP_ERR_CANT_OPEN;
- fh = wftap_dump_file_open(wfdh, filename);
+ fh = wtap_dump_file_open(wdh, filename);
if (fh == NULL) {
*err = errno;
g_free(wdh);
- g_free(wfdh);
return NULL; /* can't create file */
}
- wfdh->fh = fh;
+ wdh->fh = fh;
}
- if (!wtap_dump_open_finish(wfdh, file_type_subtype, compressed, err)) {
+ if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
/* Get rid of the file we created; we couldn't finish
opening it. */
- if (wfdh->fh != stdout) {
- wtap_dump_file_close(wfdh);
+ if (wdh->fh != stdout) {
+ wtap_dump_file_close(wdh);
ws_unlink(filename);
}
g_free(wdh);
- g_free(wfdh);
return NULL;
}
- return wfdh;
+ return wdh;
}
-wftap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
+wtap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err)
{
return wtap_dump_fdopen_ng(fd, file_type_subtype, encap, snaplen, compressed, NULL, NULL, err);
}
-wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
+wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err)
{
- wftap_dumper *wfdh;
+ wtap_dumper *wdh;
WFILE_T fh;
/* Check whether we can open a capture file with that file type
@@ -2111,9 +2090,9 @@ wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int
return NULL;
/* Allocate and initialize a data structure for the output stream. */
- wfdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
+ wdh = wtap_dump_init_dumper(file_type_subtype, encap, snaplen, compressed,
shb_hdr, idb_inf, err);
- if (wfdh == NULL)
+ if (wdh == NULL)
return NULL;
#ifdef _WIN32
@@ -2121,7 +2100,7 @@ wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int
if (_setmode(fileno(stdout), O_BINARY) == -1) {
/* "Should not happen" */
*err = errno;
- g_free(wfdh);
+ g_free(wdh);
return NULL; /* couldn't put standard output in binary mode */
}
}
@@ -2130,20 +2109,20 @@ wftap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int
/* In case "fopen()" fails but doesn't set "errno", set "errno"
to a generic "the open failed" error. */
errno = WTAP_ERR_CANT_OPEN;
- fh = wftap_dump_file_fdopen(wfdh, fd);
+ fh = wtap_dump_file_fdopen(wdh, fd);
if (fh == NULL) {
*err = errno;
- g_free(wfdh);
+ g_free(wdh);
return NULL; /* can't create standard I/O stream */
}
- wfdh->fh = fh;
+ wdh->fh = fh;
- if (!wtap_dump_open_finish(wfdh, file_type_subtype, compressed, err)) {
- wtap_dump_file_close(wfdh);
- g_free(wfdh);
+ if (!wtap_dump_open_finish(wdh, file_type_subtype, compressed, err)) {
+ wtap_dump_file_close(wdh);
+ g_free(wdh);
return NULL;
}
- return wfdh;
+ return wdh;
}
static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean compressed, int *err)
@@ -2179,12 +2158,12 @@ static gboolean wtap_dump_open_check(int file_type_subtype, int encap, gboolean
return TRUE;
}
-static wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int snaplen,
+static wtap_dumper* wtap_dump_alloc_wdh(int file_type_subtype, int encap, int snaplen,
gboolean compressed, int *err)
{
- wftap_dumper *wdh;
+ wtap_dumper *wdh;
- wdh = (wftap_dumper *)g_malloc0(sizeof (wftap_dumper));
+ wdh = (wtap_dumper *)g_malloc0(sizeof (wtap_dumper));
if (wdh == NULL) {
*err = errno;
return NULL;
@@ -2198,7 +2177,7 @@ static wftap_dumper* wtap_dump_alloc_wfdh(int file_type_subtype, int encap, int
return wdh;
}
-static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err)
+static gboolean wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compressed, int *err)
{
int fd;
gboolean cant_seek;
@@ -2238,13 +2217,13 @@ static gboolean wtap_dump_open_finish(wftap_dumper *wdh, int file_type_subtype,
return TRUE; /* success! */
}
-gboolean wtap_dump(wftap_dumper *wdh, const struct wtap_pkthdr *phdr,
+gboolean wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
const guint8 *pd, int *err)
{
- return (wdh->subtype_write)(wdh, (void*)phdr, pd, err);
+ return (wdh->subtype_write)(wdh, phdr, pd, err);
}
-void wftap_dump_flush(wftap_dumper *wdh)
+void wtap_dump_flush(wtap_dumper *wdh)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
@@ -2256,7 +2235,7 @@ void wftap_dump_flush(wftap_dumper *wdh)
}
}
-gboolean wftap_dump_close(wftap_dumper *wdh, int *err)
+gboolean wtap_dump_close(wtap_dumper *wdh, int *err)
{
gboolean ret = TRUE;
@@ -2280,44 +2259,36 @@ gboolean wftap_dump_close(wftap_dumper *wdh, int *err)
}
} else {
/* as we don't close stdout, at least try to flush it */
- wftap_dump_flush(wdh);
+ wtap_dump_flush(wdh);
}
if (wdh->priv != NULL)
g_free(wdh->priv);
-
- if (wdh->tap_specific_data != NULL)
- g_free(wdh->tap_specific_data);
-
g_free(wdh);
return ret;
}
-gint64 wftap_get_bytes_dumped(wftap_dumper *wdh)
+gint64 wtap_get_bytes_dumped(wtap_dumper *wdh)
{
return wdh->bytes_dumped;
}
-void wftap_set_bytes_dumped(wftap_dumper *wdh, gint64 bytes_dumped)
+void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
{
wdh->bytes_dumped = bytes_dumped;
}
-gboolean wtap_dump_set_addrinfo_list(wftap_dumper *wfdh, addrinfo_lists_t *addrinfo_lists)
+gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists)
{
- wtap_dumper *wdh;
-
- if (!wfdh || wfdh->file_type_subtype < 0 || wfdh->file_type_subtype >= wtap_num_file_types_subtypes
- || dump_open_table[wfdh->file_type_subtype].has_name_resolution == FALSE)
+ if (!wdh || wdh->file_type_subtype < 0 || wdh->file_type_subtype >= wtap_num_file_types_subtypes
+ || dump_open_table[wdh->file_type_subtype].has_name_resolution == FALSE)
return FALSE;
-
- wdh = (wtap_dumper*)wfdh->tap_specific_data;
wdh->addrinfo_lists = addrinfo_lists;
return TRUE;
}
/* internally open a file for writing (compressed or not) */
#ifdef HAVE_LIBZ
-static WFILE_T wftap_dump_file_open(wftap_dumper *wdh, const char *filename)
+static WFILE_T wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
{
if(wdh->compressed) {
return gzwfile_open(filename);
@@ -2326,7 +2297,7 @@ static WFILE_T wftap_dump_file_open(wftap_dumper *wdh, const char *filename)
}
}
#else
-static WFILE_T wftap_dump_file_open(wftap_dumper *wdh _U_, const char *filename)
+static WFILE_T wtap_dump_file_open(wtap_dumper *wdh _U_, const char *filename)
{
return ws_fopen(filename, "wb");
}
@@ -2334,7 +2305,7 @@ static WFILE_T wftap_dump_file_open(wftap_dumper *wdh _U_, const char *filename)
/* internally open a file for writing (compressed or not) */
#ifdef HAVE_LIBZ
-static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd)
+static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
{
if(wdh->compressed) {
return gzwfile_fdopen(fd);
@@ -2343,14 +2314,14 @@ static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd)
}
}
#else
-static WFILE_T wftap_dump_file_fdopen(wftap_dumper *wdh, int fd)
+static WFILE_T wtap_dump_file_fdopen(wtap_dumper *wdh _U_, int fd)
{
return fdopen(fd, "wb");
}
#endif
/* internally writing raw bytes (compressed or not) */
-gboolean wftap_dump_file_write(wftap_dumper *wdh, const void *buf, size_t bufsize,
+gboolean wtap_dump_file_write(wtap_dumper *wdh, const void *buf, size_t bufsize,
int *err)
{
size_t nwritten;
@@ -2385,7 +2356,7 @@ gboolean wftap_dump_file_write(wftap_dumper *wdh, const void *buf, size_t bufsiz
}
/* internally close a file for writing (compressed or not) */
-static int wtap_dump_file_close(wftap_dumper *wdh)
+static int wtap_dump_file_close(wtap_dumper *wdh)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
@@ -2397,7 +2368,7 @@ static int wtap_dump_file_close(wftap_dumper *wdh)
}
}
-gint64 wftap_dump_file_seek(wftap_dumper *wdh, gint64 offset, int whence, int *err)
+gint64 wtap_dump_file_seek(wtap_dumper *wdh, gint64 offset, int whence, int *err)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
@@ -2415,7 +2386,7 @@ gint64 wftap_dump_file_seek(wftap_dumper *wdh, gint64 offset, int whence, int *e
}
}
}
-gint64 wftap_dump_file_tell(wftap_dumper *wdh, int *err)
+gint64 wtap_dump_file_tell(wtap_dumper *wdh, int *err)
{
gint64 rval;
#ifdef HAVE_LIBZ