Move the file utility functions from wiretap to libwsutil so that

libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
This commit is contained in:
Jeff Morriss 2008-05-22 15:46:27 +00:00
parent da2f447a9b
commit a5cee04fad
108 changed files with 986 additions and 997 deletions

View File

@ -45,6 +45,7 @@ EXTRA_OBJECTS = \
wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib shell32.lib comctl32.lib \ wsock32.lib user32.lib shell32.lib comctl32.lib \
$(HHC_LIBS) \ $(HHC_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
@ -53,7 +54,6 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \ epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \ epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \ epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -63,6 +63,7 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \ wsock32.lib user32.lib \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
@ -71,7 +72,6 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \ epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \ epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \ epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -81,6 +81,7 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \ wsock32.lib user32.lib \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
@ -89,7 +90,6 @@ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
epan\crypt\airpdcap.lib \ epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \ epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \ epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -124,13 +124,13 @@ dumpcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \ wsock32.lib user32.lib \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \ epan\libwireshark.lib \
!ELSE !ELSE
epan\dissectors\dissectors.lib \ epan\dissectors\dissectors.lib \
epan\wireshark.lib \ epan\wireshark.lib \
epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \ epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
wsutil\libwsutil.lib \
$(ADNS_LIBS) \ $(ADNS_LIBS) \
$(PCRE_LIBS) \ $(PCRE_LIBS) \
$(ZLIB_LIBS) \ $(ZLIB_LIBS) \
@ -509,7 +509,7 @@ image::
# Unfortunately: # Unfortunately:
# - we need to "patch" adns_dll.rep and adns_dll.rc (at least for MSVC2005EE) # - we need to "patch" adns_dll.rep and adns_dll.rc (at least for MSVC2005EE)
# - on MSVC6 we can't easily rebuild, because iphlpapi.h is needed # - on MSVC6 we can't easily rebuild, because iphlpapi.h is needed
# #
$(ADNS_DLL): $(ADNS_DLL):
!IF "$(MSVC_VARIANT)" == "MSVC6" !IF "$(MSVC_VARIANT)" == "MSVC6"
if not exist $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns mkdir $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns if not exist $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns mkdir $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns
@ -1051,7 +1051,7 @@ checkapi_local:
# $(TSHARK_TAP_SRC) # $(TSHARK_TAP_SRC)
# EXTRA_wireshark_SOURCES # EXTRA_wireshark_SOURCES
checkapi: checkapi:
# checkapi_local # checkapi_local
cd wiretap cd wiretap
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi

View File

@ -90,7 +90,7 @@
#include "capture-wpcap.h" #include "capture-wpcap.h"
#endif #endif
#include "ui_util.h" #include "ui_util.h"
#include "file_util.h" #include "wsutil/file_util.h"
#include "log.h" #include "log.h"
typedef struct if_stat_cache_item_s { typedef struct if_stat_cache_item_s {
@ -580,7 +580,7 @@ capture_input_closed(capture_options *capture_opts)
if(capture_opts->restart) { if(capture_opts->restart) {
capture_opts->restart = FALSE; capture_opts->restart = FALSE;
eth_unlink(capture_opts->save_file); ws_unlink(capture_opts->save_file);
/* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */ /* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */
if(cf_is_tempfile(capture_opts->cf)) { if(cf_is_tempfile(capture_opts->cf)) {

View File

@ -69,7 +69,7 @@
#include "cmdarg_err.h" #include "cmdarg_err.h"
#include "capture-pcap-util.h" #include "capture-pcap-util.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
typedef struct { typedef struct {
char *name; char *name;
@ -877,7 +877,7 @@ static int capture_opts_test_for_fifo(const char *path)
{ {
struct stat statb; struct stat statb;
if (eth_stat(path, &statb) < 0) if (ws_stat(path, &statb) < 0)
return errno; return errno;
if (S_ISFIFO(statb.st_mode)) if (S_ISFIFO(statb.st_mode))

View File

@ -98,7 +98,7 @@
#include "capture-wpcap.h" #include "capture-wpcap.h"
#endif #endif
#include "ui_util.h" #include "ui_util.h"
#include "file_util.h" #include <wsutil/file_util.h>
#include "log.h" #include "log.h"
#ifdef _WIN32 #ifdef _WIN32
@ -291,7 +291,7 @@ sync_pipe_start(capture_options *capture_opts) {
report_failure("We don't know where to find dumpcap."); report_failure("We don't know where to find dumpcap.");
return FALSE; return FALSE;
} }
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "argv[0]: %s", argv[0]); g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "argv[0]: %s", argv[0]);
argv = sync_pipe_add_arg(argv, &argc, "-i"); argv = sync_pipe_add_arg(argv, &argc, "-i");
@ -506,7 +506,7 @@ sync_pipe_start(capture_options *capture_opts) {
* it just capture with the specified capture parameters * it just capture with the specified capture parameters
*/ */
dup2(sync_pipe[PIPE_WRITE], 2); dup2(sync_pipe[PIPE_WRITE], 2);
eth_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_READ]);
execv(argv[0], (gpointer)argv); execv(argv[0], (gpointer)argv);
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
argv[0], strerror(errno)); argv[0], strerror(errno));
@ -538,15 +538,15 @@ sync_pipe_start(capture_options *capture_opts) {
#ifdef _WIN32 #ifdef _WIN32
CloseHandle(sync_pipe_write); CloseHandle(sync_pipe_write);
#else #else
eth_close(sync_pipe[PIPE_WRITE]); ws_close(sync_pipe[PIPE_WRITE]);
#endif #endif
if (capture_opts->fork_child == -1) { if (capture_opts->fork_child == -1) {
/* We couldn't even create the child process. */ /* We couldn't even create the child process. */
report_failure("Couldn't create child process: %s", strerror(errno)); report_failure("Couldn't create child process: %s", strerror(errno));
eth_close(sync_pipe_read_fd); ws_close(sync_pipe_read_fd);
#ifdef _WIN32 #ifdef _WIN32
eth_close(capture_opts->signal_pipe_write_fd); ws_close(capture_opts->signal_pipe_write_fd);
#endif #endif
return FALSE; return FALSE;
} }
@ -679,7 +679,7 @@ sync_pipe_open_command(const char** argv, int *read_fd, int *fork_child, gchar *
* it just capture with the specified capture parameters * it just capture with the specified capture parameters
*/ */
dup2(sync_pipe[PIPE_WRITE], 1); dup2(sync_pipe[PIPE_WRITE], 1);
eth_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_READ]);
execv(argv[0], (gpointer)argv); execv(argv[0], (gpointer)argv);
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
argv[0], strerror(errno)); argv[0], strerror(errno));
@ -711,13 +711,13 @@ sync_pipe_open_command(const char** argv, int *read_fd, int *fork_child, gchar *
#ifdef _WIN32 #ifdef _WIN32
CloseHandle(sync_pipe_write); CloseHandle(sync_pipe_write);
#else #else
eth_close(sync_pipe[PIPE_WRITE]); ws_close(sync_pipe[PIPE_WRITE]);
#endif #endif
if (*fork_child == -1) { if (*fork_child == -1) {
/* We couldn't even create the child process. */ /* We couldn't even create the child process. */
*msg = g_strdup_printf("Couldn't create child process: %s", strerror(errno)); *msg = g_strdup_printf("Couldn't create child process: %s", strerror(errno));
eth_close(*read_fd); ws_close(*read_fd);
return CANT_RUN_DUMPCAP; return CANT_RUN_DUMPCAP;
} }
@ -734,7 +734,7 @@ sync_pipe_close_command(int *read_fd, gchar **msg) {
#endif #endif
int fork_child_status; int fork_child_status;
eth_close(*read_fd); ws_close(*read_fd);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_close_command: wait till child closed"); g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_close_command: wait till child closed");
@ -801,7 +801,7 @@ sync_pipe_run_command(const char** argv, gchar **msg) {
/* We were able to set up to read dumpcap's output. Do so and /* We were able to set up to read dumpcap's output. Do so and
return its exit value. */ return its exit value. */
msg_buf = g_string_new(""); msg_buf = g_string_new("");
while ((count = eth_read(sync_pipe_read_fd, buf, PIPE_BUF_SIZE)) > 0) { while ((count = ws_read(sync_pipe_read_fd, buf, PIPE_BUF_SIZE)) > 0) {
buf[count] = '\0'; buf[count] = '\0';
g_string_append(msg_buf, buf); g_string_append(msg_buf, buf);
} }
@ -862,7 +862,7 @@ sync_interface_list_open(gchar **msg) {
/* currently be sent as is to stderr resulting in garbled output. */ /* currently be sent as is to stderr resulting in garbled output. */
/* ToDo: Revise this code to be similar to sync_pipe_start so that 'dumpcap -Z' */ /* ToDo: Revise this code to be similar to sync_pipe_start so that 'dumpcap -Z' */
/* special format error messages to stderr are captured and returned to caller */ /* special format error messages to stderr are captured and returned to caller */
/* (eg: so can be processed and displayed in a pop-up box). */ /* (eg: so can be processed and displayed in a pop-up box). */
#ifndef DEBUG_CHILD #ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z"); argv = sync_pipe_add_arg(argv, &argc, "-Z");
argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE); argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE);
@ -914,7 +914,7 @@ sync_linktype_list_open(const gchar *ifname, gchar **msg) {
/* currently be sent as is to stderr resulting in garbled output. */ /* currently be sent as is to stderr resulting in garbled output. */
/* ToDo: Revise this code to be similar to sync_pipe_start so that 'dumpcap -Z' */ /* ToDo: Revise this code to be similar to sync_pipe_start so that 'dumpcap -Z' */
/* special format error messages to stderr are captured and returned to caller */ /* special format error messages to stderr are captured and returned to caller */
/* (eg: so can be processed and displayed in a pop-up box). */ /* (eg: so can be processed and displayed in a pop-up box). */
#ifndef DEBUG_CHILD #ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z"); argv = sync_pipe_add_arg(argv, &argc, "-Z");
argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE); argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE);
@ -963,7 +963,7 @@ sync_interface_stats_open(int *read_fd, int *fork_child, gchar **msg) {
/* currently be sent as is to stderr resulting in garbled output. */ /* currently be sent as is to stderr resulting in garbled output. */
/* ToDo: Revise this code to be similar to sync_pipe_start so that 'dumpcap -Z' */ /* ToDo: Revise this code to be similar to sync_pipe_start so that 'dumpcap -Z' */
/* special format error messages to stderr are captured and returned to caller */ /* special format error messages to stderr are captured and returned to caller */
/* (eg: so can be processed and displayed in a pop-up box). */ /* (eg: so can be processed and displayed in a pop-up box). */
#ifndef DEBUG_CHILD #ifndef DEBUG_CHILD
argv = sync_pipe_add_arg(argv, &argc, "-Z"); argv = sync_pipe_add_arg(argv, &argc, "-Z");
argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE); argv = sync_pipe_add_arg(argv, &argc, SIGNAL_PIPE_CTRL_ID_NONE);
@ -1181,7 +1181,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
sync_pipe_wait_for_child(capture_opts); sync_pipe_wait_for_child(capture_opts);
#ifdef _WIN32 #ifdef _WIN32
eth_close(capture_opts->signal_pipe_write_fd); ws_close(capture_opts->signal_pipe_write_fd);
#endif #endif
capture_input_closed(capture_opts); capture_input_closed(capture_opts);
return FALSE; return FALSE;
@ -1195,7 +1195,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
/* We weren't able to open the new capture file; user has been /* We weren't able to open the new capture file; user has been
alerted. Close the sync pipe. */ alerted. Close the sync pipe. */
eth_close(source); ws_close(source);
/* the child has send us a filename which we couldn't open. /* the child has send us a filename which we couldn't open.
this probably means, the child is creating files faster than we can handle it. this probably means, the child is creating files faster than we can handle it.

View File

@ -24,7 +24,7 @@
/* /*
* Updated 1 Dec 10 jjm * Updated 1 Dec 10 jjm
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
@ -34,7 +34,7 @@
#include <string.h> #include <string.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include "file_util.h" #include <wsutil/file_util.h>
#include <epan/packet.h> #include <epan/packet.h>
#include "color.h" #include "color.h"
@ -54,7 +54,7 @@ static gboolean read_users_filters(GSList **cfl);
/* the currently active filters */ /* the currently active filters */
static GSList *color_filter_list = NULL; static GSList *color_filter_list = NULL;
/* keep "old" deleted filters in this list until /* keep "old" deleted filters in this list until
* the dissection no longer needs them (e.g. file is closed) */ * the dissection no longer needs them (e.g. file is closed) */
static GSList *color_filter_deleted_list = NULL; static GSList *color_filter_deleted_list = NULL;
static GSList *color_filter_valid_list = NULL; static GSList *color_filter_valid_list = NULL;
@ -157,10 +157,10 @@ color_filters_set_tmp(guint8 filt_nr, gchar *filter, gboolean disabled)
* If found, clear it so that a filter can be "moved" up and down the list * If found, clear it so that a filter can be "moved" up and down the list
*/ */
for ( i=1 ; i<=10 ; i++ ) { for ( i=1 ; i<=10 ; i++ ) {
/* If we need to reset the temporary filter (filter==NULL), don't look /* If we need to reset the temporary filter (filter==NULL), don't look
* for other rules with the same filter string * for other rules with the same filter string
*/ */
if( i!=filt_nr && filter==NULL ) if( i!=filt_nr && filter==NULL )
continue; continue;
name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,i); name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,i);
@ -380,7 +380,7 @@ color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl)
/* clone all list entries from tmp/edit to normal list */ /* clone all list entries from tmp/edit to normal list */
color_filter_valid_list = NULL; color_filter_valid_list = NULL;
color_filter_valid_list = color_filter_list_clone(tmp_cfl); color_filter_valid_list = color_filter_list_clone(tmp_cfl);
color_filter_valid_list = g_slist_concat(color_filter_valid_list, color_filter_valid_list = g_slist_concat(color_filter_valid_list,
color_filter_list_clone(edit_cfl) ); color_filter_list_clone(edit_cfl) );
/* compile all filter */ /* compile all filter */
@ -393,13 +393,13 @@ color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl)
g_slist_foreach(color_filter_list, color_filter_compile_cb, NULL); g_slist_foreach(color_filter_list, color_filter_compile_cb, NULL);
} }
gboolean gboolean
color_filters_used(void) color_filters_used(void)
{ {
return color_filter_list != NULL && filters_enabled; return color_filter_list != NULL && filters_enabled;
} }
gboolean gboolean
tmp_color_filters_used(void) tmp_color_filters_used(void)
{ {
return tmp_colors_set; return tmp_colors_set;
@ -505,7 +505,7 @@ read_filters_file(FILE *f, gpointer user_data)
} }
/* skip # comments and invalid lines */ /* skip # comments and invalid lines */
if (c != '@') { if (c != '@') {
skip_end_of_line = TRUE; skip_end_of_line = TRUE;
continue; continue;
} }
@ -526,7 +526,7 @@ read_filters_file(FILE *f, gpointer user_data)
name_len *= 2; name_len *= 2;
name = g_realloc(name, name_len + 1); name = g_realloc(name, name_len + 1);
} }
name[i++] = c; name[i++] = c;
} }
name[i] = '\0'; name[i] = '\0';
@ -630,7 +630,7 @@ read_users_filters(GSList **cfl)
/* decide what file to open (from dfilter code) */ /* decide what file to open (from dfilter code) */
path = get_persconffile_path("colorfilters", TRUE, FALSE); path = get_persconffile_path("colorfilters", TRUE, FALSE);
if ((f = eth_fopen(path, "r")) == NULL) { if ((f = ws_fopen(path, "r")) == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open filter file\n\"%s\": %s.", path, "Could not open filter file\n\"%s\": %s.", path,
@ -657,7 +657,7 @@ color_filters_read_globals(gpointer user_data)
/* decide what file to open (from dfilter code) */ /* decide what file to open (from dfilter code) */
path = get_datafile_path("colorfilters"); path = get_datafile_path("colorfilters");
if ((f = eth_fopen(path, "r")) == NULL) { if ((f = ws_fopen(path, "r")) == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open global filter file\n\"%s\": %s.", path, "Could not open global filter file\n\"%s\": %s.", path,
@ -681,7 +681,7 @@ color_filters_import(gchar *path, gpointer user_data)
FILE *f; FILE *f;
gboolean ret; gboolean ret;
if ((f = eth_fopen(path, "r")) == NULL) { if ((f = ws_fopen(path, "r")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor reading: %s.", "Could not open\n%s\nfor reading: %s.",
path, strerror(errno)); path, strerror(errno));
@ -730,7 +730,7 @@ write_filters_file(GSList *cfl, FILE *f, gboolean only_selected)
data.f = f; data.f = f;
data.only_selected = only_selected; data.only_selected = only_selected;
fprintf(f,"# DO NOT EDIT THIS FILE! It was created by Wireshark\n"); fprintf(f,"# DO NOT EDIT THIS FILE! It was created by Wireshark\n");
g_slist_foreach(cfl, write_filter, &data); g_slist_foreach(cfl, write_filter, &data);
return TRUE; return TRUE;
@ -755,7 +755,7 @@ color_filters_write(GSList *cfl)
} }
path = get_persconffile_path("colorfilters", TRUE, TRUE); path = get_persconffile_path("colorfilters", TRUE, TRUE);
if ((f = eth_fopen(path, "w+")) == NULL) { if ((f = ws_fopen(path, "w+")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor writing: %s.", "Could not open\n%s\nfor writing: %s.",
path, strerror(errno)); path, strerror(errno));
@ -774,7 +774,7 @@ color_filters_export(gchar *path, GSList *cfl, gboolean only_marked)
{ {
FILE *f; FILE *f;
if ((f = eth_fopen(path, "w+")) == NULL) { if ((f = ws_fopen(path, "w+")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open\n%s\nfor writing: %s.", "Could not open\n%s\nfor writing: %s.",
path, strerror(errno)); path, strerror(errno));

View File

@ -41,7 +41,7 @@
#include <epan/proto.h> #include <epan/proto.h>
#include "disabled_protos.h" #include "disabled_protos.h"
#include "file_util.h" #include <wsutil/file_util.h>
#define GLOBAL_PROTOCOLS_FILE_NAME "disabled_protos" #define GLOBAL_PROTOCOLS_FILE_NAME "disabled_protos"
#define PROTOCOLS_FILE_NAME "disabled_protos" #define PROTOCOLS_FILE_NAME "disabled_protos"
@ -104,7 +104,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
/* Read the global disabled protocols file, if it exists. */ /* Read the global disabled protocols file, if it exists. */
*gpath_return = NULL; *gpath_return = NULL;
if ((ff = eth_fopen(gff_path, "r")) != NULL) { if ((ff = ws_fopen(gff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
err = read_disabled_protos_list_file(gff_path, ff, err = read_disabled_protos_list_file(gff_path, ff,
&global_disabled_protos); &global_disabled_protos);
@ -137,7 +137,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
/* Read the user's disabled protocols file, if it exists. */ /* Read the user's disabled protocols file, if it exists. */
*path_return = NULL; *path_return = NULL;
if ((ff = eth_fopen(ff_path, "r")) != NULL) { if ((ff = ws_fopen(ff_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
err = read_disabled_protos_list_file(ff_path, ff, &disabled_protos); err = read_disabled_protos_list_file(ff_path, ff, &disabled_protos);
if (err != 0) { if (err != 0) {
@ -345,7 +345,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
completely. */ completely. */
ff_path_new = g_strdup_printf("%s.new", ff_path); ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = eth_fopen(ff_path_new, "w")) == NULL) { if ((ff = ws_fopen(ff_path_new, "w")) == NULL) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
g_free(ff_path_new); g_free(ff_path_new);
@ -373,7 +373,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
if (fclose(ff) == EOF) { if (fclose(ff) == EOF) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -383,22 +383,22 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
exists; the Win32 call to rename files doesn't do so, which I exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so. infer is the reason why the MSVC++ "rename()" doesn't do so.
We must therefore remove the target file first, on Windows. */ We must therefore remove the target file first, on Windows. */
if (eth_remove(ff_path) < 0 && errno != ENOENT) { if (ws_remove(ff_path) < 0 && errno != ENOENT) {
/* It failed for some reason other than "it's not there"; if /* It failed for some reason other than "it's not there"; if
it's not there, we don't need to remove it, so we just it's not there, we don't need to remove it, so we just
drive on. */ drive on. */
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
#endif #endif
if (eth_rename(ff_path_new, ff_path) < 0) { if (ws_rename(ff_path_new, ff_path) < 0) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }

View File

@ -94,7 +94,7 @@
#include "tempfile.h" #include "tempfile.h"
#include "log.h" #include "log.h"
#include "file_util.h" #include "wsutil/file_util.h"
/* /*
* Get information about libpcap format from "wiretap/libpcap.h". * Get information about libpcap format from "wiretap/libpcap.h".
@ -689,7 +689,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
#endif /* _WIN32 */ #endif /* _WIN32 */
} else { } else {
#ifndef _WIN32 #ifndef _WIN32
if (eth_stat(pipename, &pipe_stat) < 0) { if (ws_stat(pipename, &pipe_stat) < 0) {
if (errno == ENOENT || errno == ENOTDIR) if (errno == ENOENT || errno == ENOTDIR)
ld->cap_pipe_err = PIPNEXIST; ld->cap_pipe_err = PIPNEXIST;
else { else {
@ -716,7 +716,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
} }
return -1; return -1;
} }
fd = eth_open(pipename, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */); fd = ws_open(pipename, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
if (fd == -1) { if (fd == -1) {
g_snprintf(errmsg, errmsgl, g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated " "The capture session could not be initiated "
@ -891,7 +891,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
error: error:
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: error %s", errmsg); g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: error %s", errmsg);
ld->cap_pipe_err = PIPERR; ld->cap_pipe_err = PIPERR;
eth_close(fd); ws_close(fd);
return -1; return -1;
} }
@ -1288,7 +1288,7 @@ static void capture_loop_close_input(loop_data *ld) {
/* if open, close the capture pipe "input file" */ /* if open, close the capture pipe "input file" */
if (ld->cap_pipe_fd >= 0) { if (ld->cap_pipe_fd >= 0) {
g_assert(ld->from_cap_pipe); g_assert(ld->from_cap_pipe);
eth_close(ld->cap_pipe_fd); ws_close(ld->cap_pipe_fd);
ld->cap_pipe_fd = 0; ld->cap_pipe_fd = 0;
} }
@ -1644,7 +1644,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
} }
} else { } else {
/* Try to open/create the specified file for use as a capture buffer. */ /* Try to open/create the specified file for use as a capture buffer. */
*save_file_fd = eth_open(capfile_name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, *save_file_fd = ws_open(capfile_name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT,
0600); 0600);
} }
} }
@ -2094,13 +2094,13 @@ error:
/* We can't use the save file, and we have no FILE * for the stream /* We can't use the save file, and we have no FILE * for the stream
to close in order to close it, so close the FD directly. */ to close in order to close it, so close the FD directly. */
if(save_file_fd != -1) { if(save_file_fd != -1) {
eth_close(save_file_fd); ws_close(save_file_fd);
} }
/* We couldn't even start the capture, so get rid of the capture /* We couldn't even start the capture, so get rid of the capture
file. */ file. */
if(capture_opts->save_file != NULL) { if(capture_opts->save_file != NULL) {
eth_unlink(capture_opts->save_file); ws_unlink(capture_opts->save_file);
g_free(capture_opts->save_file); g_free(capture_opts->save_file);
} }
} }

View File

@ -122,7 +122,7 @@
#include "filesystem.h" #include "filesystem.h"
#include <epan/strutil.h> #include <epan/strutil.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/emem.h> #include <epan/emem.h>
@ -356,7 +356,7 @@ static void add_service_name(hashport_t **proto_table, guint port, const char *s
{ {
int hash_idx; int hash_idx;
hashport_t *tp; hashport_t *tp;
hash_idx = HASH_PORT(port); hash_idx = HASH_PORT(port);
tp = proto_table[hash_idx]; tp = proto_table[hash_idx];
@ -465,7 +465,7 @@ static void parse_services_file(const char * path)
static char *buf = NULL; static char *buf = NULL;
/* services hash table initialization */ /* services hash table initialization */
serv_p = eth_fopen(path, "r"); serv_p = ws_fopen(path, "r");
if (serv_p == NULL) if (serv_p == NULL)
return; return;
@ -610,7 +610,7 @@ static void fill_dummy_ip4(guint addr, hashipv4_t* volatile tp)
* If length of mask is 32, we chomp the whole address. * If length of mask is 32, we chomp the whole address.
* If the address string starts '.' (should not happen?), * If the address string starts '.' (should not happen?),
* we skip that '.'. * we skip that '.'.
*/ */
i = subnet_entry.mask_length / 8; i = subnet_entry.mask_length / 8;
while(*(paddr) != '\0' && i > 0) { while(*(paddr) != '\0' && i > 0) {
if(*(++paddr) == '.') { if(*(++paddr) == '.') {
@ -618,11 +618,11 @@ static void fill_dummy_ip4(guint addr, hashipv4_t* volatile tp)
} }
} }
/* There are more efficient ways to do this, but this is safe if we /* There are more efficient ways to do this, but this is safe if we
* trust g_snprintf and MAXNAMELEN * trust g_snprintf and MAXNAMELEN
*/ */
g_snprintf(tp->name, MAXNAMELEN, "%s%s", subnet_entry.name, paddr); g_snprintf(tp->name, MAXNAMELEN, "%s%s", subnet_entry.name, paddr);
} else { } else {
ip_to_str_buf((guint8 *)&addr, tp->name, MAXNAMELEN); ip_to_str_buf((guint8 *)&addr, tp->name, MAXNAMELEN);
} }
} }
@ -991,7 +991,7 @@ static void set_ethent(char *path)
if (eth_p) if (eth_p)
rewind(eth_p); rewind(eth_p);
else else
eth_p = eth_fopen(path, "r"); eth_p = ws_fopen(path, "r");
} }
static void end_ethent(void) static void end_ethent(void)
@ -1573,7 +1573,7 @@ static void set_ipxnetent(char *path)
if (ipxnet_p) if (ipxnet_p)
rewind(ipxnet_p); rewind(ipxnet_p);
else else
ipxnet_p = eth_fopen(path, "r"); ipxnet_p = ws_fopen(path, "r");
} }
static void end_ipxnetent(void) static void end_ipxnetent(void)
@ -1798,7 +1798,7 @@ read_hosts_file (const char *hostspath)
* See the hosts(4) or hosts(5) man page for hosts file format * See the hosts(4) or hosts(5) man page for hosts file format
* (not available on all systems). * (not available on all systems).
*/ */
if ((hf = eth_fopen(hostspath, "r")) == NULL) if ((hf = ws_fopen(hostspath, "r")) == NULL)
return FALSE; return FALSE;
while (fgetline(&line, &size, hf) >= 0) { while (fgetline(&line, &size, hf) >= 0) {
@ -1852,7 +1852,7 @@ read_hosts_file (const char *hostspath)
/* Read in a list of subnet definition - name pairs. /* Read in a list of subnet definition - name pairs.
* <line> = <comment> | <entry> | <whitespace> * <line> = <comment> | <entry> | <whitespace>
* <comment> = <whitespace>#<any> * <comment> = <whitespace>#<any>
* <entry> = <subnet_definition> <whitespace> <subnet_name> [<comment>|<whitespace><any>] * <entry> = <subnet_definition> <whitespace> <subnet_name> [<comment>|<whitespace><any>]
* <subnet_definition> = <ipv4_address> / <subnet_mask_length> * <subnet_definition> = <ipv4_address> / <subnet_mask_length>
* <ipv4_address> is a full address; it will be masked to get the subnet-ID. * <ipv4_address> is a full address; it will be masked to get the subnet-ID.
* <subnet_mask_length> is a decimal 1-31 * <subnet_mask_length> is a decimal 1-31
@ -1873,7 +1873,7 @@ read_subnets_file (const char *subnetspath)
guint32 host_addr; /* IPv4 ONLY */ guint32 host_addr; /* IPv4 ONLY */
int mask_length; int mask_length;
if ((hf = eth_fopen(subnetspath, "r")) == NULL) if ((hf = ws_fopen(subnetspath, "r")) == NULL)
return FALSE; return FALSE;
while (fgetline(&line, &size, hf) >= 0) { while (fgetline(&line, &size, hf) >= 0) {
@ -1892,7 +1892,7 @@ read_subnets_file (const char *subnetspath)
} }
*cp2 = '\0'; /* Cut token */ *cp2 = '\0'; /* Cut token */
++cp2 ; ++cp2 ;
/* Check if this is a valid IPv4 address */ /* Check if this is a valid IPv4 address */
if (inet_pton(AF_INET, cp, &host_addr) != 1) { if (inet_pton(AF_INET, cp, &host_addr) != 1) {
continue; /* no */ continue; /* no */
@ -1901,7 +1901,7 @@ read_subnets_file (const char *subnetspath)
mask_length = atoi(cp2); mask_length = atoi(cp2);
if(0 >= mask_length || mask_length > 31) { if(0 >= mask_length || mask_length > 31) {
continue; /* invalid mask length */ continue; /* invalid mask length */
} }
if ((cp = strtok(NULL, " \t")) == NULL) if ((cp = strtok(NULL, " \t")) == NULL)
continue; /* no subnet name */ continue; /* no subnet name */
@ -1926,7 +1926,7 @@ static subnet_entry_t subnet_lookup(const guint32 addr)
while(have_subnet_entry && i > 0) { while(have_subnet_entry && i > 0) {
guint32 masked_addr; guint32 masked_addr;
subnet_length_entry_t* length_entry; subnet_length_entry_t* length_entry;
/* Note that we run from 31 (length 32) to 0 (length 1) */ /* Note that we run from 31 (length 32) to 0 (length 1) */
--i; --i;
g_assert(i < SUBNETLENGTHSIZE); g_assert(i < SUBNETLENGTHSIZE);
@ -1937,7 +1937,7 @@ static subnet_entry_t subnet_lookup(const guint32 addr)
if(NULL != length_entry->subnet_addresses) { if(NULL != length_entry->subnet_addresses) {
hashipv4_t * tp; hashipv4_t * tp;
guint32 hash_idx; guint32 hash_idx;
masked_addr = addr & length_entry->mask; masked_addr = addr & length_entry->mask;
hash_idx = HASH_IPV4_ADDRESS(masked_addr); hash_idx = HASH_IPV4_ADDRESS(masked_addr);
@ -1954,7 +1954,7 @@ static subnet_entry_t subnet_lookup(const guint32 addr)
} }
} }
} }
subnet_entry.mask = 0; subnet_entry.mask = 0;
subnet_entry.mask_length = 0; subnet_entry.mask_length = 0;
subnet_entry.name = NULL; subnet_entry.name = NULL;
@ -2013,7 +2013,7 @@ static guint32 get_subnet_mask(guint32 mask_length) {
initialised = TRUE; initialised = TRUE;
/* XXX There must be a better way to do this than /* XXX There must be a better way to do this than
* hand-coding the values, but I can't seem to * hand-coding the values, but I can't seem to
* come up with one! * come up with one!
*/ */
@ -2026,7 +2026,7 @@ static guint32 get_subnet_mask(guint32 mask_length) {
inet_pton(AF_INET, "252.0.0.0", &masks[5]); inet_pton(AF_INET, "252.0.0.0", &masks[5]);
inet_pton(AF_INET, "254.0.0.0", &masks[6]); inet_pton(AF_INET, "254.0.0.0", &masks[6]);
inet_pton(AF_INET, "255.0.0.0", &masks[7]); inet_pton(AF_INET, "255.0.0.0", &masks[7]);
inet_pton(AF_INET, "255.128.0.0", &masks[8]); inet_pton(AF_INET, "255.128.0.0", &masks[8]);
inet_pton(AF_INET, "255.192.0.0", &masks[9]); inet_pton(AF_INET, "255.192.0.0", &masks[9]);
inet_pton(AF_INET, "255.224.0.0", &masks[10]); inet_pton(AF_INET, "255.224.0.0", &masks[10]);
@ -2035,7 +2035,7 @@ static guint32 get_subnet_mask(guint32 mask_length) {
inet_pton(AF_INET, "255.252.0.0", &masks[13]); inet_pton(AF_INET, "255.252.0.0", &masks[13]);
inet_pton(AF_INET, "255.254.0.0", &masks[14]); inet_pton(AF_INET, "255.254.0.0", &masks[14]);
inet_pton(AF_INET, "255.255.0.0", &masks[15]); inet_pton(AF_INET, "255.255.0.0", &masks[15]);
inet_pton(AF_INET, "255.255.128.0", &masks[16]); inet_pton(AF_INET, "255.255.128.0", &masks[16]);
inet_pton(AF_INET, "255.255.192.0", &masks[17]); inet_pton(AF_INET, "255.255.192.0", &masks[17]);
inet_pton(AF_INET, "255.255.224.0", &masks[18]); inet_pton(AF_INET, "255.255.224.0", &masks[18]);
@ -2044,7 +2044,7 @@ static guint32 get_subnet_mask(guint32 mask_length) {
inet_pton(AF_INET, "255.255.252.0", &masks[21]); inet_pton(AF_INET, "255.255.252.0", &masks[21]);
inet_pton(AF_INET, "255.255.254.0", &masks[22]); inet_pton(AF_INET, "255.255.254.0", &masks[22]);
inet_pton(AF_INET, "255.255.255.0", &masks[23]); inet_pton(AF_INET, "255.255.255.0", &masks[23]);
inet_pton(AF_INET, "255.255.255.128", &masks[24]); inet_pton(AF_INET, "255.255.255.128", &masks[24]);
inet_pton(AF_INET, "255.255.255.192", &masks[25]); inet_pton(AF_INET, "255.255.255.192", &masks[25]);
inet_pton(AF_INET, "255.255.255.224", &masks[26]); inet_pton(AF_INET, "255.255.255.224", &masks[26]);
@ -2054,7 +2054,7 @@ static guint32 get_subnet_mask(guint32 mask_length) {
inet_pton(AF_INET, "255.255.255.254", &masks[30]); inet_pton(AF_INET, "255.255.255.254", &masks[30]);
inet_pton(AF_INET, "255.255.255.255", &masks[31]); inet_pton(AF_INET, "255.255.255.255", &masks[31]);
} }
if(mask_length == 0 || mask_length > SUBNETLENGTHSIZE) { if(mask_length == 0 || mask_length > SUBNETLENGTHSIZE) {
g_assert_not_reached(); g_assert_not_reached();
return 0; return 0;
@ -2070,7 +2070,7 @@ static void subnet_name_lookup_init()
guint32 i; guint32 i;
for(i = 0; i < SUBNETLENGTHSIZE; ++i) { for(i = 0; i < SUBNETLENGTHSIZE; ++i) {
guint32 length = i + 1; guint32 length = i + 1;
subnet_length_entries[i].subnet_addresses = NULL; subnet_length_entries[i].subnet_addresses = NULL;
subnet_length_entries[i].mask_length = length; subnet_length_entries[i].mask_length = length;
subnet_length_entries[i].mask = get_subnet_mask(length); subnet_length_entries[i].mask = get_subnet_mask(length);
@ -2373,9 +2373,9 @@ extern void add_ipv6_name(struct e_in6_addr *addrp, const gchar *name)
static gchar *ep_utoa(guint port) static gchar *ep_utoa(guint port)
{ {
gchar *bp = ep_alloc(MAXNAMELEN); gchar *bp = ep_alloc(MAXNAMELEN);
bp = &bp[MAXNAMELEN -1]; bp = &bp[MAXNAMELEN -1];
*bp = 0; *bp = 0;
do { do {
*--bp = (port % 10) +'0'; *--bp = (port % 10) +'0';

View File

@ -38,7 +38,7 @@
#include <epan/uat.h> #include <epan/uat.h>
#include <epan/report_err.h> #include <epan/report_err.h>
#include <epan/proto.h> #include <epan/proto.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
typedef struct { typedef struct {
const char* name; const char* name;
@ -112,7 +112,7 @@ static void macro_fprint(dfilter_macro_t* m, void* ud) {
} }
void dfilter_macro_save(const gchar* filename, gchar** error) { void dfilter_macro_save(const gchar* filename, gchar** error) {
FILE* f = eth_fopen(filename,"w"); FILE* f = ws_fopen(filename,"w");
if (!f) { if (!f) {
*error = ep_strdup_printf("Could not open file: '%s', error: %s\n", filename, strerror(errno) ); *error = ep_strdup_printf("Could not open file: '%s', error: %s\n", filename, strerror(errno) );
@ -515,12 +515,12 @@ static void* macro_copy(void* dest, const void* orig, unsigned len _U_) {
/* /*
* Copy the contents of m->priv (a "cooked" version * Copy the contents of m->priv (a "cooked" version
* of m->text) into d->priv. * of m->text) into d->priv.
* *
* First we clone m->text into d->priv, this gets * First we clone m->text into d->priv, this gets
* us a NUL terminated string of the proper length. * us a NUL terminated string of the proper length.
* *
* Then we loop copying bytes from m->priv into * Then we loop copying bytes from m->priv into
* d-priv. Since m->priv contains internal ACSII NULs * d-priv. Since m->priv contains internal ACSII NULs
* we use the length of m->text to stop the copy. * we use the length of m->text to stop the copy.
*/ */
@ -531,7 +531,7 @@ static void* macro_copy(void* dest, const void* orig, unsigned len _U_) {
gchar* newPriv = d->priv; gchar* newPriv = d->priv;
while(oldText && *oldText) { while(oldText && *oldText) {
*(newPriv++) = *(oldPriv++); *(newPriv++) = *(oldPriv++);
oldText++; oldText++;
} }
} }
@ -543,8 +543,8 @@ static void* macro_copy(void* dest, const void* orig, unsigned len _U_) {
* to hold the final NULL terminator. * to hold the final NULL terminator.
* *
* The following copy clones the original m->parts * The following copy clones the original m->parts
* array into d->parts but then fixes-up the pointers * array into d->parts but then fixes-up the pointers
* so that they point into the appropriate sections * so that they point into the appropriate sections
* of the d->priv. * of the d->priv.
*/ */
@ -623,26 +623,26 @@ void dfilter_macro_get_uat(void** p) {
#ifdef DUMP_DFILTER_MACRO #ifdef DUMP_DFILTER_MACRO
/* /*
* The dfilter_macro_t has several characteristics that are * The dfilter_macro_t has several characteristics that are
* not immediattly obvious. The dump_dfilter_filter_macro_t() * not immediattly obvious. The dump_dfilter_filter_macro_t()
* function can be used to help "visualize" the contents of * function can be used to help "visualize" the contents of
* a dfilter_macro_t. * a dfilter_macro_t.
* *
* Some non-obvious components of this struct include: * Some non-obvious components of this struct include:
* *
* m->parts is an argv style array of pointers into the * m->parts is an argv style array of pointers into the
* m->priv string. * m->priv string.
* *
* The last pointer of an m->parts array should contain * The last pointer of an m->parts array should contain
* NULL to indicate the end of the parts pointer array. * NULL to indicate the end of the parts pointer array.
* *
* m->priv is a "cooked" copy of the m->text string. * m->priv is a "cooked" copy of the m->text string.
* Any variable substitution indicators within m->text * Any variable substitution indicators within m->text
* ("$1", "$2", ...) will have been replaced with ASCII * ("$1", "$2", ...) will have been replaced with ASCII
* NUL characters within m->priv. * NUL characters within m->priv.
* *
* The first element of m->parts array (m-parts[0]) will * The first element of m->parts array (m-parts[0]) will
* usually have the same pointer value as m->priv (unless * usually have the same pointer value as m->priv (unless
* the dfilter-macro starts off with a variable * the dfilter-macro starts off with a variable
* substitution indicator (e.g. "$1"). * substitution indicator (e.g. "$1").
*/ */

View File

@ -59,7 +59,7 @@
#include "emem.h" #include "emem.h"
#include "diam_dict.h" #include "diam_dict.h"
#include "diam_dict_lex.h" #include "diam_dict_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
typedef struct entity_t { typedef struct entity_t {
char* name; char* name;
@ -615,7 +615,7 @@ static FILE* ddict_open(const char* system_directory, const char* filename) {
fname = strdup(filename); fname = strdup(filename);
} }
fh = eth_fopen(fname,"r"); fh = ws_fopen(fname,"r");
D(("fname: %s fh: %p\n",fname,fh)); D(("fname: %s fh: %p\n",fname,fh));
@ -798,7 +798,7 @@ void ddict_print(FILE* fh, ddict_t* d) {
/* /*
* We want to stop processing when we get to the end of the input. * We want to stop processing when we get to the end of the input.
* (%option noyywrap is not used because if used then * (%option noyywrap is not used because if used then
* some flex versions (eg: 2.5.35) generate code which causes * some flex versions (eg: 2.5.35) generate code which causes
* warnings by the Windows VC compiler). * warnings by the Windows VC compiler).
*/ */

View File

@ -301,7 +301,7 @@
#include "packet-giop.h" #include "packet-giop.h"
#include "packet-tcp.h" #include "packet-tcp.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
/* /*
@ -1291,7 +1291,7 @@ static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) {
gboolean stream_is_big_endian; gboolean stream_is_big_endian;
fp = eth_fopen(name,"r"); /* open read only */ fp = ws_fopen(name,"r"); /* open read only */
if (fp == NULL) { if (fp == NULL) {
if (errno == EACCES) if (errno == EACCES)
@ -3785,17 +3785,17 @@ dissect_giop_fragment( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
if (fragment_tree == NULL) if (fragment_tree == NULL)
{ {
fragment_tree = proto_item_add_subtree (tf, ett_giop_fragment); fragment_tree = proto_item_add_subtree (tf, ett_giop_fragment);
} }
} }
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE); request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO)) if (check_col(pinfo->cinfo, COL_INFO))
{ {
col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id); col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
} }
if (fragment_tree ) if (fragment_tree )
{ {
proto_tree_add_uint (fragment_tree, hf_giop_req_id, tvb, offset-4, 4,request_id); proto_tree_add_uint (fragment_tree, hf_giop_req_id, tvb, offset-4, 4,request_id);
} }

View File

@ -56,7 +56,7 @@
#include <nettle/cbc.h> #include <nettle/cbc.h>
#endif #endif
#include <epan/strutil.h> #include <epan/strutil.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#endif #endif
#include <epan/packet.h> #include <epan/packet.h>
@ -3218,7 +3218,7 @@ isakmp_init_protocol(void) {
G_ALLOC_AND_FREE); G_ALLOC_AND_FREE);
if (logf) if (logf)
fclose(logf); fclose(logf);
logf = eth_fopen(pluto_log_path, "r"); logf = ws_fopen(pluto_log_path, "r");
scan_pluto_log(); scan_pluto_log();
#endif /* HAVE_LIBNETTLE */ #endif /* HAVE_LIBNETTLE */

View File

@ -102,7 +102,7 @@
#include <epan/dissectors/packet-gssapi.h> #include <epan/dissectors/packet-gssapi.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define UDP_PORT_KERBEROS 88 #define UDP_PORT_KERBEROS 88
#define TCP_PORT_KERBEROS 88 #define TCP_PORT_KERBEROS 88
@ -731,7 +731,7 @@ read_keytab_file(const char *service_key_file)
unsigned char buf[SERVICE_KEY_SIZE]; unsigned char buf[SERVICE_KEY_SIZE];
int newline_skip = 0, count = 0; int newline_skip = 0, count = 0;
if (service_key_file != NULL && eth_stat (service_key_file, &st) == 0) { if (service_key_file != NULL && ws_stat (service_key_file, &st) == 0) {
/* The service key file contains raw 192-bit (24 byte) 3DES keys. /* The service key file contains raw 192-bit (24 byte) 3DES keys.
* There can be zero, one (\n), or two (\r\n) characters between * There can be zero, one (\n), or two (\r\n) characters between
@ -749,7 +749,7 @@ read_keytab_file(const char *service_key_file)
} }
} }
skf = eth_fopen(service_key_file, "rb"); skf = ws_fopen(service_key_file, "rb");
if (! skf) return; if (! skf) return;
while (fread(buf, SERVICE_KEY_SIZE, 1, skf) == 1) { while (fread(buf, SERVICE_KEY_SIZE, 1, skf) == 1) {
@ -838,7 +838,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
ENDTRY; ENDTRY;
if (do_continue) continue; if (do_continue) continue;
data_len = item_len + offset - CONFOUNDER_PLUS_CHECKSUM; data_len = item_len + offset - CONFOUNDER_PLUS_CHECKSUM;
if ((int) item_len + offset > length) { if ((int) item_len + offset > length) {
tvb_free(encr_tvb); tvb_free(encr_tvb);

View File

@ -37,7 +37,7 @@
#include <epan/emem.h> #include <epan/emem.h>
#include <epan/strutil.h> #include <epan/strutil.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
/* /*
* Lookup tables * Lookup tables
@ -105,7 +105,7 @@ const value_string ssl_20_cipher_suites[] = {
{ 0x000035, "TLS_RSA_WITH_AES_256_CBC_SHA" }, { 0x000035, "TLS_RSA_WITH_AES_256_CBC_SHA" },
{ 0x000036, "TLS_DH_DSS_WITH_AES_256_CBC_SHA" }, { 0x000036, "TLS_DH_DSS_WITH_AES_256_CBC_SHA" },
{ 0x000037, "TLS_DH_RSA_WITH_AES_256_CBC_SHA" }, { 0x000037, "TLS_DH_RSA_WITH_AES_256_CBC_SHA" },
{ 0x000038, "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" }, { 0x000038, "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" },
{ 0x000039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" }, { 0x000039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" },
{ 0x00003A, "TLS_DH_anon_WITH_AES_256_CBC_SHA" }, { 0x00003A, "TLS_DH_anon_WITH_AES_256_CBC_SHA" },
{ 0x000041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" }, { 0x000041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" },
@ -1835,7 +1835,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
gcry_sexp_t rsa_priv_key; gcry_sexp_t rsa_priv_key;
gint major, minor, patch; gint major, minor, patch;
gint i; gint i;
#ifdef SSL_FAST #ifdef SSL_FAST
gcry_mpi_t* rsa_params = g_malloc(sizeof(gcry_mpi_t)*RSA_PARS); gcry_mpi_t* rsa_params = g_malloc(sizeof(gcry_mpi_t)*RSA_PARS);
#else #else
@ -1845,7 +1845,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
/* /*
* note: openssl and gnutls use 'p' and 'q' with opposite meaning: * note: openssl and gnutls use 'p' and 'q' with opposite meaning:
* our 'p' must be equal to 'q' as provided from openssl and viceversa * our 'p' must be equal to 'q' as provided from openssl and viceversa
*/ */
/* RSA get parameter */ /* RSA get parameter */
if (gnutls_x509_privkey_export_rsa_raw(priv_key, if (gnutls_x509_privkey_export_rsa_raw(priv_key,
@ -1856,7 +1856,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
#endif #endif
return NULL; return NULL;
} }
/* convert each rsa parameter to mpi format*/ /* convert each rsa parameter to mpi format*/
for(i=0; i<RSA_PARS; i++) { for(i=0; i<RSA_PARS; i++) {
if (gcry_mpi_scan(&rsa_params[i], GCRYMPI_FMT_USG, rsa_datum[i].data, rsa_datum[i].size,&tmp_size) != 0) { if (gcry_mpi_scan(&rsa_params[i], GCRYMPI_FMT_USG, rsa_datum[i].data, rsa_datum[i].size,&tmp_size) != 0) {
@ -1865,7 +1865,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
g_free(rsa_params); g_free(rsa_params);
#endif #endif
return NULL; return NULL;
} }
} }
ssl_get_version(&major, &minor, &patch); ssl_get_version(&major, &minor, &patch);
@ -1887,7 +1887,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
ssl_debug_printf("ssl_load_key: can't built rsa private key s-exp\n"); ssl_debug_printf("ssl_load_key: can't built rsa private key s-exp\n");
#ifdef SSL_FAST #ifdef SSL_FAST
g_free(rsa_params); g_free(rsa_params);
#endif #endif
return NULL; return NULL;
} }
@ -1901,7 +1901,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
} }
return rsa_priv_key; return rsa_priv_key;
#endif #endif
} }
Ssl_private_key_t * Ssl_private_key_t *
@ -1920,7 +1920,7 @@ ssl_load_key(FILE* fp)
private_key->x509_cert = 0; private_key->x509_cert = 0;
private_key->x509_pkey = 0; private_key->x509_pkey = 0;
private_key->sexp_pkey = 0; private_key->sexp_pkey = 0;
/* init private key data*/ /* init private key data*/
gnutls_x509_privkey_init(&priv_key); gnutls_x509_privkey_init(&priv_key);
@ -1947,7 +1947,7 @@ ssl_load_key(FILE* fp)
ssl_debug_printf("ssl_load_key: can't read from file %d bytes, got %d\n", ssl_debug_printf("ssl_load_key: can't read from file %d bytes, got %d\n",
key.size, bytes); key.size, bytes);
g_free(private_key); g_free(private_key);
g_free(key.data); g_free(key.data);
return NULL; return NULL;
} }
@ -1965,7 +1965,7 @@ ssl_load_key(FILE* fp)
if ( !private_key->sexp_pkey ) { if ( !private_key->sexp_pkey ) {
g_free(private_key); g_free(private_key);
return NULL; return NULL;
} }
return private_key; return private_key;
} }
@ -2004,7 +2004,7 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
private_key->x509_cert = 0; private_key->x509_cert = 0;
private_key->x509_pkey = 0; private_key->x509_pkey = 0;
private_key->sexp_pkey = 0; private_key->sexp_pkey = 0;
rest = 4096; rest = 4096;
data.data = g_malloc(rest); data.data = g_malloc(rest);
data.size = rest; data.size = rest;
@ -2097,7 +2097,7 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
if (ret < 0) { g_strlcpy(buf_email, "<ERROR>", 128); } if (ret < 0) { g_strlcpy(buf_email, "<ERROR>", 128); }
buf_len = sizeof(buf_keyid); buf_len = sizeof(buf_keyid);
ret = gnutls_x509_crt_get_key_id(ssl_cert, 0, buf_keyid, &buf_len); ret = gnutls_x509_crt_get_key_id(ssl_cert, 0, buf_keyid, &buf_len);
if (ret < 0) { g_strlcpy(buf_keyid, "<ERROR>", 32); } if (ret < 0) { g_strlcpy(buf_keyid, "<ERROR>", 32); }
private_key->x509_cert = ssl_cert; private_key->x509_cert = ssl_cert;
@ -2106,14 +2106,14 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
case GNUTLS_BAG_PKCS8_KEY: case GNUTLS_BAG_PKCS8_KEY:
case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY:
ret = gnutls_x509_privkey_init(&ssl_pkey); ret = gnutls_x509_privkey_init(&ssl_pkey);
if (ret < 0) { if (ret < 0) {
ssl_debug_printf( "gnutls_x509_privkey_init(&ssl_pkey) - %s\n", gnutls_strerror(ret)); ssl_debug_printf( "gnutls_x509_privkey_init(&ssl_pkey) - %s\n", gnutls_strerror(ret));
g_free(private_key); g_free(private_key);
return 0; return 0;
} }
ret = gnutls_x509_privkey_import_pkcs8(ssl_pkey, &data, GNUTLS_X509_FMT_DER, cert_passwd, ret = gnutls_x509_privkey_import_pkcs8(ssl_pkey, &data, GNUTLS_X509_FMT_DER, cert_passwd,
(bag_type==GNUTLS_BAG_PKCS8_KEY) ? GNUTLS_PKCS_PLAIN : 0); (bag_type==GNUTLS_BAG_PKCS8_KEY) ? GNUTLS_PKCS_PLAIN : 0);
if (ret < 0) { if (ret < 0) {
ssl_debug_printf( "Can not decrypt private key - %s\n", gnutls_strerror(ret)); ssl_debug_printf( "Can not decrypt private key - %s\n", gnutls_strerror(ret));
@ -2122,19 +2122,19 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
} }
buf_len = sizeof(buf_keyid); buf_len = sizeof(buf_keyid);
ret = gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len); ret = gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len);
if (ret < 0) { if (ret < 0) {
ssl_debug_printf( "gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len) - %s\n", gnutls_strerror(ret)); ssl_debug_printf( "gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len) - %s\n", gnutls_strerror(ret));
return 0; return 0;
} }
ssl_debug_printf( "Private key imported: KeyID %s\n", bytes_to_str(buf_keyid, buf_len)); ssl_debug_printf( "Private key imported: KeyID %s\n", bytes_to_str(buf_keyid, buf_len));
private_key->x509_pkey = ssl_pkey; private_key->x509_pkey = ssl_pkey;
private_key->sexp_pkey = ssl_privkey_to_sexp(ssl_pkey); private_key->sexp_pkey = ssl_privkey_to_sexp(ssl_pkey);
if ( !private_key->sexp_pkey ) { if ( !private_key->sexp_pkey ) {
g_free(private_key); g_free(private_key);
return NULL; return NULL;
} }
break; break;
default: ; default: ;
@ -2142,7 +2142,7 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
} /* j */ } /* j */
} /* i */ } /* i */
return private_key; return private_key;
} }
@ -2158,10 +2158,10 @@ void ssl_free_key(Ssl_private_key_t* key)
if (!key->x509_cert) if (!key->x509_cert)
gnutls_x509_crt_deinit (key->x509_cert); gnutls_x509_crt_deinit (key->x509_cert);
if (!key->x509_pkey) if (!key->x509_pkey)
gnutls_x509_privkey_deinit(key->x509_pkey); gnutls_x509_privkey_deinit(key->x509_pkey);
g_free((Ssl_private_key_t*)key); g_free((Ssl_private_key_t*)key);
} }
@ -2371,7 +2371,7 @@ ssl_association_add(GTree* associations, dissector_handle_t handle, guint port,
if(!assoc->handle){ if(!assoc->handle){
fprintf(stderr, "association_add() could not find handle for protocol:%s\n",protocol); fprintf(stderr, "association_add() could not find handle for protocol:%s\n",protocol);
} else { } else {
if(port) { if(port) {
if(tcp) if(tcp)
dissector_add("tcp.port", port, handle); dissector_add("tcp.port", port, handle);
else else
@ -2605,33 +2605,33 @@ ssl_parse_key_list(const gchar * keys_list, GHashTable *key_hash, GTree* associa
} }
*filename=0; *filename=0;
filename++; filename++;
cert_passwd = strchr(filename,','); cert_passwd = strchr(filename,',');
if (cert_passwd) if (cert_passwd)
{ {
*cert_passwd=0; *cert_passwd=0;
cert_passwd++; cert_passwd++;
} }
/* convert ip and port string to network rappresentation*/ /* convert ip and port string to network rappresentation*/
service = g_malloc(sizeof(SslService) + 4); service = g_malloc(sizeof(SslService) + 4);
service->addr.type = AT_IPv4; service->addr.type = AT_IPv4;
service->addr.len = 4; service->addr.len = 4;
service->addr.data = ip = ((guchar*)service) + sizeof(SslService); service->addr.data = ip = ((guchar*)service) + sizeof(SslService);
/* remove all spaces in addr */ /* remove all spaces in addr */
read_index = 0; read_index = 0;
write_index = 0; write_index = 0;
while(addr[read_index]) { while(addr[read_index]) {
if (addr[read_index] != ' ') { if (addr[read_index] != ' ') {
addr[write_index] = addr[read_index]; addr[write_index] = addr[read_index];
write_index++; write_index++;
} }
read_index++; read_index++;
} }
addr[write_index] = 0; addr[write_index] = 0;
if ( !strcmp("any", addr) || !strcmp("ANY", addr) ) { if ( !strcmp("any", addr) || !strcmp("ANY", addr) ) {
ip[0] = 0; ip[0] = 0;
ip[1] = 0; ip[1] = 0;
@ -2650,17 +2650,17 @@ ssl_parse_key_list(const gchar * keys_list, GHashTable *key_hash, GTree* associa
ip[0], ip[1], ip[2], ip[3], service->port, filename, cert_passwd); ip[0], ip[1], ip[2], ip[3], service->port, filename, cert_passwd);
/* try to load pen or p12 file*/ /* try to load pen or p12 file*/
fp = eth_fopen(filename, "rb"); fp = ws_fopen(filename, "rb");
if (!fp) { if (!fp) {
fprintf(stderr, "can't open file %s \n",filename); fprintf(stderr, "can't open file %s \n",filename);
continue; continue;
} }
if (!cert_passwd) { if (!cert_passwd) {
private_key = ssl_load_key(fp); private_key = ssl_load_key(fp);
} }
else else
{ {
private_key = ssl_load_pkcs12(fp,cert_passwd); private_key = ssl_load_pkcs12(fp,cert_passwd);
} }
/* !!! */ /* !!! */
@ -2669,17 +2669,17 @@ ssl_parse_key_list(const gchar * keys_list, GHashTable *key_hash, GTree* associa
filename); filename);
continue; continue;
} }
fclose(fp); fclose(fp);
ssl_debug_printf("ssl_init private key file %s successfully loaded\n",filename); ssl_debug_printf("ssl_init private key file %s successfully loaded\n",filename);
/* if item exists, remove first */ /* if item exists, remove first */
tmp_private_key = g_hash_table_lookup(key_hash, service); tmp_private_key = g_hash_table_lookup(key_hash, service);
if (tmp_private_key) { if (tmp_private_key) {
g_hash_table_remove(key_hash, service); g_hash_table_remove(key_hash, service);
ssl_free_key(tmp_private_key); ssl_free_key(tmp_private_key);
} }
g_hash_table_insert(key_hash, service, private_key); g_hash_table_insert(key_hash, service, private_key);
ssl_association_add(associations, handle, service->port, protocol, tcp, TRUE); ssl_association_add(associations, handle, service->port, protocol, tcp, TRUE);
@ -2753,7 +2753,7 @@ ssl_set_debug(char* name)
else if (!name || (strcmp(name, "") ==0)) else if (!name || (strcmp(name, "") ==0))
ssl_debug_file = NULL; ssl_debug_file = NULL;
else else
ssl_debug_file = eth_fopen(name, "w"); ssl_debug_file = ws_fopen(name, "w");
if (!use_stderr && ssl_debug_file) if (!use_stderr && ssl_debug_file)
debug_file_must_be_closed = 1; debug_file_must_be_closed = 1;
} }

View File

@ -120,7 +120,7 @@
#include "packet-x509if.h" #include "packet-x509if.h"
#include "packet-ssl.h" #include "packet-ssl.h"
#include "packet-ssl-utils.h" #include "packet-ssl-utils.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
static gboolean ssl_desegment = TRUE; static gboolean ssl_desegment = TRUE;
@ -334,7 +334,7 @@ ssl_parse(void)
if (ssl_keys_list && (ssl_keys_list[0] != 0)) if (ssl_keys_list && (ssl_keys_list[0] != 0))
{ {
if (file_exists(ssl_keys_list)) { if (file_exists(ssl_keys_list)) {
if ((ssl_keys_file = eth_fopen(ssl_keys_list, "r"))) { if ((ssl_keys_file = ws_fopen(ssl_keys_list, "r"))) {
read_failed = FALSE; read_failed = FALSE;
fstat(fileno(ssl_keys_file), &statb); fstat(fileno(ssl_keys_file), &statb);
size = statb.st_size; size = statb.st_size;
@ -548,7 +548,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
else { else {
SslService dummy; SslService dummy;
char ip_addr_any[] = {0,0,0,0}; char ip_addr_any[] = {0,0,0,0};
ssl_session = se_alloc0(sizeof(SslDecryptSession)); ssl_session = se_alloc0(sizeof(SslDecryptSession));
ssl_session_init(ssl_session); ssl_session_init(ssl_session);
ssl_session->version = SSL_VER_UNKNOWN; ssl_session->version = SSL_VER_UNKNOWN;
@ -570,37 +570,37 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* is not always available * is not always available
* Note that with HAVE_LIBGNUTLS undefined private_key is allways 0 * Note that with HAVE_LIBGNUTLS undefined private_key is allways 0
* and thus decryption never engaged*/ * and thus decryption never engaged*/
ssl_session->private_key = 0; ssl_session->private_key = 0;
private_key = g_hash_table_lookup(ssl_key_hash, &dummy); private_key = g_hash_table_lookup(ssl_key_hash, &dummy);
if (!private_key) { if (!private_key) {
ssl_debug_printf("dissect_ssl can't find private key for this server! Try it again with universal port 0\n"); ssl_debug_printf("dissect_ssl can't find private key for this server! Try it again with universal port 0\n");
dummy.port = 0; dummy.port = 0;
private_key = g_hash_table_lookup(ssl_key_hash, &dummy); private_key = g_hash_table_lookup(ssl_key_hash, &dummy);
} }
if (!private_key) { if (!private_key) {
ssl_debug_printf("dissect_ssl can't find private key for this server (universal port)! Try it again with universal address 0.0.0.0\n"); ssl_debug_printf("dissect_ssl can't find private key for this server (universal port)! Try it again with universal address 0.0.0.0\n");
dummy.addr.type = AT_IPv4; dummy.addr.type = AT_IPv4;
dummy.addr.len = 4; dummy.addr.len = 4;
dummy.addr.data = ip_addr_any; dummy.addr.data = ip_addr_any;
dummy.port = port; dummy.port = port;
private_key = g_hash_table_lookup(ssl_key_hash, &dummy); private_key = g_hash_table_lookup(ssl_key_hash, &dummy);
} }
if (!private_key) { if (!private_key) {
ssl_debug_printf("dissect_ssl can't find any private key!\n"); ssl_debug_printf("dissect_ssl can't find any private key!\n");
}
else {
ssl_session->private_key = private_key->sexp_pkey;
} }
else {
ssl_session->private_key = private_key->sexp_pkey;
}
} }
conv_version= & ssl_session->version; conv_version= & ssl_session->version;
@ -1274,7 +1274,7 @@ dissect_ssl_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *t
process_ssl_payload(next_tvb, 0, pinfo, tree, association); process_ssl_payload(next_tvb, 0, pinfo, tree, association);
pinfo->fragmented = save_fragmented; pinfo->fragmented = save_fragmented;
} }
/* restore desegmentation ability */ /* restore desegmentation ability */
pinfo->can_desegment = save_can_desegment; pinfo->can_desegment = save_can_desegment;
} }

View File

@ -36,7 +36,7 @@
#include <glib.h> #include <glib.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/prefs.h> #include <epan/prefs.h>
@ -123,7 +123,7 @@ static value_string tpncp_enums_id_vals[MAX_ENUMS_NUM][MAX_ENUM_ENTRIES];
static gchar *tpncp_enums_name_vals[MAX_ENUMS_NUM]; static gchar *tpncp_enums_name_vals[MAX_ENUMS_NUM];
static gint hf_size = 1; static gint hf_size = 1;
static gint hf_allocated = 0; static gint hf_allocated = 0;
static hf_register_info *hf = NULL; static hf_register_info *hf = NULL;
static hf_register_info hf_tpncp[] = { static hf_register_info hf_tpncp[] = {
{ {
@ -618,8 +618,8 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info,
current_data_id = data_id; current_data_id = data_id;
} }
else { else {
if ((current_tpncp_data_field_info->p_next = if ((current_tpncp_data_field_info->p_next =
(tpncp_data_field_info *)g_malloc0(sizeof(tpncp_data_field_info))) (tpncp_data_field_info *)g_malloc0(sizeof(tpncp_data_field_info)))
== NULL) == NULL)
return (-1); return (-1);
current_tpncp_data_field_info = current_tpncp_data_field_info->p_next; current_tpncp_data_field_info = current_tpncp_data_field_info->p_next;
@ -684,7 +684,7 @@ static gint init_tpncp_db(void) {
g_snprintf(tpncp_dat_file_path, MAX_TPNCP_DAT_FILE_PATH_LEN, "%s" G_DIR_SEPARATOR_S"tpncp" G_DIR_SEPARATOR_S "tpncp.dat", get_datafile_dir()); g_snprintf(tpncp_dat_file_path, MAX_TPNCP_DAT_FILE_PATH_LEN, "%s" G_DIR_SEPARATOR_S"tpncp" G_DIR_SEPARATOR_S "tpncp.dat", get_datafile_dir());
/* Open file with TPNCP data. */ /* Open file with TPNCP data. */
if ((file = eth_fopen(tpncp_dat_file_path, "r")) == NULL) if ((file = ws_fopen(tpncp_dat_file_path, "r")) == NULL)
return (-1); return (-1);
fill_tpncp_id_vals(tpncp_events_id_vals, file); fill_tpncp_id_vals(tpncp_events_id_vals, file);

View File

@ -25,12 +25,12 @@
/* /*
* dtd_preparser.l * dtd_preparser.l
* *
* an XML dissector for wireshark * an XML dissector for wireshark
* *
* DTD Preparser - import a dtd file into a GString * DTD Preparser - import a dtd file into a GString
* including files, removing comments * including files, removing comments
* and resolving %entities; * and resolving %entities;
* *
* Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com> * Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
* *
* $Id$ * $Id$
@ -43,24 +43,24 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include "dtd.h" #include "dtd.h"
#include "dtd_preparse_lex.h" #include "dtd_preparse_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define ECHO g_string_append(current,yytext); #define ECHO g_string_append(current,yytext);
@ -135,7 +135,7 @@ newline \n
<IN_COMMENT>[^-]? | <IN_COMMENT>[^-]? |
<IN_COMMENT>[-] ; <IN_COMMENT>[-] ;
<IN_COMMENT>{comment_stop} { current = output; BEGIN OUTSIDE; } <IN_COMMENT>{comment_stop} { current = output; BEGIN OUTSIDE; }
{newline} { {newline} {
linenum++; linenum++;
if (current) g_string_append_printf(current,"%s\n",location()); if (current) g_string_append_printf(current,"%s\n",location());
@ -159,27 +159,27 @@ newline \n
static gchar* replace_entity(gchar* entity) { static gchar* replace_entity(gchar* entity) {
GString* replacement; GString* replacement;
*entity = '%'; *entity = '%';
replacement = g_hash_table_lookup(entities,entity); replacement = g_hash_table_lookup(entities,entity);
if (replacement) { if (replacement) {
return replacement->str; return replacement->str;
} else { } else {
g_string_append_printf(error,"dtd_preparse: in file '%s': entity %s does not exists\n", filename, entity); g_string_append_printf(error,"dtd_preparse: in file '%s': entity %s does not exists\n", filename, entity);
return ""; return "";
} }
} }
static const gchar* location(void) { static const gchar* location(void) {
static gchar* loc = NULL; static gchar* loc = NULL;
if (loc) g_free(loc); if (loc) g_free(loc);
loc = g_strdup_printf("<? wireshark:location %s:%u ?>", filename, linenum); loc = g_strdup_printf("<? wireshark:location %s:%u ?>", filename, linenum);
return loc; return loc;
} }
@ -191,31 +191,31 @@ static gboolean free_gstring_hash_items(gpointer k,gpointer v,gpointer p _U_) {
extern GString* dtd_preparse(const gchar* dname,const gchar* fname, GString* err) { extern GString* dtd_preparse(const gchar* dname,const gchar* fname, GString* err) {
gchar* fullname = g_strdup_printf("%s%c%s",dname,G_DIR_SEPARATOR,fname); gchar* fullname = g_strdup_printf("%s%c%s",dname,G_DIR_SEPARATOR,fname);
dtd_dirname = dname; dtd_dirname = dname;
filename = fname; filename = fname;
linenum = 1; linenum = 1;
yyin = eth_fopen(fullname,"r"); yyin = ws_fopen(fullname,"r");
if (!yyin) { if (!yyin) {
if (err) if (err)
g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,strerror(errno)); g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,strerror(errno));
return NULL; return NULL;
} }
error = err; error = err;
entities = g_hash_table_new(g_str_hash,g_str_equal); entities = g_hash_table_new(g_str_hash,g_str_equal);
current = output = g_string_new(location()); current = output = g_string_new(location());
BEGIN OUTSIDE; BEGIN OUTSIDE;
yylex(); yylex();
fclose(yyin); fclose(yyin);
yyrestart(NULL); yyrestart(NULL);
g_hash_table_foreach_remove(entities,free_gstring_hash_items,NULL); g_hash_table_foreach_remove(entities,free_gstring_hash_items,NULL);
@ -228,7 +228,7 @@ extern GString* dtd_preparse(const gchar* dname,const gchar* fname, GString* er
/* /*
* We want to stop processing when we get to the end of the input. * We want to stop processing when we get to the end of the input.
* (%option noyywrap is not used because if used then * (%option noyywrap is not used because if used then
* some flex versions (eg: 2.5.35) generate code which causes * some flex versions (eg: 2.5.35) generate code which causes
* warnings by the Windows VC compiler). * warnings by the Windows VC compiler).
*/ */

View File

@ -44,7 +44,6 @@
#include <glib.h> #include <glib.h>
#include <proto.h> #include <proto.h>
#include "emem.h" #include "emem.h"
#include <wiretap/file_util.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> /* VirtualAlloc, VirtualProtect */ #include <windows.h> /* VirtualAlloc, VirtualProtect */
@ -1410,7 +1409,7 @@ emem_tree_lookup32_array(emem_tree_t *se_tree, emem_tree_key_t *key)
/* Strings are stored as an array of uint32 containing the string characters /* Strings are stored as an array of uint32 containing the string characters
with 4 characters in each uint32. with 4 characters in each uint32.
The first byte of the string is stored as the most significant byte. The first byte of the string is stored as the most significant byte.
If the string is not a multiple of 4 characters in length the last If the string is not a multiple of 4 characters in length the last
uint32 containing the string bytes are padded with 0 bytes. uint32 containing the string bytes are padded with 0 bytes.
@ -1445,7 +1444,7 @@ emem_tree_insert_string(emem_tree_t* se_tree, const gchar* k, void* v, guint32 f
if (i%4 == 3) { if (i%4 == 3) {
aligned[i/4] = tmp; aligned[i/4] = tmp;
tmp = 0; tmp = 0;
} }
} }
/* add required padding to the last uint32 */ /* add required padding to the last uint32 */
if (i%4 != 0) { if (i%4 != 0) {
@ -1455,7 +1454,7 @@ emem_tree_insert_string(emem_tree_t* se_tree, const gchar* k, void* v, guint32 f
} }
aligned[i/4-1] = tmp; aligned[i/4-1] = tmp;
} }
/* add the terminator */ /* add the terminator */
aligned[div-1] = 0x00000001; aligned[div-1] = 0x00000001;
@ -1498,7 +1497,7 @@ emem_tree_lookup_string(emem_tree_t* se_tree, const gchar* k, guint32 flags)
if (i%4 == 3) { if (i%4 == 3) {
aligned[i/4] = tmp; aligned[i/4] = tmp;
tmp = 0; tmp = 0;
} }
} }
/* add required padding to the last uint32 */ /* add required padding to the last uint32 */
if (i%4 != 0) { if (i%4 != 0) {
@ -1508,7 +1507,7 @@ emem_tree_lookup_string(emem_tree_t* se_tree, const gchar* k, guint32 flags)
} }
aligned[i/4-1] = tmp; aligned[i/4-1] = tmp;
} }
/* add the terminator */ /* add the terminator */
aligned[div-1] = 0x00000001; aligned[div-1] = 0x00000001;

View File

@ -57,7 +57,7 @@
#include "filesystem.h" #include "filesystem.h"
#include "privileges.h" #include "privileges.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define PROFILES_DIR "profiles" #define PROFILES_DIR "profiles"
#define U3_MY_CAPTURES "\\My Captures" #define U3_MY_CAPTURES "\\My Captures"
@ -195,7 +195,7 @@ test_for_directory(const char *path)
{ {
struct stat statb; struct stat statb;
if (eth_stat(path, &statb) < 0) if (ws_stat(path, &statb) < 0)
return errno; return errno;
if (S_ISDIR(statb.st_mode)) if (S_ISDIR(statb.st_mode))
@ -209,7 +209,7 @@ test_for_fifo(const char *path)
{ {
struct stat statb; struct stat statb;
if (eth_stat(path, &statb) < 0) if (ws_stat(path, &statb) < 0)
return errno; return errno;
if (S_ISFIFO(statb.st_mode)) if (S_ISFIFO(statb.st_mode))
@ -975,12 +975,12 @@ delete_directory (const char *directory, char **pf_dir_path_return)
gchar *filename; gchar *filename;
int ret = 0; int ret = 0;
if ((dir = eth_dir_open(directory, 0, NULL)) != NULL) { if ((dir = ws_dir_open(directory, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
filename = g_strdup_printf ("%s%s%s", directory, G_DIR_SEPARATOR_S, filename = g_strdup_printf ("%s%s%s", directory, G_DIR_SEPARATOR_S,
eth_dir_get_name(file)); ws_dir_get_name(file));
if (test_for_directory(filename) != EISDIR) { if (test_for_directory(filename) != EISDIR) {
ret = eth_remove(filename); ret = ws_remove(filename);
#if 0 #if 0
} else { } else {
/* The user has manually created a directory in the profile directory */ /* The user has manually created a directory in the profile directory */
@ -994,10 +994,10 @@ delete_directory (const char *directory, char **pf_dir_path_return)
} }
g_free (filename); g_free (filename);
} }
eth_dir_close(dir); ws_dir_close(dir);
} }
if (ret == 0 && (ret = eth_remove(directory)) != 0) { if (ret == 0 && (ret = ws_remove(directory)) != 0) {
*pf_dir_path_return = g_strdup (directory); *pf_dir_path_return = g_strdup (directory);
} }
@ -1025,7 +1025,7 @@ rename_persconffile_profile(const char *fromname, const char *toname,
char *to_dir = g_strdup (get_persconffile_dir(toname)); char *to_dir = g_strdup (get_persconffile_dir(toname));
int ret = 0; int ret = 0;
ret = eth_rename (from_dir, to_dir); ret = ws_rename (from_dir, to_dir);
if (ret != 0) { if (ret != 0) {
*pf_from_dir_path_return = g_strdup (from_dir); *pf_from_dir_path_return = g_strdup (from_dir);
*pf_to_dir_path_return = g_strdup (to_dir); *pf_to_dir_path_return = g_strdup (to_dir);
@ -1061,8 +1061,8 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
* If not then create it. * If not then create it.
*/ */
pf_dir_path = get_profiles_dir (); pf_dir_path = get_profiles_dir ();
if (eth_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) { if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
ret = eth_mkdir(pf_dir_path, 0755); ret = ws_mkdir(pf_dir_path, 0755);
if (ret == -1) { if (ret == -1) {
*pf_dir_path_return = g_strdup(pf_dir_path); *pf_dir_path_return = g_strdup(pf_dir_path);
return ret; return ret;
@ -1071,7 +1071,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
} }
pf_dir_path = get_persconffile_dir(profilename); pf_dir_path = get_persconffile_dir(profilename);
if (eth_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) { if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
#ifdef _WIN32 #ifdef _WIN32
/* /*
* Does the parent directory of that directory * Does the parent directory of that directory
@ -1089,20 +1089,20 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
pf_dir_parent_path_len = strlen(pf_dir_parent_path); pf_dir_parent_path_len = strlen(pf_dir_parent_path);
if (pf_dir_parent_path_len > 0 if (pf_dir_parent_path_len > 0
&& pf_dir_parent_path[pf_dir_parent_path_len - 1] != ':' && pf_dir_parent_path[pf_dir_parent_path_len - 1] != ':'
&& eth_stat(pf_dir_parent_path, &s_buf) != 0) { && ws_stat(pf_dir_parent_path, &s_buf) != 0) {
/* /*
* No, it doesn't exist - make it first. * No, it doesn't exist - make it first.
*/ */
ret = eth_mkdir(pf_dir_parent_path, 0755); ret = ws_mkdir(pf_dir_parent_path, 0755);
if (ret == -1) { if (ret == -1) {
*pf_dir_path_return = pf_dir_parent_path; *pf_dir_path_return = pf_dir_parent_path;
return -1; return -1;
} }
} }
g_free(pf_dir_path_copy); g_free(pf_dir_path_copy);
ret = eth_mkdir(pf_dir_path, 0755); ret = ws_mkdir(pf_dir_path, 0755);
#else #else
ret = eth_mkdir(pf_dir_path, 0755); ret = ws_mkdir(pf_dir_path, 0755);
#endif #endif
} else { } else {
/* /*
@ -1268,7 +1268,7 @@ get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_
} }
#ifdef _WIN32 #ifdef _WIN32
if (!for_writing) { if (!for_writing) {
if (eth_stat(path, &s_buf) != 0 && errno == ENOENT) { if (ws_stat(path, &s_buf) != 0 && errno == ENOENT) {
/* /*
* OK, it's not in the personal configuration file * OK, it's not in the personal configuration file
* directory; is it in the ".wireshark" subdirectory * directory; is it in the ".wireshark" subdirectory
@ -1277,7 +1277,7 @@ get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_
old_path = g_strdup_printf( old_path = g_strdup_printf(
"%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s", "%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s",
get_home_dir(), filename); get_home_dir(), filename);
if (eth_stat(old_path, &s_buf) == 0) { if (ws_stat(old_path, &s_buf) == 0) {
/* /*
* OK, it exists; return it instead. * OK, it exists; return it instead.
*/ */
@ -1368,7 +1368,7 @@ get_datafile_path(const char *filename)
gboolean gboolean
deletefile(const char *path) deletefile(const char *path)
{ {
return eth_unlink(path) == 0; return ws_unlink(path) == 0;
} }
/* /*
@ -1481,14 +1481,14 @@ file_exists(const char *fname)
* so this is working, but maybe not quite the way expected. ULFL * so this is working, but maybe not quite the way expected. ULFL
*/ */
file_stat.st_ino = 1; /* this will make things work if an error occured */ file_stat.st_ino = 1; /* this will make things work if an error occured */
eth_stat(fname, &file_stat); ws_stat(fname, &file_stat);
if (file_stat.st_ino == 0) { if (file_stat.st_ino == 0) {
return TRUE; return TRUE;
} else { } else {
return FALSE; return FALSE;
} }
#else #else
if (eth_stat(fname, &file_stat) != 0 && errno == ENOENT) { if (ws_stat(fname, &file_stat) != 0 && errno == ENOENT) {
return FALSE; return FALSE;
} else { } else {
return TRUE; return TRUE;
@ -1543,9 +1543,9 @@ files_identical(const char *fname1, const char *fname2)
/* /*
* Compare st_dev and st_ino. * Compare st_dev and st_ino.
*/ */
if (eth_stat(fname1, &filestat1) == -1) if (ws_stat(fname1, &filestat1) == -1)
return FALSE; /* can't get info about the first file */ return FALSE; /* can't get info about the first file */
if (eth_stat(fname2, &filestat2) == -1) if (ws_stat(fname2, &filestat2) == -1)
return FALSE; /* can't get info about the second file */ return FALSE; /* can't get info about the second file */
return (filestat1.st_dev == filestat2.st_dev && return (filestat1.st_dev == filestat2.st_dev &&
filestat1.st_ino == filestat2.st_ino); filestat1.st_ino == filestat2.st_ino);

View File

@ -254,10 +254,10 @@ dissect_per_sequence_of
dissect_per_sequence dissect_per_sequence
dissect_per_set_of dissect_per_set_of
dissect_per_VisibleString dissect_per_VisibleString
dissect_q932_PartyNumber dissect_q932_PartyNumber
dissect_q932_PartySubaddress dissect_q932_PartySubaddress
dissect_q932_PresentedNumberUnscreened dissect_q932_PresentedNumberUnscreened
dissect_q932_PresentedNumberScreened dissect_q932_PresentedNumberScreened
dissect_qsig_na_Name dissect_qsig_na_Name
dissect_rpc_array dissect_rpc_array
dissect_rpc_bool dissect_rpc_bool
@ -335,7 +335,6 @@ epan_dissect_run
epan_get_version epan_get_version
epan_init epan_init
epan_strcasestr epan_strcasestr
eth_stdio_fopen
ether_to_str ether_to_str
ex_opt_add ex_opt_add
ex_opt_count ex_opt_count
@ -634,7 +633,7 @@ proto_find_finfo
proto_frame DATA proto_frame DATA
proto_get_finfo_ptr_array proto_get_finfo_ptr_array
proto_get_first_protocol_field proto_get_first_protocol_field
proto_get_first_protocol proto_get_first_protocol
proto_get_id proto_get_id
proto_get_id_by_filter_name proto_get_id_by_filter_name
proto_get_next_protocol proto_get_next_protocol

View File

@ -50,7 +50,7 @@
#include "filesystem.h" #include "filesystem.h"
#include "privileges.h" #include "privileges.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "report_err.h" #include "report_err.h"
/* linked list of all plugins */ /* linked list of all plugins */
@ -148,12 +148,12 @@ plugins_scan_dir(const char *dirname)
gchar *dot; gchar *dot;
int cr; int cr;
if ((dir = eth_dir_open(dirname, 0, NULL)) != NULL) if ((dir = ws_dir_open(dirname, 0, NULL)) != NULL)
{ {
while ((file = eth_dir_read_name(dir)) != NULL) while ((file = ws_dir_read_name(dir)) != NULL)
{ {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
/* /*
* GLib 2.x defines G_MODULE_SUFFIX as the extension used on * GLib 2.x defines G_MODULE_SUFFIX as the extension used on
@ -180,7 +180,7 @@ plugins_scan_dir(const char *dirname)
continue; continue;
} }
version = gp; version = gp;
/* /*
* Do we have a register routine? * Do we have a register routine?
*/ */
@ -263,7 +263,7 @@ plugins_scan_dir(const char *dirname)
g_module_close(handle); g_module_close(handle);
continue; continue;
} }
/* /*
* Do we have a register_wtap_module routine? * Do we have a register_wtap_module routine?
*/ */
@ -273,7 +273,7 @@ plugins_scan_dir(const char *dirname)
} else { } else {
register_wtap_module = NULL; register_wtap_module = NULL;
} }
/* /*
* Do we have a register_codec_module routine? * Do we have a register_codec_module routine?
*/ */
@ -288,7 +288,7 @@ plugins_scan_dir(const char *dirname)
* Does this dissector do anything useful? * Does this dissector do anything useful?
*/ */
if (register_protoinfo == NULL && if (register_protoinfo == NULL &&
register_tap_listener == NULL && register_tap_listener == NULL &&
register_wtap_module == NULL && register_wtap_module == NULL &&
register_codec_module == NULL ) register_codec_module == NULL )
{ {
@ -319,9 +319,9 @@ plugins_scan_dir(const char *dirname)
g_module_close(handle); g_module_close(handle);
continue; continue;
} }
} }
eth_dir_close(dir); ws_dir_close(dir);
} }
} }
@ -357,9 +357,9 @@ init_plugins(void)
*/ */
plugin_dir = get_plugin_dir(); plugin_dir = get_plugin_dir();
if (running_in_build_directory()) { if (running_in_build_directory()) {
if ((dir = eth_dir_open(plugin_dir, 0, NULL)) != NULL) { if ((dir = ws_dir_open(plugin_dir, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
continue; /* skip "." and ".." */ continue; /* skip "." and ".." */
/* /*
@ -411,7 +411,7 @@ void
register_all_plugin_registrations(void) register_all_plugin_registrations(void)
{ {
plugin *pt_plug; plugin *pt_plug;
/* /*
* For all plugins with register-handoff routines, call the routines. * For all plugins with register-handoff routines, call the routines.
* This is called from "proto_init()"; it must be called after * This is called from "proto_init()"; it must be called after

View File

@ -46,7 +46,7 @@
#include "cfile.h" #include "cfile.h"
#include <epan/column.h> #include <epan/column.h>
#include "print.h" #include "print.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/prefs-int.h> #include <epan/prefs-int.h>
#include <epan/uat-int.h> #include <epan/uat-int.h>
@ -1263,19 +1263,19 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
* file doesn't exist, try the old path. * file doesn't exist, try the old path.
*/ */
gpf_path = get_datafile_path(PF_NAME); gpf_path = get_datafile_path(PF_NAME);
if ((pf = eth_fopen(gpf_path, "r")) == NULL && errno == ENOENT) { if ((pf = ws_fopen(gpf_path, "r")) == NULL && errno == ENOENT) {
/* /*
* It doesn't exist by the new name; try the old name. * It doesn't exist by the new name; try the old name.
*/ */
g_free(gpf_path); g_free(gpf_path);
gpf_path = get_datafile_path(OLD_GPF_NAME); gpf_path = get_datafile_path(OLD_GPF_NAME);
pf = eth_fopen(gpf_path, "r"); pf = ws_fopen(gpf_path, "r");
} }
} else { } else {
/* /*
* We have the path; try it. * We have the path; try it.
*/ */
pf = eth_fopen(gpf_path, "r"); pf = ws_fopen(gpf_path, "r");
} }
/* /*
@ -1318,7 +1318,7 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
/* Read the user's preferences file, if it exists. */ /* Read the user's preferences file, if it exists. */
*pf_path_return = NULL; *pf_path_return = NULL;
if ((pf = eth_fopen(pf_path, "r")) != NULL) { if ((pf = ws_fopen(pf_path, "r")) != NULL) {
/* /*
* Start out the counters of "mgcp.{tcp,udp}.port" entries we've * Start out the counters of "mgcp.{tcp,udp}.port" entries we've
* seen. * seen.
@ -2562,7 +2562,7 @@ write_prefs(char **pf_path_return)
if (pf_path_return != NULL) { if (pf_path_return != NULL) {
pf_path = get_persconffile_path(PF_NAME, TRUE, TRUE); pf_path = get_persconffile_path(PF_NAME, TRUE, TRUE);
if ((pf = eth_fopen(pf_path, "w")) == NULL) { if ((pf = ws_fopen(pf_path, "w")) == NULL) {
*pf_path_return = pf_path; *pf_path_return = pf_path;
return errno; return errno;
} }

View File

@ -59,7 +59,7 @@
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/dissectors/packet-radius.h> #include <epan/dissectors/packet-radius.h>
#include "radius_dict_lex.h" #include "radius_dict_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#ifdef _WIN32 #ifdef _WIN32
/* disable Windows VC compiler warning "signed/unsigned mismatch" associated */ /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
@ -198,7 +198,7 @@
fullpaths[include_stack_ptr] = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", fullpaths[include_stack_ptr] = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
directory,yytext); directory,yytext);
yyin = eth_fopen( fullpaths[include_stack_ptr], "r" ); yyin = ws_fopen( fullpaths[include_stack_ptr], "r" );
if (!yyin) { if (!yyin) {
if (errno) { if (errno) {
@ -382,7 +382,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
error = g_string_new(""); error = g_string_new("");
yyin = eth_fopen(fullpaths[include_stack_ptr],"r"); yyin = ws_fopen(fullpaths[include_stack_ptr],"r");
if (!yyin) { if (!yyin) {
g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) ); g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
@ -423,7 +423,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
/* /*
* We want to stop processing when we get to the end of the input. * We want to stop processing when we get to the end of the input.
* (%option noyywrap is not used because if used then * (%option noyywrap is not used because if used then
* some flex versions (eg: 2.5.35) generate code which causes * some flex versions (eg: 2.5.35) generate code which causes
* warnings by the Windows VC compiler). * warnings by the Windows VC compiler).
*/ */

View File

@ -43,7 +43,7 @@
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/range.h> #include <epan/range.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "uat-int.h" #include "uat-int.h"
@ -240,7 +240,7 @@ gboolean uat_save(uat_t* uat, char** error) {
if (! fname ) return FALSE; if (! fname ) return FALSE;
fp = eth_fopen(fname,"w"); fp = ws_fopen(fname,"w");
if (!fp) { if (!fp) {
*error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno)); *error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno));

View File

@ -59,7 +59,7 @@
#include <epan/emem.h> #include <epan/emem.h>
#include "uat-int.h" #include "uat-int.h"
#include "uat_load_lex.h" #include "uat_load_lex.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#ifdef _WIN32 #ifdef _WIN32
/* disable Windows VC compiler warning "signed/unsigned mismatch" associated */ /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */
@ -288,7 +288,7 @@ gboolean uat_load(uat_t* uat_in, char** err) {
} }
if (!(yyin = eth_fopen(fname,"r"))) { if (!(yyin = ws_fopen(fname,"r"))) {
*err = strerror(errno); *err = strerror(errno);
g_free(fname); g_free(fname);
return FALSE; return FALSE;
@ -353,7 +353,7 @@ gboolean uat_load_str(uat_t* uat_in, char* entry, char** err) {
/* /*
* We want to stop processing when we get to the end of the input. * We want to stop processing when we get to the end of the input.
* (%option noyywrap is not used because if used then * (%option noyywrap is not used because if used then
* some flex versions (eg: 2.5.35) generate code which causes * some flex versions (eg: 2.5.35) generate code which causes
* warnings by the Windows VC compiler). * warnings by the Windows VC compiler).
*/ */

View File

@ -32,7 +32,7 @@
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/ex-opt.h> #include <epan/ex-opt.h>
#include <epan/privileges.h> #include <epan/privileges.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
static lua_State* L = NULL; static lua_State* L = NULL;
@ -192,7 +192,7 @@ static int lua_main_error_handler(lua_State* LS) {
void lua_load_script(const gchar* filename) { void lua_load_script(const gchar* filename) {
FILE* file; FILE* file;
if (! ( file = eth_fopen(filename,"r")) ) { if (! ( file = ws_fopen(filename,"r")) ) {
report_open_failure(filename,errno,FALSE); report_open_failure(filename,errno,FALSE);
return; return;
} }

46
file.c
View File

@ -74,7 +74,7 @@
#include <epan/dissectors/packet-ber.h> #include <epan/dissectors/packet-ber.h>
#include <epan/timestamp.h> #include <epan/timestamp.h>
#include <epan/dfilter/dfilter-macro.h> #include <epan/dfilter/dfilter-macro.h>
#include "file_util.h" #include <wsutil/file_util.h>
#include <epan/column-utils.h> #include <epan/column-utils.h>
#include <epan/strutil.h> #include <epan/strutil.h>
#include <epan/emem.h> #include <epan/emem.h>
@ -327,7 +327,7 @@ cf_reset_state(capture_file *cf)
if (cf->filename != NULL) { if (cf->filename != NULL) {
/* If it's a temporary file, remove it. */ /* If it's a temporary file, remove it. */
if (cf->is_tempfile) if (cf->is_tempfile)
eth_unlink(cf->filename); ws_unlink(cf->filename);
g_free(cf->filename); g_free(cf->filename);
cf->filename = NULL; cf->filename = NULL;
} }
@ -1037,7 +1037,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
fdata->col_expr.col_expr = cf->cinfo.col_expr.col_expr; fdata->col_expr.col_expr = cf->cinfo.col_expr.col_expr;
fdata->col_expr.col_expr_val = cf->cinfo.col_expr.col_expr_val; fdata->col_expr.col_expr_val = cf->cinfo.col_expr.col_expr_val;
row = packet_list_append(cf->cinfo.col_data, fdata); row = packet_list_append(cf->cinfo.col_data, fdata);
/* colorize packet: first apply color filters /* colorize packet: first apply color filters
@ -1178,7 +1178,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
if (*out_filenamep != NULL) { if (*out_filenamep != NULL) {
out_filename = *out_filenamep; out_filename = *out_filenamep;
out_fd = eth_open(out_filename, O_CREAT|O_TRUNC|O_BINARY, 0600); out_fd = ws_open(out_filename, O_CREAT|O_TRUNC|O_BINARY, 0600);
if (out_fd == -1) if (out_fd == -1)
open_err = errno; open_err = errno;
} else { } else {
@ -1201,7 +1201,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
merge_max_snapshot_length(in_file_count, in_files), merge_max_snapshot_length(in_file_count, in_files),
FALSE /* compressed */, &open_err); FALSE /* compressed */, &open_err);
if (pdh == NULL) { if (pdh == NULL) {
eth_close(out_fd); ws_close(out_fd);
merge_close_in_files(in_file_count, in_files); merge_close_in_files(in_file_count, in_files);
g_free(in_files); g_free(in_files);
cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE, cf_open_failure_alert_box(out_filename, open_err, err_info, TRUE,
@ -2236,7 +2236,7 @@ cf_write_pdml_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2310,7 +2310,7 @@ cf_write_psml_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2384,7 +2384,7 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2430,7 +2430,7 @@ cf_write_csv_packets(capture_file *cf, print_args_t *print_args)
static gboolean static gboolean
write_carrays_packet(capture_file *cf _U_, frame_data *fdata, write_carrays_packet(capture_file *cf _U_, frame_data *fdata,
union wtap_pseudo_header *pseudo_header _U_, union wtap_pseudo_header *pseudo_header _U_,
const guint8 *pd, void *argsp) const guint8 *pd, void *argsp)
{ {
FILE *fh = argsp; FILE *fh = argsp;
@ -2445,7 +2445,7 @@ cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
FILE *fh; FILE *fh;
psp_return_t ret; psp_return_t ret;
fh = eth_fopen(print_args->file, "w"); fh = ws_fopen(print_args->file, "w");
if (fh == NULL) if (fh == NULL)
return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */
@ -2459,7 +2459,7 @@ cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
/* Iterate through the list of packets, printing the packets we were /* Iterate through the list of packets, printing the packets we were
told to print. */ told to print. */
ret = process_specified_packets(cf, &print_args->range, ret = process_specified_packets(cf, &print_args->range,
"Writing C Arrays", "Writing C Arrays",
"selected packets", TRUE, "selected packets", TRUE,
write_carrays_packet, fh); write_carrays_packet, fh);
@ -3499,7 +3499,7 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
capture, so it doesn't need to stay around under that name; capture, so it doesn't need to stay around under that name;
first, try renaming the capture buffer file to the new name. */ first, try renaming the capture buffer file to the new name. */
#ifndef _WIN32 #ifndef _WIN32
if (eth_rename(cf->filename, fname) == 0) { if (ws_rename(cf->filename, fname) == 0) {
/* That succeeded - there's no need to copy the source file. */ /* That succeeded - there's no need to copy the source file. */
from_filename = NULL; from_filename = NULL;
do_copy = FALSE; do_copy = FALSE;
@ -3928,7 +3928,7 @@ copy_binary_file(const char *from_filename, const char *to_filename)
guint8 pd[65536]; guint8 pd[65536];
/* Copy the raw bytes of the file. */ /* Copy the raw bytes of the file. */
from_fd = eth_open(from_filename, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */); from_fd = ws_open(from_filename, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (from_fd < 0) { if (from_fd < 0) {
open_failure_alert_box(from_filename, errno, FALSE); open_failure_alert_box(from_filename, errno, FALSE);
goto done; goto done;
@ -3939,23 +3939,23 @@ copy_binary_file(const char *from_filename, const char *to_filename)
may open the file in text mode, not binary mode, but we want may open the file in text mode, not binary mode, but we want
to copy the raw bytes of the file, so we need the output file to copy the raw bytes of the file, so we need the output file
to be open in binary mode. */ to be open in binary mode. */
to_fd = eth_open(to_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); to_fd = ws_open(to_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (to_fd < 0) { if (to_fd < 0) {
open_failure_alert_box(to_filename, errno, TRUE); open_failure_alert_box(to_filename, errno, TRUE);
eth_close(from_fd); ws_close(from_fd);
goto done; goto done;
} }
while ((nread = eth_read(from_fd, pd, sizeof pd)) > 0) { while ((nread = ws_read(from_fd, pd, sizeof pd)) > 0) {
nwritten = eth_write(to_fd, pd, nread); nwritten = ws_write(to_fd, pd, nread);
if (nwritten < nread) { if (nwritten < nread) {
if (nwritten < 0) if (nwritten < 0)
err = errno; err = errno;
else else
err = WTAP_ERR_SHORT_WRITE; err = WTAP_ERR_SHORT_WRITE;
write_failure_alert_box(to_filename, err); write_failure_alert_box(to_filename, err);
eth_close(from_fd); ws_close(from_fd);
eth_close(to_fd); ws_close(to_fd);
goto done; goto done;
} }
} }
@ -3964,12 +3964,12 @@ copy_binary_file(const char *from_filename, const char *to_filename)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"An error occurred while reading from the file \"%s\": %s.", "An error occurred while reading from the file \"%s\": %s.",
from_filename, strerror(err)); from_filename, strerror(err));
eth_close(from_fd); ws_close(from_fd);
eth_close(to_fd); ws_close(to_fd);
goto done; goto done;
} }
eth_close(from_fd); ws_close(from_fd);
if (eth_close(to_fd) < 0) { if (ws_close(to_fd) < 0) {
write_failure_alert_box(to_filename, errno); write_failure_alert_box(to_filename, errno);
goto done; goto done;
} }

View File

@ -51,7 +51,7 @@
#include <glib.h> #include <glib.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "globals.h" #include "globals.h"
#include <epan/filesystem.h> #include <epan/filesystem.h>
@ -77,7 +77,7 @@ fileset_filename_match_pattern(const char *fname)
int baselen; int baselen;
int minlen = strlen("_00001_20050418010750"); int minlen = strlen("_00001_20050418010750");
char *filename; char *filename;
/* d:\dir1\test_00001_20050418010750.cap */ /* d:\dir1\test_00001_20050418010750.cap */
filename = g_strdup(get_basename(fname)); filename = g_strdup(get_basename(fname));
@ -183,7 +183,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current)
path = g_strdup_printf("%s%s", dirname, fname); path = g_strdup_printf("%s%s", dirname, fname);
fh = eth_open( path, O_RDONLY, 0000 /* no creation so don't matter */); fh = ws_open( path, O_RDONLY, 0000 /* no creation so don't matter */);
if(fh != -1) { if(fh != -1) {
/* Get statistics */ /* Get statistics */
@ -203,7 +203,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current)
set.entries = g_list_append(set.entries, entry); set.entries = g_list_append(set.entries, entry);
} }
eth_close(fh); ws_close(fh);
} }
g_free(path); g_free(path);
@ -255,22 +255,22 @@ fileset_add_dir(const char *fname)
dirname = g_string_new(fname_dup); dirname = g_string_new(fname_dup);
g_free(fname_dup); g_free(fname_dup);
set.dirname = g_strdup(dirname->str); set.dirname = g_strdup(dirname->str);
dirname = g_string_append_c(dirname, G_DIR_SEPARATOR); dirname = g_string_append_c(dirname, G_DIR_SEPARATOR);
/* is the current file probably a part of any fileset? */ /* is the current file probably a part of any fileset? */
if(fileset_filename_match_pattern(fname)) { if(fileset_filename_match_pattern(fname)) {
/* yes, go through the files in the directory and check if the file in question is part of the current file set */ /* yes, go through the files in the directory and check if the file in question is part of the current file set */
if ((dir = eth_dir_open(dirname->str, 0, NULL)) != NULL) { if ((dir = ws_dir_open(dirname->str, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
if(fileset_filename_match_pattern(name) && fileset_is_file_in_set(name, get_basename(fname))) { if(fileset_filename_match_pattern(name) && fileset_is_file_in_set(name, get_basename(fname))) {
fileset_add_file(dirname->str, name, strcmp(name, get_basename(fname))== 0 /* current */); fileset_add_file(dirname->str, name, strcmp(name, get_basename(fname))== 0 /* current */);
} }
} /* while */ } /* while */
eth_dir_close(dir); ws_dir_close(dir);
} /* if */ } /* if */
} else { } else {
/* no, this is a "standalone file", just add this one */ /* no, this is a "standalone file", just add this one */

View File

@ -40,7 +40,7 @@
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include "filters.h" #include "filters.h"
#include "file_util.h" #include <wsutil/file_util.h>
/* /*
* Old filter file name. * Old filter file name.
@ -146,7 +146,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
/* try to open personal "cfilters"/"dfilters" file */ /* try to open personal "cfilters"/"dfilters" file */
ff_path = get_persconffile_path(ff_name, TRUE, FALSE); ff_path = get_persconffile_path(ff_name, TRUE, FALSE);
if ((ff = eth_fopen(ff_path, "r")) == NULL) { if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/* /*
* Did that fail because the file didn't exist? * Did that fail because the file didn't exist?
*/ */
@ -169,7 +169,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
*/ */
g_free(ff_path); g_free(ff_path);
ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE); ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE);
if ((ff = eth_fopen(ff_path, "r")) == NULL) { if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/* /*
* Did that fail because the file didn't exist? * Did that fail because the file didn't exist?
*/ */
@ -186,7 +186,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
* Try to open the global "cfilters/dfilters" file */ * Try to open the global "cfilters/dfilters" file */
g_free(ff_path); g_free(ff_path);
ff_path = get_datafile_path(ff_name); ff_path = get_datafile_path(ff_name);
if ((ff = eth_fopen(ff_path, "r")) == NULL) { if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/* /*
* Well, that didn't work, either. Just give up. * Well, that didn't work, either. Just give up.
@ -206,7 +206,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
/* If we already have a list of filters, discard it. */ /* If we already have a list of filters, discard it. */
/* this should never happen - this function is called only once for each list! */ /* this should never happen - this function is called only once for each list! */
while(*flpp) { while(*flpp) {
*flpp = remove_filter_entry(*flpp, g_list_first(*flpp)); *flpp = remove_filter_entry(*flpp, g_list_first(*flpp));
} }
/* Allocate the filter name buffer. */ /* Allocate the filter name buffer. */
@ -363,7 +363,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
fclose(ff); fclose(ff);
g_free(filt_name); g_free(filt_name);
g_free(filt_expr); g_free(filt_expr);
/* init the corresponding edited list */ /* init the corresponding edited list */
switch (list_type) { switch (list_type) {
case CFILTER_LIST: case CFILTER_LIST:
@ -497,7 +497,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
completely. */ completely. */
ff_path_new = g_strdup_printf("%s.new", ff_path); ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = eth_fopen(ff_path_new, "w")) == NULL) { if ((ff = ws_fopen(ff_path_new, "w")) == NULL) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
g_free(ff_path_new); g_free(ff_path_new);
@ -526,7 +526,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
fclose(ff); fclose(ff);
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -535,7 +535,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
if (fclose(ff) == EOF) { if (fclose(ff) == EOF) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -545,22 +545,22 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
exists; the Win32 call to rename files doesn't do so, which I exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so. infer is the reason why the MSVC++ "rename()" doesn't do so.
We must therefore remove the target file first, on Windows. */ We must therefore remove the target file first, on Windows. */
if (eth_remove(ff_path) < 0 && errno != ENOENT) { if (ws_remove(ff_path) < 0 && errno != ENOENT) {
/* It failed for some reason other than "it's not there"; if /* It failed for some reason other than "it's not there"; if
it's not there, we don't need to remove it, so we just it's not there, we don't need to remove it, so we just
drive on. */ drive on. */
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
#endif #endif
if (eth_rename(ff_path_new, ff_path) < 0) { if (ws_rename(ff_path_new, ff_path) < 0) {
*pref_path_return = ff_path; *pref_path_return = ff_path;
*errno_return = errno; *errno_return = errno;
eth_unlink(ff_path_new); ws_unlink(ff_path_new);
g_free(ff_path_new); g_free(ff_path_new);
return; return;
} }
@ -586,7 +586,7 @@ void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type)
/* throw away the "old" destination list - a NULL list is ok here */ /* throw away the "old" destination list - a NULL list is ok here */
while(*flpp_dest) { while(*flpp_dest) {
*flpp_dest = remove_filter_entry(*flpp_dest, g_list_first(*flpp_dest)); *flpp_dest = remove_filter_entry(*flpp_dest, g_list_first(*flpp_dest));
} }
g_assert(g_list_length(*flpp_dest) == 0); g_assert(g_list_length(*flpp_dest) == 0);

View File

@ -47,7 +47,7 @@
#include "../color_filters.h" #include "../color_filters.h"
#include "../merge.h" #include "../merge.h"
#include "../util.h" #include "../util.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/keys.h" #include "gtk/keys.h"
@ -1350,7 +1350,7 @@ static void file_save_as_exists_answered_cb(gpointer dialog _U_, gint btn, gpoin
switch(btn) { switch(btn) {
case(ESD_BTN_OK): case(ESD_BTN_OK):
/* save file */ /* save file */
eth_unlink(cf_name); ws_unlink(cf_name);
file_save_as_cb(NULL, data); file_save_as_cb(NULL, data);
break; break;
case(ESD_BTN_CANCEL): case(ESD_BTN_CANCEL):
@ -1435,7 +1435,7 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) {
/* the file exists, ask the user to remove it first */ /* the file exists, ask the user to remove it first */
dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL, dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL,
"%sA file named \"%s\" already exists.%s\n\n" "%sA file named \"%s\" already exists.%s\n\n"
"Do you want to replace it with the capture you are saving?", "Do you want to replace it with the capture you are saving?",
simple_dialog_primary_start(), cf_name, simple_dialog_primary_end()); simple_dialog_primary_start(), cf_name, simple_dialog_primary_end());
simple_dialog_set_cb(dialog, file_save_as_exists_answered_cb, fs); simple_dialog_set_cb(dialog, file_save_as_exists_answered_cb, fs);

View File

@ -44,7 +44,7 @@
#include <../alert_box.h> #include <../alert_box.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <gtk/dlg_utils.h> #include <gtk/dlg_utils.h>
#include <gtk/file_dlg.h> #include <gtk/file_dlg.h>
@ -125,7 +125,7 @@ eo_save_entry(gchar *save_as_filename, export_object_entry_t *entry, gboolean sh
{ {
int to_fd; int to_fd;
to_fd = eth_open(save_as_filename, O_WRONLY | O_CREAT | O_EXCL | to_fd = ws_open(save_as_filename, O_WRONLY | O_CREAT | O_EXCL |
O_BINARY, 0644); O_BINARY, 0644);
if(to_fd == -1) { /* An error occurred */ if(to_fd == -1) { /* An error occurred */
if (show_err) if (show_err)
@ -134,15 +134,15 @@ eo_save_entry(gchar *save_as_filename, export_object_entry_t *entry, gboolean sh
return FALSE; return FALSE;
} }
if(eth_write(to_fd, entry->payload_data, entry->payload_len) < 0) { if(ws_write(to_fd, entry->payload_data, entry->payload_len) < 0) {
if (show_err) if (show_err)
write_failure_alert_box(save_as_filename, errno); write_failure_alert_box(save_as_filename, errno);
eth_close(to_fd); ws_close(to_fd);
g_free(save_as_filename); g_free(save_as_filename);
return FALSE; return FALSE;
} }
if (eth_close(to_fd) < 0) { if (ws_close(to_fd) < 0) {
if (show_err) if (show_err)
write_failure_alert_box(save_as_filename, errno); write_failure_alert_box(save_as_filename, errno);
g_free(save_as_filename); g_free(save_as_filename);

View File

@ -66,7 +66,7 @@
#include <../alert_box.h> #include <../alert_box.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <../util.h> #include <../util.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <gtk/main.h> #include <gtk/main.h>
#include <gtk/dlg_utils.h> #include <gtk/dlg_utils.h>
@ -747,7 +747,7 @@ firewall_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
} }
rule_info = g_object_get_data(G_OBJECT(fs), WS_RULE_INFO_KEY); rule_info = g_object_get_data(G_OBJECT(fs), WS_RULE_INFO_KEY);
fh = eth_fopen(to_name, "w"); fh = ws_fopen(to_name, "w");
if (fh == NULL) { if (fh == NULL) {
open_failure_alert_box(to_name, errno, TRUE); open_failure_alert_box(to_name, errno, TRUE);
g_free(to_name); g_free(to_name);

View File

@ -52,7 +52,6 @@
#include <../alert_box.h> #include <../alert_box.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <../util.h> #include <../util.h>
#include <wiretap/file_util.h>
#include <gtk/color_utils.h> #include <gtk/color_utils.h>
#include <gtk/main.h> #include <gtk/main.h>
@ -87,7 +86,7 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_
int proto_ssl = (long) ssl; int proto_ssl = (long) ssl;
SslPacketInfo* pi = p_get_proto_data(pinfo->fd, proto_ssl); SslPacketInfo* pi = p_get_proto_data(pinfo->fd, proto_ssl);
/* skip packet without decrypted data payload*/ /* skip packet without decrypted data payload*/
if (!pi || !pi->appl_data) if (!pi || !pi->appl_data)
return 0; return 0;
@ -95,10 +94,10 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_
total_len = 0; total_len = 0;
appl_data = pi->appl_data; appl_data = pi->appl_data;
do { do {
total_len += appl_data->plain_data.data_len; total_len += appl_data->plain_data.data_len;
appl_data = appl_data->next; appl_data = appl_data->next;
} while (appl_data); } while (appl_data);
/* compute packet direction */ /* compute packet direction */
rec = g_malloc(sizeof(SslDecryptedRecord) + total_len); rec = g_malloc(sizeof(SslDecryptedRecord) + total_len);
@ -109,20 +108,20 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_
if (ADDRESSES_EQUAL(&follow_info->client_ip, &pinfo->src) && if (ADDRESSES_EQUAL(&follow_info->client_ip, &pinfo->src) &&
follow_info->client_port == pinfo->srcport) follow_info->client_port == pinfo->srcport)
rec->is_server = 0; rec->is_server = 0;
else else
rec->is_server = 1; rec->is_server = 1;
/* update stream counter */ /* update stream counter */
follow_info->bytes_written[rec->is_server] += total_len; follow_info->bytes_written[rec->is_server] += total_len;
/* extract decrypted data and queue it locally */ /* extract decrypted data and queue it locally */
rec->data.data = (guchar*)(rec + 1); rec->data.data = (guchar*)(rec + 1);
rec->data.data_len = total_len; rec->data.data_len = total_len;
appl_data = pi->appl_data; appl_data = pi->appl_data;
p = rec->data.data; p = rec->data.data;
do { do {
memcpy(p, appl_data->plain_data.data, appl_data->plain_data.data_len); memcpy(p, appl_data->plain_data.data, appl_data->plain_data.data_len);
p += appl_data->plain_data.data_len; p += appl_data->plain_data.data_len;
appl_data = appl_data->next; appl_data = appl_data->next;
} while (appl_data); } while (appl_data);
follow_info->payload = g_list_append( follow_info->payload = g_list_append(
@ -131,7 +130,7 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_
return 0; return 0;
} }
extern gboolean extern gboolean
packet_is_ssl(epan_dissect_t* edt); packet_is_ssl(epan_dissect_t* edt);
@ -238,22 +237,22 @@ follow_ssl_stream_cb(GtkWidget * w, gpointer data _U_)
memcpy(&ipaddr, stats.ip_address[1], 4); memcpy(&ipaddr, stats.ip_address[1], 4);
hostname1 = get_hostname(ipaddr); hostname1 = get_hostname(ipaddr);
} }
port0 = get_tcp_port(stats.port[0]); port0 = get_tcp_port(stats.port[0]);
port1 = get_tcp_port(stats.port[1]); port1 = get_tcp_port(stats.port[1]);
follow_info->is_ipv6 = stats.is_ipv6; follow_info->is_ipv6 = stats.is_ipv6;
/* Both Stream Directions */ /* Both Stream Directions */
both_directions_string = g_strdup_printf("Entire conversation (%u bytes)", follow_info->bytes_written[0] + follow_info->bytes_written[1]); both_directions_string = g_strdup_printf("Entire conversation (%u bytes)", follow_info->bytes_written[0] + follow_info->bytes_written[1]);
if(follow_info->client_port == stats.port[0]) { if(follow_info->client_port == stats.port[0]) {
server_to_client_string = server_to_client_string =
g_strdup_printf("%s:%s --> %s:%s (%u bytes)", g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
hostname0, port0, hostname0, port0,
hostname1, port1, hostname1, port1,
follow_info->bytes_written[0]); follow_info->bytes_written[0]);
client_to_server_string = client_to_server_string =
g_strdup_printf("%s:%s --> %s:%s (%u bytes)", g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
hostname1, port1, hostname1, port1,
@ -265,14 +264,14 @@ follow_ssl_stream_cb(GtkWidget * w, gpointer data _U_)
hostname1, port1, hostname1, port1,
hostname0, port0, hostname0, port0,
follow_info->bytes_written[0]); follow_info->bytes_written[0]);
client_to_server_string = client_to_server_string =
g_strdup_printf("%s:%s --> %s:%s (%u bytes)", g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
hostname0, port0, hostname0, port0,
hostname1, port1, hostname1, port1,
follow_info->bytes_written[1]); follow_info->bytes_written[1]);
} }
follow_stream("Follow SSL Stream", follow_info, both_directions_string, follow_stream("Follow SSL Stream", follow_info, both_directions_string,
server_to_client_string, client_to_server_string); server_to_client_string, client_to_server_string);
@ -315,7 +314,7 @@ follow_read_ssl_stream(follow_info_t *follow_info,
frs_return_t frs_return; frs_return_t frs_return;
iplen = (follow_info->is_ipv6) ? 16 : 4; iplen = (follow_info->is_ipv6) ? 16 : 4;
for (cur = follow_info->payload; cur; cur = g_list_next(cur)) { for (cur = follow_info->payload; cur; cur = g_list_next(cur)) {
SslDecryptedRecord* rec = cur->data; SslDecryptedRecord* rec = cur->data;
skip = FALSE; skip = FALSE;
@ -334,7 +333,7 @@ follow_read_ssl_stream(follow_info_t *follow_info,
if (!skip) { if (!skip) {
size_t nchars = rec->data.data_len; size_t nchars = rec->data.data_len;
gchar *buffer = g_memdup(rec->data.data, nchars); gchar *buffer = g_memdup(rec->data.data, nchars);
frs_return = follow_show(follow_info, print_line, buffer, nchars, frs_return = follow_show(follow_info, print_line, buffer, nchars,
rec->is_server, arg, global_pos, rec->is_server, arg, global_pos,
&server_packet_count, &client_packet_count); &server_packet_count, &client_packet_count);

View File

@ -45,7 +45,7 @@
#include <../isprint.h> #include <../isprint.h>
#include <../print.h> #include <../print.h>
#include <../simple_dialog.h> #include <../simple_dialog.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <gtk/color_utils.h> #include <gtk/color_utils.h>
#include <gtk/stock_icons.h> #include <gtk/stock_icons.h>
@ -476,7 +476,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
print_mswin(print_dest); print_mswin(print_dest);
/* trash temp file */ /* trash temp file */
eth_remove(print_dest); ws_remove(print_dest);
} }
#endif #endif
return; return;
@ -495,7 +495,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
#ifdef _WIN32 #ifdef _WIN32
if (win_printer) { if (win_printer) {
/* trash temp file */ /* trash temp file */
eth_remove(print_dest); ws_remove(print_dest);
} }
#endif #endif
} }
@ -562,10 +562,10 @@ follow_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
follow_info = g_object_get_data(G_OBJECT(fs), E_FOLLOW_INFO_KEY); follow_info = g_object_get_data(G_OBJECT(fs), E_FOLLOW_INFO_KEY);
if (follow_info->show_type == SHOW_RAW) { if (follow_info->show_type == SHOW_RAW) {
/* Write the data out as raw binary data */ /* Write the data out as raw binary data */
fh = eth_fopen(to_name, "wb"); fh = ws_fopen(to_name, "wb");
} else { } else {
/* Write it out as text */ /* Write it out as text */
fh = eth_fopen(to_name, "w"); fh = ws_fopen(to_name, "w");
} }
if (fh == NULL) { if (fh == NULL) {
open_failure_alert_box(to_name, errno, TRUE); open_failure_alert_box(to_name, errno, TRUE);
@ -895,7 +895,7 @@ follow_destroy_cb(GtkWidget *w, gpointer data _U_)
switch(follow_info->follow_type) { switch(follow_info->follow_type) {
case FOLLOW_TCP : case FOLLOW_TCP :
i = eth_unlink(follow_info->data_out_filename); i = ws_unlink(follow_info->data_out_filename);
if(i != 0) { if(i != 0) {
g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, strerror(errno), errno); g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, strerror(errno), errno);
} }

View File

@ -55,7 +55,7 @@
#include "../alert_box.h" #include "../alert_box.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../tempfile.h" #include "../tempfile.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/color_utils.h" #include "gtk/color_utils.h"
#include "gtk/follow_tcp.h" #include "gtk/follow_tcp.h"
@ -142,8 +142,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not create temporary file %s: %s", "Could not create temporary file %s: %s",
follow_info->data_out_filename, strerror(errno)); follow_info->data_out_filename, strerror(errno));
eth_close(tmp_fd); ws_close(tmp_fd);
eth_unlink(follow_info->data_out_filename); ws_unlink(follow_info->data_out_filename);
g_free(follow_info); g_free(follow_info);
return; return;
} }
@ -190,8 +190,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
if (empty_tcp_stream) { if (empty_tcp_stream) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The packets in the capture file for that stream have no data."); "The packets in the capture file for that stream have no data.");
eth_close(tmp_fd); ws_close(tmp_fd);
eth_unlink(follow_info->data_out_filename); ws_unlink(follow_info->data_out_filename);
g_free(follow_info); g_free(follow_info);
return; return;
} }
@ -220,8 +220,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
(unsigned long)sizeof(sc), (unsigned long)sizeof(sc),
(unsigned long)nchars); (unsigned long)nchars);
} }
eth_close(tmp_fd); ws_close(tmp_fd);
eth_unlink(follow_info->data_out_filename); ws_unlink(follow_info->data_out_filename);
g_free(follow_info); g_free(follow_info);
return; return;
} }
@ -335,7 +335,7 @@ follow_read_tcp_stream(follow_info_t *follow_info,
iplen = (follow_info->is_ipv6) ? 16 : 4; iplen = (follow_info->is_ipv6) ? 16 : 4;
data_out_file = eth_fopen(follow_info->data_out_filename, "rb"); data_out_file = ws_fopen(follow_info->data_out_filename, "rb");
if (data_out_file == NULL) { if (data_out_file == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Could not open temporary file %s: %s", follow_info->data_out_filename, "Could not open temporary file %s: %s", follow_info->data_out_filename,
@ -385,14 +385,14 @@ follow_read_tcp_stream(follow_info_t *follow_info,
if (!skip) { if (!skip) {
frs_return = follow_show(follow_info, print_line, buffer, frs_return = follow_show(follow_info, print_line, buffer,
nchars, is_server, arg, global_pos, nchars, is_server, arg, global_pos,
&server_packet_count, &server_packet_count,
&client_packet_count); &client_packet_count);
if(frs_return == FRS_PRINT_ERROR) { if(frs_return == FRS_PRINT_ERROR) {
fclose(data_out_file); fclose(data_out_file);
data_out_file = NULL; data_out_file = NULL;
return frs_return; return frs_return;
} }
} }
} }

View File

@ -50,7 +50,7 @@
#include "../register.h" #include "../register.h"
#include "../color.h" #include "../color.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/file_dlg.h" #include "gtk/file_dlg.h"
@ -276,7 +276,7 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t* user_data)
FILE *of; FILE *of;
of = eth_fopen(user_data->dlg.save_file,"w"); of = ws_fopen(user_data->dlg.save_file,"w");
if (of==NULL){ if (of==NULL){
return FALSE; return FALSE;
} }
@ -509,7 +509,7 @@ static void save_to_file_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
/* check whether the file exists */ /* check whether the file exists */
file_test = eth_fopen(user_data_p->dlg.save_file,"r"); file_test = ws_fopen(user_data_p->dlg.save_file,"r");
if (file_test!=NULL){ if (file_test!=NULL){
dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO, dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO,
@ -1216,7 +1216,7 @@ static gint configure_event(GtkWidget *widget, GdkEventConfigure *event _U_)
user_data->dlg.bg_gc[i]=gdk_gc_new(user_data->dlg.pixmap); user_data->dlg.bg_gc[i]=gdk_gc_new(user_data->dlg.pixmap);
gdk_gc_set_rgb_fg_color(user_data->dlg.bg_gc[i], &col[i]); gdk_gc_set_rgb_fg_color(user_data->dlg.bg_gc[i], &col[i]);
} }
dialog_graph_redraw(user_data); dialog_graph_redraw(user_data);
return TRUE; return TRUE;
@ -1505,13 +1505,13 @@ static void dialog_graph_create_window(graph_analysis_data_t* user_data)
/****************************************************************************/ /****************************************************************************/
static gint add_or_get_node(graph_analysis_data_t* user_data, address* node) { static gint add_or_get_node(graph_analysis_data_t* user_data, address* node) {
guint i; guint i;
if (node->type == AT_NONE) return NODE_OVERFLOW; if (node->type == AT_NONE) return NODE_OVERFLOW;
for (i=0; i<MAX_NUM_NODES && i < user_data->num_nodes ; i++){ for (i=0; i<MAX_NUM_NODES && i < user_data->num_nodes ; i++){
if ( CMP_ADDRESS(&(user_data->nodes[i]), node) == 0 ) return i; /* it is in the array */ if ( CMP_ADDRESS(&(user_data->nodes[i]), node) == 0 ) return i; /* it is in the array */
} }
if (i == MAX_NUM_NODES) { if (i == MAX_NUM_NODES) {
return NODE_OVERFLOW; return NODE_OVERFLOW;
} else { } else {
@ -1613,14 +1613,14 @@ void graph_analysis_redraw(graph_analysis_data_t* user_data)
user_data->dlg.pixmap_width = user_data->num_nodes * NODE_WIDTH; user_data->dlg.pixmap_width = user_data->num_nodes * NODE_WIDTH;
gtk_widget_set_size_request(user_data->dlg.draw_area, user_data->dlg.pixmap_width, user_data->dlg.pixmap_height); gtk_widget_set_size_request(user_data->dlg.draw_area, user_data->dlg.pixmap_width, user_data->dlg.pixmap_height);
if ( user_data->num_nodes < 6) if ( user_data->num_nodes < 6)
gtk_widget_set_size_request(user_data->dlg.scroll_window, NODE_WIDTH*user_data->num_nodes, user_data->dlg.pixmap_height); gtk_widget_set_size_request(user_data->dlg.scroll_window, NODE_WIDTH*user_data->num_nodes, user_data->dlg.pixmap_height);
else else
gtk_widget_set_size_request(user_data->dlg.scroll_window, NODE_WIDTH*5, user_data->dlg.pixmap_height); gtk_widget_set_size_request(user_data->dlg.scroll_window, NODE_WIDTH*5, user_data->dlg.pixmap_height);
/* redraw the graph */ /* redraw the graph */
dialog_graph_redraw(user_data); dialog_graph_redraw(user_data);
window_present(user_data->dlg.window); window_present(user_data->dlg.window);
return; return;

View File

@ -37,7 +37,7 @@
#include "epan/epan.h" #include "epan/epan.h"
#include "../ui_util.h" #include "../ui_util.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/gui_utils.h" #include "gtk/gui_utils.h"

View File

@ -36,7 +36,6 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h"
#include "gtk/help_dlg.h" #include "gtk/help_dlg.h"
#include "gtk/text_page_utils.h" #include "gtk/text_page_utils.h"

View File

@ -100,7 +100,7 @@
#include "../alert_box.h" #include "../alert_box.h"
#include "../capture_ui_utils.h" #include "../capture_ui_utils.h"
#include "../log.h" #include "../log.h"
#include "../wiretap/file_util.h" #include <wsutil/file_util.h>
#ifdef HAVE_LIBPCAP #ifdef HAVE_LIBPCAP
@ -1458,7 +1458,7 @@ main_cf_cb_file_safe_reload_finished(gpointer data _U_)
set_menus_for_capture_file(&cfile); set_menus_for_capture_file(&cfile);
} }
static void static void
main_cf_callback(gint event, gpointer data, gpointer user_data _U_) main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
{ {
switch(event) { switch(event) {
@ -2046,13 +2046,13 @@ main(int argc, char *argv[])
recent_read_static(&rf_path, &rf_open_errno); recent_read_static(&rf_path, &rf_open_errno);
if (rf_path != NULL && rf_open_errno != 0) { if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open common recent file\n\"%s\": %s.", "Could not open common recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno)); rf_path, strerror(rf_open_errno));
} }
recent_read_profile_static(&rf_path, &rf_open_errno); recent_read_profile_static(&rf_path, &rf_open_errno);
if (rf_path != NULL && rf_open_errno != 0) { if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.", "Could not open recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno)); rf_path, strerror(rf_open_errno));
} }
@ -2398,7 +2398,7 @@ main(int argc, char *argv[])
recent_read_dynamic(&rf_path, &rf_open_errno); recent_read_dynamic(&rf_path, &rf_open_errno);
if (rf_path != NULL && rf_open_errno != 0) { if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open recent file\n\"%s\": %s.", "Could not open recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno)); rf_path, strerror(rf_open_errno));
} }
@ -2663,9 +2663,9 @@ create_console(void)
create one and make it the standard input, output, and error. */ create one and make it the standard input, output, and error. */
if (!AllocConsole()) if (!AllocConsole())
return; /* couldn't create console */ return; /* couldn't create console */
eth_freopen("CONIN$", "r", stdin); ws_freopen("CONIN$", "r", stdin);
eth_freopen("CONOUT$", "w", stdout); ws_freopen("CONOUT$", "w", stdout);
eth_freopen("CONOUT$", "w", stderr); ws_freopen("CONOUT$", "w", stderr);
/* Well, we have a console now. */ /* Well, we have a console now. */
has_console = TRUE; has_console = TRUE;
@ -3241,7 +3241,7 @@ void change_configuration_profile (const gchar *profile_name)
recent_read_profile_static(&rf_path, &rf_open_errno); recent_read_profile_static(&rf_path, &rf_open_errno);
if (rf_path != NULL && rf_open_errno != 0) { if (rf_path != NULL && rf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
"Could not open common recent file\n\"%s\": %s.", "Could not open common recent file\n\"%s\": %s.",
rf_path, strerror(rf_open_errno)); rf_path, strerror(rf_open_errno));
} }
timestamp_set_type (recent.gui_time_format); timestamp_set_type (recent.gui_time_format);

View File

@ -55,7 +55,7 @@
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../progress_dlg.h" #include "../progress_dlg.h"
#include "../ui_util.h" #include "../ui_util.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/keys.h" #include "gtk/keys.h"
#include "gtk/color_utils.h" #include "gtk/color_utils.h"
@ -695,7 +695,7 @@ static void copy_hex_all_info(GString* copy_buffer, const guint8* data_p, int da
byte_line_part_length = (++i) % byte_line_length; byte_line_part_length = (++i) % byte_line_length;
if(i == data_len){ if(i == data_len){
/* End of data - need to fill in spaces in hex string and then do "end of line". /* End of data - need to fill in spaces in hex string and then do "end of line".
* *
*/ */
for(j = 0; append_text && (j < (byte_line_length - byte_line_part_length)); ++j) { for(j = 0; append_text && (j < (byte_line_length - byte_line_part_length)); ++j) {
g_string_append(hex_str," "); /* Three spaces for each missing byte */ g_string_append(hex_str," "); /* Three spaces for each missing byte */
@ -704,7 +704,7 @@ static void copy_hex_all_info(GString* copy_buffer, const guint8* data_p, int da
} else { } else {
end_of_line = (byte_line_part_length == 0 ? TRUE : FALSE); end_of_line = (byte_line_part_length == 0 ? TRUE : FALSE);
} }
if (end_of_line){ if (end_of_line){
/* End of line */ /* End of line */
@ -725,7 +725,7 @@ static void copy_hex_all_info(GString* copy_buffer, const guint8* data_p, int da
g_string_free(char_str, TRUE); g_string_free(char_str, TRUE);
} }
static static
int copy_hex_bytes_text_only(GString* copy_buffer, const guint8* data_p, int data_len _U_) int copy_hex_bytes_text_only(GString* copy_buffer, const guint8* data_p, int data_len _U_)
{ {
@ -742,7 +742,7 @@ int copy_hex_bytes_text_only(GString* copy_buffer, const guint8* data_p, int dat
return 1; return 1;
} }
static static
int copy_hex_bytes_hex(GString* copy_buffer, const guint8* data_p, int data_len _U_) int copy_hex_bytes_hex(GString* copy_buffer, const guint8* data_p, int data_len _U_)
{ {
g_string_append_printf(copy_buffer, "%02x", *data_p); g_string_append_printf(copy_buffer, "%02x", *data_p);
@ -777,7 +777,7 @@ copy_hex_cb(GtkWidget * w _U_, gpointer data _U_, copy_data_type data_type)
if(flags & CD_FLAGS_SELECTEDONLY) { if(flags & CD_FLAGS_SELECTEDONLY) {
int start, end; int start, end;
/* Get the start and end of the highlighted bytes. /* Get the start and end of the highlighted bytes.
* XXX The keys appear to be REVERSED start <-> end throughout this file! * XXX The keys appear to be REVERSED start <-> end throughout this file!
* Should this be fixed? There is one exception - packet_hex_reprint, * Should this be fixed? There is one exception - packet_hex_reprint,
@ -826,12 +826,12 @@ copy_hex_cb(GtkWidget * w _U_, gpointer data _U_, copy_data_type data_type)
} }
break; break;
} }
if(copy_buffer->len > 0) { if(copy_buffer->len > 0) {
copy_to_clipboard(copy_buffer); copy_to_clipboard(copy_buffer);
} }
g_string_free(copy_buffer, TRUE); g_string_free(copy_buffer, TRUE);
} }
/* save the current highlighted hex data */ /* save the current highlighted hex data */
@ -872,17 +872,17 @@ savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_)
return; return;
} }
fd = eth_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666); fd = ws_open(file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
if (fd == -1) { if (fd == -1) {
open_failure_alert_box(file, errno, TRUE); open_failure_alert_box(file, errno, TRUE);
return; return;
} }
if (eth_write(fd, data_p + start, end - start) < 0) { if (ws_write(fd, data_p + start, end - start) < 0) {
write_failure_alert_box(file, errno); write_failure_alert_box(file, errno);
eth_close(fd); ws_close(fd);
return; return;
} }
if (eth_close(fd) < 0) { if (ws_close(fd) < 0) {
write_failure_alert_box(file, errno); write_failure_alert_box(file, errno);
return; return;
} }
@ -998,7 +998,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
gtk_text_buffer_set_text(buf, "", 0); gtk_text_buffer_set_text(buf, "", 0);
gtk_text_buffer_get_start_iter(buf, &iter); gtk_text_buffer_get_start_iter(buf, &iter);
g_object_ref(buf); g_object_ref(buf);
gtk_text_view_set_buffer( bv_text_view, NULL); gtk_text_view_set_buffer( bv_text_view, NULL);
/* /*
@ -1172,7 +1172,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
if (reverse && (reverse != newreverse)) { if (reverse && (reverse != newreverse)) {
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur,
revstyle, NULL); revstyle, NULL);
cur = 0; cur = 0;
} }
if (i < k) { if (i < k) {
@ -1214,12 +1214,12 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
"plain", NULL); "plain", NULL);
} }
gtk_text_view_set_buffer( bv_text_view, buf); gtk_text_view_set_buffer( bv_text_view, buf);
if (mark) { if (mark) {
gtk_text_view_scroll_to_mark(bv_text_view, mark, 0.0, TRUE, 1.0, 0.0); gtk_text_view_scroll_to_mark(bv_text_view, mark, 0.0, TRUE, 1.0, 0.0);
gtk_text_buffer_delete_mark(buf, mark); gtk_text_buffer_delete_mark(buf, mark);
} }
g_object_unref(buf); g_object_unref(buf);
} }
void void

View File

@ -40,7 +40,7 @@
#include "capture_opts.h" #include "capture_opts.h"
#include "capture_ui_utils.h" #include "capture_ui_utils.h"
#include "simple_dialog.h" #include "simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gui_utils.h" #include "gtk/gui_utils.h"
#include "gtk/color_utils.h" #include "gtk/color_utils.h"
@ -113,7 +113,7 @@ scroll_box_dynamic_add(GtkWidget *parent_box)
child_box = g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX); child_box = g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX);
max_cnt = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS)); max_cnt = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS));
/* get the current number of children */ /* get the current number of children */
childs = gtk_container_get_children(GTK_CONTAINER(child_box)); childs = gtk_container_get_children(GTK_CONTAINER(child_box));
curr_cnt = g_list_length(childs); curr_cnt = g_list_length(childs);
@ -204,7 +204,7 @@ welcome_button(const gchar *stock_item,
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg); gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
if(tooltip != NULL) { if(tooltip != NULL) {
gtk_tooltips_set_tip(tooltips, eb, tooltip, ""); gtk_tooltips_set_tip(tooltips, eb, tooltip, "");
} }
g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), NULL); g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), NULL);
g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), NULL); g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), NULL);
@ -367,7 +367,7 @@ welcome_filename_link_new(const gchar *filename, GtkWidget **label)
} }
/* add file size */ /* add file size */
err = eth_stat(filename, &stat_buf); err = ws_stat(filename, &stat_buf);
if(err == 0) { if(err == 0) {
if (stat_buf.st_size/1024/1024 > 10) { if (stat_buf.st_size/1024/1024 > 10) {
g_string_append_printf(str, " %" G_GINT64_MODIFIER "dMB", (gint64) (stat_buf.st_size/1024/1024)); g_string_append_printf(str, " %" G_GINT64_MODIFIER "dMB", (gint64) (stat_buf.st_size/1024/1024));

View File

@ -1,7 +1,7 @@
/* mcast_stream.c /* mcast_stream.c
* *
* Copyright 2006, Iskratel , Slovenia * Copyright 2006, Iskratel , Slovenia
* By Jakob Bratkovic <j.bratkovic@iskratel.si> and * By Jakob Bratkovic <j.bratkovic@iskratel.si> and
* Miha Jemec <m.jemec@iskratel.si> * Miha Jemec <m.jemec@iskratel.si>
* *
* $Id$ * $Id$
@ -54,7 +54,6 @@
#include "../register.h" #include "../register.h"
#include "../alert_box.h" #include "../alert_box.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h"
#include "gtk/mcast_stream.h" #include "gtk/mcast_stream.h"
#include "gtk/mcast_stream_dlg.h" #include "gtk/mcast_stream_dlg.h"
@ -192,7 +191,7 @@ static int mcaststream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt
/* not in the list? then create a new entry */ /* not in the list? then create a new entry */
if (!strinfo) { if (!strinfo) {
/*printf("nov sip %s sp %d dip %s dp %d\n", g_strdup(get_addr_name(&(pinfo->src))), /*printf("nov sip %s sp %d dip %s dp %d\n", g_strdup(get_addr_name(&(pinfo->src))),
pinfo->srcport, g_strdup(get_addr_name(&(pinfo->dst))), pinfo->destport);*/ pinfo->srcport, g_strdup(get_addr_name(&(pinfo->dst))), pinfo->destport);*/
tmp_strinfo.npackets = 0; tmp_strinfo.npackets = 0;
tmp_strinfo.apackets = 0; tmp_strinfo.apackets = 0;
@ -230,7 +229,7 @@ static int mcaststream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt
/* set time with the first packet */ /* set time with the first packet */
if (tapinfo->npackets == 0) { if (tapinfo->npackets == 0) {
tapinfo->allstreams = g_malloc(sizeof(mcast_stream_info_t)); tapinfo->allstreams = g_malloc(sizeof(mcast_stream_info_t));
tapinfo->allstreams->element.buff = tapinfo->allstreams->element.buff =
(struct timeval *)g_malloc(buffsize * sizeof(struct timeval)); (struct timeval *)g_malloc(buffsize * sizeof(struct timeval));
tapinfo->allstreams->start_rel_sec = (guint32) pinfo->fd->rel_ts.secs; tapinfo->allstreams->start_rel_sec = (guint32) pinfo->fd->rel_ts.secs;
tapinfo->allstreams->start_rel_usec = pinfo->fd->rel_ts.nsecs/1000; tapinfo->allstreams->start_rel_usec = pinfo->fd->rel_ts.nsecs/1000;
@ -399,7 +398,7 @@ void buffusagecalc(mcast_stream_info_t *strinfo, packet_info *pinfo, double empt
strinfo->element.buffusage-= (guint32) (timeelapsed * emptyspeed / 8); strinfo->element.buffusage-= (guint32) (timeelapsed * emptyspeed / 8);
if(strinfo->element.buffusage < 0) strinfo->element.buffusage=0; if(strinfo->element.buffusage < 0) strinfo->element.buffusage=0;
if(strinfo->element.buffusage > strinfo->element.topbuffusage) if(strinfo->element.buffusage > strinfo->element.topbuffusage)
strinfo->element.topbuffusage = strinfo->element.buffusage; strinfo->element.topbuffusage = strinfo->element.buffusage;
/* check for buffer losses */ /* check for buffer losses */
if((strinfo->element.buffusage >= bufferalarm) && (strinfo->element.buffstatus == 0)){ if((strinfo->element.buffusage >= bufferalarm) && (strinfo->element.buffstatus == 0)){
@ -433,7 +432,7 @@ void slidingwindow(mcast_stream_info_t *strinfo, packet_info *pinfo)
/* burst count */ /* burst count */
buffer[strinfo->element.last].tv_sec = (guint32) pinfo->fd->rel_ts.secs; buffer[strinfo->element.last].tv_sec = (guint32) pinfo->fd->rel_ts.secs;
buffer[strinfo->element.last].tv_usec = pinfo->fd->rel_ts.nsecs/1000; buffer[strinfo->element.last].tv_usec = pinfo->fd->rel_ts.nsecs/1000;
while(comparetimes((struct timeval *)&(buffer[strinfo->element.first]), while(comparetimes((struct timeval *)&(buffer[strinfo->element.first]),
(struct timeval *)&(buffer[strinfo->element.last]), burstint)){ (struct timeval *)&(buffer[strinfo->element.last]), burstint)){
strinfo->element.first++; strinfo->element.first++;
if(strinfo->element.first >= buffsize) strinfo->element.first = strinfo->element.first % buffsize; if(strinfo->element.first >= buffsize) strinfo->element.first = strinfo->element.first % buffsize;

View File

@ -40,7 +40,7 @@
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../tempfile.h" #include "../tempfile.h"
#include "../util.h" #include "../util.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/keys.h" #include "gtk/keys.h"
@ -456,7 +456,7 @@ export_carrays_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
/* init the printing range */ /* init the printing range */
packet_range_init(&args->range); packet_range_init(&args->range);
export_carrays_win = open_print_dialog("Wireshark: Export as \"C Arrays\" File", export_carrays_win = open_print_dialog("Wireshark: Export as \"C Arrays\" File",
output_action_export_carrays, args); output_action_export_carrays, args);
g_signal_connect(export_carrays_win, "destroy", G_CALLBACK(print_destroy_cb), &export_carrays_win); g_signal_connect(export_carrays_win, "destroy", G_CALLBACK(print_destroy_cb), &export_carrays_win);
} }
@ -970,7 +970,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
/* remember to restore these values later! */ /* remember to restore these values later! */
tmp_oldfile = args->file; tmp_oldfile = args->file;
args->file = g_strdup(tmp_namebuf); args->file = g_strdup(tmp_namebuf);
eth_unlink(args->file); ws_unlink(args->file);
args->to_file = TRUE; args->to_file = TRUE;
#else #else
g_free(args->cmd); g_free(args->cmd);
@ -1104,7 +1104,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
print_mswin(args->file); print_mswin(args->file);
/* trash temp file */ /* trash temp file */
eth_remove(args->file); ws_remove(args->file);
/* restore old settings */ /* restore old settings */
args->to_file = FALSE; args->to_file = FALSE;

View File

@ -36,7 +36,7 @@
#include <winspool.h> #include <winspool.h>
#include "gtk/print_win32.h" #include "gtk/print_win32.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
/* /*
Some thoughts about a GTK win32 printer dialog: Some thoughts about a GTK win32 printer dialog:
@ -44,14 +44,14 @@ Some thoughts about a GTK win32 printer dialog:
"EnumPrinters()", asking for information level 2 - the PRINTER_INFO_2 "EnumPrinters()", asking for information level 2 - the PRINTER_INFO_2
structure contains a pLocation string pointer, along with other structure contains a pLocation string pointer, along with other
information. information.
"PrinterProperties", could be used to show a native printer property page?!? "PrinterProperties", could be used to show a native printer property page?!?
See See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_62ia.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_62ia.asp
for information on printer APIs. for information on printer APIs.
*/ */
BOOL CALLBACK abort_proc( HDC hDC, int Error ); BOOL CALLBACK abort_proc( HDC hDC, int Error );
@ -123,15 +123,15 @@ void print_mswin(char *file_name)
memset( &pdlg, 0, sizeof( PRINTDLG ) ); memset( &pdlg, 0, sizeof( PRINTDLG ) );
pdlg.lStructSize = sizeof( PRINTDLG ); pdlg.lStructSize = sizeof( PRINTDLG );
/* Set the flag to return printer DC. */ /* Set the flag to return printer DC. */
pdlg.Flags = pdlg.Flags =
/* return the device context we need */ /* return the device context we need */
PD_RETURNDC | PD_RETURNDC |
/* disable the "Pages" radio button */ /* disable the "Pages" radio button */
PD_NOPAGENUMS | PD_NOPAGENUMS |
/* disable the "Selection" radio button */ /* disable the "Selection" radio button */
PD_NOSELECTION | PD_NOSELECTION |
/* let device print multiple pages (if requested) */ /* let device print multiple pages (if requested) */
PD_USEDEVMODECOPIESANDCOLLATE; PD_USEDEVMODECOPIESANDCOLLATE;
/* Invoke the printer dialog box. */ /* Invoke the printer dialog box. */
PrintDlg( &pdlg ); PrintDlg( &pdlg );
@ -186,7 +186,7 @@ void print_file( char *file_name, HDC hdc) {
SetMapMode (hdc, MM_TEXT); SetMapMode (hdc, MM_TEXT);
fh1 = eth_fopen( file_name, "r" ); fh1 = ws_fopen( file_name, "r" );
if( !fh1 ) { if( !fh1 ) {
perror( "open failed on input file" ); perror( "open failed on input file" );
return; return;

View File

@ -36,7 +36,7 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "gtk/main.h" #include "gtk/main.h"
#include "gtk/profile_dlg.h" #include "gtk/profile_dlg.h"
@ -116,16 +116,16 @@ empty_profile_list(gboolean edit_list)
while(*flpp) { while(*flpp) {
*flpp = remove_profile_entry(*flpp, g_list_first(*flpp)); *flpp = remove_profile_entry(*flpp, g_list_first(*flpp));
} }
g_assert(g_list_length(*flpp) == 0); g_assert(g_list_length(*flpp) == 0);
} }
flpp = &current_profiles; flpp = &current_profiles;
while(*flpp) { while(*flpp) {
*flpp = remove_profile_entry(*flpp, g_list_first(*flpp)); *flpp = remove_profile_entry(*flpp, g_list_first(*flpp));
} }
g_assert(g_list_length(*flpp) == 0); g_assert(g_list_length(*flpp) == 0);
} }
@ -144,7 +144,7 @@ copy_profile_list(void)
while(flp_src) { while(flp_src) {
profile = (flp_src)->data; profile = (flp_src)->data;
current_profiles = add_profile_entry(current_profiles, profile->name, current_profiles = add_profile_entry(current_profiles, profile->name,
profile->reference, profile->status); profile->reference, profile->status);
flp_src = g_list_next(flp_src); flp_src = g_list_next(flp_src);
} }
@ -164,22 +164,22 @@ fill_list(GtkWidget *main_w)
const gchar *profile_name = get_profile_name (); const gchar *profile_name = get_profile_name ();
const gchar *profiles_dir, *name; const gchar *profiles_dir, *name;
gchar *filename; gchar *filename;
profile_l = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(main_w), E_PROF_PROFILE_L_KEY)); profile_l = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(main_w), E_PROF_PROFILE_L_KEY));
store = GTK_LIST_STORE(gtk_tree_view_get_model(profile_l)); store = GTK_LIST_STORE(gtk_tree_view_get_model(profile_l));
fl_entry = add_to_profile_list(DEFAULT_PROFILE, DEFAULT_PROFILE, PROF_STAT_DEFAULT); fl_entry = add_to_profile_list(DEFAULT_PROFILE, DEFAULT_PROFILE, PROF_STAT_DEFAULT);
gtk_list_store_append(store, &iter); gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, DEFAULT_PROFILE, 1, fl_entry, -1); gtk_list_store_set(store, &iter, 0, DEFAULT_PROFILE, 1, fl_entry, -1);
if (strcmp (profile_name, DEFAULT_PROFILE)==0) { if (strcmp (profile_name, DEFAULT_PROFILE)==0) {
l_select = g_memdup(&iter, sizeof(iter)); l_select = g_memdup(&iter, sizeof(iter));
} }
/* fill in data */ /* fill in data */
profiles_dir = get_profiles_dir(); profiles_dir = get_profiles_dir();
if ((dir = eth_dir_open(profiles_dir, 0, NULL)) != NULL) { if ((dir = ws_dir_open(profiles_dir, 0, NULL)) != NULL) {
while ((file = eth_dir_read_name(dir)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) {
name = eth_dir_get_name(file); name = ws_dir_get_name(file);
filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name); filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name);
if (test_for_directory(filename) == EISDIR) { if (test_for_directory(filename) == EISDIR) {
@ -187,7 +187,7 @@ fill_list(GtkWidget *main_w)
profile = (profile_def *) fl_entry->data; profile = (profile_def *) fl_entry->data;
gtk_list_store_append(store, &iter); gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, profile->name, 1, fl_entry, -1); gtk_list_store_set(store, &iter, 0, profile->name, 1, fl_entry, -1);
if (profile->name) { if (profile->name) {
if (strcmp(profile_name, profile->name) == 0) { if (strcmp(profile_name, profile->name) == 0) {
/* /*
@ -201,12 +201,12 @@ fill_list(GtkWidget *main_w)
} }
g_free (filename); g_free (filename);
} }
eth_dir_close (dir); ws_dir_close (dir);
} }
/* Make the current list an the edited list equal */ /* Make the current list an the edited list equal */
copy_profile_list (); copy_profile_list ();
return l_select; return l_select;
} }
@ -269,7 +269,7 @@ profile_select(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
/* The new profile exists, change */ /* The new profile exists, change */
change_configuration_profile (profile->name); change_configuration_profile (profile->name);
} else if (!profile_exists (get_profile_name())) { } else if (!profile_exists (get_profile_name())) {
/* The new profile does not exist, and the previous profile has /* The new profile does not exist, and the previous profile has
been deleted. Change to the default profile */ been deleted. Change to the default profile */
change_configuration_profile (NULL); change_configuration_profile (NULL);
} }
@ -318,7 +318,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't create directory\n\"%s\":\n%s.", "Can't create directory\n\"%s\":\n%s.",
pf_dir_path, strerror(errno)); pf_dir_path, strerror(errno));
g_free(pf_dir_path); g_free(pf_dir_path);
} }
profile1->status = PROF_STAT_EXISTS; profile1->status = PROF_STAT_EXISTS;
@ -335,7 +335,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't rename directory\n\"%s\" to\n\"%s\":\n%s.", "Can't rename directory\n\"%s\" to\n\"%s\":\n%s.",
pf_dir_path, pf_dir_path2, strerror(errno)); pf_dir_path, pf_dir_path2, strerror(errno));
g_free(pf_dir_path); g_free(pf_dir_path);
} }
profile1->status = PROF_STAT_EXISTS; profile1->status = PROF_STAT_EXISTS;
@ -385,7 +385,7 @@ profile_dlg_ok_cb(GtkWidget *ok_bt, gpointer data _U_)
{ {
GtkWidget *main_w = gtk_widget_get_toplevel(ok_bt); GtkWidget *main_w = gtk_widget_get_toplevel(ok_bt);
GtkTreeView *profile_l = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(main_w), E_PROF_PROFILE_L_KEY)); GtkTreeView *profile_l = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(main_w), E_PROF_PROFILE_L_KEY));
/* /*
* Apply the profile and destroy the dialog box. * Apply the profile and destroy the dialog box.
*/ */
@ -587,7 +587,7 @@ profile_name_te_changed_cb(GtkWidget *w, gpointer data _U_)
gtk_tree_model_get(model, &iter, 1, &fl_entry, -1); gtk_tree_model_get(model, &iter, 1, &fl_entry, -1);
if (fl_entry != NULL) { if (fl_entry != NULL) {
profile = (profile_def *) fl_entry->data; profile = (profile_def *) fl_entry->data;
if (strlen(name) > 0 && profile) { if (strlen(name) > 0 && profile) {
if (profile->status != PROF_STAT_DEFAULT) { if (profile->status != PROF_STAT_DEFAULT) {
g_free(profile->name); g_free(profile->name);
@ -662,16 +662,16 @@ profile_dialog_new(void)
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GtkTreeSelection *sel; GtkTreeSelection *sel;
GtkTreeIter *l_select; GtkTreeIter *l_select;
/* Get a pointer to a static variable holding the type of profile on /* Get a pointer to a static variable holding the type of profile on
which we're working, so we can pass that pointer to callback which we're working, so we can pass that pointer to callback
routines. */ routines. */
tooltips = gtk_tooltips_new (); tooltips = gtk_tooltips_new ();
main_w = dlg_conf_window_new("Wireshark: Configuration Profiles"); main_w = dlg_conf_window_new("Wireshark: Configuration Profiles");
gtk_window_set_default_size(GTK_WINDOW(main_w), 400, 400); gtk_window_set_default_size(GTK_WINDOW(main_w), 400, 400);
main_vb = gtk_vbox_new(FALSE, 0); main_vb = gtk_vbox_new(FALSE, 0);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5); gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
gtk_container_add(GTK_CONTAINER(main_w), main_vb); gtk_container_add(GTK_CONTAINER(main_w), main_vb);

View File

@ -40,7 +40,7 @@
#include <epan/column.h> #include <epan/column.h>
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/recent.h" #include "gtk/recent.h"
#include "gtk/main.h" #include "gtk/main.h"
@ -154,7 +154,7 @@ write_recent(void)
} }
rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, TRUE); rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, TRUE);
if ((rf = eth_fopen(rf_path, "w")) == NULL) { if ((rf = ws_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path, "Can't open recent file\n\"%s\": %s.", rf_path,
strerror(errno)); strerror(errno));
@ -265,7 +265,7 @@ write_profile_recent(void)
} }
rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE); rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE);
if ((rf = eth_fopen(rf_path, "w")) == NULL) { if ((rf = ws_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path, "Can't open recent file\n\"%s\": %s.", rf_path,
strerror(errno)); strerror(errno));
@ -768,7 +768,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */ /* Read the user's recent file, if it exists. */
*rf_path_return = NULL; *rf_path_return = NULL;
if ((rf = eth_fopen(rf_path, "r")) != NULL) { if ((rf = ws_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL); read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL);
@ -826,13 +826,13 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */ /* Read the user's recent file, if it exists. */
*rf_path_return = NULL; *rf_path_return = NULL;
if ((rf = eth_fopen(rf_path, "r")) != NULL) { if ((rf = ws_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL); read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL);
fclose(rf); fclose(rf);
if (!recent.has_recent_common) { if (!recent.has_recent_common) {
/* Read older common settings from recent file */ /* Read older common settings from recent file */
rf = eth_fopen(rf_path, "r"); rf = ws_fopen(rf_path, "r");
read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL); read_prefs_file(rf_path, rf, read_set_recent_common_pair_static, NULL);
fclose(rf); fclose(rf);
} }
@ -866,7 +866,7 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
/* Read the user's recent file, if it exists. */ /* Read the user's recent file, if it exists. */
*rf_path_return = NULL; *rf_path_return = NULL;
if ((rf = eth_fopen(rf_path, "r")) != NULL) { if ((rf = ws_fopen(rf_path, "r")) != NULL) {
/* We succeeded in opening it; read it. */ /* We succeeded in opening it; read it. */
read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic, NULL); read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic, NULL);
/* set dfilter combobox to have an empty line */ /* set dfilter combobox to have an empty line */

View File

@ -69,7 +69,7 @@
#include "../progress_dlg.h" #include "../progress_dlg.h"
#include "../color.h" #include "../color.h"
#include "../tempfile.h" #include "../tempfile.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/gtkglobals.h" #include "gtk/gtkglobals.h"
#include "gtk/dlg_utils.h" #include "gtk/dlg_utils.h"
@ -350,10 +350,10 @@ rtp_reset(void *user_data_arg)
fclose(user_data->forward.saveinfo.fp); fclose(user_data->forward.saveinfo.fp);
if (user_data->reversed.saveinfo.fp != NULL) if (user_data->reversed.saveinfo.fp != NULL)
fclose(user_data->reversed.saveinfo.fp); fclose(user_data->reversed.saveinfo.fp);
user_data->forward.saveinfo.fp = eth_fopen(user_data->f_tempname, "wb"); user_data->forward.saveinfo.fp = ws_fopen(user_data->f_tempname, "wb");
if (user_data->forward.saveinfo.fp == NULL) if (user_data->forward.saveinfo.fp == NULL)
user_data->forward.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR; user_data->forward.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
user_data->reversed.saveinfo.fp = eth_fopen(user_data->r_tempname, "wb"); user_data->reversed.saveinfo.fp = ws_fopen(user_data->r_tempname, "wb");
if (user_data->reversed.saveinfo.fp == NULL) if (user_data->reversed.saveinfo.fp == NULL)
user_data->reversed.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR; user_data->reversed.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
return; return;
@ -712,8 +712,8 @@ static void on_destroy(GtkWidget *win _U_, user_data_t *user_data _U_)
if (user_data->reversed.saveinfo.fp != NULL) if (user_data->reversed.saveinfo.fp != NULL)
fclose(user_data->reversed.saveinfo.fp); fclose(user_data->reversed.saveinfo.fp);
/*XXX: test for error **/ /*XXX: test for error **/
eth_remove(user_data->f_tempname); ws_remove(user_data->f_tempname);
eth_remove(user_data->r_tempname); ws_remove(user_data->r_tempname);
/* destroy save_voice_as window if open */ /* destroy save_voice_as window if open */
if (user_data->dlg.save_voice_as_w != NULL) if (user_data->dlg.save_voice_as_w != NULL)
@ -1869,7 +1869,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
user_data = (user_data_t*)g_object_get_data(G_OBJECT(bt), "user_data"); user_data = (user_data_t*)g_object_get_data(G_OBJECT(bt), "user_data");
if (GTK_TOGGLE_BUTTON(forw)->active || GTK_TOGGLE_BUTTON(both)->active) { if (GTK_TOGGLE_BUTTON(forw)->active || GTK_TOGGLE_BUTTON(both)->active) {
fp = eth_fopen(g_dest, "w"); fp = ws_fopen(g_dest, "w");
if (fp == NULL) { if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE); open_failure_alert_box(g_dest, errno, TRUE);
return; return;
@ -1923,7 +1923,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
if (GTK_TOGGLE_BUTTON(rev)->active || GTK_TOGGLE_BUTTON(both)->active) { if (GTK_TOGGLE_BUTTON(rev)->active || GTK_TOGGLE_BUTTON(both)->active) {
if (GTK_TOGGLE_BUTTON(both)->active) { if (GTK_TOGGLE_BUTTON(both)->active) {
fp = eth_fopen(g_dest, "a"); fp = ws_fopen(g_dest, "a");
if (fp == NULL) { if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE); open_failure_alert_box(g_dest, errno, TRUE);
return; return;
@ -1935,7 +1935,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
return; return;
} }
} else { } else {
fp = eth_fopen(g_dest, "w"); fp = ws_fopen(g_dest, "w");
if (fp == NULL) { if (fp == NULL) {
open_failure_alert_box(g_dest, errno, TRUE); open_failure_alert_box(g_dest, errno, TRUE);
return; return;
@ -2099,20 +2099,20 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
gboolean stop_flag = FALSE; gboolean stop_flag = FALSE;
size_t nchars; size_t nchars;
forw_fd = eth_open(user_data->f_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */); forw_fd = ws_open(user_data->f_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (forw_fd < 0) if (forw_fd < 0)
return FALSE; return FALSE;
rev_fd = eth_open(user_data->r_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */); rev_fd = ws_open(user_data->r_tempname, O_RDONLY | O_BINARY, 0000 /* no creation so don't matter */);
if (rev_fd < 0) { if (rev_fd < 0) {
eth_close(forw_fd); ws_close(forw_fd);
return FALSE; return FALSE;
} }
/* open file for saving */ /* open file for saving */
to_fd = eth_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); to_fd = ws_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (to_fd < 0) { if (to_fd < 0) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
return FALSE; return FALSE;
} }
@ -2123,22 +2123,22 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
/* First we write the .au header. XXX Hope this is endian independant */ /* First we write the .au header. XXX Hope this is endian independant */
/* the magic word 0x2e736e64 == .snd */ /* the magic word 0x2e736e64 == .snd */
phtonl(pd, 0x2e736e64); phtonl(pd, 0x2e736e64);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* header offset == 24 bytes */ /* header offset == 24 bytes */
phtonl(pd, 24); phtonl(pd, 24);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* total length, it is permited to set this to 0xffffffff */ /* total length, it is permited to set this to 0xffffffff */
phtonl(pd, -1); phtonl(pd, -1);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* encoding format == 16-bit linear PCM */ /* encoding format == 16-bit linear PCM */
phtonl(pd, 3); phtonl(pd, 3);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* sample rate == 8000 Hz */ /* sample rate == 8000 Hz */
phtonl(pd, 8000); phtonl(pd, 8000);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
/* channels == 1 */ /* channels == 1 */
phtonl(pd, 1); phtonl(pd, 1);
nchars=eth_write(to_fd, pd, 4); nchars=ws_write(to_fd, pd, 4);
switch (channels) { switch (channels) {
@ -2165,18 +2165,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
phtons(pd, sample); phtons(pd, sample);
} }
else{ else{
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
fwritten = eth_write(to_fd, pd, 2); fwritten = ws_write(to_fd, pd, 2);
if ((fwritten < 2) || (fwritten < 0) || (fread < 0)) { if ((fwritten < 2) || (fwritten < 0) || (fread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2206,18 +2206,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
phtons(pd, sample); phtons(pd, sample);
} }
else{ else{
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
rwritten = eth_write(to_fd, pd, 2); rwritten = ws_write(to_fd, pd, 2);
if ((rwritten < 2) || (rwritten < 0) || (rread < 0)) { if ((rwritten < 2) || (rwritten < 0) || (rread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2291,19 +2291,19 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
} }
else else
{ {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
rwritten = eth_write(to_fd, pd, 2); rwritten = ws_write(to_fd, pd, 2);
if ((rwritten < 2) || (rread < 0) || (fread < 0)) { if ((rwritten < 2) || (rread < 0) || (fread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2330,9 +2330,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
break; break;
} }
default: { default: {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2351,12 +2351,12 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
} }
count++; count++;
rwritten = eth_write(to_fd, pd, 1); rwritten = ws_write(to_fd, pd, 1);
if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) { if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
return FALSE; return FALSE;
} }
@ -2364,9 +2364,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
} }
destroy_progress_dlg(progbar); destroy_progress_dlg(progbar);
eth_close(forw_fd); ws_close(forw_fd);
eth_close(rev_fd); ws_close(rev_fd);
eth_close(to_fd); ws_close(to_fd);
return TRUE; return TRUE;
} }
@ -3026,7 +3026,7 @@ static void create_rtp_dialog(user_data_t* user_data)
gtk_container_add(GTK_CONTAINER(main_vb), notebook); gtk_container_add(GTK_CONTAINER(main_vb), notebook);
g_object_set_data(G_OBJECT(window), "notebook", notebook); g_object_set_data(G_OBJECT(window), "notebook", notebook);
user_data->dlg.notebook_signal_id = user_data->dlg.notebook_signal_id =
g_signal_connect(notebook, "switch_page", G_CALLBACK(on_notebook_switch_page), user_data); g_signal_connect(notebook, "switch_page", G_CALLBACK(on_notebook_switch_page), user_data);
/* page for forward connection */ /* page for forward connection */
@ -3276,10 +3276,10 @@ void rtp_analysis(
/*XXX: check for errors*/ /*XXX: check for errors*/
fd = create_tempfile(user_data->f_tempname, sizeof(user_data->f_tempname), fd = create_tempfile(user_data->f_tempname, sizeof(user_data->f_tempname),
"ether_rtp_f"); "ether_rtp_f");
eth_close(fd); ws_close(fd);
fd = create_tempfile(user_data->r_tempname, sizeof(user_data->r_tempname), fd = create_tempfile(user_data->r_tempname, sizeof(user_data->r_tempname),
"ether_rtp_r"); "ether_rtp_r");
eth_close(fd); ws_close(fd);
user_data->forward.saveinfo.fp = NULL; user_data->forward.saveinfo.fp = NULL;
user_data->reversed.saveinfo.fp = NULL; user_data->reversed.saveinfo.fp = NULL;
user_data->dlg.save_voice_as_w = NULL; user_data->dlg.save_voice_as_w = NULL;

View File

@ -50,7 +50,7 @@
#include "../alert_box.h" #include "../alert_box.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "../tap-rtp-common.h" #include "../tap-rtp-common.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/rtp_stream.h" #include "gtk/rtp_stream.h"
#include "gtk/rtp_stream_dlg.h" #include "gtk/rtp_stream_dlg.h"
@ -90,7 +90,7 @@ gboolean rtpstream_save(rtp_stream_info_t* stream, const gchar *filename)
{ {
gboolean was_registered = the_tapinfo_struct.is_registered; gboolean was_registered = the_tapinfo_struct.is_registered;
/* open file for saving */ /* open file for saving */
the_tapinfo_struct.save_file = eth_fopen(filename, "wb"); the_tapinfo_struct.save_file = ws_fopen(filename, "wb");
if (the_tapinfo_struct.save_file==NULL) { if (the_tapinfo_struct.save_file==NULL) {
open_failure_alert_box(filename, errno, TRUE); open_failure_alert_box(filename, errno, TRUE);
return FALSE; return FALSE;

View File

@ -36,7 +36,7 @@
#include "epan/filesystem.h" #include "epan/filesystem.h"
#include "../simple_dialog.h" #include "../simple_dialog.h"
#include "wiretap/file_util.h" #include <wsutil/file_util.h>
#include "gtk/text_page_utils.h" #include "gtk/text_page_utils.h"
#include "gtk/gui_utils.h" #include "gtk/gui_utils.h"
@ -59,7 +59,7 @@ GtkWidget * text_page_new(const char *absolute_path)
page_vb = gtk_vbox_new(FALSE, 0); page_vb = gtk_vbox_new(FALSE, 0);
gtk_container_border_width(GTK_CONTAINER(page_vb), 1); gtk_container_border_width(GTK_CONTAINER(page_vb), 1);
txt_scrollw = scrolled_window_new(NULL, NULL); txt_scrollw = scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(txt_scrollw), gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(txt_scrollw),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(page_vb), txt_scrollw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(page_vb), txt_scrollw, TRUE, TRUE, 0);
@ -113,7 +113,7 @@ static void text_page_set_text(GtkWidget *page, const char *absolute_path)
FILE *text_file; FILE *text_file;
char line[4096+1]; /* XXX - size? */ char line[4096+1]; /* XXX - size? */
text_file = eth_fopen(absolute_path, "r"); text_file = ws_fopen(absolute_path, "r");
if (text_file != NULL) { if (text_file != NULL) {
while (fgets(line, sizeof line, text_file) != NULL) { while (fgets(line, sizeof line, text_file) != NULL) {
text_page_insert(page, line, strlen(line)); text_page_insert(page, line, strlen(line));

View File

@ -46,7 +46,7 @@
#include <process.h> /* getpid */ #include <process.h> /* getpid */
#endif #endif
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
@ -61,7 +61,7 @@ static gchar *newpath = NULL;
static char *u3_change_path(char *path, const char *old, const char *new); static char *u3_change_path(char *path, const char *old, const char *new);
gboolean u3_active() gboolean u3_active()
{ {
return ( return (
@ -69,7 +69,7 @@ gboolean u3_active()
getenv_utf8 getenv_utf8
#else #else
getenv getenv
#endif #endif
("U3_HOST_EXEC_PATH") != NULL); ("U3_HOST_EXEC_PATH") != NULL);
} }
@ -80,12 +80,12 @@ void u3_runtime_info(GString *str)
char *u3devicepath = NULL; char *u3devicepath = NULL;
char *u3deviceproduct = NULL; char *u3deviceproduct = NULL;
if((u3deviceproduct = if((u3deviceproduct =
#ifdef _WIN32 #ifdef _WIN32
getenv_utf8 getenv_utf8
#else #else
getenv getenv
#endif #endif
("U3_DEVICE_PRODUCT")) != NULL) { ("U3_DEVICE_PRODUCT")) != NULL) {
g_string_append(str, " from the "); g_string_append(str, " from the ");
g_string_append(str, u3deviceproduct); g_string_append(str, u3deviceproduct);
@ -95,12 +95,12 @@ void u3_runtime_info(GString *str)
g_string_append(str, " U3 device"); g_string_append(str, " U3 device");
if((u3devicepath = if((u3devicepath =
#ifdef _WIN32 #ifdef _WIN32
getenv_utf8 getenv_utf8
#else #else
getenv getenv
#endif #endif
("U3_DEVICE_PATH")) != NULL) { ("U3_DEVICE_PATH")) != NULL) {
g_string_append(str, " in drive "); g_string_append(str, " in drive ");
g_string_append(str, u3devicepath); g_string_append(str, u3devicepath);
@ -114,13 +114,13 @@ void u3_register_pid()
int pid_fd; int pid_fd;
char *u3hostexecpath; char *u3hostexecpath;
int pf_size; int pf_size;
if((u3hostexecpath = if((u3hostexecpath =
#ifdef _WIN32 #ifdef _WIN32
getenv_utf8 getenv_utf8
#else #else
getenv getenv
#endif #endif
("U3_HOST_EXEC_PATH")) != NULL) { ("U3_HOST_EXEC_PATH")) != NULL) {
pid = getpid(); pid = getpid();
@ -130,10 +130,10 @@ void u3_register_pid()
g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid); g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid);
pid_fd = eth_open(pid_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); pid_fd = ws_open(pid_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(pid_fd != -1) if(pid_fd != -1)
eth_close(pid_fd); ws_close(pid_fd);
else { else {
g_free(pid_file); g_free(pid_file);
pid_file = NULL; pid_file = NULL;
@ -146,8 +146,8 @@ void u3_deregister_pid()
{ {
if(pid_file) { if(pid_file) {
/* we don't care if we succeed or fail - u3utils may have deleted the file */ /* we don't care if we succeed or fail - u3utils may have deleted the file */
eth_unlink(pid_file); ws_unlink(pid_file);
g_free(pid_file); g_free(pid_file);
pid_file = NULL; pid_file = NULL;
@ -166,20 +166,20 @@ char *u3_contract_device_path(char *path)
return u3_change_path(path, NULL, U3_DEVICE_PATH_VAR); return u3_change_path(path, NULL, U3_DEVICE_PATH_VAR);
} }
static char *u3_change_path(char *path, const char *old, const char *new) static char *u3_change_path(char *path, const char *old, const char *new)
{ {
if(u3devicepath == (char*)-1) { if(u3devicepath == (char*)-1) {
/* cache the device path */ /* cache the device path */
u3devicepath = u3devicepath =
#ifdef _WIN32 #ifdef _WIN32
getenv_utf8 getenv_utf8
#else #else
getenv getenv
#endif #endif
("U3_DEVICE_PATH"); ("U3_DEVICE_PATH");
} }
if(new == NULL) if(new == NULL)
new = u3devicepath; new = u3devicepath;
if(old == NULL) if(old == NULL)
@ -191,7 +191,7 @@ static char *u3_change_path(char *path, const char *old, const char *new)
} }
if((path != NULL) && (u3devicepath != NULL) && (strncmp(path, old, strlen(old)) == 0)) { if((path != NULL) && (u3devicepath != NULL) && (strncmp(path, old, strlen(old)) == 0)) {
newpath = g_strconcat(new, path + strlen(old), NULL); newpath = g_strconcat(new, path + strlen(old), NULL);
return newpath; return newpath;

View File

@ -33,7 +33,7 @@
#include "svnversion.h" #include "svnversion.h"
#include "merge.h" #include "merge.h"
#include "file_util.h" #include "wsutil/file_util.h"
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
@ -308,19 +308,19 @@ main(int argc, char *argv[])
} }
/* open the outfile */ /* open the outfile */
if (strncmp(out_filename, "-", 2) == 0) { if (strncmp(out_filename, "-", 2) == 0) {
/* use stdout as the outfile */ /* use stdout as the outfile */
out_fd = 1 /*stdout*/; out_fd = 1 /*stdout*/;
} else { } else {
/* open the outfile */ /* open the outfile */
out_fd = eth_open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); out_fd = ws_open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (out_fd == -1) { if (out_fd == -1) {
fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n", fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n",
out_filename, strerror(errno)); out_filename, strerror(errno));
exit(1); exit(1);
} }
} }
/* prepare the outfile */ /* prepare the outfile */
pdh = wtap_dump_fdopen(out_fd, file_type, frame_type, snaplen, FALSE /* compressed */, &open_err); pdh = wtap_dump_fdopen(out_fd, file_type, frame_type, snaplen, FALSE /* compressed */, &open_err);
if (pdh == NULL) { if (pdh == NULL) {

View File

@ -39,7 +39,7 @@
#include <glib.h> #include <glib.h>
#include "file_util.h" #include <wsutil/file_util.h>
#ifndef __set_errno #ifndef __set_errno
#define __set_errno(x) errno=(x) #define __set_errno(x) errno=(x)
@ -76,7 +76,7 @@ mkstemp (template)
template[len - 6] = letters[i]; template[len - 6] = letters[i];
fd = eth_open (template, O_RDWR|O_BINARY|O_CREAT|O_EXCL, 0600); fd = ws_open (template, O_RDWR|O_BINARY|O_CREAT|O_EXCL, 0600);
if (fd >= 0) if (fd >= 0)
return fd; return fd;
} }

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,16 +9,16 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wiretap\wiretap-$(WTAP_VERSION).lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
@ -93,12 +93,12 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
# TODO: Fix api's :) # TODO: Fix api's :)
# $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) # $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -85,7 +85,7 @@
#include <epan/dissectors/packet-tcp.h> #include <epan/dissectors/packet-tcp.h>
#include <epan/oids.h> #include <epan/oids.h>
#include <plugins/asn1/asn1.h> #include <plugins/asn1/asn1.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#ifdef DISSECTOR_WITH_GUI #ifdef DISSECTOR_WITH_GUI
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -2797,7 +2797,7 @@ static char eol[] = "\r\n";
(void) log_domain; (void) log_level; (void) user_data; /* make references */ (void) log_domain; (void) log_level; (void) user_data; /* make references */
if (logf == NULL && asn1_logfile) { if (logf == NULL && asn1_logfile) {
logf = eth_fopen(asn1_logfile, "w"); logf = ws_fopen(asn1_logfile, "w");
} }
if (logf) { if (logf) {
fputs(message, logf); fputs(message, logf);
@ -2818,7 +2818,7 @@ read_asn1_type_table(const char *filename)
if ((filename == 0) || (strlen(filename) == 0)) if ((filename == 0) || (strlen(filename) == 0))
return; /* no filename provided */ return; /* no filename provided */
f = eth_fopen(filename, "rb"); f = ws_fopen(filename, "rb");
if (f == 0) { if (f == 0) {
/* /*
* Ignore "file not found" errors if it's the old default * Ignore "file not found" errors if it's the old default
@ -3929,7 +3929,7 @@ create_message_window(void)
model = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, model = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT,
G_TYPE_STRING, G_TYPE_STRING); G_TYPE_STRING, G_TYPE_STRING);
namelist = eth_fopen("namelist.txt", "w"); namelist = ws_fopen("namelist.txt", "w");
build_tree_view(model, PDUtree, NULL); build_tree_view(model, PDUtree, NULL);
fclose(namelist); fclose(namelist);
namelist = 0; namelist = 0;

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,14 +9,14 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
CPPFLAGS = $(CFLAGS) -TP CPPFLAGS = $(CFLAGS) -TP
.c.obj:: .c.obj::
$(CC) $(CPPFLAGS) -Fd$(PLUGIN_NAME).pdb -c $< $(CC) $(CPPFLAGS) -Fd$(PLUGIN_NAME).pdb -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -50,8 +50,8 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU
link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
$(GLIB_LIBS) $(CODEC_LIBS) $(RESOURCE) $(GLIB_LIBS) $(CODEC_LIBS) $(RESOURCE)
easy_codec_plugin.obj : easy_codec_plugin.c easy_codec_plugin.obj : easy_codec_plugin.c
$(CC) $(CFLAGS) -Fd$(PLUGIN_NAME).pdb -c easy_codec_plugin.c $(CC) $(CFLAGS) -Fd$(PLUGIN_NAME).pdb -c easy_codec_plugin.c
!ENDIF !ENDIF
@ -63,5 +63,5 @@ distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -6,7 +6,7 @@ include ..\..\config.nmake
############### no need to modify below this line ######### ############### no need to modify below this line #########
CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
@ -15,9 +15,9 @@ LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
OBJECTS=packet-cosnaming.obj packet-coseventcomm.obj packet-tango.obj packet-parlay.obj OBJECTS=packet-cosnaming.obj packet-coseventcomm.obj packet-tango.obj packet-parlay.obj
all : cosnaming.dll coseventcomm.dll tango.dll parlay.dll all : cosnaming.dll coseventcomm.dll tango.dll parlay.dll
cosnaming.dll cosnaming.exp cosnaming.lib : packet-cosnaming.obj $(LINK_PLUGIN_WITH) cosnaming.dll cosnaming.exp cosnaming.lib : packet-cosnaming.obj $(LINK_PLUGIN_WITH)
link -dll /out:cosnaming.dll $(LDFLAGS) packet-cosnaming.obj $(LINK_PLUGIN_WITH) \ link -dll /out:cosnaming.dll $(LDFLAGS) packet-cosnaming.obj $(LINK_PLUGIN_WITH) \
@ -44,16 +44,16 @@ clean:
parlay.dll parlay.exp parlay.lib *.pdb \ parlay.dll parlay.exp parlay.lib *.pdb \
cosnaming.dll.manifest coseventcomm.dll.manifest \ cosnaming.dll.manifest coseventcomm.dll.manifest \
parlay.dll.manifest tango.dll.manifest parlay.dll.manifest tango.dll.manifest
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl \ $(PERL) ../../tools/checkAPIs.pl \
packet-cosnaming.c \ packet-cosnaming.c \
packet-coseventcomm.c \ packet-coseventcomm.c \
packet-tango.c \ packet-tango.c \
packet-parlay.c packet-parlay.c

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,7 +9,7 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
@ -89,11 +89,11 @@ plugin.c: $(DISSECTOR_SRC) ../../tools/make-dissector-reg.py ../../tools/make-di
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../wimax /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../wimax $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -13,7 +13,7 @@ include Makefile.common
LEMON=..\..\tools\lemon LEMON=..\..\tools\lemon
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) /I$(LEMON)\
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
@ -22,7 +22,7 @@ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wiretap\wiretap-$(WTAP_VERSION).lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
@ -97,7 +97,7 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
# We remove the generated files with "distclean" because one of them, # We remove the generated files with "distclean" because one of them,
# "mate_parser.c", needs different #includes for UN*X and Windows # "mate_parser.c", needs different #includes for UN*X and Windows
@ -120,12 +120,12 @@ mate_parser.obj : mate_parser.c
mate_grammar.h : mate_grammar.c mate_grammar.h : mate_grammar.c
mate_grammar.c : mate_grammar.lemon $(LEMON)\lemon.exe mate_grammar.c : mate_grammar.lemon $(LEMON)\lemon.exe
$(LEMON)\lemon.exe t=$(LEMON)\lempar.c mate_grammar.lemon $(LEMON)\lemon.exe t=$(LEMON)\lempar.c mate_grammar.lemon
$(LEMON)\lemon.exe: $(LEMON)\lemon.exe:
cd ../../tools/lemon cd ../../tools/lemon
$(MAKE) /$(MAKEFLAGS) -f makefile.nmake $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
cd ../../plugins/mate cd ../../plugins/mate
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -1,7 +1,7 @@
%include { %include {
/* mate_grammar.lemon /* mate_grammar.lemon
* MATE's configuration language grammar * MATE's configuration language grammar
* *
* Copyright 2005, Luis E. Garcia Ontanon <luis.ontanon@gmail.com> * Copyright 2005, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
* *
@ -15,12 +15,12 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -28,7 +28,7 @@
#include "mate.h" #include "mate.h"
#include "mate_grammar.h" #include "mate_grammar.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#define DUMMY void* #define DUMMY void*
@ -68,7 +68,7 @@ typedef struct _gog_statements {
typedef struct _transf_match_t { typedef struct _transf_match_t {
avpl_match_mode match_mode; avpl_match_mode match_mode;
AVPL* avpl; AVPL* avpl;
} transf_match_t; } transf_match_t;
typedef struct _transf_action_t { typedef struct _transf_action_t {
avpl_replace_mode replace_mode; avpl_replace_mode replace_mode;
@ -81,13 +81,13 @@ static void configuration_error(mate_config* mc, const gchar* fmt, ...) {
gint i; gint i;
mate_config_frame* current_frame; mate_config_frame* current_frame;
va_list list; va_list list;
va_start( list, fmt ); va_start( list, fmt );
g_vsnprintf(error_buffer,sizeof(error_buffer),fmt,list); g_vsnprintf(error_buffer,sizeof(error_buffer),fmt,list);
va_end( list ); va_end( list );
i = (gint) mc->config_stack->len; i = (gint) mc->config_stack->len;
while (i--) { while (i--) {
if (i>0) { if (i>0) {
@ -95,30 +95,30 @@ static void configuration_error(mate_config* mc, const gchar* fmt, ...) {
} else { } else {
incl = " "; incl = " ";
} }
current_frame = g_ptr_array_index(mc->config_stack,(guint)i); current_frame = g_ptr_array_index(mc->config_stack,(guint)i);
g_string_append_printf(mc->config_error,"%s%s at line %u",incl, current_frame->filename, current_frame->linenum); g_string_append_printf(mc->config_error,"%s%s at line %u",incl, current_frame->filename, current_frame->linenum);
} }
g_string_append_printf(mc->config_error,": %s\n",error_buffer); g_string_append_printf(mc->config_error,": %s\n",error_buffer);
THROW(MateConfigError); THROW(MateConfigError);
} }
static AVPL_Transf* new_transform_elem(AVPL* match, AVPL* replace, avpl_match_mode match_mode, avpl_replace_mode replace_mode) { static AVPL_Transf* new_transform_elem(AVPL* match, AVPL* replace, avpl_match_mode match_mode, avpl_replace_mode replace_mode) {
AVPL_Transf* t = g_malloc(sizeof(AVPL_Transf)); AVPL_Transf* t = g_malloc(sizeof(AVPL_Transf));
t->name = NULL; t->name = NULL;
t->match = match; t->match = match;
t->replace = replace; t->replace = replace;
t->match_mode = match_mode; t->match_mode = match_mode;
t->replace_mode = replace_mode; t->replace_mode = replace_mode;
t->map = NULL; t->map = NULL;
t->next = NULL; t->next = NULL;
return t; return t;
} }
@ -128,12 +128,12 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
gchar* r; gchar* r;
guint i,v; guint i,v;
gchar c; gchar c;
vec = g_strsplit(s,":",0); vec = g_strsplit(s,":",0);
for (i = 0; vec[i]; i++) { for (i = 0; vec[i]; i++) {
g_strdown(vec[i]); g_strdown(vec[i]);
v = 0; v = 0;
switch ( strlen(vec[i]) ) { switch ( strlen(vec[i]) ) {
case 2: case 2:
@ -156,16 +156,16 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
default: default:
configuration_error(mc,"bad token %s",s); configuration_error(mc,"bad token %s",s);
} }
g_string_append_printf(str,":%.2X",v); g_string_append_printf(str,":%.2X",v);
} }
g_strfreev(vec); g_strfreev(vec);
g_string_erase(str,0,1); g_string_erase(str,0,1);
r = str->str; r = str->str;
g_string_free(str,FALSE); g_string_free(str,FALSE);
return r; return r;
@ -207,9 +207,9 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
%type criteria_statement { pdu_criteria_t* } %type criteria_statement { pdu_criteria_t* }
%type accept_mode { accept_mode_t } %type accept_mode { accept_mode_t }
%type pdu_drop_unassigned_statement { gboolean } %type pdu_drop_unassigned_statement { gboolean }
%type discard_pdu_data_statement { gboolean } %type discard_pdu_data_statement { gboolean }
%type last_extracted_statement { gboolean } %type last_extracted_statement { gboolean }
%type extraction_statement {extraction_t*} %type extraction_statement {extraction_t*}
%type extraction_statements {extraction_t*} %type extraction_statements {extraction_t*}
@ -264,8 +264,8 @@ decl ::= DONE_KW SEMICOLON.
debug_decl ::= DEBUG_KW OPEN_BRACE dbgfile_default dbglevel_default pdu_dbglevel_default gop_dbglevel_default gog_dbglevel_default CLOSE_BRACE SEMICOLON. debug_decl ::= DEBUG_KW OPEN_BRACE dbgfile_default dbglevel_default pdu_dbglevel_default gop_dbglevel_default gog_dbglevel_default CLOSE_BRACE SEMICOLON.
dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = eth_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); } dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
dbgfile_default ::= FILENAME_KW NAME(Filename) SEMICOLON. { mc->dbg_facility = eth_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); } dbgfile_default ::= FILENAME_KW NAME(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
dbgfile_default ::= . dbgfile_default ::= .
dbglevel_default ::= LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_lvl = (int) strtol(LevelString,NULL,10); } dbglevel_default ::= LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_lvl = (int) strtol(LevelString,NULL,10); }
@ -341,9 +341,9 @@ transform_decl(A) ::= TRANSFORM_KW NAME(B) transform_body(C) SEMICOLON. {
for ( c = C; c; c = c->next ) for ( c = C; c; c = c->next )
c->name = g_strdup(B); c->name = g_strdup(B);
g_hash_table_insert(mc->transfs,C->name,C); g_hash_table_insert(mc->transfs,C->name,C);
A = NULL; A = NULL;
} }
@ -351,7 +351,7 @@ transform_body(A) ::= OPEN_BRACE transform_statements(B) CLOSE_BRACE. { A = B; }
transform_statements(A) ::= transform_statements(C) transform_statement(B). { transform_statements(A) ::= transform_statements(C) transform_statement(B). {
AVPL_Transf* c; AVPL_Transf* c;
for ( c = C; c->next; c = c->next ) ; for ( c = C; c->next; c = c->next ) ;
c->next = B; c->next = B;
A = C; A = C;
@ -411,12 +411,12 @@ pdu_decl ::=
last_extracted_statement(LastExtracted) last_extracted_statement(LastExtracted)
CLOSE_BRACE SEMICOLON. CLOSE_BRACE SEMICOLON.
{ {
mate_cfg_pdu* cfg = new_pducfg(Name); mate_cfg_pdu* cfg = new_pducfg(Name);
extraction_t *extraction, *next_extraction; extraction_t *extraction, *next_extraction;
GPtrArray* transport_stack = g_ptr_array_new(); GPtrArray* transport_stack = g_ptr_array_new();
int i; int i;
if (! cfg ) configuration_error(mc,"could not create Pdu %s.",Name); if (! cfg ) configuration_error(mc,"could not create Pdu %s.",Name);
cfg->hfid_proto = Field->id; cfg->hfid_proto = Field->id;
@ -424,34 +424,34 @@ pdu_decl ::=
cfg->last_extracted = LastExtracted; cfg->last_extracted = LastExtracted;
cfg->discard = DistcardPduData; cfg->discard = DistcardPduData;
cfg->drop_unassigned = DropUnassigned; cfg->drop_unassigned = DropUnassigned;
g_string_append_printf(mc->protos_filter,"||%s",Field->abbrev); g_string_append_printf(mc->protos_filter,"||%s",Field->abbrev);
/* flip the transport_stack */ /* flip the transport_stack */
for (i = Stack->len - 1; Stack->len; i--) { for (i = Stack->len - 1; Stack->len; i--) {
g_ptr_array_add(transport_stack,g_ptr_array_remove_index(Stack,i)); g_ptr_array_add(transport_stack,g_ptr_array_remove_index(Stack,i));
} }
g_ptr_array_free(Stack,FALSE); g_ptr_array_free(Stack,FALSE);
cfg->transport_ranges = transport_stack; cfg->transport_ranges = transport_stack;
cfg->payload_ranges = Payload; cfg->payload_ranges = Payload;
if (Criteria) { if (Criteria) {
cfg->criterium = Criteria->criterium_avpl; cfg->criterium = Criteria->criterium_avpl;
cfg->criterium_match_mode = Criteria->criterium_match_mode; cfg->criterium_match_mode = Criteria->criterium_match_mode;
cfg->criterium_accept_mode = Criteria->criterium_accept_mode; cfg->criterium_accept_mode = Criteria->criterium_accept_mode;
} }
cfg->transforms = Transform; cfg->transforms = Transform;
for (extraction = Extraction; extraction; extraction = next_extraction) { for (extraction = Extraction; extraction; extraction = next_extraction) {
next_extraction = extraction->next; next_extraction = extraction->next;
if ( ! add_hfid(extraction->hfi, extraction->as, cfg->hfids_attr) ) { if ( ! add_hfid(extraction->hfi, extraction->as, cfg->hfids_attr) ) {
configuration_error(mc,"MATE: failed to create extraction rule '%s'",extraction->as); configuration_error(mc,"MATE: failed to create extraction rule '%s'",extraction->as);
} }
g_free(extraction); g_free(extraction);
} }
} }
@ -482,20 +482,20 @@ extraction_statement(A) ::= EXTRACT_KW NAME(NAME) FROM_KW field(FIELD) SEMICOLON
} }
pdu_drop_unassigned_statement(A) ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { A = B; } pdu_drop_unassigned_statement(A) ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { A = B; }
pdu_drop_unassigned_statement(A) ::= . { A = mc->defaults.pdu.drop_unassigned; } pdu_drop_unassigned_statement(A) ::= . { A = mc->defaults.pdu.drop_unassigned; }
discard_pdu_data_statement(A) ::= DISCARD_PDU_DATA_KW true_false(B) SEMICOLON. { A = B; } discard_pdu_data_statement(A) ::= DISCARD_PDU_DATA_KW true_false(B) SEMICOLON. { A = B; }
discard_pdu_data_statement(A) ::= . { A = mc->defaults.pdu.discard; } discard_pdu_data_statement(A) ::= . { A = mc->defaults.pdu.discard; }
last_extracted_statement(A) ::= LAST_PDU_KW true_false(B) SEMICOLON. { A = B; } last_extracted_statement(A) ::= LAST_PDU_KW true_false(B) SEMICOLON. { A = B; }
last_extracted_statement(A) ::= . { A = mc->defaults.pdu.last_extracted; } last_extracted_statement(A) ::= . { A = mc->defaults.pdu.last_extracted; }
proto_stack(A) ::= proto_stack(B) SLASH field(C). { proto_stack(A) ::= proto_stack(B) SLASH field(C). {
int* hfidp = g_malloc(sizeof(int)); int* hfidp = g_malloc(sizeof(int));
g_string_append_printf(mc->fields_filter,"||%s",C->abbrev); g_string_append_printf(mc->fields_filter,"||%s",C->abbrev);
*hfidp = C->id; *hfidp = C->id;
g_ptr_array_add(B,hfidp); g_ptr_array_add(B,hfidp);
A = B; A = B;
@ -504,7 +504,7 @@ proto_stack(A) ::= proto_stack(B) SLASH field(C). {
proto_stack(A) ::= field(B). { proto_stack(A) ::= field(B). {
int* hfidp = g_malloc(sizeof(int)); int* hfidp = g_malloc(sizeof(int));
*hfidp = B->id; *hfidp = B->id;
g_string_append_printf(mc->fields_filter,"||%s",B->abbrev); g_string_append_printf(mc->fields_filter,"||%s",B->abbrev);
A = g_ptr_array_new(); A = g_ptr_array_new();
@ -518,7 +518,7 @@ field(A) ::= NAME(B). {
/******************************************* GOP /******************************************* GOP
*/ */
gop_decl(A) ::= GOP_KW NAME(Name) ON_KW pdu_name(PduName) MATCH_KW avpl(Key) OPEN_BRACE gop_decl(A) ::= GOP_KW NAME(Name) ON_KW pdu_name(PduName) MATCH_KW avpl(Key) OPEN_BRACE
gop_start_statement(Start) gop_start_statement(Start)
gop_stop_statement(Stop) gop_stop_statement(Stop)
extra_statement(Extra) extra_statement(Extra)
@ -531,14 +531,14 @@ gop_decl(A) ::= GOP_KW NAME(Name) ON_KW pdu_name(PduName) MATCH_KW avpl(Key) OPE
show_times_statement(ShowTimes) show_times_statement(ShowTimes)
CLOSE_BRACE SEMICOLON. { CLOSE_BRACE SEMICOLON. {
mate_cfg_gop* cfg; mate_cfg_gop* cfg;
if (g_hash_table_lookup(mc->gopcfgs,Name)) configuration_error(mc,"A Gop Named '%s' exists already.",Name); if (g_hash_table_lookup(mc->gopcfgs,Name)) configuration_error(mc,"A Gop Named '%s' exists already.",Name);
if (g_hash_table_lookup(mc->gops_by_pduname,PduName) ) configuration_error(mc,"Gop for Pdu '%s' exists already",PduName); if (g_hash_table_lookup(mc->gops_by_pduname,PduName) ) configuration_error(mc,"Gop for Pdu '%s' exists already",PduName);
cfg = new_gopcfg(Name); cfg = new_gopcfg(Name);
g_hash_table_insert(mc->gops_by_pduname,PduName,cfg); g_hash_table_insert(mc->gops_by_pduname,PduName,cfg);
g_hash_table_insert(mc->gopcfgs,cfg->name,cfg); g_hash_table_insert(mc->gopcfgs,cfg->name,cfg);
cfg->on_pdu = PduName; cfg->on_pdu = PduName;
cfg->key = Key; cfg->key = Key;
cfg->drop_unassigned = DropUnassigned; cfg->drop_unassigned = DropUnassigned;
@ -550,12 +550,12 @@ gop_decl(A) ::= GOP_KW NAME(Name) ON_KW pdu_name(PduName) MATCH_KW avpl(Key) OPE
cfg->start = Start; cfg->start = Start;
cfg->stop = Stop; cfg->stop = Stop;
cfg->transforms = Transform; cfg->transforms = Transform;
merge_avpl(cfg->extra,Extra,TRUE); merge_avpl(cfg->extra,Extra,TRUE);
delete_avpl(Extra,TRUE); delete_avpl(Extra,TRUE);
} }
gop_drop_unassigned_statement(A) ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { A = B; } gop_drop_unassigned_statement(A) ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { A = B; }
gop_drop_unassigned_statement(A) ::= . { A = mc->defaults.gop.drop_unassigned; } gop_drop_unassigned_statement(A) ::= . { A = mc->defaults.gop.drop_unassigned; }
gop_start_statement(A) ::= START_KW avpl(B) SEMICOLON. { A = B; } gop_start_statement(A) ::= START_KW avpl(B) SEMICOLON. { A = B; }
@ -608,7 +608,7 @@ time_value(A) ::= INTEGER(B). {
/************* GOG /************* GOG
*/ */
gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE
gog_key_statements(Keys) gog_key_statements(Keys)
extra_statement(Extra) extra_statement(Extra)
transform_list_statement(Transforms) transform_list_statement(Transforms)
@ -616,18 +616,18 @@ gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE
gog_goptree_statement(Tree) gog_goptree_statement(Tree)
CLOSE_BRACE SEMICOLON. { CLOSE_BRACE SEMICOLON. {
mate_cfg_gog* cfg = NULL; mate_cfg_gog* cfg = NULL;
if ( g_hash_table_lookup(mc->gogcfgs,Name) ) { if ( g_hash_table_lookup(mc->gogcfgs,Name) ) {
configuration_error(mc,"Gog '%s' exists already ",Name); configuration_error(mc,"Gog '%s' exists already ",Name);
} }
cfg = new_gogcfg(Name); cfg = new_gogcfg(Name);
cfg->expiration = Expiration; cfg->expiration = Expiration;
cfg->gop_tree_mode = Tree; cfg->gop_tree_mode = Tree;
cfg->transforms = Transforms; cfg->transforms = Transforms;
cfg->keys = Keys; cfg->keys = Keys;
merge_avpl(cfg->extra,Extra,TRUE); merge_avpl(cfg->extra,Extra,TRUE);
delete_avpl(Extra,TRUE); delete_avpl(Extra,TRUE);
} }
@ -676,7 +676,7 @@ extra_statement(A) ::= . { A = new_avpl(""); }
transform_list_statement(A) ::= TRANSFORM_KW transform_list(B) SEMICOLON. { A = B; } transform_list_statement(A) ::= TRANSFORM_KW transform_list(B) SEMICOLON. { A = B; }
transform_list_statement(A) ::= . { A = g_ptr_array_new(); } transform_list_statement(A) ::= . { A = g_ptr_array_new(); }
transform_list(A) ::= transform_list(B) COMMA transform(C). { transform_list(A) ::= transform_list(B) COMMA transform(C). {
A = B; A = B;
g_ptr_array_add(B,C); g_ptr_array_add(B,C);
} }
@ -688,12 +688,12 @@ transform_list(A) ::= transform(B). {
transform(A) ::= NAME(B). { transform(A) ::= NAME(B). {
AVPL_Transf* t; AVPL_Transf* t;
if (( t = g_hash_table_lookup(mc->transfs,B) )) { if (( t = g_hash_table_lookup(mc->transfs,B) )) {
A = t; A = t;
} else { } else {
configuration_error(mc,"There's no such Transformation: %s",B); configuration_error(mc,"There's no such Transformation: %s",B);
} }
} }
avpl(A) ::= OPEN_PARENS avps(B) CLOSE_PARENS. { A = B; } avpl(A) ::= OPEN_PARENS avps(B) CLOSE_PARENS. { A = B; }
@ -706,7 +706,7 @@ avp(A) ::= NAME(B) AVP_OPERATOR(C) value(D). { A = new_avp(B,D,*C); }
avp(A) ::= NAME(B). { A = new_avp(B,"",'?'); } avp(A) ::= NAME(B). { A = new_avp(B,"",'?'); }
avp(A) ::= NAME(B) OPEN_BRACE avp_oneoff(C) CLOSE_BRACE. { A = new_avp(B,C,'|'); } avp(A) ::= NAME(B) OPEN_BRACE avp_oneoff(C) CLOSE_BRACE. { A = new_avp(B,C,'|'); }
avp_oneoff(A) ::= avp_oneoff(B) PIPE value(C). { A = g_strdup_printf("%s|%s",B,C); } avp_oneoff(A) ::= avp_oneoff(B) PIPE value(C). { A = g_strdup_printf("%s|%s",B,C); }
avp_oneoff(A) ::= value(B). { A = g_strdup(B); } avp_oneoff(A) ::= value(B). { A = g_strdup(B); }
value(A) ::= QUOTED(B). { A = g_strdup(B); } value(A) ::= QUOTED(B). { A = g_strdup(B); }

View File

@ -1,7 +1,7 @@
/* /*
* We don't use unput, so don't generate code for it. * We don't use unput, so don't generate code for it.
*/ */
%option nounput %option nounput
/* /*
* We don't read from the terminal. * We don't read from the terminal.
@ -31,20 +31,20 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include <wiretap/file_util.h>
#include "mate.h" #include <wsutil/file_util.h>
#include "mate.h"
#include "mate_grammar.h" #include "mate_grammar.h"
#include "mate_parser_lex.h" #include "mate_parser_lex.h"
@ -62,16 +62,16 @@
#endif #endif
void MateParserFree( void*, void(*)(void*) ); void MateParserFree( void*, void(*)(void*) );
void MateParseTrace(FILE*,char*); void MateParseTrace(FILE*,char*);
#define MAX_INCLUDE_DEPTH 10 #define MAX_INCLUDE_DEPTH 10
static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
static int include_stack_ptr = 0; static int include_stack_ptr = 0;
static void* pParser; static void* pParser;
static mate_config_frame* current_frame; static mate_config_frame* current_frame;
static mate_config* mc; static mate_config* mc;
#define MATE_PARSE(token_type) MateParser(pParser, (token_type), g_strdup(yytext), mc ); #define MATE_PARSE(token_type) MateParser(pParser, (token_type), g_strdup(yytext), mc );
/* /*
@ -159,11 +159,11 @@ comment "//"[^\n]*\n
blk_cmnt_start "/*" blk_cmnt_start "/*"
cmnt_char . cmnt_char .
blk_cmnt_stop "*/" blk_cmnt_stop "*/"
%START OUTSIDE QUOTED INCLUDING COMMENT %START OUTSIDE QUOTED INCLUDING COMMENT
%% %%
{newline} current_frame->linenum++; {newline} current_frame->linenum++;
{whitespace} ; {whitespace} ;
<OUTSIDE>{include} BEGIN INCLUDING; <OUTSIDE>{include} BEGIN INCLUDING;
@ -171,46 +171,46 @@ blk_cmnt_stop "*/"
<INCLUDING>{filename} { <INCLUDING>{filename} {
if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
g_error("dtd_preparse: include files nested to deeply"); g_error("dtd_preparse: include files nested to deeply");
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
yyin = eth_fopen( yytext, "r" ); yyin = ws_fopen( yytext, "r" );
if (!yyin) { if (!yyin) {
yy_delete_buffer( YY_CURRENT_BUFFER ); yy_delete_buffer( YY_CURRENT_BUFFER );
/* coverity[negative_sink] */ /* coverity[negative_sink] */
yy_switch_to_buffer(include_stack[--include_stack_ptr] ); yy_switch_to_buffer(include_stack[--include_stack_ptr] );
if (errno) if (errno)
g_string_append_printf(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, strerror(errno) ); g_string_append_printf(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, strerror(errno) );
} else { } else {
current_frame = g_malloc(sizeof(mate_config_frame)); current_frame = g_malloc(sizeof(mate_config_frame));
current_frame->filename = g_strdup(yytext); current_frame->filename = g_strdup(yytext);
current_frame->linenum = 1; current_frame->linenum = 1;
g_ptr_array_add(mc->config_stack,current_frame); g_ptr_array_add(mc->config_stack,current_frame);
yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) ); yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) );
} }
BEGIN OUTSIDE; BEGIN OUTSIDE;
} }
<<EOF>> { <<EOF>> {
/* coverity[check_after_sink] */ /* coverity[check_after_sink] */
if ( --include_stack_ptr < 0 ) { if ( --include_stack_ptr < 0 ) {
yyterminate(); yyterminate();
} else { } else {
yy_delete_buffer( YY_CURRENT_BUFFER ); yy_delete_buffer( YY_CURRENT_BUFFER );
yy_switch_to_buffer( include_stack[include_stack_ptr] ); yy_switch_to_buffer( include_stack[include_stack_ptr] );
g_free(current_frame->filename); g_free(current_frame->filename);
g_free(current_frame); g_free(current_frame);
current_frame = g_ptr_array_remove_index(mc->config_stack,mc->config_stack->len-1); current_frame = g_ptr_array_remove_index(mc->config_stack,mc->config_stack->len-1);
} }
} }
<OUTSIDE>{comment} ; <OUTSIDE>{comment} ;
@ -289,25 +289,25 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
volatile gboolean state = TRUE; volatile gboolean state = TRUE;
mc = matecfg; mc = matecfg;
yyin = eth_fopen(filename,"r"); yyin = ws_fopen(filename,"r");
if (!yyin) { if (!yyin) {
g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) ); g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) );
return FALSE; return FALSE;
} }
mc->config_stack = g_ptr_array_new(); mc->config_stack = g_ptr_array_new();
current_frame = g_malloc(sizeof(mate_config_frame)); current_frame = g_malloc(sizeof(mate_config_frame));
current_frame->filename = g_strdup(filename); current_frame->filename = g_strdup(filename);
current_frame->linenum = 1; current_frame->linenum = 1;
g_ptr_array_add(mc->config_stack,current_frame); g_ptr_array_add(mc->config_stack,current_frame);
pParser = MateParserAlloc(g_malloc); pParser = MateParserAlloc(g_malloc);
/* MateParserTrace(stdout,""); */ /* MateParserTrace(stdout,""); */
TRY { TRY {
BEGIN OUTSIDE; BEGIN OUTSIDE;
@ -316,27 +316,27 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
MateParser(pParser, 0, NULL,mc); MateParser(pParser, 0, NULL,mc);
yyrestart(NULL); yyrestart(NULL);
MateParserFree(pParser, g_free ); MateParserFree(pParser, g_free );
g_free(current_frame->filename); g_free(current_frame->filename);
g_free(current_frame); g_free(current_frame);
g_ptr_array_free(mc->config_stack,FALSE); g_ptr_array_free(mc->config_stack,FALSE);
} CATCH(MateConfigError) { } CATCH(MateConfigError) {
state = FALSE; state = FALSE;
} CATCH_ALL { } CATCH_ALL {
state = FALSE; state = FALSE;
g_string_append_printf(mc->config_error,"An unexpected error occurred"); g_string_append_printf(mc->config_error,"An unexpected error occurred");
} }
ENDTRY; ENDTRY;
return state; return state;
} }
/* /*
* We want to stop processing when we get to the end of the input. * We want to stop processing when we get to the end of the input.
* (%option noyywrap is not used because if used then * (%option noyywrap is not used because if used then
* some flex versions (eg: 2.5.35) generate code which causes * some flex versions (eg: 2.5.35) generate code which causes
* warnings by the Windows VC compiler). * warnings by the Windows VC compiler).
*/ */

View File

@ -27,7 +27,7 @@
#include "mate.h" #include "mate.h"
#include "mate_util.h" #include "mate_util.h"
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
/*************************************************************************** /***************************************************************************
* dbg_print * dbg_print
@ -81,7 +81,7 @@ void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... )
struct _scs_collection { struct _scs_collection {
GHashTable* hash; /* key: a string value: guint number of subscribers */ GHashTable* hash; /* key: a string value: guint number of subscribers */
GMemChunk* ctrs; GMemChunk* ctrs;
GMemChunk* mate_small; GMemChunk* mate_small;
GMemChunk* mate_medium; GMemChunk* mate_medium;
GMemChunk* mate_large; GMemChunk* mate_large;
GMemChunk* mate_huge; GMemChunk* mate_huge;
@ -93,7 +93,7 @@ extern void destroy_scs_collection(SCS_collection* c) {
if ( c->mate_medium ) g_mem_chunk_destroy(c->mate_medium); if ( c->mate_medium ) g_mem_chunk_destroy(c->mate_medium);
if ( c->mate_large ) g_mem_chunk_destroy(c->mate_large); if ( c->mate_large ) g_mem_chunk_destroy(c->mate_large);
if ( c->mate_huge ) g_mem_chunk_destroy(c->mate_huge); if ( c->mate_huge ) g_mem_chunk_destroy(c->mate_huge);
if (c->hash) g_hash_table_destroy(c->hash); if (c->hash) g_hash_table_destroy(c->hash);
} }
@ -101,19 +101,19 @@ extern SCS_collection* scs_init(void) {
SCS_collection* c = g_malloc(sizeof(SCS_collection)); SCS_collection* c = g_malloc(sizeof(SCS_collection));
c->hash = g_hash_table_new(g_str_hash,g_str_equal); c->hash = g_hash_table_new(g_str_hash,g_str_equal);
c->ctrs = g_mem_chunk_new("ints_scs_chunk", sizeof(guint), c->ctrs = g_mem_chunk_new("ints_scs_chunk", sizeof(guint),
sizeof(guint) * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE); sizeof(guint) * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE);
c->mate_small = g_mem_chunk_new("small_scs_chunk", SCS_SMALL_SIZE, c->mate_small = g_mem_chunk_new("small_scs_chunk", SCS_SMALL_SIZE,
SCS_SMALL_SIZE * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE); SCS_SMALL_SIZE * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE);
c->mate_medium = g_mem_chunk_new("medium_scs_chunk", SCS_MEDIUM_SIZE, c->mate_medium = g_mem_chunk_new("medium_scs_chunk", SCS_MEDIUM_SIZE,
SCS_MEDIUM_SIZE * SCS_MEDIUM_CHUNK_SIZE, G_ALLOC_AND_FREE); SCS_MEDIUM_SIZE * SCS_MEDIUM_CHUNK_SIZE, G_ALLOC_AND_FREE);
c->mate_large = g_mem_chunk_new("large_scs_chunk", SCS_LARGE_SIZE, c->mate_large = g_mem_chunk_new("large_scs_chunk", SCS_LARGE_SIZE,
SCS_LARGE_SIZE * SCS_LARGE_CHUNK_SIZE, G_ALLOC_AND_FREE); SCS_LARGE_SIZE * SCS_LARGE_CHUNK_SIZE, G_ALLOC_AND_FREE);
c->mate_huge = g_mem_chunk_new("huge_scs_chunk", SCS_HUGE_SIZE, c->mate_huge = g_mem_chunk_new("huge_scs_chunk", SCS_HUGE_SIZE,
SCS_HUGE_SIZE * SCS_HUGE_CHUNK_SIZE, G_ALLOC_AND_FREE); SCS_HUGE_SIZE * SCS_HUGE_CHUNK_SIZE, G_ALLOC_AND_FREE);
return c; return c;
@ -137,7 +137,7 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
guint* ip = NULL; guint* ip = NULL;
size_t len = 0; size_t len = 0;
GMemChunk* chunk = NULL; GMemChunk* chunk = NULL;
g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer)&orig,(gpointer)&ip); g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer)&orig,(gpointer)&ip);
if (ip) { if (ip) {
@ -145,9 +145,9 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
} else { } else {
ip = g_mem_chunk_alloc(c->ctrs); ip = g_mem_chunk_alloc(c->ctrs);
*ip = 0; *ip = 0;
len = strlen(s) + 1; len = strlen(s) + 1;
if (len <= SCS_SMALL_SIZE) { if (len <= SCS_SMALL_SIZE) {
chunk = c->mate_small; chunk = c->mate_small;
len = SCS_SMALL_SIZE; len = SCS_SMALL_SIZE;
@ -165,10 +165,10 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
len = SCS_HUGE_SIZE; len = SCS_HUGE_SIZE;
g_warning("mate SCS: string truncated to huge size"); g_warning("mate SCS: string truncated to huge size");
} }
orig = g_mem_chunk_alloc(chunk); orig = g_mem_chunk_alloc(chunk);
strncpy(orig,s,len); strncpy(orig,s,len);
g_hash_table_insert(c->hash,orig,ip); g_hash_table_insert(c->hash,orig,ip);
} }
@ -188,15 +188,15 @@ void scs_unsubscribe(SCS_collection* c, gchar* s) {
guint* ip = NULL; guint* ip = NULL;
size_t len = 0xffff; size_t len = 0xffff;
GMemChunk* chunk = NULL; GMemChunk* chunk = NULL;
g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer)&orig,(gpointer)&ip); g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer)&orig,(gpointer)&ip);
if (ip) { if (ip) {
if (*ip == 0) { if (*ip == 0) {
g_hash_table_remove(c->hash,orig); g_hash_table_remove(c->hash,orig);
len = strlen(orig); len = strlen(orig);
if (len < SCS_SMALL_SIZE) { if (len < SCS_SMALL_SIZE) {
chunk = c->mate_small; chunk = c->mate_small;
} else if (len < SCS_MEDIUM_SIZE) { } else if (len < SCS_MEDIUM_SIZE) {
@ -205,8 +205,8 @@ void scs_unsubscribe(SCS_collection* c, gchar* s) {
chunk = c->mate_large; chunk = c->mate_large;
} else { } else {
chunk = c->mate_huge; chunk = c->mate_huge;
} }
g_mem_chunk_free(chunk,orig); g_mem_chunk_free(chunk,orig);
g_mem_chunk_free(c->ctrs,ip); g_mem_chunk_free(c->ctrs,ip);
} }
@ -230,7 +230,7 @@ void scs_unsubscribe(SCS_collection* c, gchar* s) {
gchar* scs_subscribe_printf(SCS_collection* c, gchar* fmt, ...) { gchar* scs_subscribe_printf(SCS_collection* c, gchar* fmt, ...) {
va_list list; va_list list;
static gchar buf[SCS_HUGE_SIZE]; static gchar buf[SCS_HUGE_SIZE];
va_start( list, fmt ); va_start( list, fmt );
g_vsnprintf(buf, SCS_HUGE_SIZE-1 ,fmt, list); g_vsnprintf(buf, SCS_HUGE_SIZE-1 ,fmt, list);
va_end( list ); va_end( list );
@ -335,7 +335,7 @@ extern void avp_init(void) {
extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo) { extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo) {
AVP* new = g_mem_chunk_alloc(avp_chunk); AVP* new = g_mem_chunk_alloc(avp_chunk);
gchar* value; gchar* value;
new->n = scs_subscribe(avp_strings, name); new->n = scs_subscribe(avp_strings, name);
if (finfo->value.ftype->val_to_string_repr) { if (finfo->value.ftype->val_to_string_repr) {
@ -1098,17 +1098,17 @@ extern AVPL* new_avpl_every_match(const gchar* name, AVPL* src, AVPL* op, gboole
AVP* m; AVP* m;
AVP* copy; AVP* copy;
gboolean matches; gboolean matches;
#ifdef _AVP_DEBUGGING #ifdef _AVP_DEBUGGING
dbg_print(dbg_avpl_op,3,dbg_fp,"new_avpl_every_match: %X src=%X op=%X name='%s'",newavpl,src,op,name); dbg_print(dbg_avpl_op,3,dbg_fp,"new_avpl_every_match: %X src=%X op=%X name='%s'",newavpl,src,op,name);
#endif #endif
if (src->len == 0) return NULL; if (src->len == 0) return NULL;
newavpl = new_avpl(scs_subscribe(avp_strings, name)); newavpl = new_avpl(scs_subscribe(avp_strings, name));
if (op->len == 0) if (op->len == 0)
return newavpl; return newavpl;
matches = TRUE; matches = TRUE;
cs = src->null.next; cs = src->null.next;
@ -1195,7 +1195,7 @@ extern AVPL* new_avpl_exact_match(const gchar* name,AVPL* src, AVPL* op, gboolea
if (op->len == 0) if (op->len == 0)
return newavpl; return newavpl;
if (src->len == 0) { if (src->len == 0) {
delete_avpl(newavpl,FALSE); delete_avpl(newavpl,FALSE);
return NULL; return NULL;
@ -1254,7 +1254,7 @@ extern AVPL* new_avpl_exact_match(const gchar* name,AVPL* src, AVPL* op, gboolea
extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) { extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) {
AVPL* avpl = NULL; AVPL* avpl = NULL;
switch (mode) { switch (mode) {
case AVPL_STRICT: case AVPL_STRICT:
avpl = new_avpl_exact_match(name,src,op,copy_avps); avpl = new_avpl_exact_match(name,src,op,copy_avps);
@ -1270,7 +1270,7 @@ extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* s
merge_avpl(avpl, op, copy_avps); merge_avpl(avpl, op, copy_avps);
break; break;
} }
return avpl; return avpl;
} }
@ -1325,7 +1325,7 @@ extern void avpl_transform(AVPL* src, AVPL_Transf* op) {
#endif #endif
for ( ; op ; op = op->next) { for ( ; op ; op = op->next) {
avpl = new_avpl_from_match(op->match_mode, src->name,src, op->match, TRUE); avpl = new_avpl_from_match(op->match_mode, src->name,src, op->match, TRUE);
if (avpl) { if (avpl) {
@ -1556,7 +1556,7 @@ static LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, cons
gchar* desc; gchar* desc;
LoAL* ret = NULL; LoAL* ret = NULL;
gchar* err; gchar* err;
va_start( list, fmt ); va_start( list, fmt );
desc = g_strdup_vprintf(fmt, list); desc = g_strdup_vprintf(fmt, list);
va_end( list ); va_end( list );
@ -1630,7 +1630,7 @@ extern LoAL* loal_from_file(gchar* filename) {
state = START; state = START;
if (( fp = eth_fopen(filename,"r") )) { if (( fp = ws_fopen(filename,"r") )) {
while(( c = (gchar) fgetc(fp) )){ while(( c = (gchar) fgetc(fp) )){
if ( feof(fp) ) { if ( feof(fp) ) {

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,7 +93,7 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fdstats_tree.pdb -c $< $(CC) $(CFLAGS) -Fdstats_tree.pdb -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -53,5 +53,5 @@ distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(TAP_SRC) $(PERL) ../../tools/checkAPIs.pl $(TAP_SRC)

View File

@ -9,12 +9,12 @@ include <win32.mak>
LEMON=..\..\tools\lemon LEMON=..\..\tools\lemon
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) /I$(LEMON)\
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fdmate.pdb -c $< $(CC) $(CFLAGS) -Fdmate.pdb -c $<
LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -57,12 +57,12 @@ mate_parser.c : mate_parser.l
mate_grammar.h : mate_grammar.c mate_grammar.h : mate_grammar.c
mate_grammar.c : mate_grammar.lemon $(LEMON)\lemon.exe mate_grammar.c : mate_grammar.lemon $(LEMON)\lemon.exe
$(LEMON)\lemon.exe t=$(LEMON)\lempar.c mate_grammar.lemon $(LEMON)\lemon.exe t=$(LEMON)\lempar.c mate_grammar.lemon
$(LEMON)\lemon.exe: $(LEMON)\lemon.exe:
cd ../../tools/lemon cd ../../tools/lemon
$(MAKE) /$(MAKEFLAGS) -f makefile.nmake $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
cd ../../plugins/mate cd ../../plugins/mate
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -9,12 +9,12 @@ include moduleinfo.nmake
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
@ -93,13 +93,13 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl \ $(PERL) ../../tools/checkAPIs.pl \
$(DISSECTOR_SRC) \ $(DISSECTOR_SRC) \
$(DISSECTOR_SUPPORT_SRC) $(DISSECTOR_SUPPORT_SRC)

View File

@ -10,16 +10,16 @@ include ..\..\Makefile.nmake.inc
include Makefile.common include Makefile.common
CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj:: .c.obj::
$(CC) $(CFLAGS) -Fd.\ -c $< $(CC) $(CFLAGS) -Fd.\ -c $<
LDFLAGS = $(PLUGIN_LDFLAGS) LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK !IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
@ -100,12 +100,12 @@ wimaxasncp_dict.obj : wimaxasncp_dict.c
clean: clean:
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
distclean: clean distclean: clean
rm -f wimaxasncp_dict.c wimaxasncp_dict_lex.h rm -f wimaxasncp_dict.c wimaxasncp_dict_lex.h
maintainer-clean: distclean maintainer-clean: distclean
checkapi: checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC) $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -65,7 +65,7 @@
#include <epan/emem.h> #include <epan/emem.h>
#include <epan/value_string.h> #include <epan/value_string.h>
#include <epan/packet.h> /* array_length */ #include <epan/packet.h> /* array_length */
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "wimaxasncp_dict.h" #include "wimaxasncp_dict.h"
#include "wimaxasncp_dict_lex.h" #include "wimaxasncp_dict_lex.h"
@ -592,7 +592,7 @@ static FILE *wimaxasncp_dict_open(
fname = g_strdup(filename); fname = g_strdup(filename);
} }
fh = eth_fopen(fname,"r"); fh = ws_fopen(fname,"r");
D(("fname: %s fh: %p\n",fname,fh)); D(("fname: %s fh: %p\n",fname,fh));
@ -728,7 +728,7 @@ void wimaxasncp_dict_print(FILE *fh, wimaxasncp_dict_t *d) {
/* /*
* We want to stop processing when we get to the end of the input. * We want to stop processing when we get to the end of the input.
* (%option noyywrap is not used because if used then * (%option noyywrap is not used because if used then
* some flex versions (eg: 2.5.35) generate code which causes * some flex versions (eg: 2.5.35) generate code which causes
* warnings by the Windows VC compiler). * warnings by the Windows VC compiler).
*/ */

32
print.c
View File

@ -40,7 +40,7 @@
#include "packet-range.h" #include "packet-range.h"
#include "print.h" #include "print.h"
#include "ps.h" #include "ps.h"
#include "file_util.h" #include <wsutil/file_util.h>
#include <epan/charsets.h> #include <epan/charsets.h>
#include <epan/dissectors/packet-data.h> #include <epan/dissectors/packet-data.h>
#include <epan/dissectors/packet-frame.h> #include <epan/dissectors/packet-frame.h>
@ -103,7 +103,7 @@ open_print_dest(int to_file, const char *dest)
/* Open the file or command for output */ /* Open the file or command for output */
if (to_file) if (to_file)
fh = eth_fopen(dest, "w"); fh = ws_fopen(dest, "w");
else else
fh = popen(dest, "w"); fh = popen(dest, "w");
@ -334,7 +334,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
print_escaped_xml(pdata->fh, fi->hfinfo->abbrev); print_escaped_xml(pdata->fh, fi->hfinfo->abbrev);
#if 0 #if 0
/* PDML spec, see: /* PDML spec, see:
* http://analyzer.polito.it/30alpha/docs/dissectors/PDMLSpec.htm * http://analyzer.polito.it/30alpha/docs/dissectors/PDMLSpec.htm
* *
* the show fields contains things in 'human readable' format * the show fields contains things in 'human readable' format
@ -343,9 +343,9 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
* showdtl: contains additional details of the field data * showdtl: contains additional details of the field data
* showmap: contains mappings of the field data (e.g. the hostname to an IP address) * showmap: contains mappings of the field data (e.g. the hostname to an IP address)
* *
* XXX - the showname shouldn't contain the field data itself * XXX - the showname shouldn't contain the field data itself
* (like it's contained in the fi->rep->representation). * (like it's contained in the fi->rep->representation).
* Unfortunately, we don't have the field data representation for * Unfortunately, we don't have the field data representation for
* all fields, so this isn't currently possible */ * all fields, so this isn't currently possible */
fputs("\" showname=\"", pdata->fh); fputs("\" showname=\"", pdata->fh);
print_escaped_xml(pdata->fh, fi->hfinfo->name); print_escaped_xml(pdata->fh, fi->hfinfo->name);
@ -1240,7 +1240,7 @@ output_fields_t* output_fields_new()
fields->fields = NULL; /*Do lazy initialisation */ fields->fields = NULL; /*Do lazy initialisation */
fields->field_indicies = NULL; fields->field_indicies = NULL;
fields->field_values = NULL; fields->field_values = NULL;
fields->quote='\0'; fields->quote='\0';
return fields; return fields;
} }
@ -1274,7 +1274,7 @@ void output_fields_free(output_fields_t* fields)
g_ptr_array_free(fields->fields, TRUE); g_ptr_array_free(fields->fields, TRUE);
} }
g_free(fields); g_free(fields);
} }
void output_fields_add(output_fields_t* fields, const gchar* field) void output_fields_add(output_fields_t* fields, const gchar* field)
@ -1341,7 +1341,7 @@ gboolean output_fields_set_option(output_fields_t* info, gchar* option)
info->separator = *option_value; info->separator = *option_value;
break; break;
} }
return TRUE; return TRUE;
} }
if(0 == strcmp(option_name, "quote")) { if(0 == strcmp(option_name, "quote")) {
@ -1360,7 +1360,7 @@ gboolean output_fields_set_option(output_fields_t* info, gchar* option)
info->quote='\0'; info->quote='\0';
break; break;
} }
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -1392,11 +1392,11 @@ void write_fields_preamble(output_fields_t* fields, FILE *fh)
fputc(fields->separator, fh); fputc(fields->separator, fh);
} }
fputs(field, fh); fputs(field, fh);
} }
fputc('\n', fh); fputc('\n', fh);
} }
static void proto_tree_get_node_field_values(proto_node *node, gpointer data) static void proto_tree_get_node_field_values(proto_node *node, gpointer data)
{ {
write_field_data_t *call_data; write_field_data_t *call_data;
field_info *fi; field_info *fi;
@ -1418,7 +1418,7 @@ static void proto_tree_get_node_field_values(proto_node *node, gpointer data)
call_data->fields->field_values[actual_index - 1] = value; call_data->fields->field_values[actual_index - 1] = value;
} }
} }
/* Recurse here. */ /* Recurse here. */
if (node->first_child != NULL) { if (node->first_child != NULL) {
proto_tree_children_foreach(node, proto_tree_get_node_field_values, proto_tree_children_foreach(node, proto_tree_get_node_field_values,
@ -1446,17 +1446,17 @@ void proto_tree_write_fields(output_fields_t* fields, epan_dissect_t *edt, FILE
i = 0; i = 0;
while( i < fields->fields->len) { while( i < fields->fields->len) {
gchar* field = g_ptr_array_index(fields->fields, i); gchar* field = g_ptr_array_index(fields->fields, i);
/* Store field indicies +1 so that zero is not a valid value, /* Store field indicies +1 so that zero is not a valid value,
* and can be distinguished from NULL as a pointer. * and can be distinguished from NULL as a pointer.
*/ */
++i; ++i;
g_hash_table_insert(fields->field_indicies, field, GUINT_TO_POINTER(i)); g_hash_table_insert(fields->field_indicies, field, GUINT_TO_POINTER(i));
} }
} }
/* Buffer to store values for this packet */ /* Buffer to store values for this packet */
fields->field_values = ep_alloc_array0(const gchar*, fields->fields->len); fields->field_values = ep_alloc_array0(const gchar*, fields->fields->len);
proto_tree_children_foreach(edt->tree, proto_tree_get_node_field_values, proto_tree_children_foreach(edt->tree, proto_tree_get_node_field_values,
&data); &data);

View File

@ -73,7 +73,7 @@
#include <epan/epan.h> #include <epan/epan.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include <epan/privileges.h> #include <epan/privileges.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include "globals.h" #include "globals.h"
#include <epan/packet.h> #include <epan/packet.h>
@ -268,7 +268,7 @@ raw_pipe_open(const char *pipe_name)
#endif /* _WIN32 */ #endif /* _WIN32 */
} else { } else {
#ifndef _WIN32 #ifndef _WIN32
if (eth_stat(pipe_name, &pipe_stat) < 0) { if (ws_stat(pipe_name, &pipe_stat) < 0) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"The capture session could not be initiated " "The capture session could not be initiated "
"due to error on pipe: %s", strerror(errno)); "due to error on pipe: %s", strerror(errno));
@ -288,7 +288,7 @@ raw_pipe_open(const char *pipe_name)
} }
return -1; return -1;
} }
rfd = eth_open(pipe_name, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */); rfd = ws_open(pipe_name, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
if (rfd == -1) { if (rfd == -1) {
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"The capture session could not be initiated " "The capture session could not be initiated "

View File

@ -26,18 +26,18 @@
* <laurent.deniel@free.fr> * <laurent.deniel@free.fr>
* *
* Almost completely rewritten in order to: * Almost completely rewritten in order to:
* *
* - be able to use a unlimited number of ringbuffer files * - be able to use a unlimited number of ringbuffer files
* - close the current file and open (truncating) the next file at switch * - close the current file and open (truncating) the next file at switch
* - set the final file name once open (or reopen) * - set the final file name once open (or reopen)
* - avoid the deletion of files that could not be truncated (can't arise now) * - avoid the deletion of files that could not be truncated (can't arise now)
* and do not erase empty files * and do not erase empty files
* *
* The idea behind that is to remove the limitation of the maximum # of * The idea behind that is to remove the limitation of the maximum # of
* ringbuffer files being less than the maximum # of open fd per process * ringbuffer files being less than the maximum # of open fd per process
* and to be able to reduce the amount of virtual memory usage (having only * and to be able to reduce the amount of virtual memory usage (having only
* one file open at most) or the amount of file system usage (by truncating * one file open at most) or the amount of file system usage (by truncating
* the files at switch and not the capture stop, and by closing them which * the files at switch and not the capture stop, and by closing them which
* makes possible their move or deletion after a switch). * makes possible their move or deletion after a switch).
* *
*/ */
@ -67,7 +67,7 @@
#include "pcapio.h" #include "pcapio.h"
#include "ringbuffer.h" #include "ringbuffer.h"
#include "file_util.h" #include <wsutil/file_util.h>
/* Ringbuffer file structure */ /* Ringbuffer file structure */
@ -94,7 +94,7 @@ static ringbuf_data rb_data;
/* /*
* create the next filename and open a new binary file with that name * create the next filename and open a new binary file with that name
*/ */
static int ringbuf_open_file(rb_file *rfile, int *err) static int ringbuf_open_file(rb_file *rfile, int *err)
{ {
@ -105,7 +105,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
if (rfile->name != NULL) { if (rfile->name != NULL) {
if (rb_data.unlimited == FALSE) { if (rb_data.unlimited == FALSE) {
/* remove old file (if any, so ignore error) */ /* remove old file (if any, so ignore error) */
eth_unlink(rfile->name); ws_unlink(rfile->name);
} }
g_free(rfile->name); g_free(rfile->name);
} }
@ -125,7 +125,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
return -1; return -1;
} }
rb_data.fd = eth_open(rfile->name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, 0600); rb_data.fd = ws_open(rfile->name, O_RDWR|O_BINARY|O_TRUNC|O_CREAT, 0600);
if (rb_data.fd == -1 && err != NULL) { if (rb_data.fd == -1 && err != NULL) {
*err = errno; *err = errno;
@ -246,7 +246,7 @@ ringbuf_init_libpcap_fdopen(int linktype, int snaplen,
* Switches to the next ringbuffer file * Switches to the next ringbuffer file
*/ */
gboolean gboolean
ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd, ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd,
long *bytes_written, int *err) long *bytes_written, int *err)
{ {
int next_file_index; int next_file_index;
@ -255,7 +255,7 @@ ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd,
/* close current file */ /* close current file */
if (!libpcap_dump_close(rb_data.pdh, err)) { if (!libpcap_dump_close(rb_data.pdh, err)) {
eth_close(rb_data.fd); /* XXX - the above should have closed this already */ ws_close(rb_data.fd); /* XXX - the above should have closed this already */
rb_data.pdh = NULL; /* it's still closed, we just got an error while closing */ rb_data.pdh = NULL; /* it's still closed, we just got an error while closing */
rb_data.fd = -1; rb_data.fd = -1;
return FALSE; return FALSE;
@ -298,7 +298,7 @@ ringbuf_libpcap_dump_close(gchar **save_file, int *err)
/* close current file, if it's open */ /* close current file, if it's open */
if (rb_data.pdh != NULL) { if (rb_data.pdh != NULL) {
if (!libpcap_dump_close(rb_data.pdh, err)) { if (!libpcap_dump_close(rb_data.pdh, err)) {
eth_close(rb_data.fd); ws_close(rb_data.fd);
ret_val = FALSE; ret_val = FALSE;
} }
@ -359,14 +359,14 @@ ringbuf_error_cleanup(void)
/* XXX - it shouldn't still be open; "libpcap_dump_close()" should leave the /* XXX - it shouldn't still be open; "libpcap_dump_close()" should leave the
file closed even if it fails */ file closed even if it fails */
if (rb_data.fd != -1) { if (rb_data.fd != -1) {
eth_close(rb_data.fd); ws_close(rb_data.fd);
rb_data.fd = -1; rb_data.fd = -1;
} }
if (rb_data.files != NULL) { if (rb_data.files != NULL) {
for (i=0; i < rb_data.num_files; i++) { for (i=0; i < rb_data.num_files; i++) {
if (rb_data.files[i].name != NULL) { if (rb_data.files[i].name != NULL) {
eth_unlink(rb_data.files[i].name); ws_unlink(rb_data.files[i].name);
} }
} }
} }

View File

@ -37,14 +37,13 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "file_util.h"
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
#include <windows.h> #include <windows.h>
#endif #endif
#include "tempfile.h" #include "tempfile.h"
#include "mkstemp.h" #include "mkstemp.h"
#include <wsutil/file_util.h>
static const char * static const char *
setup_tmpdir(const char *dir) setup_tmpdir(const char *dir)

View File

@ -97,7 +97,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wiretap/file_util.h> #include <wsutil/file_util.h>
#include <time.h> #include <time.h>
#include <glib.h> #include <glib.h>
@ -1264,7 +1264,7 @@ parse_options (int argc, char *argv[])
if (strcmp(argv[optind], "-")) { if (strcmp(argv[optind], "-")) {
input_filename = g_strdup(argv[optind]); input_filename = g_strdup(argv[optind]);
input_file = eth_fopen(input_filename, "rb"); input_file = ws_fopen(input_filename, "rb");
if (!input_file) { if (!input_file) {
fprintf(stderr, "Cannot open file [%s] for reading: %s\n", fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
input_filename, strerror(errno)); input_filename, strerror(errno));
@ -1277,7 +1277,7 @@ parse_options (int argc, char *argv[])
if (strcmp(argv[optind+1], "-")) { if (strcmp(argv[optind+1], "-")) {
output_filename = g_strdup(argv[optind+1]); output_filename = g_strdup(argv[optind+1]);
output_file = eth_fopen(output_filename, "wb"); output_file = ws_fopen(output_filename, "wb");
if (!output_file) { if (!output_file) {
fprintf(stderr, "Cannot open file [%s] for writing: %s\n", fprintf(stderr, "Cannot open file [%s] for writing: %s\n",
output_filename, strerror(errno)); output_filename, strerror(errno));

View File

@ -76,7 +76,7 @@ my @prohibitedAPIs=
'g_strdown', 'g_strdown',
'g_string_up', 'g_string_up',
'g_string_down', 'g_string_down',
# Use the eth_* version of these: # Use the ws_* version of these:
# (Necessary because on Windows we use UTF8 for throughout the code # (Necessary because on Windows we use UTF8 for throughout the code
# so we must tweak that to UTF16 before operating on the file. Code # so we must tweak that to UTF16 before operating on the file. Code
# using these functions will work unless the file/path name contains # using these functions will work unless the file/path name contains

View File

@ -63,7 +63,6 @@
#include <epan/epan.h> #include <epan/epan.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include <epan/privileges.h> #include <epan/privileges.h>
#include <wiretap/file_util.h>
#include "globals.h" #include "globals.h"
#include <epan/timestamp.h> #include <epan/timestamp.h>
@ -863,7 +862,7 @@ main(int argc, char *argv[])
we can just process it with the other arguments. */ we can just process it with the other arguments. */
if (argc >= 2 && strcmp(argv[1], "-G") == 0) { if (argc >= 2 && strcmp(argv[1], "-G") == 0) {
proto_initialize_all_prefixes(); proto_initialize_all_prefixes();
if (argc == 2) if (argc == 2)
proto_registrar_dump_fields(1); proto_registrar_dump_fields(1);
else { else {

View File

@ -41,7 +41,7 @@
#include "capture-pcap-util.h" #include "capture-pcap-util.h"
#endif #endif
#include "file_util.h" #include <wsutil/file_util.h>
#include <wininet.h> #include <wininet.h>
#include "nio-ie5.h" #include "nio-ie5.h"
@ -74,7 +74,7 @@ download_file(const char *url, const char *filename) {
/* open output file */ /* open output file */
fd = eth_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); fd = ws_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(fd == -1) { if(fd == -1) {
g_warning("Couldn't open output file %s!", filename); g_warning("Couldn't open output file %s!", filename);
return -1; return -1;
@ -89,12 +89,12 @@ download_file(const char *url, const char *filename) {
do { do {
/* XXX - maybe add a progress bar here */ /* XXX - maybe add a progress bar here */
/* read some bytes from the url */ /* read some bytes from the url */
chunk_len = netio_ie5_read (conn, buf, sizeof(buf)); chunk_len = netio_ie5_read (conn, buf, sizeof(buf));
/* write bytes to the output file */ /* write bytes to the output file */
stream_len = eth_write( fd, buf, chunk_len); stream_len = ws_write( fd, buf, chunk_len);
if(stream_len != chunk_len) { if(stream_len != chunk_len) {
g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len); g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len);
ret = -1; ret = -1;
@ -104,7 +104,7 @@ download_file(const char *url, const char *filename) {
netio_ie5_disconnect(conn); netio_ie5_disconnect(conn);
eth_close(fd); ws_close(fd);
return ret; return ret;
} }
@ -144,7 +144,7 @@ static void
update_pref_check(gchar *pref_name, gchar *value, char *check_prefix, char *check_name, char **check_value) update_pref_check(gchar *pref_name, gchar *value, char *check_prefix, char *check_name, char **check_value)
{ {
GString *check = g_string_new(check_prefix); GString *check = g_string_new(check_prefix);
g_string_append(check, check_name); g_string_append(check, check_name);
if(strcmp(pref_name, check->str) == 0) { if(strcmp(pref_name, check->str) == 0) {
@ -163,7 +163,7 @@ static prefs_set_pref_e
update_pref(gchar *pref_name, gchar *value, void *private_data) update_pref(gchar *pref_name, gchar *value, void *private_data)
{ {
update_info_t *update_info = private_data; update_info_t *update_info = private_data;
update_pref_check(pref_name, value, update_info->prefix, "title", &update_info->title); update_pref_check(pref_name, value, update_info->prefix, "title", &update_info->title);
update_pref_check(pref_name, value, update_info->prefix, "description", &update_info->description); update_pref_check(pref_name, value, update_info->prefix, "description", &update_info->description);
update_pref_check(pref_name, value, update_info->prefix, "version", &update_info->version_recommended); update_pref_check(pref_name, value, update_info->prefix, "version", &update_info->version_recommended);
@ -226,7 +226,7 @@ update_check_wireshark(const char *local_file)
update_info->version_installed = g_strdup(VERSION); update_info->version_installed = g_strdup(VERSION);
update_info->prefix = "wireshark.setup."; update_info->prefix = "wireshark.setup.";
pf = eth_fopen(local_file, "r"); pf = ws_fopen(local_file, "r");
if(pf != NULL) { if(pf != NULL) {
/* read in update_info of Wireshark */ /* read in update_info of Wireshark */
read_prefs_file(local_file, pf, update_pref, update_info); read_prefs_file(local_file, pf, update_pref, update_info);
@ -256,10 +256,10 @@ update_check_winpcap(const char *local_file)
char *pcap_vstart; char *pcap_vstart;
char *pcap_vend; char *pcap_vend;
update_info->prefix = "winpcap."; update_info->prefix = "winpcap.";
pf = eth_fopen(local_file, "r"); pf = ws_fopen(local_file, "r");
if(pf != NULL) { if(pf != NULL) {
/* read in update_info of WinPcap */ /* read in update_info of WinPcap */
read_prefs_file(local_file, pf, update_pref, update_info); read_prefs_file(local_file, pf, update_pref, update_info);
@ -317,7 +317,7 @@ update_check(gboolean interactive)
g_warning("Couldn't create output path!"); g_warning("Couldn't create output path!");
return; return;
} }
/* download update file */ /* download update file */
if(download_file(url_file, local_file) == -1) { if(download_file(url_file, local_file) == -1) {
g_warning("Couldn't download update file: %s", local_file); g_warning("Couldn't download update file: %s", local_file);
@ -330,7 +330,7 @@ update_check(gboolean interactive)
/* check winpcap */ /* check winpcap */
update_info_winpcap = update_check_winpcap(local_file); update_info_winpcap = update_check_winpcap(local_file);
/* display results */ /* display results */
if(update_info_wireshark->needs_update || update_info_winpcap->needs_update) { if(update_info_wireshark->needs_update || update_info_winpcap->needs_update) {
if(update_info_wireshark->needs_update) if(update_info_wireshark->needs_update)

View File

@ -87,7 +87,6 @@ NONGENERATED_HEADER_FILES = \
erf.h \ erf.h \
etherpeek.h \ etherpeek.h \
eyesdn.h \ eyesdn.h \
file_util.h \
file_wrappers.h \ file_wrappers.h \
hcidump.h \ hcidump.h \
i4btrace.h \ i4btrace.h \

View File

@ -17,7 +17,7 @@ CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
.c.obj:: .c.obj::
$(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $< $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
OBJECTS=$(NONGENERATED_C_FILES:.c=.obj) $(GENERATED_C_FILES:.c=.obj) file_util.obj OBJECTS=$(NONGENERATED_C_FILES:.c=.obj) $(GENERATED_C_FILES:.c=.obj)
wiretap_LIBS = \ wiretap_LIBS = \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
@ -36,7 +36,7 @@ wiretap-$(WTAP_VERSION).dll : $(OBJECTS) wtap.def ..\image\wiretap.res
/IMPLIB:wiretap-$(WTAP_VERSION).lib \ /IMPLIB:wiretap-$(WTAP_VERSION).lib \
..\image\wiretap.res \ ..\image\wiretap.res \
$(OBJECTS) $(wiretap_LIBS) $(OBJECTS) $(wiretap_LIBS)
!IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20" !IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20"
mt.exe -nologo -manifest "wiretap-$(WTAP_VERSION).dll.manifest" -outputresource:wiretap-$(WTAP_VERSION).dll;2 mt.exe -nologo -manifest "wiretap-$(WTAP_VERSION).dll.manifest" -outputresource:wiretap-$(WTAP_VERSION).dll;2
!ENDIF !ENDIF

View File

@ -28,7 +28,7 @@
#include "ascend.h" #include "ascend.h"
#include "ascend-int.h" #include "ascend-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
#include "file_util.h" #include <wsutil/file_util.h>
#include <errno.h> #include <errno.h>
@ -57,7 +57,7 @@
typedef struct _ascend_magic_string { typedef struct _ascend_magic_string {
guint type; guint type;
const gchar *strptr; const gchar *strptr;
} ascend_magic_string; } ascend_magic_string;
#define ASCEND_MAGIC_STRINGS 11 #define ASCEND_MAGIC_STRINGS 11
@ -100,7 +100,7 @@ static gint64 ascend_seek(wtap *wth, int *err)
while (((byte = file_getc(wth->fh)) != EOF)) { while (((byte = file_getc(wth->fh)) != EOF)) {
excessive_read_count--; excessive_read_count--;
if (!excessive_read_count) { if (!excessive_read_count) {
return -1; return -1;
} }
@ -124,7 +124,7 @@ static gint64 ascend_seek(wtap *wth, int *err)
if (strcmp(strptr, ASCEND_DATE) == 0) { if (strcmp(strptr, ASCEND_DATE) == 0) {
date_off = cur_off - len; date_off = cur_off - len;
} else { } else {
if (date_off == -1) { if (date_off == -1) {
/* Back up over the header we just read; that's where a read /* Back up over the header we just read; that's where a read
of this packet should start. */ of this packet should start. */
packet_off = cur_off - len; packet_off = cur_off - len;

View File

@ -38,7 +38,7 @@
#include <errno.h> #include <errno.h>
#include "file_util.h" #include <wsutil/file_util.h>
#include "wtap-int.h" #include "wtap-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
@ -131,7 +131,7 @@ static wtap_open_routine_t open_routines_base[] = {
/* I put NetScreen *before* erf, because there were some /* I put NetScreen *before* erf, because there were some
* false positives with my test-files (Sake Blok, July 2007) * false positives with my test-files (Sake Blok, July 2007)
*/ */
netscreen_open, netscreen_open,
erf_open, erf_open,
k12text_open, k12text_open,
etherpeek_open, etherpeek_open,
@ -157,13 +157,13 @@ static GArray* open_routines_arr = NULL;
/* initialize the open routines array if it has not being initialized yet */ /* initialize the open routines array if it has not being initialized yet */
static void init_open_routines(void) { static void init_open_routines(void) {
if (open_routines_arr) return; if (open_routines_arr) return;
open_routines_arr = g_array_new(FALSE,TRUE,sizeof(wtap_open_routine_t)); open_routines_arr = g_array_new(FALSE,TRUE,sizeof(wtap_open_routine_t));
g_array_append_vals(open_routines_arr,open_routines_base,N_FILE_TYPES); g_array_append_vals(open_routines_arr,open_routines_base,N_FILE_TYPES);
open_routines = (void*)open_routines_arr->data; open_routines = (void*)open_routines_arr->data;
} }
@ -174,7 +174,7 @@ void wtap_register_open_routine(wtap_open_routine_t open_routine, gboolean has_m
g_array_prepend_val(open_routines_arr,open_routine); g_array_prepend_val(open_routines_arr,open_routine);
else else
g_array_append_val(open_routines_arr,open_routine); g_array_append_val(open_routines_arr,open_routine);
open_routines = (void*)open_routines_arr->data; open_routines = (void*)open_routines_arr->data;
} }
@ -223,7 +223,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
return NULL; return NULL;
} }
} else { } else {
if (eth_stat(filename, &statb) < 0) { if (ws_stat(filename, &statb) < 0) {
*err = errno; *err = errno;
return NULL; return NULL;
} }
@ -285,12 +285,12 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
* an fclose or gzclose of wth->fh closing the standard * an fclose or gzclose of wth->fh closing the standard
* input of the process. * input of the process.
*/ */
wth->fd = eth_dup(0); wth->fd = ws_dup(0);
#ifdef _WIN32 #ifdef _WIN32
_setmode(wth->fd, O_BINARY); _setmode(wth->fd, O_BINARY);
#endif #endif
} else } else
wth->fd = eth_open(filename, O_RDONLY|O_BINARY, 0000 /* no creation so don't matter */); wth->fd = ws_open(filename, O_RDONLY|O_BINARY, 0000 /* no creation so don't matter */);
if (wth->fd < 0) { if (wth->fd < 0) {
*err = errno; *err = errno;
g_free(wth); g_free(wth);
@ -298,7 +298,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
} }
if (!(wth->fh = filed_open(wth->fd, "rb"))) { if (!(wth->fh = filed_open(wth->fd, "rb"))) {
*err = errno; *err = errno;
eth_close(wth->fd); ws_close(wth->fd);
g_free(wth); g_free(wth);
return NULL; return NULL;
} }
@ -319,9 +319,9 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
wth->subtype_sequential_close = NULL; wth->subtype_sequential_close = NULL;
wth->subtype_close = NULL; wth->subtype_close = NULL;
wth->tsprecision = WTAP_FILE_TSPREC_USEC; wth->tsprecision = WTAP_FILE_TSPREC_USEC;
init_open_routines(); init_open_routines();
/* Try all file types */ /* Try all file types */
for (i = 0; i < open_routines_arr->len; i++) { for (i = 0; i < open_routines_arr->len; i++) {
/* Seek back to the beginning of the file; the open routine /* Seek back to the beginning of the file; the open routine
@ -340,7 +340,7 @@ wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
return NULL; return NULL;
} }
wth->data_offset = 0; wth->data_offset = 0;
switch ((*open_routines[i])(wth, err, err_info)) { switch ((*open_routines[i])(wth, err, err_info)) {
case -1: case -1:
@ -464,7 +464,7 @@ static const struct file_type_info dump_open_table_base[] = {
/* WTAP_FILE_EYESDN */ /* WTAP_FILE_EYESDN */
{ "EyeSDN USB S0/E1 ISDN trace format", "eyesdn", "*.*", NULL, FALSE, { "EyeSDN USB S0/E1 ISDN trace format", "eyesdn", "*.*", NULL, FALSE,
NULL, NULL }, NULL, NULL },
/* WTAP_FILE_NETTL */ /* WTAP_FILE_NETTL */
{ "HP-UX nettl trace", "nettl", "*.TRC0;*.TRC1", ".TRC0", FALSE, { "HP-UX nettl trace", "nettl", "*.TRC0;*.TRC1", ".TRC0", FALSE,
nettl_dump_can_write_encap, nettl_dump_open }, nettl_dump_can_write_encap, nettl_dump_open },
@ -560,7 +560,7 @@ static const struct file_type_info dump_open_table_base[] = {
/* WTAP_FILE_ETHERPEEK_V9 */ /* WTAP_FILE_ETHERPEEK_V9 */
{ "Wildpacket Ether/AiroPeek (V9)", "peek9", "*.tpc;*.apc;*.pkt;*.wpz", ".pkt", FALSE, { "Wildpacket Ether/AiroPeek (V9)", "peek9", "*.tpc;*.apc;*.pkt;*.wpz", ".pkt", FALSE,
NULL, NULL }, NULL, NULL },
/* WTAP_FILE_MPEG */ /* WTAP_FILE_MPEG */
{ "MPEG", "mpeg", "*.mpeg;*.mpg;*.mp3", ".mpeg", FALSE, { "MPEG", "mpeg", "*.mpeg;*.mpg;*.mp3", ".mpeg", FALSE,
NULL, NULL }, NULL, NULL },
@ -576,7 +576,7 @@ static const struct file_type_info dump_open_table_base[] = {
/* WTAP_FILE_COMMVIEW */ /* WTAP_FILE_COMMVIEW */
{ "TamoSoft CommView", "commview", "*.ncf", ".ncf", TRUE, { "TamoSoft CommView", "commview", "*.ncf", ".ncf", TRUE,
commview_dump_can_write_encap, commview_dump_open }, commview_dump_can_write_encap, commview_dump_open },
/* WTAP_FILE_PCAPNG */ /* WTAP_FILE_PCAPNG */
{ "Wireshark - pcapng (experimental)", "pcapng", "*.pcapng", NULL, FALSE, { "Wireshark - pcapng (experimental)", "pcapng", "*.pcapng", NULL, FALSE,
pcapng_dump_can_write_encap, pcapng_dump_open }, pcapng_dump_can_write_encap, pcapng_dump_open },
@ -592,13 +592,13 @@ static const struct file_type_info* dump_open_table = dump_open_table_base;
/* initialize the open routines array if it has not being initialized yet */ /* initialize the open routines array if it has not being initialized yet */
static void init_file_types(void) { static void init_file_types(void) {
if (dump_open_table_arr) return; if (dump_open_table_arr) return;
dump_open_table_arr = g_array_new(FALSE,TRUE,sizeof(struct file_type_info)); dump_open_table_arr = g_array_new(FALSE,TRUE,sizeof(struct file_type_info));
g_array_append_vals(dump_open_table_arr,dump_open_table_base,wtap_num_file_types); g_array_append_vals(dump_open_table_arr,dump_open_table_base,wtap_num_file_types);
dump_open_table = (void*)dump_open_table_arr->data; dump_open_table = (void*)dump_open_table_arr->data;
} }
@ -606,9 +606,9 @@ int wtap_register_file_type(const struct file_type_info* fi) {
init_file_types(); init_file_types();
g_array_append_val(dump_open_table_arr,*fi); g_array_append_val(dump_open_table_arr,*fi);
dump_open_table = (void*)dump_open_table_arr->data; dump_open_table = (void*)dump_open_table_arr->data;
return wtap_num_file_types++; return wtap_num_file_types++;
} }
@ -755,7 +755,7 @@ wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
opening it. */ opening it. */
if (wdh->fh != stdout) { if (wdh->fh != stdout) {
wtap_dump_file_close(wdh); wtap_dump_file_close(wdh);
eth_unlink(filename); ws_unlink(filename);
} }
g_free(wdh); g_free(wdh);
return NULL; return NULL;
@ -894,7 +894,7 @@ void wtap_dump_flush(wtap_dumper *wdh)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if(wdh->compressed) { if(wdh->compressed) {
gzflush(wdh->fh, Z_SYNC_FLUSH); /* XXX - is Z_SYNC_FLUSH the right one? */ gzflush(wdh->fh, Z_SYNC_FLUSH); /* XXX - is Z_SYNC_FLUSH the right one? */
} else } else
#endif #endif
{ {
fflush(wdh->fh); fflush(wdh->fh);
@ -950,10 +950,10 @@ static FILE *wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if(wdh->compressed) { if(wdh->compressed) {
return gzopen(filename, "wb"); return gzopen(filename, "wb");
} else } else
#endif #endif
{ {
return eth_fopen(filename, "wb"); return ws_fopen(filename, "wb");
} }
} }
@ -963,7 +963,7 @@ static FILE *wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if(wdh->compressed) { if(wdh->compressed) {
return gzdopen(fd, "wb"); return gzdopen(fd, "wb");
} else } else
#endif #endif
{ {
return fdopen(fd, "wb"); return fdopen(fd, "wb");
@ -976,7 +976,7 @@ size_t wtap_dump_file_write(wtap_dumper *wdh, const void *buf, unsigned bufsize)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if(wdh->compressed) { if(wdh->compressed) {
return gzwrite(wdh->fh, buf, bufsize); return gzwrite(wdh->fh, buf, bufsize);
} else } else
#endif #endif
{ {
return fwrite(buf, 1, bufsize, wdh->fh); return fwrite(buf, 1, bufsize, wdh->fh);
@ -989,7 +989,7 @@ static int wtap_dump_file_close(wtap_dumper *wdh)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if(wdh->compressed) { if(wdh->compressed) {
return gzclose(wdh->fh); return gzclose(wdh->fh);
} else } else
#endif #endif
{ {
return fclose(wdh->fh); return fclose(wdh->fh);
@ -1010,7 +1010,7 @@ int wtap_dump_file_ferror(wtap_dumper *wdh)
/* XXX - what to do with this zlib specific number? */ /* XXX - what to do with this zlib specific number? */
return errnum; return errnum;
} }
} else } else
#endif #endif
{ {
return ferror(wdh->fh); return ferror(wdh->fh);

View File

@ -113,7 +113,7 @@
#endif /* HAVE_LIBZ */ #endif /* HAVE_LIBZ */
#include "wtap-int.h" #include "wtap-int.h"
#include "file_wrappers.h" #include "file_wrappers.h"
#include "file_util.h" #include <wsutil/file_util.h>
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
@ -149,13 +149,13 @@ file_open(const char *path, const char *mode)
oflag |= O_BINARY; oflag |= O_BINARY;
#endif #endif
/* open file and do correct filename conversions */ /* open file and do correct filename conversions */
if ((fd = eth_open(path, oflag, 0666)) == -1) if ((fd = ws_open(path, oflag, 0666)) == -1)
return NULL; return NULL;
/* open zlib file handle */ /* open zlib file handle */
ft = gzdopen(fd, mode); ft = gzdopen(fd, mode);
if (ft == NULL) { if (ft == NULL) {
eth_close(fd); ws_close(fd);
return NULL; return NULL;
} }

Some files were not shown because too many files have changed in this diff Show More