forked from osmocom/wireshark
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:
parent
da2f447a9b
commit
a5cee04fad
|
@ -45,6 +45,7 @@ EXTRA_OBJECTS = \
|
|||
wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
||||
wsock32.lib user32.lib shell32.lib comctl32.lib \
|
||||
$(HHC_LIBS) \
|
||||
wsutil\libwsutil.lib \
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
epan\libwireshark.lib \
|
||||
!ELSE
|
||||
|
@ -53,7 +54,6 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
|||
epan\crypt\airpdcap.lib \
|
||||
epan\dfilter\dfilter.lib \
|
||||
epan\ftypes\ftypes.lib \
|
||||
wsutil\libwsutil.lib \
|
||||
$(ADNS_LIBS) \
|
||||
$(PCRE_LIBS) \
|
||||
$(ZLIB_LIBS) \
|
||||
|
@ -63,6 +63,7 @@ wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
|||
tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
||||
wsock32.lib user32.lib \
|
||||
$(GLIB_LIBS) \
|
||||
wsutil\libwsutil.lib \
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
epan\libwireshark.lib \
|
||||
!ELSE
|
||||
|
@ -71,7 +72,6 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
|||
epan\crypt\airpdcap.lib \
|
||||
epan\dfilter\dfilter.lib \
|
||||
epan\ftypes\ftypes.lib \
|
||||
wsutil\libwsutil.lib \
|
||||
$(ADNS_LIBS) \
|
||||
$(PCRE_LIBS) \
|
||||
$(ZLIB_LIBS) \
|
||||
|
@ -81,6 +81,7 @@ tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
|||
rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
||||
wsock32.lib user32.lib \
|
||||
$(GLIB_LIBS) \
|
||||
wsutil\libwsutil.lib \
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
epan\libwireshark.lib \
|
||||
!ELSE
|
||||
|
@ -89,7 +90,6 @@ rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
|||
epan\crypt\airpdcap.lib \
|
||||
epan\dfilter\dfilter.lib \
|
||||
epan\ftypes\ftypes.lib \
|
||||
wsutil\libwsutil.lib \
|
||||
$(ADNS_LIBS) \
|
||||
$(PCRE_LIBS) \
|
||||
$(ZLIB_LIBS) \
|
||||
|
@ -124,13 +124,13 @@ dumpcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
|||
dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
|
||||
wsock32.lib user32.lib \
|
||||
$(GLIB_LIBS) \
|
||||
wsutil\libwsutil.lib \
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
epan\libwireshark.lib \
|
||||
!ELSE
|
||||
epan\dissectors\dissectors.lib \
|
||||
epan\wireshark.lib \
|
||||
epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
|
||||
wsutil\libwsutil.lib \
|
||||
$(ADNS_LIBS) \
|
||||
$(PCRE_LIBS) \
|
||||
$(ZLIB_LIBS) \
|
||||
|
@ -509,7 +509,7 @@ image::
|
|||
# Unfortunately:
|
||||
# - 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
|
||||
#
|
||||
#
|
||||
$(ADNS_DLL):
|
||||
!IF "$(MSVC_VARIANT)" == "MSVC6"
|
||||
if not exist $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns mkdir $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns
|
||||
|
@ -1051,7 +1051,7 @@ checkapi_local:
|
|||
# $(TSHARK_TAP_SRC)
|
||||
# EXTRA_wireshark_SOURCES
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
# checkapi_local
|
||||
cd wiretap
|
||||
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
#include "capture-wpcap.h"
|
||||
#endif
|
||||
#include "ui_util.h"
|
||||
#include "file_util.h"
|
||||
#include "wsutil/file_util.h"
|
||||
#include "log.h"
|
||||
|
||||
typedef struct if_stat_cache_item_s {
|
||||
|
@ -580,7 +580,7 @@ capture_input_closed(capture_options *capture_opts)
|
|||
if(capture_opts->restart) {
|
||||
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(cf_is_tempfile(capture_opts->cf)) {
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#include "cmdarg_err.h"
|
||||
|
||||
#include "capture-pcap-util.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
|
@ -877,7 +877,7 @@ static int capture_opts_test_for_fifo(const char *path)
|
|||
{
|
||||
struct stat statb;
|
||||
|
||||
if (eth_stat(path, &statb) < 0)
|
||||
if (ws_stat(path, &statb) < 0)
|
||||
return errno;
|
||||
|
||||
if (S_ISFIFO(statb.st_mode))
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
#include "capture-wpcap.h"
|
||||
#endif
|
||||
#include "ui_util.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
#include "log.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -291,7 +291,7 @@ sync_pipe_start(capture_options *capture_opts) {
|
|||
report_failure("We don't know where to find dumpcap.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "argv[0]: %s", argv[0]);
|
||||
|
||||
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
|
||||
*/
|
||||
dup2(sync_pipe[PIPE_WRITE], 2);
|
||||
eth_close(sync_pipe[PIPE_READ]);
|
||||
ws_close(sync_pipe[PIPE_READ]);
|
||||
execv(argv[0], (gpointer)argv);
|
||||
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
|
||||
argv[0], strerror(errno));
|
||||
|
@ -538,15 +538,15 @@ sync_pipe_start(capture_options *capture_opts) {
|
|||
#ifdef _WIN32
|
||||
CloseHandle(sync_pipe_write);
|
||||
#else
|
||||
eth_close(sync_pipe[PIPE_WRITE]);
|
||||
ws_close(sync_pipe[PIPE_WRITE]);
|
||||
#endif
|
||||
|
||||
if (capture_opts->fork_child == -1) {
|
||||
/* We couldn't even create the child process. */
|
||||
report_failure("Couldn't create child process: %s", strerror(errno));
|
||||
eth_close(sync_pipe_read_fd);
|
||||
ws_close(sync_pipe_read_fd);
|
||||
#ifdef _WIN32
|
||||
eth_close(capture_opts->signal_pipe_write_fd);
|
||||
ws_close(capture_opts->signal_pipe_write_fd);
|
||||
#endif
|
||||
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
|
||||
*/
|
||||
dup2(sync_pipe[PIPE_WRITE], 1);
|
||||
eth_close(sync_pipe[PIPE_READ]);
|
||||
ws_close(sync_pipe[PIPE_READ]);
|
||||
execv(argv[0], (gpointer)argv);
|
||||
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
|
||||
argv[0], strerror(errno));
|
||||
|
@ -711,13 +711,13 @@ sync_pipe_open_command(const char** argv, int *read_fd, int *fork_child, gchar *
|
|||
#ifdef _WIN32
|
||||
CloseHandle(sync_pipe_write);
|
||||
#else
|
||||
eth_close(sync_pipe[PIPE_WRITE]);
|
||||
ws_close(sync_pipe[PIPE_WRITE]);
|
||||
#endif
|
||||
|
||||
if (*fork_child == -1) {
|
||||
/* We couldn't even create the child process. */
|
||||
*msg = g_strdup_printf("Couldn't create child process: %s", strerror(errno));
|
||||
eth_close(*read_fd);
|
||||
ws_close(*read_fd);
|
||||
return CANT_RUN_DUMPCAP;
|
||||
}
|
||||
|
||||
|
@ -734,7 +734,7 @@ sync_pipe_close_command(int *read_fd, gchar **msg) {
|
|||
#endif
|
||||
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");
|
||||
|
||||
|
@ -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
|
||||
return its exit value. */
|
||||
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';
|
||||
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. */
|
||||
/* 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 */
|
||||
/* (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
|
||||
argv = sync_pipe_add_arg(argv, &argc, "-Z");
|
||||
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. */
|
||||
/* 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 */
|
||||
/* (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
|
||||
argv = sync_pipe_add_arg(argv, &argc, "-Z");
|
||||
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. */
|
||||
/* 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 */
|
||||
/* (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
|
||||
argv = sync_pipe_add_arg(argv, &argc, "-Z");
|
||||
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);
|
||||
|
||||
#ifdef _WIN32
|
||||
eth_close(capture_opts->signal_pipe_write_fd);
|
||||
ws_close(capture_opts->signal_pipe_write_fd);
|
||||
#endif
|
||||
capture_input_closed(capture_opts);
|
||||
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
|
||||
alerted. Close the sync pipe. */
|
||||
eth_close(source);
|
||||
ws_close(source);
|
||||
|
||||
/* 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.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*
|
||||
* Updated 1 Dec 10 jjm
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <epan/filesystem.h>
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include "color.h"
|
||||
|
@ -54,7 +54,7 @@ static gboolean read_users_filters(GSList **cfl);
|
|||
/* the currently active filters */
|
||||
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) */
|
||||
static GSList *color_filter_deleted_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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
if( i!=filt_nr && filter==NULL )
|
||||
if( i!=filt_nr && filter==NULL )
|
||||
continue;
|
||||
|
||||
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 */
|
||||
color_filter_valid_list = NULL;
|
||||
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) );
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gboolean
|
||||
color_filters_used(void)
|
||||
{
|
||||
return color_filter_list != NULL && filters_enabled;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gboolean
|
||||
tmp_color_filters_used(void)
|
||||
{
|
||||
return tmp_colors_set;
|
||||
|
@ -505,7 +505,7 @@ read_filters_file(FILE *f, gpointer user_data)
|
|||
}
|
||||
|
||||
/* skip # comments and invalid lines */
|
||||
if (c != '@') {
|
||||
if (c != '@') {
|
||||
skip_end_of_line = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ read_filters_file(FILE *f, gpointer user_data)
|
|||
name_len *= 2;
|
||||
name = g_realloc(name, name_len + 1);
|
||||
}
|
||||
name[i++] = c;
|
||||
name[i++] = c;
|
||||
}
|
||||
name[i] = '\0';
|
||||
|
||||
|
@ -630,7 +630,7 @@ read_users_filters(GSList **cfl)
|
|||
|
||||
/* decide what file to open (from dfilter code) */
|
||||
path = get_persconffile_path("colorfilters", TRUE, FALSE);
|
||||
if ((f = eth_fopen(path, "r")) == NULL) {
|
||||
if ((f = ws_fopen(path, "r")) == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"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) */
|
||||
path = get_datafile_path("colorfilters");
|
||||
if ((f = eth_fopen(path, "r")) == NULL) {
|
||||
if ((f = ws_fopen(path, "r")) == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"Could not open global filter file\n\"%s\": %s.", path,
|
||||
|
@ -681,7 +681,7 @@ color_filters_import(gchar *path, gpointer user_data)
|
|||
FILE *f;
|
||||
gboolean ret;
|
||||
|
||||
if ((f = eth_fopen(path, "r")) == NULL) {
|
||||
if ((f = ws_fopen(path, "r")) == NULL) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"Could not open\n%s\nfor reading: %s.",
|
||||
path, strerror(errno));
|
||||
|
@ -730,7 +730,7 @@ write_filters_file(GSList *cfl, FILE *f, gboolean only_selected)
|
|||
|
||||
data.f = f;
|
||||
data.only_selected = only_selected;
|
||||
|
||||
|
||||
fprintf(f,"# DO NOT EDIT THIS FILE! It was created by Wireshark\n");
|
||||
g_slist_foreach(cfl, write_filter, &data);
|
||||
return TRUE;
|
||||
|
@ -755,7 +755,7 @@ color_filters_write(GSList *cfl)
|
|||
}
|
||||
|
||||
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,
|
||||
"Could not open\n%s\nfor writing: %s.",
|
||||
path, strerror(errno));
|
||||
|
@ -774,7 +774,7 @@ color_filters_export(gchar *path, GSList *cfl, gboolean only_marked)
|
|||
{
|
||||
FILE *f;
|
||||
|
||||
if ((f = eth_fopen(path, "w+")) == NULL) {
|
||||
if ((f = ws_fopen(path, "w+")) == NULL) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"Could not open\n%s\nfor writing: %s.",
|
||||
path, strerror(errno));
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <epan/proto.h>
|
||||
|
||||
#include "disabled_protos.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#define GLOBAL_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. */
|
||||
*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. */
|
||||
err = read_disabled_protos_list_file(gff_path, ff,
|
||||
&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. */
|
||||
*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. */
|
||||
err = read_disabled_protos_list_file(ff_path, ff, &disabled_protos);
|
||||
if (err != 0) {
|
||||
|
@ -345,7 +345,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
|
|||
completely. */
|
||||
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;
|
||||
*errno_return = errno;
|
||||
g_free(ff_path_new);
|
||||
|
@ -373,7 +373,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
|
|||
if (fclose(ff) == EOF) {
|
||||
*pref_path_return = ff_path;
|
||||
*errno_return = errno;
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
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
|
||||
infer is the reason why the MSVC++ "rename()" doesn't do so.
|
||||
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's not there, we don't need to remove it, so we just
|
||||
drive on. */
|
||||
*pref_path_return = ff_path;
|
||||
*errno_return = errno;
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (eth_rename(ff_path_new, ff_path) < 0) {
|
||||
if (ws_rename(ff_path_new, ff_path) < 0) {
|
||||
*pref_path_return = ff_path;
|
||||
*errno_return = errno;
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
return;
|
||||
}
|
||||
|
|
16
dumpcap.c
16
dumpcap.c
|
@ -94,7 +94,7 @@
|
|||
|
||||
#include "tempfile.h"
|
||||
#include "log.h"
|
||||
#include "file_util.h"
|
||||
#include "wsutil/file_util.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 */
|
||||
} else {
|
||||
#ifndef _WIN32
|
||||
if (eth_stat(pipename, &pipe_stat) < 0) {
|
||||
if (ws_stat(pipename, &pipe_stat) < 0) {
|
||||
if (errno == ENOENT || errno == ENOTDIR)
|
||||
ld->cap_pipe_err = PIPNEXIST;
|
||||
else {
|
||||
|
@ -716,7 +716,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld,
|
|||
}
|
||||
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) {
|
||||
g_snprintf(errmsg, errmsgl,
|
||||
"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:
|
||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_open_live: error %s", errmsg);
|
||||
ld->cap_pipe_err = PIPERR;
|
||||
eth_close(fd);
|
||||
ws_close(fd);
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ static void capture_loop_close_input(loop_data *ld) {
|
|||
/* if open, close the capture pipe "input file" */
|
||||
if (ld->cap_pipe_fd >= 0) {
|
||||
g_assert(ld->from_cap_pipe);
|
||||
eth_close(ld->cap_pipe_fd);
|
||||
ws_close(ld->cap_pipe_fd);
|
||||
ld->cap_pipe_fd = 0;
|
||||
}
|
||||
|
||||
|
@ -1644,7 +1644,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
|
|||
}
|
||||
} else {
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
@ -2094,13 +2094,13 @@ error:
|
|||
/* 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. */
|
||||
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
|
||||
file. */
|
||||
if(capture_opts->save_file != NULL) {
|
||||
eth_unlink(capture_opts->save_file);
|
||||
ws_unlink(capture_opts->save_file);
|
||||
g_free(capture_opts->save_file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
#include "filesystem.h"
|
||||
|
||||
#include <epan/strutil.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include <epan/prefs.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;
|
||||
hashport_t *tp;
|
||||
|
||||
|
||||
|
||||
hash_idx = HASH_PORT(port);
|
||||
tp = proto_table[hash_idx];
|
||||
|
@ -465,7 +465,7 @@ static void parse_services_file(const char * path)
|
|||
static char *buf = NULL;
|
||||
|
||||
/* services hash table initialization */
|
||||
serv_p = eth_fopen(path, "r");
|
||||
serv_p = ws_fopen(path, "r");
|
||||
|
||||
if (serv_p == NULL)
|
||||
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 the address string starts '.' (should not happen?),
|
||||
* we skip that '.'.
|
||||
*/
|
||||
*/
|
||||
i = subnet_entry.mask_length / 8;
|
||||
while(*(paddr) != '\0' && i > 0) {
|
||||
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
|
||||
*/
|
||||
g_snprintf(tp->name, MAXNAMELEN, "%s%s", subnet_entry.name, paddr);
|
||||
} else {
|
||||
g_snprintf(tp->name, MAXNAMELEN, "%s%s", subnet_entry.name, paddr);
|
||||
} else {
|
||||
ip_to_str_buf((guint8 *)&addr, tp->name, MAXNAMELEN);
|
||||
}
|
||||
}
|
||||
|
@ -991,7 +991,7 @@ static void set_ethent(char *path)
|
|||
if (eth_p)
|
||||
rewind(eth_p);
|
||||
else
|
||||
eth_p = eth_fopen(path, "r");
|
||||
eth_p = ws_fopen(path, "r");
|
||||
}
|
||||
|
||||
static void end_ethent(void)
|
||||
|
@ -1573,7 +1573,7 @@ static void set_ipxnetent(char *path)
|
|||
if (ipxnet_p)
|
||||
rewind(ipxnet_p);
|
||||
else
|
||||
ipxnet_p = eth_fopen(path, "r");
|
||||
ipxnet_p = ws_fopen(path, "r");
|
||||
}
|
||||
|
||||
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
|
||||
* (not available on all systems).
|
||||
*/
|
||||
if ((hf = eth_fopen(hostspath, "r")) == NULL)
|
||||
if ((hf = ws_fopen(hostspath, "r")) == NULL)
|
||||
return FALSE;
|
||||
|
||||
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.
|
||||
* <line> = <comment> | <entry> | <whitespace>
|
||||
* <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>
|
||||
* <ipv4_address> is a full address; it will be masked to get the subnet-ID.
|
||||
* <subnet_mask_length> is a decimal 1-31
|
||||
|
@ -1873,7 +1873,7 @@ read_subnets_file (const char *subnetspath)
|
|||
guint32 host_addr; /* IPv4 ONLY */
|
||||
int mask_length;
|
||||
|
||||
if ((hf = eth_fopen(subnetspath, "r")) == NULL)
|
||||
if ((hf = ws_fopen(subnetspath, "r")) == NULL)
|
||||
return FALSE;
|
||||
|
||||
while (fgetline(&line, &size, hf) >= 0) {
|
||||
|
@ -1892,7 +1892,7 @@ read_subnets_file (const char *subnetspath)
|
|||
}
|
||||
*cp2 = '\0'; /* Cut token */
|
||||
++cp2 ;
|
||||
|
||||
|
||||
/* Check if this is a valid IPv4 address */
|
||||
if (inet_pton(AF_INET, cp, &host_addr) != 1) {
|
||||
continue; /* no */
|
||||
|
@ -1901,7 +1901,7 @@ read_subnets_file (const char *subnetspath)
|
|||
mask_length = atoi(cp2);
|
||||
if(0 >= mask_length || mask_length > 31) {
|
||||
continue; /* invalid mask length */
|
||||
}
|
||||
}
|
||||
|
||||
if ((cp = strtok(NULL, " \t")) == NULL)
|
||||
continue; /* no subnet name */
|
||||
|
@ -1926,7 +1926,7 @@ static subnet_entry_t subnet_lookup(const guint32 addr)
|
|||
while(have_subnet_entry && i > 0) {
|
||||
guint32 masked_addr;
|
||||
subnet_length_entry_t* length_entry;
|
||||
|
||||
|
||||
/* Note that we run from 31 (length 32) to 0 (length 1) */
|
||||
--i;
|
||||
g_assert(i < SUBNETLENGTHSIZE);
|
||||
|
@ -1937,7 +1937,7 @@ static subnet_entry_t subnet_lookup(const guint32 addr)
|
|||
if(NULL != length_entry->subnet_addresses) {
|
||||
hashipv4_t * tp;
|
||||
guint32 hash_idx;
|
||||
|
||||
|
||||
masked_addr = addr & length_entry->mask;
|
||||
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_length = 0;
|
||||
subnet_entry.name = NULL;
|
||||
|
@ -2013,7 +2013,7 @@ static guint32 get_subnet_mask(guint32 mask_length) {
|
|||
|
||||
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
|
||||
* 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, "254.0.0.0", &masks[6]);
|
||||
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.192.0.0", &masks[9]);
|
||||
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.254.0.0", &masks[14]);
|
||||
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.192.0", &masks[17]);
|
||||
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.254.0", &masks[22]);
|
||||
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.192", &masks[25]);
|
||||
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.255", &masks[31]);
|
||||
}
|
||||
|
||||
|
||||
if(mask_length == 0 || mask_length > SUBNETLENGTHSIZE) {
|
||||
g_assert_not_reached();
|
||||
return 0;
|
||||
|
@ -2070,7 +2070,7 @@ static void subnet_name_lookup_init()
|
|||
guint32 i;
|
||||
for(i = 0; i < SUBNETLENGTHSIZE; ++i) {
|
||||
guint32 length = i + 1;
|
||||
|
||||
|
||||
subnet_length_entries[i].subnet_addresses = NULL;
|
||||
subnet_length_entries[i].mask_length = 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)
|
||||
{
|
||||
gchar *bp = ep_alloc(MAXNAMELEN);
|
||||
|
||||
|
||||
bp = &bp[MAXNAMELEN -1];
|
||||
|
||||
|
||||
*bp = 0;
|
||||
do {
|
||||
*--bp = (port % 10) +'0';
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <epan/uat.h>
|
||||
#include <epan/report_err.h>
|
||||
#include <epan/proto.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
typedef struct {
|
||||
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) {
|
||||
FILE* f = eth_fopen(filename,"w");
|
||||
FILE* f = ws_fopen(filename,"w");
|
||||
|
||||
if (!f) {
|
||||
*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
|
||||
* of m->text) into d->priv.
|
||||
*
|
||||
*
|
||||
* First we clone m->text into d->priv, this gets
|
||||
* us a NUL terminated string of the proper length.
|
||||
*
|
||||
* Then we loop copying bytes from m->priv into
|
||||
* d-priv. Since m->priv contains internal ACSII NULs
|
||||
* Then we loop copying bytes from m->priv into
|
||||
* d-priv. Since m->priv contains internal ACSII NULs
|
||||
* 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;
|
||||
while(oldText && *oldText) {
|
||||
*(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.
|
||||
*
|
||||
* The following copy clones the original m->parts
|
||||
* array into d->parts but then fixes-up the pointers
|
||||
* so that they point into the appropriate sections
|
||||
* array into d->parts but then fixes-up the pointers
|
||||
* so that they point into the appropriate sections
|
||||
* of the d->priv.
|
||||
*/
|
||||
|
||||
|
@ -623,26 +623,26 @@ void dfilter_macro_get_uat(void** p) {
|
|||
#ifdef DUMP_DFILTER_MACRO
|
||||
/*
|
||||
* The dfilter_macro_t has several characteristics that are
|
||||
* not immediattly obvious. The dump_dfilter_filter_macro_t()
|
||||
* function can be used to help "visualize" the contents of
|
||||
* not immediattly obvious. The dump_dfilter_filter_macro_t()
|
||||
* function can be used to help "visualize" the contents of
|
||||
* a dfilter_macro_t.
|
||||
*
|
||||
* Some non-obvious components of this struct include:
|
||||
*
|
||||
* 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
|
||||
* NULL to indicate the end of the parts pointer array.
|
||||
*
|
||||
* m->priv is a "cooked" copy of the m->text string.
|
||||
* Any variable substitution indicators within m->text
|
||||
* ("$1", "$2", ...) will have been replaced with ASCII
|
||||
* Any variable substitution indicators within m->text
|
||||
* ("$1", "$2", ...) will have been replaced with ASCII
|
||||
* NUL characters within m->priv.
|
||||
*
|
||||
* The first element of m->parts array (m-parts[0]) will
|
||||
* usually have the same pointer value as m->priv (unless
|
||||
* the dfilter-macro starts off with a variable
|
||||
* The first element of m->parts array (m-parts[0]) will
|
||||
* usually have the same pointer value as m->priv (unless
|
||||
* the dfilter-macro starts off with a variable
|
||||
* substitution indicator (e.g. "$1").
|
||||
*/
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include "emem.h"
|
||||
#include "diam_dict.h"
|
||||
#include "diam_dict_lex.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
typedef struct entity_t {
|
||||
char* name;
|
||||
|
@ -615,7 +615,7 @@ static FILE* ddict_open(const char* system_directory, const char* filename) {
|
|||
fname = strdup(filename);
|
||||
}
|
||||
|
||||
fh = eth_fopen(fname,"r");
|
||||
fh = ws_fopen(fname,"r");
|
||||
|
||||
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.
|
||||
* (%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
|
||||
* warnings by the Windows VC compiler).
|
||||
*/
|
||||
|
|
|
@ -301,7 +301,7 @@
|
|||
|
||||
#include "packet-giop.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;
|
||||
|
||||
|
||||
fp = eth_fopen(name,"r"); /* open read only */
|
||||
fp = ws_fopen(name,"r"); /* open read only */
|
||||
|
||||
if (fp == NULL) {
|
||||
if (errno == EACCES)
|
||||
|
@ -3785,17 +3785,17 @@ dissect_giop_fragment( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
|
|||
if (fragment_tree == NULL)
|
||||
{
|
||||
fragment_tree = proto_item_add_subtree (tf, ett_giop_fragment);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
|
||||
if (check_col(pinfo->cinfo, COL_INFO))
|
||||
{
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
|
||||
}
|
||||
}
|
||||
if (fragment_tree )
|
||||
{
|
||||
{
|
||||
proto_tree_add_uint (fragment_tree, hf_giop_req_id, tvb, offset-4, 4,request_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include <nettle/cbc.h>
|
||||
#endif
|
||||
#include <epan/strutil.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#endif
|
||||
|
||||
#include <epan/packet.h>
|
||||
|
@ -3218,7 +3218,7 @@ isakmp_init_protocol(void) {
|
|||
G_ALLOC_AND_FREE);
|
||||
if (logf)
|
||||
fclose(logf);
|
||||
logf = eth_fopen(pluto_log_path, "r");
|
||||
logf = ws_fopen(pluto_log_path, "r");
|
||||
|
||||
scan_pluto_log();
|
||||
#endif /* HAVE_LIBNETTLE */
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
#include <epan/dissectors/packet-gssapi.h>
|
||||
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#define UDP_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];
|
||||
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.
|
||||
* 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;
|
||||
|
||||
while (fread(buf, SERVICE_KEY_SIZE, 1, skf) == 1) {
|
||||
|
@ -838,7 +838,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo,
|
|||
ENDTRY;
|
||||
|
||||
if (do_continue) continue;
|
||||
|
||||
|
||||
data_len = item_len + offset - CONFOUNDER_PLUS_CHECKSUM;
|
||||
if ((int) item_len + offset > length) {
|
||||
tvb_free(encr_tvb);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <epan/emem.h>
|
||||
#include <epan/strutil.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
/*
|
||||
* Lookup tables
|
||||
|
@ -105,7 +105,7 @@ const value_string ssl_20_cipher_suites[] = {
|
|||
{ 0x000035, "TLS_RSA_WITH_AES_256_CBC_SHA" },
|
||||
{ 0x000036, "TLS_DH_DSS_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" },
|
||||
{ 0x00003A, "TLS_DH_anon_WITH_AES_256_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;
|
||||
gint major, minor, patch;
|
||||
gint i;
|
||||
|
||||
|
||||
#ifdef SSL_FAST
|
||||
gcry_mpi_t* rsa_params = g_malloc(sizeof(gcry_mpi_t)*RSA_PARS);
|
||||
#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:
|
||||
* our 'p' must be equal to 'q' as provided from openssl and viceversa
|
||||
*/
|
||||
*/
|
||||
|
||||
/* RSA get parameter */
|
||||
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
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* convert each rsa parameter to mpi format*/
|
||||
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) {
|
||||
|
@ -1865,7 +1865,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
|
|||
g_free(rsa_params);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
#ifdef SSL_FAST
|
||||
g_free(rsa_params);
|
||||
#endif
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1901,7 +1901,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key)
|
|||
}
|
||||
return rsa_priv_key;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
Ssl_private_key_t *
|
||||
|
@ -1920,7 +1920,7 @@ ssl_load_key(FILE* fp)
|
|||
private_key->x509_cert = 0;
|
||||
private_key->x509_pkey = 0;
|
||||
private_key->sexp_pkey = 0;
|
||||
|
||||
|
||||
/* init private key data*/
|
||||
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",
|
||||
key.size, bytes);
|
||||
g_free(private_key);
|
||||
g_free(key.data);
|
||||
g_free(key.data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1965,7 +1965,7 @@ ssl_load_key(FILE* fp)
|
|||
if ( !private_key->sexp_pkey ) {
|
||||
g_free(private_key);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return private_key;
|
||||
}
|
||||
|
||||
|
@ -2004,7 +2004,7 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
|
|||
private_key->x509_cert = 0;
|
||||
private_key->x509_pkey = 0;
|
||||
private_key->sexp_pkey = 0;
|
||||
|
||||
|
||||
rest = 4096;
|
||||
data.data = g_malloc(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); }
|
||||
|
||||
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); }
|
||||
|
||||
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_ENCRYPTED_KEY:
|
||||
|
||||
|
||||
ret = gnutls_x509_privkey_init(&ssl_pkey);
|
||||
if (ret < 0) {
|
||||
ssl_debug_printf( "gnutls_x509_privkey_init(&ssl_pkey) - %s\n", gnutls_strerror(ret));
|
||||
g_free(private_key);
|
||||
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);
|
||||
if (ret < 0) {
|
||||
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);
|
||||
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) {
|
||||
ssl_debug_printf( "gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len) - %s\n", gnutls_strerror(ret));
|
||||
return 0;
|
||||
}
|
||||
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);
|
||||
if ( !private_key->sexp_pkey ) {
|
||||
g_free(private_key);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: ;
|
||||
|
@ -2142,7 +2142,7 @@ ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) {
|
|||
} /* j */
|
||||
} /* i */
|
||||
|
||||
return private_key;
|
||||
return private_key;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2158,10 +2158,10 @@ void ssl_free_key(Ssl_private_key_t* key)
|
|||
|
||||
if (!key->x509_cert)
|
||||
gnutls_x509_crt_deinit (key->x509_cert);
|
||||
|
||||
|
||||
if (!key->x509_pkey)
|
||||
gnutls_x509_privkey_deinit(key->x509_pkey);
|
||||
|
||||
|
||||
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){
|
||||
fprintf(stderr, "association_add() could not find handle for protocol:%s\n",protocol);
|
||||
} else {
|
||||
if(port) {
|
||||
if(port) {
|
||||
if(tcp)
|
||||
dissector_add("tcp.port", port, handle);
|
||||
else
|
||||
|
@ -2605,33 +2605,33 @@ ssl_parse_key_list(const gchar * keys_list, GHashTable *key_hash, GTree* associa
|
|||
}
|
||||
*filename=0;
|
||||
filename++;
|
||||
|
||||
|
||||
cert_passwd = strchr(filename,',');
|
||||
if (cert_passwd)
|
||||
{
|
||||
*cert_passwd=0;
|
||||
cert_passwd++;
|
||||
cert_passwd++;
|
||||
}
|
||||
|
||||
|
||||
/* convert ip and port string to network rappresentation*/
|
||||
service = g_malloc(sizeof(SslService) + 4);
|
||||
service->addr.type = AT_IPv4;
|
||||
service->addr.len = 4;
|
||||
service->addr.data = ip = ((guchar*)service) + sizeof(SslService);
|
||||
|
||||
|
||||
/* remove all spaces in addr */
|
||||
read_index = 0;
|
||||
write_index = 0;
|
||||
|
||||
|
||||
while(addr[read_index]) {
|
||||
if (addr[read_index] != ' ') {
|
||||
addr[write_index] = addr[read_index];
|
||||
write_index++;
|
||||
}
|
||||
read_index++;
|
||||
}
|
||||
read_index++;
|
||||
}
|
||||
addr[write_index] = 0;
|
||||
|
||||
|
||||
if ( !strcmp("any", addr) || !strcmp("ANY", addr) ) {
|
||||
ip[0] = 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);
|
||||
|
||||
/* try to load pen or p12 file*/
|
||||
fp = eth_fopen(filename, "rb");
|
||||
fp = ws_fopen(filename, "rb");
|
||||
if (!fp) {
|
||||
fprintf(stderr, "can't open file %s \n",filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!cert_passwd) {
|
||||
private_key = ssl_load_key(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
fclose(fp);
|
||||
|
||||
ssl_debug_printf("ssl_init private key file %s successfully loaded\n",filename);
|
||||
|
||||
|
||||
/* if item exists, remove first */
|
||||
tmp_private_key = g_hash_table_lookup(key_hash, service);
|
||||
if (tmp_private_key) {
|
||||
g_hash_table_remove(key_hash, service);
|
||||
ssl_free_key(tmp_private_key);
|
||||
}
|
||||
}
|
||||
g_hash_table_insert(key_hash, service, private_key);
|
||||
|
||||
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))
|
||||
ssl_debug_file = NULL;
|
||||
else
|
||||
ssl_debug_file = eth_fopen(name, "w");
|
||||
ssl_debug_file = ws_fopen(name, "w");
|
||||
if (!use_stderr && ssl_debug_file)
|
||||
debug_file_must_be_closed = 1;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
#include "packet-x509if.h"
|
||||
#include "packet-ssl.h"
|
||||
#include "packet-ssl-utils.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
|
||||
static gboolean ssl_desegment = TRUE;
|
||||
|
@ -334,7 +334,7 @@ ssl_parse(void)
|
|||
if (ssl_keys_list && (ssl_keys_list[0] != 0))
|
||||
{
|
||||
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;
|
||||
fstat(fileno(ssl_keys_file), &statb);
|
||||
size = statb.st_size;
|
||||
|
@ -548,7 +548,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
else {
|
||||
SslService dummy;
|
||||
char ip_addr_any[] = {0,0,0,0};
|
||||
|
||||
|
||||
ssl_session = se_alloc0(sizeof(SslDecryptSession));
|
||||
ssl_session_init(ssl_session);
|
||||
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
|
||||
* Note that with HAVE_LIBGNUTLS undefined private_key is allways 0
|
||||
* and thus decryption never engaged*/
|
||||
|
||||
|
||||
|
||||
|
||||
ssl_session->private_key = 0;
|
||||
private_key = g_hash_table_lookup(ssl_key_hash, &dummy);
|
||||
|
||||
if (!private_key) {
|
||||
ssl_debug_printf("dissect_ssl can't find private key for this server! Try it again with universal port 0\n");
|
||||
|
||||
|
||||
dummy.port = 0;
|
||||
private_key = g_hash_table_lookup(ssl_key_hash, &dummy);
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
|
||||
dummy.addr.type = AT_IPv4;
|
||||
dummy.addr.len = 4;
|
||||
dummy.addr.data = ip_addr_any;
|
||||
|
||||
|
||||
dummy.port = port;
|
||||
|
||||
private_key = g_hash_table_lookup(ssl_key_hash, &dummy);
|
||||
}
|
||||
|
||||
|
||||
if (!private_key) {
|
||||
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;
|
||||
|
||||
|
@ -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);
|
||||
pinfo->fragmented = save_fragmented;
|
||||
}
|
||||
|
||||
|
||||
/* restore desegmentation ability */
|
||||
pinfo->can_desegment = save_can_desegment;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <epan/packet.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 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_tpncp[] = {
|
||||
{
|
||||
|
@ -618,8 +618,8 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info,
|
|||
current_data_id = data_id;
|
||||
}
|
||||
else {
|
||||
if ((current_tpncp_data_field_info->p_next =
|
||||
(tpncp_data_field_info *)g_malloc0(sizeof(tpncp_data_field_info)))
|
||||
if ((current_tpncp_data_field_info->p_next =
|
||||
(tpncp_data_field_info *)g_malloc0(sizeof(tpncp_data_field_info)))
|
||||
== NULL)
|
||||
return (-1);
|
||||
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());
|
||||
|
||||
/* 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);
|
||||
|
||||
fill_tpncp_id_vals(tpncp_events_id_vals, file);
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
/*
|
||||
* dtd_preparser.l
|
||||
*
|
||||
* an XML dissector for wireshark
|
||||
* an XML dissector for wireshark
|
||||
*
|
||||
* DTD Preparser - import a dtd file into a GString
|
||||
* including files, removing comments
|
||||
* and resolving %entities;
|
||||
*
|
||||
*
|
||||
* Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
|
||||
*
|
||||
* $Id$
|
||||
|
@ -43,24 +43,24 @@
|
|||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include "dtd.h"
|
||||
#include "dtd_preparse_lex.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#define ECHO g_string_append(current,yytext);
|
||||
|
||||
|
@ -135,7 +135,7 @@ newline \n
|
|||
<IN_COMMENT>[^-]? |
|
||||
<IN_COMMENT>[-] ;
|
||||
<IN_COMMENT>{comment_stop} { current = output; BEGIN OUTSIDE; }
|
||||
|
||||
|
||||
{newline} {
|
||||
linenum++;
|
||||
if (current) g_string_append_printf(current,"%s\n",location());
|
||||
|
@ -159,27 +159,27 @@ newline \n
|
|||
|
||||
static gchar* replace_entity(gchar* entity) {
|
||||
GString* replacement;
|
||||
|
||||
|
||||
*entity = '%';
|
||||
|
||||
|
||||
replacement = g_hash_table_lookup(entities,entity);
|
||||
|
||||
|
||||
if (replacement) {
|
||||
return replacement->str;
|
||||
} else {
|
||||
g_string_append_printf(error,"dtd_preparse: in file '%s': entity %s does not exists\n", filename, entity);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static const gchar* location(void) {
|
||||
static gchar* loc = NULL;
|
||||
|
||||
|
||||
if (loc) g_free(loc);
|
||||
|
||||
|
||||
loc = g_strdup_printf("<? wireshark:location %s:%u ?>", filename, linenum);
|
||||
|
||||
|
||||
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) {
|
||||
gchar* fullname = g_strdup_printf("%s%c%s",dname,G_DIR_SEPARATOR,fname);
|
||||
|
||||
|
||||
dtd_dirname = dname;
|
||||
filename = fname;
|
||||
linenum = 1;
|
||||
|
||||
yyin = eth_fopen(fullname,"r");
|
||||
|
||||
yyin = ws_fopen(fullname,"r");
|
||||
|
||||
if (!yyin) {
|
||||
if (err)
|
||||
g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,strerror(errno));
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
error = err;
|
||||
|
||||
|
||||
entities = g_hash_table_new(g_str_hash,g_str_equal);
|
||||
current = output = g_string_new(location());
|
||||
|
||||
|
||||
BEGIN OUTSIDE;
|
||||
|
||||
yylex();
|
||||
|
||||
|
||||
fclose(yyin);
|
||||
|
||||
|
||||
yyrestart(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.
|
||||
* (%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
|
||||
* warnings by the Windows VC compiler).
|
||||
*/
|
||||
|
|
11
epan/emem.c
11
epan/emem.c
|
@ -44,7 +44,6 @@
|
|||
#include <glib.h>
|
||||
#include <proto.h>
|
||||
#include "emem.h"
|
||||
#include <wiretap/file_util.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#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
|
||||
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.
|
||||
If the string is not a multiple of 4 characters in length the last
|
||||
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) {
|
||||
aligned[i/4] = tmp;
|
||||
tmp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* add required padding to the last uint32 */
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* add the terminator */
|
||||
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) {
|
||||
aligned[i/4] = tmp;
|
||||
tmp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* add required padding to the last uint32 */
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* add the terminator */
|
||||
aligned[div-1] = 0x00000001;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#include "filesystem.h"
|
||||
#include "privileges.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#define PROFILES_DIR "profiles"
|
||||
#define U3_MY_CAPTURES "\\My Captures"
|
||||
|
@ -195,7 +195,7 @@ test_for_directory(const char *path)
|
|||
{
|
||||
struct stat statb;
|
||||
|
||||
if (eth_stat(path, &statb) < 0)
|
||||
if (ws_stat(path, &statb) < 0)
|
||||
return errno;
|
||||
|
||||
if (S_ISDIR(statb.st_mode))
|
||||
|
@ -209,7 +209,7 @@ test_for_fifo(const char *path)
|
|||
{
|
||||
struct stat statb;
|
||||
|
||||
if (eth_stat(path, &statb) < 0)
|
||||
if (ws_stat(path, &statb) < 0)
|
||||
return errno;
|
||||
|
||||
if (S_ISFIFO(statb.st_mode))
|
||||
|
@ -975,12 +975,12 @@ delete_directory (const char *directory, char **pf_dir_path_return)
|
|||
gchar *filename;
|
||||
int ret = 0;
|
||||
|
||||
if ((dir = eth_dir_open(directory, 0, NULL)) != NULL) {
|
||||
while ((file = eth_dir_read_name(dir)) != NULL) {
|
||||
if ((dir = ws_dir_open(directory, 0, NULL)) != NULL) {
|
||||
while ((file = ws_dir_read_name(dir)) != NULL) {
|
||||
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) {
|
||||
ret = eth_remove(filename);
|
||||
ret = ws_remove(filename);
|
||||
#if 0
|
||||
} else {
|
||||
/* 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ rename_persconffile_profile(const char *fromname, const char *toname,
|
|||
char *to_dir = g_strdup (get_persconffile_dir(toname));
|
||||
int ret = 0;
|
||||
|
||||
ret = eth_rename (from_dir, to_dir);
|
||||
ret = ws_rename (from_dir, to_dir);
|
||||
if (ret != 0) {
|
||||
*pf_from_dir_path_return = g_strdup (from_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.
|
||||
*/
|
||||
pf_dir_path = get_profiles_dir ();
|
||||
if (eth_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
|
||||
ret = eth_mkdir(pf_dir_path, 0755);
|
||||
if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
|
||||
ret = ws_mkdir(pf_dir_path, 0755);
|
||||
if (ret == -1) {
|
||||
*pf_dir_path_return = g_strdup(pf_dir_path);
|
||||
return ret;
|
||||
|
@ -1071,7 +1071,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
|
|||
}
|
||||
|
||||
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
|
||||
/*
|
||||
* 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);
|
||||
if (pf_dir_parent_path_len > 0
|
||||
&& 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.
|
||||
*/
|
||||
ret = eth_mkdir(pf_dir_parent_path, 0755);
|
||||
ret = ws_mkdir(pf_dir_parent_path, 0755);
|
||||
if (ret == -1) {
|
||||
*pf_dir_path_return = pf_dir_parent_path;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
g_free(pf_dir_path_copy);
|
||||
ret = eth_mkdir(pf_dir_path, 0755);
|
||||
ret = ws_mkdir(pf_dir_path, 0755);
|
||||
#else
|
||||
ret = eth_mkdir(pf_dir_path, 0755);
|
||||
ret = ws_mkdir(pf_dir_path, 0755);
|
||||
#endif
|
||||
} else {
|
||||
/*
|
||||
|
@ -1268,7 +1268,7 @@ get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_
|
|||
}
|
||||
#ifdef _WIN32
|
||||
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
|
||||
* 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(
|
||||
"%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s",
|
||||
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.
|
||||
*/
|
||||
|
@ -1368,7 +1368,7 @@ get_datafile_path(const char *filename)
|
|||
gboolean
|
||||
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
|
||||
*/
|
||||
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) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
if (eth_stat(fname, &file_stat) != 0 && errno == ENOENT) {
|
||||
if (ws_stat(fname, &file_stat) != 0 && errno == ENOENT) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
|
@ -1543,9 +1543,9 @@ files_identical(const char *fname1, const char *fname2)
|
|||
/*
|
||||
* 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 */
|
||||
if (eth_stat(fname2, &filestat2) == -1)
|
||||
if (ws_stat(fname2, &filestat2) == -1)
|
||||
return FALSE; /* can't get info about the second file */
|
||||
return (filestat1.st_dev == filestat2.st_dev &&
|
||||
filestat1.st_ino == filestat2.st_ino);
|
||||
|
|
|
@ -254,10 +254,10 @@ dissect_per_sequence_of
|
|||
dissect_per_sequence
|
||||
dissect_per_set_of
|
||||
dissect_per_VisibleString
|
||||
dissect_q932_PartyNumber
|
||||
dissect_q932_PartySubaddress
|
||||
dissect_q932_PartyNumber
|
||||
dissect_q932_PartySubaddress
|
||||
dissect_q932_PresentedNumberUnscreened
|
||||
dissect_q932_PresentedNumberScreened
|
||||
dissect_q932_PresentedNumberScreened
|
||||
dissect_qsig_na_Name
|
||||
dissect_rpc_array
|
||||
dissect_rpc_bool
|
||||
|
@ -335,7 +335,6 @@ epan_dissect_run
|
|||
epan_get_version
|
||||
epan_init
|
||||
epan_strcasestr
|
||||
eth_stdio_fopen
|
||||
ether_to_str
|
||||
ex_opt_add
|
||||
ex_opt_count
|
||||
|
@ -634,7 +633,7 @@ proto_find_finfo
|
|||
proto_frame DATA
|
||||
proto_get_finfo_ptr_array
|
||||
proto_get_first_protocol_field
|
||||
proto_get_first_protocol
|
||||
proto_get_first_protocol
|
||||
proto_get_id
|
||||
proto_get_id_by_filter_name
|
||||
proto_get_next_protocol
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
#include "filesystem.h"
|
||||
#include "privileges.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include "report_err.h"
|
||||
|
||||
/* linked list of all plugins */
|
||||
|
@ -148,12 +148,12 @@ plugins_scan_dir(const char *dirname)
|
|||
gchar *dot;
|
||||
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
|
||||
|
@ -180,7 +180,7 @@ plugins_scan_dir(const char *dirname)
|
|||
continue;
|
||||
}
|
||||
version = gp;
|
||||
|
||||
|
||||
/*
|
||||
* Do we have a register routine?
|
||||
*/
|
||||
|
@ -263,7 +263,7 @@ plugins_scan_dir(const char *dirname)
|
|||
g_module_close(handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Do we have a register_wtap_module routine?
|
||||
*/
|
||||
|
@ -273,7 +273,7 @@ plugins_scan_dir(const char *dirname)
|
|||
} else {
|
||||
register_wtap_module = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Do we have a register_codec_module routine?
|
||||
*/
|
||||
|
@ -288,7 +288,7 @@ plugins_scan_dir(const char *dirname)
|
|||
* Does this dissector do anything useful?
|
||||
*/
|
||||
if (register_protoinfo == NULL &&
|
||||
register_tap_listener == NULL &&
|
||||
register_tap_listener == NULL &&
|
||||
register_wtap_module == NULL &&
|
||||
register_codec_module == NULL )
|
||||
{
|
||||
|
@ -319,9 +319,9 @@ plugins_scan_dir(const char *dirname)
|
|||
g_module_close(handle);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
eth_dir_close(dir);
|
||||
ws_dir_close(dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,9 +357,9 @@ init_plugins(void)
|
|||
*/
|
||||
plugin_dir = get_plugin_dir();
|
||||
if (running_in_build_directory()) {
|
||||
if ((dir = eth_dir_open(plugin_dir, 0, NULL)) != NULL) {
|
||||
while ((file = eth_dir_read_name(dir)) != NULL) {
|
||||
name = eth_dir_get_name(file);
|
||||
if ((dir = ws_dir_open(plugin_dir, 0, NULL)) != NULL) {
|
||||
while ((file = ws_dir_read_name(dir)) != NULL) {
|
||||
name = ws_dir_get_name(file);
|
||||
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
|
||||
continue; /* skip "." and ".." */
|
||||
/*
|
||||
|
@ -411,7 +411,7 @@ void
|
|||
register_all_plugin_registrations(void)
|
||||
{
|
||||
plugin *pt_plug;
|
||||
|
||||
|
||||
/*
|
||||
* For all plugins with register-handoff routines, call the routines.
|
||||
* This is called from "proto_init()"; it must be called after
|
||||
|
|
12
epan/prefs.c
12
epan/prefs.c
|
@ -46,7 +46,7 @@
|
|||
#include "cfile.h"
|
||||
#include <epan/column.h>
|
||||
#include "print.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <epan/prefs-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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
g_free(gpf_path);
|
||||
gpf_path = get_datafile_path(OLD_GPF_NAME);
|
||||
pf = eth_fopen(gpf_path, "r");
|
||||
pf = ws_fopen(gpf_path, "r");
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* 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. */
|
||||
*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
|
||||
* seen.
|
||||
|
@ -2562,7 +2562,7 @@ write_prefs(char **pf_path_return)
|
|||
|
||||
if (pf_path_return != NULL) {
|
||||
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;
|
||||
return errno;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include <epan/packet.h>
|
||||
#include <epan/dissectors/packet-radius.h>
|
||||
#include "radius_dict_lex.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
/* 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",
|
||||
directory,yytext);
|
||||
|
||||
yyin = eth_fopen( fullpaths[include_stack_ptr], "r" );
|
||||
yyin = ws_fopen( fullpaths[include_stack_ptr], "r" );
|
||||
|
||||
if (!yyin) {
|
||||
if (errno) {
|
||||
|
@ -382,7 +382,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
|
|||
|
||||
error = g_string_new("");
|
||||
|
||||
yyin = eth_fopen(fullpaths[include_stack_ptr],"r");
|
||||
yyin = ws_fopen(fullpaths[include_stack_ptr],"r");
|
||||
|
||||
if (!yyin) {
|
||||
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.
|
||||
* (%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
|
||||
* warnings by the Windows VC compiler).
|
||||
*/
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <epan/filesystem.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/range.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "uat-int.h"
|
||||
|
||||
|
@ -240,7 +240,7 @@ gboolean uat_save(uat_t* uat, char** error) {
|
|||
|
||||
if (! fname ) return FALSE;
|
||||
|
||||
fp = eth_fopen(fname,"w");
|
||||
fp = ws_fopen(fname,"w");
|
||||
|
||||
if (!fp) {
|
||||
*error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno));
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
#include <epan/emem.h>
|
||||
#include "uat-int.h"
|
||||
#include "uat_load_lex.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
/* 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);
|
||||
g_free(fname);
|
||||
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.
|
||||
* (%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
|
||||
* warnings by the Windows VC compiler).
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <epan/expert.h>
|
||||
#include <epan/ex-opt.h>
|
||||
#include <epan/privileges.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
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) {
|
||||
FILE* file;
|
||||
|
||||
if (! ( file = eth_fopen(filename,"r")) ) {
|
||||
if (! ( file = ws_fopen(filename,"r")) ) {
|
||||
report_open_failure(filename,errno,FALSE);
|
||||
return;
|
||||
}
|
||||
|
|
46
file.c
46
file.c
|
@ -74,7 +74,7 @@
|
|||
#include <epan/dissectors/packet-ber.h>
|
||||
#include <epan/timestamp.h>
|
||||
#include <epan/dfilter/dfilter-macro.h>
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
#include <epan/column-utils.h>
|
||||
#include <epan/strutil.h>
|
||||
#include <epan/emem.h>
|
||||
|
@ -327,7 +327,7 @@ cf_reset_state(capture_file *cf)
|
|||
if (cf->filename != NULL) {
|
||||
/* If it's a temporary file, remove it. */
|
||||
if (cf->is_tempfile)
|
||||
eth_unlink(cf->filename);
|
||||
ws_unlink(cf->filename);
|
||||
g_free(cf->filename);
|
||||
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_val = cf->cinfo.col_expr.col_expr_val;
|
||||
|
||||
|
||||
row = packet_list_append(cf->cinfo.col_data, fdata);
|
||||
|
||||
/* colorize packet: first apply color filters
|
||||
|
@ -1178,7 +1178,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
|
||||
if (*out_filenamep != NULL) {
|
||||
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)
|
||||
open_err = errno;
|
||||
} else {
|
||||
|
@ -1201,7 +1201,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
merge_max_snapshot_length(in_file_count, in_files),
|
||||
FALSE /* compressed */, &open_err);
|
||||
if (pdh == NULL) {
|
||||
eth_close(out_fd);
|
||||
ws_close(out_fd);
|
||||
merge_close_in_files(in_file_count, in_files);
|
||||
g_free(in_files);
|
||||
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;
|
||||
psp_return_t ret;
|
||||
|
||||
fh = eth_fopen(print_args->file, "w");
|
||||
fh = ws_fopen(print_args->file, "w");
|
||||
if (fh == NULL)
|
||||
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;
|
||||
psp_return_t ret;
|
||||
|
||||
fh = eth_fopen(print_args->file, "w");
|
||||
fh = ws_fopen(print_args->file, "w");
|
||||
if (fh == NULL)
|
||||
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;
|
||||
psp_return_t ret;
|
||||
|
||||
fh = eth_fopen(print_args->file, "w");
|
||||
fh = ws_fopen(print_args->file, "w");
|
||||
if (fh == NULL)
|
||||
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
|
||||
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)
|
||||
{
|
||||
FILE *fh = argsp;
|
||||
|
@ -2445,7 +2445,7 @@ cf_write_carrays_packets(capture_file *cf, print_args_t *print_args)
|
|||
FILE *fh;
|
||||
psp_return_t ret;
|
||||
|
||||
fh = eth_fopen(print_args->file, "w");
|
||||
fh = ws_fopen(print_args->file, "w");
|
||||
|
||||
if (fh == NULL)
|
||||
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
|
||||
told to print. */
|
||||
ret = process_specified_packets(cf, &print_args->range,
|
||||
ret = process_specified_packets(cf, &print_args->range,
|
||||
"Writing C Arrays",
|
||||
"selected packets", TRUE,
|
||||
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;
|
||||
first, try renaming the capture buffer file to the new name. */
|
||||
#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. */
|
||||
from_filename = NULL;
|
||||
do_copy = FALSE;
|
||||
|
@ -3928,7 +3928,7 @@ copy_binary_file(const char *from_filename, const char *to_filename)
|
|||
guint8 pd[65536];
|
||||
|
||||
/* 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) {
|
||||
open_failure_alert_box(from_filename, errno, FALSE);
|
||||
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
|
||||
to copy the raw bytes of the file, so we need the output file
|
||||
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) {
|
||||
open_failure_alert_box(to_filename, errno, TRUE);
|
||||
eth_close(from_fd);
|
||||
ws_close(from_fd);
|
||||
goto done;
|
||||
}
|
||||
|
||||
while ((nread = eth_read(from_fd, pd, sizeof pd)) > 0) {
|
||||
nwritten = eth_write(to_fd, pd, nread);
|
||||
while ((nread = ws_read(from_fd, pd, sizeof pd)) > 0) {
|
||||
nwritten = ws_write(to_fd, pd, nread);
|
||||
if (nwritten < nread) {
|
||||
if (nwritten < 0)
|
||||
err = errno;
|
||||
else
|
||||
err = WTAP_ERR_SHORT_WRITE;
|
||||
write_failure_alert_box(to_filename, err);
|
||||
eth_close(from_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(from_fd);
|
||||
ws_close(to_fd);
|
||||
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,
|
||||
"An error occurred while reading from the file \"%s\": %s.",
|
||||
from_filename, strerror(err));
|
||||
eth_close(from_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(from_fd);
|
||||
ws_close(to_fd);
|
||||
goto done;
|
||||
}
|
||||
eth_close(from_fd);
|
||||
if (eth_close(to_fd) < 0) {
|
||||
ws_close(from_fd);
|
||||
if (ws_close(to_fd) < 0) {
|
||||
write_failure_alert_box(to_filename, errno);
|
||||
goto done;
|
||||
}
|
||||
|
|
20
fileset.c
20
fileset.c
|
@ -51,7 +51,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
#include "globals.h"
|
||||
|
||||
#include <epan/filesystem.h>
|
||||
|
@ -77,7 +77,7 @@ fileset_filename_match_pattern(const char *fname)
|
|||
int baselen;
|
||||
int minlen = strlen("_00001_20050418010750");
|
||||
char *filename;
|
||||
|
||||
|
||||
|
||||
/* d:\dir1\test_00001_20050418010750.cap */
|
||||
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);
|
||||
|
||||
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) {
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
eth_close(fh);
|
||||
ws_close(fh);
|
||||
}
|
||||
|
||||
g_free(path);
|
||||
|
@ -255,22 +255,22 @@ fileset_add_dir(const char *fname)
|
|||
dirname = g_string_new(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);
|
||||
|
||||
/* is the current file probably a part of any fileset? */
|
||||
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 */
|
||||
if ((dir = eth_dir_open(dirname->str, 0, NULL)) != NULL) {
|
||||
while ((file = eth_dir_read_name(dir)) != NULL) {
|
||||
name = eth_dir_get_name(file);
|
||||
if ((dir = ws_dir_open(dirname->str, 0, NULL)) != NULL) {
|
||||
while ((file = ws_dir_read_name(dir)) != NULL) {
|
||||
name = ws_dir_get_name(file);
|
||||
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 */);
|
||||
}
|
||||
} /* while */
|
||||
|
||||
eth_dir_close(dir);
|
||||
ws_dir_close(dir);
|
||||
} /* if */
|
||||
} else {
|
||||
/* no, this is a "standalone file", just add this one */
|
||||
|
|
28
filters.c
28
filters.c
|
@ -40,7 +40,7 @@
|
|||
#include <epan/filesystem.h>
|
||||
|
||||
#include "filters.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
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?
|
||||
*/
|
||||
|
@ -169,7 +169,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
|
|||
*/
|
||||
g_free(ff_path);
|
||||
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?
|
||||
*/
|
||||
|
@ -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 */
|
||||
g_free(ff_path);
|
||||
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.
|
||||
|
@ -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. */
|
||||
/* this should never happen - this function is called only once for each list! */
|
||||
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. */
|
||||
|
@ -363,7 +363,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
|
|||
fclose(ff);
|
||||
g_free(filt_name);
|
||||
g_free(filt_expr);
|
||||
|
||||
|
||||
/* init the corresponding edited list */
|
||||
switch (list_type) {
|
||||
case CFILTER_LIST:
|
||||
|
@ -497,7 +497,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
|
|||
completely. */
|
||||
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;
|
||||
*errno_return = errno;
|
||||
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;
|
||||
*errno_return = errno;
|
||||
fclose(ff);
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
return;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
|
|||
if (fclose(ff) == EOF) {
|
||||
*pref_path_return = ff_path;
|
||||
*errno_return = errno;
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
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
|
||||
infer is the reason why the MSVC++ "rename()" doesn't do so.
|
||||
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's not there, we don't need to remove it, so we just
|
||||
drive on. */
|
||||
*pref_path_return = ff_path;
|
||||
*errno_return = errno;
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (eth_rename(ff_path_new, ff_path) < 0) {
|
||||
if (ws_rename(ff_path_new, ff_path) < 0) {
|
||||
*pref_path_return = ff_path;
|
||||
*errno_return = errno;
|
||||
eth_unlink(ff_path_new);
|
||||
ws_unlink(ff_path_new);
|
||||
g_free(ff_path_new);
|
||||
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 */
|
||||
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);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "../color_filters.h"
|
||||
#include "../merge.h"
|
||||
#include "../util.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/gtkglobals.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) {
|
||||
case(ESD_BTN_OK):
|
||||
/* save file */
|
||||
eth_unlink(cf_name);
|
||||
ws_unlink(cf_name);
|
||||
file_save_as_cb(NULL, data);
|
||||
break;
|
||||
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 */
|
||||
dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL,
|
||||
"%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_set_cb(dialog, file_save_as_exists_answered_cb, fs);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include <../alert_box.h>
|
||||
#include <../simple_dialog.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <gtk/dlg_utils.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;
|
||||
|
||||
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);
|
||||
if(to_fd == -1) { /* An error occurred */
|
||||
if (show_err)
|
||||
|
@ -134,15 +134,15 @@ eo_save_entry(gchar *save_as_filename, export_object_entry_t *entry, gboolean sh
|
|||
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)
|
||||
write_failure_alert_box(save_as_filename, errno);
|
||||
eth_close(to_fd);
|
||||
ws_close(to_fd);
|
||||
g_free(save_as_filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (eth_close(to_fd) < 0) {
|
||||
if (ws_close(to_fd) < 0) {
|
||||
if (show_err)
|
||||
write_failure_alert_box(save_as_filename, errno);
|
||||
g_free(save_as_filename);
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include <../alert_box.h>
|
||||
#include <../simple_dialog.h>
|
||||
#include <../util.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <gtk/main.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);
|
||||
fh = eth_fopen(to_name, "w");
|
||||
fh = ws_fopen(to_name, "w");
|
||||
if (fh == NULL) {
|
||||
open_failure_alert_box(to_name, errno, TRUE);
|
||||
g_free(to_name);
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include <../alert_box.h>
|
||||
#include <../simple_dialog.h>
|
||||
#include <../util.h>
|
||||
#include <wiretap/file_util.h>
|
||||
|
||||
#include <gtk/color_utils.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;
|
||||
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)
|
||||
return 0;
|
||||
|
||||
|
@ -95,10 +94,10 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_
|
|||
total_len = 0;
|
||||
appl_data = pi->appl_data;
|
||||
do {
|
||||
total_len += appl_data->plain_data.data_len;
|
||||
total_len += appl_data->plain_data.data_len;
|
||||
appl_data = appl_data->next;
|
||||
} while (appl_data);
|
||||
|
||||
|
||||
/* compute packet direction */
|
||||
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) &&
|
||||
follow_info->client_port == pinfo->srcport)
|
||||
rec->is_server = 0;
|
||||
else
|
||||
else
|
||||
rec->is_server = 1;
|
||||
|
||||
/* update stream counter */
|
||||
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_len = total_len;
|
||||
appl_data = pi->appl_data;
|
||||
p = rec->data.data;
|
||||
do {
|
||||
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;
|
||||
} while (appl_data);
|
||||
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;
|
||||
}
|
||||
|
||||
extern gboolean
|
||||
extern gboolean
|
||||
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);
|
||||
hostname1 = get_hostname(ipaddr);
|
||||
}
|
||||
|
||||
|
||||
port0 = get_tcp_port(stats.port[0]);
|
||||
port1 = get_tcp_port(stats.port[1]);
|
||||
|
||||
|
||||
follow_info->is_ipv6 = stats.is_ipv6;
|
||||
|
||||
/* Both Stream Directions */
|
||||
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]) {
|
||||
server_to_client_string =
|
||||
g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
|
||||
hostname0, port0,
|
||||
hostname1, port1,
|
||||
follow_info->bytes_written[0]);
|
||||
|
||||
|
||||
client_to_server_string =
|
||||
g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
|
||||
hostname1, port1,
|
||||
|
@ -265,14 +264,14 @@ follow_ssl_stream_cb(GtkWidget * w, gpointer data _U_)
|
|||
hostname1, port1,
|
||||
hostname0, port0,
|
||||
follow_info->bytes_written[0]);
|
||||
|
||||
|
||||
client_to_server_string =
|
||||
g_strdup_printf("%s:%s --> %s:%s (%u bytes)",
|
||||
hostname0, port0,
|
||||
hostname1, port1,
|
||||
follow_info->bytes_written[1]);
|
||||
}
|
||||
|
||||
|
||||
follow_stream("Follow SSL Stream", follow_info, both_directions_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;
|
||||
|
||||
iplen = (follow_info->is_ipv6) ? 16 : 4;
|
||||
|
||||
|
||||
for (cur = follow_info->payload; cur; cur = g_list_next(cur)) {
|
||||
SslDecryptedRecord* rec = cur->data;
|
||||
skip = FALSE;
|
||||
|
@ -334,7 +333,7 @@ follow_read_ssl_stream(follow_info_t *follow_info,
|
|||
if (!skip) {
|
||||
size_t nchars = rec->data.data_len;
|
||||
gchar *buffer = g_memdup(rec->data.data, nchars);
|
||||
|
||||
|
||||
frs_return = follow_show(follow_info, print_line, buffer, nchars,
|
||||
rec->is_server, arg, global_pos,
|
||||
&server_packet_count, &client_packet_count);
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <../isprint.h>
|
||||
#include <../print.h>
|
||||
#include <../simple_dialog.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <gtk/color_utils.h>
|
||||
#include <gtk/stock_icons.h>
|
||||
|
@ -476,7 +476,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
|
|||
print_mswin(print_dest);
|
||||
|
||||
/* trash temp file */
|
||||
eth_remove(print_dest);
|
||||
ws_remove(print_dest);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -495,7 +495,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
|
|||
#ifdef _WIN32
|
||||
if (win_printer) {
|
||||
/* trash temp file */
|
||||
eth_remove(print_dest);
|
||||
ws_remove(print_dest);
|
||||
}
|
||||
#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);
|
||||
if (follow_info->show_type == SHOW_RAW) {
|
||||
/* Write the data out as raw binary data */
|
||||
fh = eth_fopen(to_name, "wb");
|
||||
fh = ws_fopen(to_name, "wb");
|
||||
} else {
|
||||
/* Write it out as text */
|
||||
fh = eth_fopen(to_name, "w");
|
||||
fh = ws_fopen(to_name, "w");
|
||||
}
|
||||
if (fh == NULL) {
|
||||
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) {
|
||||
|
||||
case FOLLOW_TCP :
|
||||
i = eth_unlink(follow_info->data_out_filename);
|
||||
i = ws_unlink(follow_info->data_out_filename);
|
||||
if(i != 0) {
|
||||
g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, strerror(errno), errno);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "../alert_box.h"
|
||||
#include "../simple_dialog.h"
|
||||
#include "../tempfile.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/color_utils.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,
|
||||
"Could not create temporary file %s: %s",
|
||||
follow_info->data_out_filename, strerror(errno));
|
||||
eth_close(tmp_fd);
|
||||
eth_unlink(follow_info->data_out_filename);
|
||||
ws_close(tmp_fd);
|
||||
ws_unlink(follow_info->data_out_filename);
|
||||
g_free(follow_info);
|
||||
return;
|
||||
}
|
||||
|
@ -190,8 +190,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
|
|||
if (empty_tcp_stream) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"The packets in the capture file for that stream have no data.");
|
||||
eth_close(tmp_fd);
|
||||
eth_unlink(follow_info->data_out_filename);
|
||||
ws_close(tmp_fd);
|
||||
ws_unlink(follow_info->data_out_filename);
|
||||
g_free(follow_info);
|
||||
return;
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
|
|||
(unsigned long)sizeof(sc),
|
||||
(unsigned long)nchars);
|
||||
}
|
||||
eth_close(tmp_fd);
|
||||
eth_unlink(follow_info->data_out_filename);
|
||||
ws_close(tmp_fd);
|
||||
ws_unlink(follow_info->data_out_filename);
|
||||
g_free(follow_info);
|
||||
return;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ follow_read_tcp_stream(follow_info_t *follow_info,
|
|||
|
||||
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) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"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) {
|
||||
frs_return = follow_show(follow_info, print_line, buffer,
|
||||
nchars, is_server, arg, global_pos,
|
||||
nchars, is_server, arg, global_pos,
|
||||
&server_packet_count,
|
||||
&client_packet_count);
|
||||
if(frs_return == FRS_PRINT_ERROR) {
|
||||
fclose(data_out_file);
|
||||
data_out_file = NULL;
|
||||
return frs_return;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "../register.h"
|
||||
#include "../color.h"
|
||||
#include "../simple_dialog.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/gtkglobals.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;
|
||||
|
||||
of = eth_fopen(user_data->dlg.save_file,"w");
|
||||
of = ws_fopen(user_data->dlg.save_file,"w");
|
||||
if (of==NULL){
|
||||
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 */
|
||||
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){
|
||||
|
||||
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);
|
||||
gdk_gc_set_rgb_fg_color(user_data->dlg.bg_gc[i], &col[i]);
|
||||
}
|
||||
|
||||
|
||||
dialog_graph_redraw(user_data);
|
||||
|
||||
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) {
|
||||
guint i;
|
||||
|
||||
|
||||
if (node->type == AT_NONE) return NODE_OVERFLOW;
|
||||
|
||||
|
||||
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 (i == MAX_NUM_NODES) {
|
||||
return NODE_OVERFLOW;
|
||||
} 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;
|
||||
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);
|
||||
else
|
||||
gtk_widget_set_size_request(user_data->dlg.scroll_window, NODE_WIDTH*5, user_data->dlg.pixmap_height);
|
||||
|
||||
|
||||
/* redraw the graph */
|
||||
dialog_graph_redraw(user_data);
|
||||
dialog_graph_redraw(user_data);
|
||||
|
||||
window_present(user_data->dlg.window);
|
||||
return;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "epan/epan.h"
|
||||
|
||||
#include "../ui_util.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/gtkglobals.h"
|
||||
#include "gtk/gui_utils.h"
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <epan/prefs.h>
|
||||
|
||||
#include "../simple_dialog.h"
|
||||
#include "wiretap/file_util.h"
|
||||
|
||||
#include "gtk/help_dlg.h"
|
||||
#include "gtk/text_page_utils.h"
|
||||
|
|
18
gtk/main.c
18
gtk/main.c
|
@ -100,7 +100,7 @@
|
|||
#include "../alert_box.h"
|
||||
#include "../capture_ui_utils.h"
|
||||
#include "../log.h"
|
||||
#include "../wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
@ -1458,7 +1458,7 @@ main_cf_cb_file_safe_reload_finished(gpointer data _U_)
|
|||
set_menus_for_capture_file(&cfile);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
|
||||
{
|
||||
switch(event) {
|
||||
|
@ -2046,13 +2046,13 @@ main(int argc, char *argv[])
|
|||
recent_read_static(&rf_path, &rf_open_errno);
|
||||
if (rf_path != NULL && rf_open_errno != 0) {
|
||||
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));
|
||||
}
|
||||
recent_read_profile_static(&rf_path, &rf_open_errno);
|
||||
if (rf_path != NULL && rf_open_errno != 0) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -2398,7 +2398,7 @@ main(int argc, char *argv[])
|
|||
recent_read_dynamic(&rf_path, &rf_open_errno);
|
||||
if (rf_path != NULL && rf_open_errno != 0) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -2663,9 +2663,9 @@ create_console(void)
|
|||
create one and make it the standard input, output, and error. */
|
||||
if (!AllocConsole())
|
||||
return; /* couldn't create console */
|
||||
eth_freopen("CONIN$", "r", stdin);
|
||||
eth_freopen("CONOUT$", "w", stdout);
|
||||
eth_freopen("CONOUT$", "w", stderr);
|
||||
ws_freopen("CONIN$", "r", stdin);
|
||||
ws_freopen("CONOUT$", "w", stdout);
|
||||
ws_freopen("CONOUT$", "w", stderr);
|
||||
|
||||
/* Well, we have a console now. */
|
||||
has_console = TRUE;
|
||||
|
@ -3241,7 +3241,7 @@ void change_configuration_profile (const gchar *profile_name)
|
|||
recent_read_profile_static(&rf_path, &rf_open_errno);
|
||||
if (rf_path != NULL && rf_open_errno != 0) {
|
||||
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));
|
||||
}
|
||||
timestamp_set_type (recent.gui_time_format);
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "../simple_dialog.h"
|
||||
#include "../progress_dlg.h"
|
||||
#include "../ui_util.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/keys.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;
|
||||
if(i == data_len){
|
||||
/* 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) {
|
||||
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 {
|
||||
end_of_line = (byte_line_part_length == 0 ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (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);
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
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;
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
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);
|
||||
|
@ -777,7 +777,7 @@ copy_hex_cb(GtkWidget * w _U_, gpointer data _U_, copy_data_type data_type)
|
|||
|
||||
if(flags & CD_FLAGS_SELECTEDONLY) {
|
||||
int start, end;
|
||||
|
||||
|
||||
/* Get the start and end of the highlighted bytes.
|
||||
* XXX The keys appear to be REVERSED start <-> end throughout this file!
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
if(copy_buffer->len > 0) {
|
||||
copy_to_clipboard(copy_buffer);
|
||||
}
|
||||
|
||||
g_string_free(copy_buffer, TRUE);
|
||||
g_string_free(copy_buffer, TRUE);
|
||||
}
|
||||
|
||||
/* save the current highlighted hex data */
|
||||
|
@ -872,17 +872,17 @@ savehex_save_clicked_cb(GtkWidget * w _U_, gpointer data _U_)
|
|||
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) {
|
||||
open_failure_alert_box(file, errno, TRUE);
|
||||
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);
|
||||
eth_close(fd);
|
||||
ws_close(fd);
|
||||
return;
|
||||
}
|
||||
if (eth_close(fd) < 0) {
|
||||
if (ws_close(fd) < 0) {
|
||||
write_failure_alert_box(file, errno);
|
||||
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_get_start_iter(buf, &iter);
|
||||
g_object_ref(buf);
|
||||
g_object_ref(buf);
|
||||
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)) {
|
||||
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur,
|
||||
revstyle, NULL);
|
||||
|
||||
|
||||
cur = 0;
|
||||
}
|
||||
if (i < k) {
|
||||
|
@ -1214,12 +1214,12 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
|
|||
"plain", NULL);
|
||||
}
|
||||
gtk_text_view_set_buffer( bv_text_view, buf);
|
||||
|
||||
|
||||
if (mark) {
|
||||
gtk_text_view_scroll_to_mark(bv_text_view, mark, 0.0, TRUE, 1.0, 0.0);
|
||||
gtk_text_buffer_delete_mark(buf, mark);
|
||||
}
|
||||
g_object_unref(buf);
|
||||
g_object_unref(buf);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "capture_opts.h"
|
||||
#include "capture_ui_utils.h"
|
||||
#include "simple_dialog.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/gui_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);
|
||||
max_cnt = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS));
|
||||
|
||||
|
||||
/* get the current number of children */
|
||||
childs = gtk_container_get_children(GTK_CONTAINER(child_box));
|
||||
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);
|
||||
if(tooltip != NULL) {
|
||||
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, "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 */
|
||||
err = eth_stat(filename, &stat_buf);
|
||||
err = ws_stat(filename, &stat_buf);
|
||||
if(err == 0) {
|
||||
if (stat_buf.st_size/1024/1024 > 10) {
|
||||
g_string_append_printf(str, " %" G_GINT64_MODIFIER "dMB", (gint64) (stat_buf.st_size/1024/1024));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* mcast_stream.c
|
||||
*
|
||||
* 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>
|
||||
*
|
||||
* $Id$
|
||||
|
@ -54,7 +54,6 @@
|
|||
#include "../register.h"
|
||||
#include "../alert_box.h"
|
||||
#include "../simple_dialog.h"
|
||||
#include "wiretap/file_util.h"
|
||||
|
||||
#include "gtk/mcast_stream.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 */
|
||||
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);*/
|
||||
tmp_strinfo.npackets = 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 */
|
||||
if (tapinfo->npackets == 0) {
|
||||
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));
|
||||
tapinfo->allstreams->start_rel_sec = (guint32) pinfo->fd->rel_ts.secs;
|
||||
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);
|
||||
|
||||
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;
|
||||
/* check for buffer losses */
|
||||
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 */
|
||||
buffer[strinfo->element.last].tv_sec = (guint32) pinfo->fd->rel_ts.secs;
|
||||
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)){
|
||||
strinfo->element.first++;
|
||||
if(strinfo->element.first >= buffsize) strinfo->element.first = strinfo->element.first % buffsize;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "../simple_dialog.h"
|
||||
#include "../tempfile.h"
|
||||
#include "../util.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/gtkglobals.h"
|
||||
#include "gtk/keys.h"
|
||||
|
@ -456,7 +456,7 @@ export_carrays_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
/* init the printing 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);
|
||||
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! */
|
||||
tmp_oldfile = args->file;
|
||||
args->file = g_strdup(tmp_namebuf);
|
||||
eth_unlink(args->file);
|
||||
ws_unlink(args->file);
|
||||
args->to_file = TRUE;
|
||||
#else
|
||||
g_free(args->cmd);
|
||||
|
@ -1104,7 +1104,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
|
|||
print_mswin(args->file);
|
||||
|
||||
/* trash temp file */
|
||||
eth_remove(args->file);
|
||||
ws_remove(args->file);
|
||||
|
||||
/* restore old settings */
|
||||
args->to_file = FALSE;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <winspool.h>
|
||||
|
||||
#include "gtk/print_win32.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
/*
|
||||
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
|
||||
structure contains a pLocation string pointer, along with other
|
||||
information.
|
||||
|
||||
|
||||
"PrinterProperties", could be used to show a native printer property page?!?
|
||||
|
||||
See
|
||||
|
||||
|
||||
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 );
|
||||
|
@ -123,15 +123,15 @@ void print_mswin(char *file_name)
|
|||
memset( &pdlg, 0, sizeof( PRINTDLG ) );
|
||||
pdlg.lStructSize = sizeof( PRINTDLG );
|
||||
/* Set the flag to return printer DC. */
|
||||
pdlg.Flags =
|
||||
pdlg.Flags =
|
||||
/* return the device context we need */
|
||||
PD_RETURNDC |
|
||||
PD_RETURNDC |
|
||||
/* disable the "Pages" radio button */
|
||||
PD_NOPAGENUMS |
|
||||
PD_NOPAGENUMS |
|
||||
/* disable the "Selection" radio button */
|
||||
PD_NOSELECTION |
|
||||
PD_NOSELECTION |
|
||||
/* let device print multiple pages (if requested) */
|
||||
PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
|
||||
/* Invoke the printer dialog box. */
|
||||
PrintDlg( &pdlg );
|
||||
|
@ -186,7 +186,7 @@ void print_file( char *file_name, HDC hdc) {
|
|||
SetMapMode (hdc, MM_TEXT);
|
||||
|
||||
|
||||
fh1 = eth_fopen( file_name, "r" );
|
||||
fh1 = ws_fopen( file_name, "r" );
|
||||
if( !fh1 ) {
|
||||
perror( "open failed on input file" );
|
||||
return;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <epan/prefs.h>
|
||||
|
||||
#include "../simple_dialog.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/main.h"
|
||||
#include "gtk/profile_dlg.h"
|
||||
|
@ -116,16 +116,16 @@ empty_profile_list(gboolean edit_list)
|
|||
while(*flpp) {
|
||||
*flpp = remove_profile_entry(*flpp, g_list_first(*flpp));
|
||||
}
|
||||
|
||||
|
||||
g_assert(g_list_length(*flpp) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
flpp = ¤t_profiles;
|
||||
|
||||
while(*flpp) {
|
||||
*flpp = remove_profile_entry(*flpp, g_list_first(*flpp));
|
||||
}
|
||||
|
||||
|
||||
g_assert(g_list_length(*flpp) == 0);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ copy_profile_list(void)
|
|||
while(flp_src) {
|
||||
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);
|
||||
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 *profiles_dir, *name;
|
||||
gchar *filename;
|
||||
|
||||
|
||||
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));
|
||||
|
||||
|
||||
fl_entry = add_to_profile_list(DEFAULT_PROFILE, DEFAULT_PROFILE, PROF_STAT_DEFAULT);
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter, 0, DEFAULT_PROFILE, 1, fl_entry, -1);
|
||||
if (strcmp (profile_name, DEFAULT_PROFILE)==0) {
|
||||
l_select = g_memdup(&iter, sizeof(iter));
|
||||
}
|
||||
|
||||
|
||||
/* fill in data */
|
||||
profiles_dir = get_profiles_dir();
|
||||
if ((dir = eth_dir_open(profiles_dir, 0, NULL)) != NULL) {
|
||||
while ((file = eth_dir_read_name(dir)) != NULL) {
|
||||
name = eth_dir_get_name(file);
|
||||
if ((dir = ws_dir_open(profiles_dir, 0, NULL)) != NULL) {
|
||||
while ((file = ws_dir_read_name(dir)) != NULL) {
|
||||
name = ws_dir_get_name(file);
|
||||
filename = g_strdup_printf ("%s%s%s", profiles_dir, G_DIR_SEPARATOR_S, name);
|
||||
|
||||
if (test_for_directory(filename) == EISDIR) {
|
||||
|
@ -187,7 +187,7 @@ fill_list(GtkWidget *main_w)
|
|||
profile = (profile_def *) fl_entry->data;
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter, 0, profile->name, 1, fl_entry, -1);
|
||||
|
||||
|
||||
if (profile->name) {
|
||||
if (strcmp(profile_name, profile->name) == 0) {
|
||||
/*
|
||||
|
@ -201,12 +201,12 @@ fill_list(GtkWidget *main_w)
|
|||
}
|
||||
g_free (filename);
|
||||
}
|
||||
eth_dir_close (dir);
|
||||
ws_dir_close (dir);
|
||||
}
|
||||
|
||||
/* Make the current list an the edited list equal */
|
||||
copy_profile_list ();
|
||||
|
||||
|
||||
return l_select;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ profile_select(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
|
|||
/* The new profile exists, change */
|
||||
change_configuration_profile (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 */
|
||||
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,
|
||||
"Can't create directory\n\"%s\":\n%s.",
|
||||
pf_dir_path, strerror(errno));
|
||||
|
||||
|
||||
g_free(pf_dir_path);
|
||||
}
|
||||
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,
|
||||
"Can't rename directory\n\"%s\" to\n\"%s\":\n%s.",
|
||||
pf_dir_path, pf_dir_path2, strerror(errno));
|
||||
|
||||
|
||||
g_free(pf_dir_path);
|
||||
}
|
||||
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);
|
||||
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.
|
||||
*/
|
||||
|
@ -587,7 +587,7 @@ profile_name_te_changed_cb(GtkWidget *w, gpointer data _U_)
|
|||
gtk_tree_model_get(model, &iter, 1, &fl_entry, -1);
|
||||
if (fl_entry != NULL) {
|
||||
profile = (profile_def *) fl_entry->data;
|
||||
|
||||
|
||||
if (strlen(name) > 0 && profile) {
|
||||
if (profile->status != PROF_STAT_DEFAULT) {
|
||||
g_free(profile->name);
|
||||
|
@ -662,16 +662,16 @@ profile_dialog_new(void)
|
|||
GtkTreeViewColumn *column;
|
||||
GtkTreeSelection *sel;
|
||||
GtkTreeIter *l_select;
|
||||
|
||||
|
||||
/* 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
|
||||
routines. */
|
||||
|
||||
|
||||
tooltips = gtk_tooltips_new ();
|
||||
|
||||
|
||||
main_w = dlg_conf_window_new("Wireshark: Configuration Profiles");
|
||||
gtk_window_set_default_size(GTK_WINDOW(main_w), 400, 400);
|
||||
|
||||
|
||||
main_vb = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
|
||||
gtk_container_add(GTK_CONTAINER(main_w), main_vb);
|
||||
|
|
14
gtk/recent.c
14
gtk/recent.c
|
@ -40,7 +40,7 @@
|
|||
#include <epan/column.h>
|
||||
|
||||
#include "../simple_dialog.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/recent.h"
|
||||
#include "gtk/main.h"
|
||||
|
@ -154,7 +154,7 @@ write_recent(void)
|
|||
}
|
||||
|
||||
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,
|
||||
"Can't open recent file\n\"%s\": %s.", rf_path,
|
||||
strerror(errno));
|
||||
|
@ -265,7 +265,7 @@ write_profile_recent(void)
|
|||
}
|
||||
|
||||
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,
|
||||
"Can't open recent file\n\"%s\": %s.", rf_path,
|
||||
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. */
|
||||
*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. */
|
||||
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. */
|
||||
*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. */
|
||||
read_prefs_file(rf_path, rf, read_set_recent_pair_static, NULL);
|
||||
fclose(rf);
|
||||
if (!recent.has_recent_common) {
|
||||
/* 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);
|
||||
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. */
|
||||
*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. */
|
||||
read_prefs_file(rf_path, rf, read_set_recent_pair_dynamic, NULL);
|
||||
/* set dfilter combobox to have an empty line */
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#include "../progress_dlg.h"
|
||||
#include "../color.h"
|
||||
#include "../tempfile.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/gtkglobals.h"
|
||||
#include "gtk/dlg_utils.h"
|
||||
|
@ -350,10 +350,10 @@ rtp_reset(void *user_data_arg)
|
|||
fclose(user_data->forward.saveinfo.fp);
|
||||
if (user_data->reversed.saveinfo.fp != NULL)
|
||||
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)
|
||||
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)
|
||||
user_data->reversed.saveinfo.error_type = TAP_RTP_FILE_OPEN_ERROR;
|
||||
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)
|
||||
fclose(user_data->reversed.saveinfo.fp);
|
||||
/*XXX: test for error **/
|
||||
eth_remove(user_data->f_tempname);
|
||||
eth_remove(user_data->r_tempname);
|
||||
ws_remove(user_data->f_tempname);
|
||||
ws_remove(user_data->r_tempname);
|
||||
|
||||
/* destroy save_voice_as window if open */
|
||||
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");
|
||||
|
||||
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) {
|
||||
open_failure_alert_box(g_dest, errno, TRUE);
|
||||
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(both)->active) {
|
||||
fp = eth_fopen(g_dest, "a");
|
||||
fp = ws_fopen(g_dest, "a");
|
||||
if (fp == NULL) {
|
||||
open_failure_alert_box(g_dest, errno, TRUE);
|
||||
return;
|
||||
|
@ -1935,7 +1935,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
fp = eth_fopen(g_dest, "w");
|
||||
fp = ws_fopen(g_dest, "w");
|
||||
if (fp == NULL) {
|
||||
open_failure_alert_box(g_dest, errno, TRUE);
|
||||
return;
|
||||
|
@ -2099,20 +2099,20 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
gboolean stop_flag = FALSE;
|
||||
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)
|
||||
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) {
|
||||
eth_close(forw_fd);
|
||||
ws_close(forw_fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
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 */
|
||||
/* the magic word 0x2e736e64 == .snd */
|
||||
phtonl(pd, 0x2e736e64);
|
||||
nchars=eth_write(to_fd, pd, 4);
|
||||
nchars=ws_write(to_fd, pd, 4);
|
||||
/* header offset == 24 bytes */
|
||||
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 */
|
||||
phtonl(pd, -1);
|
||||
nchars=eth_write(to_fd, pd, 4);
|
||||
nchars=ws_write(to_fd, pd, 4);
|
||||
/* encoding format == 16-bit linear PCM */
|
||||
phtonl(pd, 3);
|
||||
nchars=eth_write(to_fd, pd, 4);
|
||||
nchars=ws_write(to_fd, pd, 4);
|
||||
/* sample rate == 8000 Hz */
|
||||
phtonl(pd, 8000);
|
||||
nchars=eth_write(to_fd, pd, 4);
|
||||
nchars=ws_write(to_fd, pd, 4);
|
||||
/* channels == 1 */
|
||||
phtonl(pd, 1);
|
||||
nchars=eth_write(to_fd, pd, 4);
|
||||
nchars=ws_write(to_fd, pd, 4);
|
||||
|
||||
|
||||
switch (channels) {
|
||||
|
@ -2165,18 +2165,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
phtons(pd, sample);
|
||||
}
|
||||
else{
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fwritten = eth_write(to_fd, pd, 2);
|
||||
fwritten = ws_write(to_fd, pd, 2);
|
||||
if ((fwritten < 2) || (fwritten < 0) || (fread < 0)) {
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2206,18 +2206,18 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
phtons(pd, sample);
|
||||
}
|
||||
else{
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rwritten = eth_write(to_fd, pd, 2);
|
||||
rwritten = ws_write(to_fd, pd, 2);
|
||||
if ((rwritten < 2) || (rwritten < 0) || (rread < 0)) {
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2291,19 +2291,19 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
}
|
||||
else
|
||||
{
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
rwritten = eth_write(to_fd, pd, 2);
|
||||
rwritten = ws_write(to_fd, pd, 2);
|
||||
if ((rwritten < 2) || (rread < 0) || (fread < 0)) {
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2330,9 +2330,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2351,12 +2351,12 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
}
|
||||
count++;
|
||||
|
||||
rwritten = eth_write(to_fd, pd, 1);
|
||||
rwritten = ws_write(to_fd, pd, 1);
|
||||
|
||||
if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
destroy_progress_dlg(progbar);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2364,9 +2364,9 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
}
|
||||
|
||||
destroy_progress_dlg(progbar);
|
||||
eth_close(forw_fd);
|
||||
eth_close(rev_fd);
|
||||
eth_close(to_fd);
|
||||
ws_close(forw_fd);
|
||||
ws_close(rev_fd);
|
||||
ws_close(to_fd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3026,7 +3026,7 @@ static void create_rtp_dialog(user_data_t* user_data)
|
|||
gtk_container_add(GTK_CONTAINER(main_vb), 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);
|
||||
|
||||
/* page for forward connection */
|
||||
|
@ -3276,10 +3276,10 @@ void rtp_analysis(
|
|||
/*XXX: check for errors*/
|
||||
fd = create_tempfile(user_data->f_tempname, sizeof(user_data->f_tempname),
|
||||
"ether_rtp_f");
|
||||
eth_close(fd);
|
||||
ws_close(fd);
|
||||
fd = create_tempfile(user_data->r_tempname, sizeof(user_data->r_tempname),
|
||||
"ether_rtp_r");
|
||||
eth_close(fd);
|
||||
ws_close(fd);
|
||||
user_data->forward.saveinfo.fp = NULL;
|
||||
user_data->reversed.saveinfo.fp = NULL;
|
||||
user_data->dlg.save_voice_as_w = NULL;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "../alert_box.h"
|
||||
#include "../simple_dialog.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_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;
|
||||
/* 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) {
|
||||
open_failure_alert_box(filename, errno, TRUE);
|
||||
return FALSE;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "epan/filesystem.h"
|
||||
|
||||
#include "../simple_dialog.h"
|
||||
#include "wiretap/file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "gtk/text_page_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);
|
||||
gtk_container_border_width(GTK_CONTAINER(page_vb), 1);
|
||||
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_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;
|
||||
char line[4096+1]; /* XXX - size? */
|
||||
|
||||
text_file = eth_fopen(absolute_path, "r");
|
||||
text_file = ws_fopen(absolute_path, "r");
|
||||
if (text_file != NULL) {
|
||||
while (fgets(line, sizeof line, text_file) != NULL) {
|
||||
text_page_insert(page, line, strlen(line));
|
||||
|
|
38
gtk/u3.c
38
gtk/u3.c
|
@ -46,7 +46,7 @@
|
|||
#include <process.h> /* getpid */
|
||||
#endif
|
||||
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.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);
|
||||
|
||||
gboolean u3_active()
|
||||
gboolean u3_active()
|
||||
{
|
||||
|
||||
return (
|
||||
|
@ -69,7 +69,7 @@ gboolean u3_active()
|
|||
getenv_utf8
|
||||
#else
|
||||
getenv
|
||||
#endif
|
||||
#endif
|
||||
("U3_HOST_EXEC_PATH") != NULL);
|
||||
|
||||
}
|
||||
|
@ -80,12 +80,12 @@ void u3_runtime_info(GString *str)
|
|||
char *u3devicepath = NULL;
|
||||
char *u3deviceproduct = NULL;
|
||||
|
||||
if((u3deviceproduct =
|
||||
if((u3deviceproduct =
|
||||
#ifdef _WIN32
|
||||
getenv_utf8
|
||||
#else
|
||||
getenv
|
||||
#endif
|
||||
#endif
|
||||
("U3_DEVICE_PRODUCT")) != NULL) {
|
||||
g_string_append(str, " from the ");
|
||||
g_string_append(str, u3deviceproduct);
|
||||
|
@ -95,12 +95,12 @@ void u3_runtime_info(GString *str)
|
|||
|
||||
g_string_append(str, " U3 device");
|
||||
|
||||
if((u3devicepath =
|
||||
if((u3devicepath =
|
||||
#ifdef _WIN32
|
||||
getenv_utf8
|
||||
#else
|
||||
getenv
|
||||
#endif
|
||||
#endif
|
||||
("U3_DEVICE_PATH")) != NULL) {
|
||||
g_string_append(str, " in drive ");
|
||||
g_string_append(str, u3devicepath);
|
||||
|
@ -114,13 +114,13 @@ void u3_register_pid()
|
|||
int pid_fd;
|
||||
char *u3hostexecpath;
|
||||
int pf_size;
|
||||
|
||||
if((u3hostexecpath =
|
||||
|
||||
if((u3hostexecpath =
|
||||
#ifdef _WIN32
|
||||
getenv_utf8
|
||||
#else
|
||||
getenv
|
||||
#endif
|
||||
#endif
|
||||
("U3_HOST_EXEC_PATH")) != NULL) {
|
||||
|
||||
pid = getpid();
|
||||
|
@ -130,10 +130,10 @@ void u3_register_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)
|
||||
eth_close(pid_fd);
|
||||
ws_close(pid_fd);
|
||||
else {
|
||||
g_free(pid_file);
|
||||
pid_file = NULL;
|
||||
|
@ -146,8 +146,8 @@ void u3_deregister_pid()
|
|||
{
|
||||
if(pid_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);
|
||||
|
||||
pid_file = NULL;
|
||||
|
@ -166,20 +166,20 @@ char *u3_contract_device_path(char *path)
|
|||
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) {
|
||||
/* cache the device path */
|
||||
u3devicepath =
|
||||
u3devicepath =
|
||||
#ifdef _WIN32
|
||||
getenv_utf8
|
||||
#else
|
||||
getenv
|
||||
#endif
|
||||
#endif
|
||||
("U3_DEVICE_PATH");
|
||||
}
|
||||
|
||||
|
||||
if(new == NULL)
|
||||
new = u3devicepath;
|
||||
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)) {
|
||||
|
||||
|
||||
newpath = g_strconcat(new, path + strlen(old), NULL);
|
||||
|
||||
return newpath;
|
||||
|
|
10
mergecap.c
10
mergecap.c
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "svnversion.h"
|
||||
#include "merge.h"
|
||||
#include "file_util.h"
|
||||
#include "wsutil/file_util.h"
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
|
@ -308,19 +308,19 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* open the outfile */
|
||||
if (strncmp(out_filename, "-", 2) == 0) {
|
||||
if (strncmp(out_filename, "-", 2) == 0) {
|
||||
/* use stdout as the outfile */
|
||||
out_fd = 1 /*stdout*/;
|
||||
} else {
|
||||
/* 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) {
|
||||
fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n",
|
||||
out_filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* prepare the outfile */
|
||||
pdh = wtap_dump_fdopen(out_fd, file_type, frame_type, snaplen, FALSE /* compressed */, &open_err);
|
||||
if (pdh == NULL) {
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#ifndef __set_errno
|
||||
#define __set_errno(x) errno=(x)
|
||||
|
@ -76,7 +76,7 @@ mkstemp (template)
|
|||
|
||||
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)
|
||||
return fd;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,16 +9,16 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!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)
|
||||
|
||||
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
|
||||
|
@ -93,12 +93,12 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
# TODO: Fix api's :)
|
||||
# $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
#include <epan/dissectors/packet-tcp.h>
|
||||
#include <epan/oids.h>
|
||||
#include <plugins/asn1/asn1.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#ifdef DISSECTOR_WITH_GUI
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -2797,7 +2797,7 @@ static char eol[] = "\r\n";
|
|||
(void) log_domain; (void) log_level; (void) user_data; /* make references */
|
||||
|
||||
if (logf == NULL && asn1_logfile) {
|
||||
logf = eth_fopen(asn1_logfile, "w");
|
||||
logf = ws_fopen(asn1_logfile, "w");
|
||||
}
|
||||
if (logf) {
|
||||
fputs(message, logf);
|
||||
|
@ -2818,7 +2818,7 @@ read_asn1_type_table(const char *filename)
|
|||
if ((filename == 0) || (strlen(filename) == 0))
|
||||
return; /* no filename provided */
|
||||
|
||||
f = eth_fopen(filename, "rb");
|
||||
f = ws_fopen(filename, "rb");
|
||||
if (f == 0) {
|
||||
/*
|
||||
* 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,
|
||||
G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
namelist = eth_fopen("namelist.txt", "w");
|
||||
namelist = ws_fopen("namelist.txt", "w");
|
||||
build_tree_view(model, PDUtree, NULL);
|
||||
fclose(namelist);
|
||||
namelist = 0;
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,14 +9,14 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
CPPFLAGS = $(CFLAGS) -TP
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CPPFLAGS) -Fd$(PLUGIN_NAME).pdb -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!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) \
|
||||
$(GLIB_LIBS) $(CODEC_LIBS) $(RESOURCE)
|
||||
|
||||
easy_codec_plugin.obj : easy_codec_plugin.c
|
||||
$(CC) $(CFLAGS) -Fd$(PLUGIN_NAME).pdb -c easy_codec_plugin.c
|
||||
easy_codec_plugin.obj : easy_codec_plugin.c
|
||||
$(CC) $(CFLAGS) -Fd$(PLUGIN_NAME).pdb -c easy_codec_plugin.c
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
@ -63,5 +63,5 @@ distclean: clean
|
|||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,7 +9,7 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -6,7 +6,7 @@ include ..\..\config.nmake
|
|||
|
||||
############### 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)
|
||||
|
||||
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
|
||||
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)
|
||||
link -dll /out:cosnaming.dll $(LDFLAGS) packet-cosnaming.obj $(LINK_PLUGIN_WITH) \
|
||||
|
@ -44,16 +44,16 @@ clean:
|
|||
parlay.dll parlay.exp parlay.lib *.pdb \
|
||||
cosnaming.dll.manifest coseventcomm.dll.manifest \
|
||||
parlay.dll.manifest tango.dll.manifest
|
||||
|
||||
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl \
|
||||
packet-cosnaming.c \
|
||||
packet-coseventcomm.c \
|
||||
packet-tango.c \
|
||||
packet-parlay.c
|
||||
packet-parlay.c
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,7 +9,7 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
@ -89,11 +89,11 @@ plugin.c: $(DISSECTOR_SRC) ../../tools/make-dissector-reg.py ../../tools/make-di
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -13,7 +13,7 @@ include Makefile.common
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
|
@ -22,7 +22,7 @@ CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\
|
|||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!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)
|
||||
|
||||
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
|
||||
|
@ -97,7 +97,7 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(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,
|
||||
# "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.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:
|
||||
cd ../../tools/lemon
|
||||
$(MAKE) /$(MAKEFLAGS) -f makefile.nmake
|
||||
cd ../../plugins/mate
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%include {
|
||||
|
||||
/* mate_grammar.lemon
|
||||
* MATE's configuration language grammar
|
||||
* MATE's configuration language grammar
|
||||
*
|
||||
* 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "mate.h"
|
||||
#include "mate_grammar.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#define DUMMY void*
|
||||
|
||||
|
@ -68,7 +68,7 @@ typedef struct _gog_statements {
|
|||
typedef struct _transf_match_t {
|
||||
avpl_match_mode match_mode;
|
||||
AVPL* avpl;
|
||||
} transf_match_t;
|
||||
} transf_match_t;
|
||||
|
||||
typedef struct _transf_action_t {
|
||||
avpl_replace_mode replace_mode;
|
||||
|
@ -81,13 +81,13 @@ static void configuration_error(mate_config* mc, const gchar* fmt, ...) {
|
|||
gint i;
|
||||
mate_config_frame* current_frame;
|
||||
va_list list;
|
||||
|
||||
|
||||
va_start( list, fmt );
|
||||
g_vsnprintf(error_buffer,sizeof(error_buffer),fmt,list);
|
||||
va_end( list );
|
||||
|
||||
i = (gint) mc->config_stack->len;
|
||||
|
||||
|
||||
while (i--) {
|
||||
|
||||
if (i>0) {
|
||||
|
@ -95,30 +95,30 @@ static void configuration_error(mate_config* mc, const gchar* fmt, ...) {
|
|||
} else {
|
||||
incl = " ";
|
||||
}
|
||||
|
||||
|
||||
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\n",error_buffer);
|
||||
|
||||
|
||||
THROW(MateConfigError);
|
||||
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
||||
t->name = NULL;
|
||||
t->match = match;
|
||||
t->replace = replace;
|
||||
t->match_mode = match_mode;
|
||||
t->replace_mode = replace_mode;
|
||||
|
||||
|
||||
t->map = NULL;
|
||||
t->next = NULL;
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -128,12 +128,12 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
|
|||
gchar* r;
|
||||
guint i,v;
|
||||
gchar c;
|
||||
|
||||
|
||||
vec = g_strsplit(s,":",0);
|
||||
|
||||
|
||||
for (i = 0; vec[i]; i++) {
|
||||
g_strdown(vec[i]);
|
||||
|
||||
|
||||
v = 0;
|
||||
switch ( strlen(vec[i]) ) {
|
||||
case 2:
|
||||
|
@ -156,16 +156,16 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
|
|||
default:
|
||||
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_string_erase(str,0,1);
|
||||
|
||||
|
||||
r = str->str;
|
||||
|
||||
|
||||
g_string_free(str,FALSE);
|
||||
|
||||
return r;
|
||||
|
@ -207,9 +207,9 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
|
|||
|
||||
%type criteria_statement { pdu_criteria_t* }
|
||||
%type accept_mode { accept_mode_t }
|
||||
%type pdu_drop_unassigned_statement { gboolean }
|
||||
%type discard_pdu_data_statement { gboolean }
|
||||
%type last_extracted_statement { gboolean }
|
||||
%type pdu_drop_unassigned_statement { gboolean }
|
||||
%type discard_pdu_data_statement { gboolean }
|
||||
%type last_extracted_statement { gboolean }
|
||||
|
||||
%type extraction_statement {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.
|
||||
|
||||
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 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 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 = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
|
||||
dbgfile_default ::= .
|
||||
|
||||
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 )
|
||||
c->name = g_strdup(B);
|
||||
|
||||
|
||||
g_hash_table_insert(mc->transfs,C->name,C);
|
||||
|
||||
|
||||
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). {
|
||||
AVPL_Transf* c;
|
||||
|
||||
|
||||
for ( c = C; c->next; c = c->next ) ;
|
||||
c->next = B;
|
||||
A = C;
|
||||
|
@ -411,12 +411,12 @@ pdu_decl ::=
|
|||
last_extracted_statement(LastExtracted)
|
||||
CLOSE_BRACE SEMICOLON.
|
||||
{
|
||||
|
||||
|
||||
mate_cfg_pdu* cfg = new_pducfg(Name);
|
||||
extraction_t *extraction, *next_extraction;
|
||||
GPtrArray* transport_stack = g_ptr_array_new();
|
||||
int i;
|
||||
|
||||
|
||||
if (! cfg ) configuration_error(mc,"could not create Pdu %s.",Name);
|
||||
|
||||
cfg->hfid_proto = Field->id;
|
||||
|
@ -424,34 +424,34 @@ pdu_decl ::=
|
|||
cfg->last_extracted = LastExtracted;
|
||||
cfg->discard = DistcardPduData;
|
||||
cfg->drop_unassigned = DropUnassigned;
|
||||
|
||||
|
||||
g_string_append_printf(mc->protos_filter,"||%s",Field->abbrev);
|
||||
|
||||
/* flip the transport_stack */
|
||||
for (i = Stack->len - 1; Stack->len; i--) {
|
||||
g_ptr_array_add(transport_stack,g_ptr_array_remove_index(Stack,i));
|
||||
}
|
||||
|
||||
|
||||
g_ptr_array_free(Stack,FALSE);
|
||||
|
||||
|
||||
cfg->transport_ranges = transport_stack;
|
||||
cfg->payload_ranges = Payload;
|
||||
|
||||
|
||||
if (Criteria) {
|
||||
cfg->criterium = Criteria->criterium_avpl;
|
||||
cfg->criterium_match_mode = Criteria->criterium_match_mode;
|
||||
cfg->criterium_accept_mode = Criteria->criterium_accept_mode;
|
||||
}
|
||||
|
||||
|
||||
cfg->transforms = Transform;
|
||||
|
||||
|
||||
for (extraction = Extraction; extraction; extraction = next_extraction) {
|
||||
next_extraction = extraction->next;
|
||||
|
||||
|
||||
if ( ! add_hfid(extraction->hfi, extraction->as, cfg->hfids_attr) ) {
|
||||
configuration_error(mc,"MATE: failed to create extraction rule '%s'",extraction->as);
|
||||
}
|
||||
|
||||
|
||||
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; }
|
||||
|
||||
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) ::= DISCARD_PDU_DATA_KW true_false(B) SEMICOLON. { A = B; }
|
||||
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) ::= . { A = mc->defaults.pdu.last_extracted; }
|
||||
last_extracted_statement(A) ::= LAST_PDU_KW true_false(B) SEMICOLON. { A = B; }
|
||||
last_extracted_statement(A) ::= . { A = mc->defaults.pdu.last_extracted; }
|
||||
|
||||
proto_stack(A) ::= proto_stack(B) SLASH field(C). {
|
||||
int* hfidp = g_malloc(sizeof(int));
|
||||
|
||||
g_string_append_printf(mc->fields_filter,"||%s",C->abbrev);
|
||||
|
||||
|
||||
*hfidp = C->id;
|
||||
g_ptr_array_add(B,hfidp);
|
||||
A = B;
|
||||
|
@ -504,7 +504,7 @@ proto_stack(A) ::= proto_stack(B) SLASH field(C). {
|
|||
proto_stack(A) ::= field(B). {
|
||||
int* hfidp = g_malloc(sizeof(int));
|
||||
*hfidp = B->id;
|
||||
|
||||
|
||||
g_string_append_printf(mc->fields_filter,"||%s",B->abbrev);
|
||||
|
||||
A = g_ptr_array_new();
|
||||
|
@ -518,7 +518,7 @@ field(A) ::= NAME(B). {
|
|||
/******************************************* 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_stop_statement(Stop)
|
||||
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)
|
||||
CLOSE_BRACE SEMICOLON. {
|
||||
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->gops_by_pduname,PduName) ) configuration_error(mc,"Gop for Pdu '%s' exists already",PduName);
|
||||
|
||||
cfg = new_gopcfg(Name);
|
||||
g_hash_table_insert(mc->gops_by_pduname,PduName,cfg);
|
||||
g_hash_table_insert(mc->gopcfgs,cfg->name,cfg);
|
||||
|
||||
|
||||
cfg->on_pdu = PduName;
|
||||
cfg->key = Key;
|
||||
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->stop = Stop;
|
||||
cfg->transforms = Transform;
|
||||
|
||||
|
||||
merge_avpl(cfg->extra,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_start_statement(A) ::= START_KW avpl(B) SEMICOLON. { A = B; }
|
||||
|
@ -608,7 +608,7 @@ time_value(A) ::= INTEGER(B). {
|
|||
/************* GOG
|
||||
*/
|
||||
|
||||
gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE
|
||||
gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE
|
||||
gog_key_statements(Keys)
|
||||
extra_statement(Extra)
|
||||
transform_list_statement(Transforms)
|
||||
|
@ -616,18 +616,18 @@ gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE
|
|||
gog_goptree_statement(Tree)
|
||||
CLOSE_BRACE SEMICOLON. {
|
||||
mate_cfg_gog* cfg = NULL;
|
||||
|
||||
|
||||
if ( g_hash_table_lookup(mc->gogcfgs,Name) ) {
|
||||
configuration_error(mc,"Gog '%s' exists already ",Name);
|
||||
}
|
||||
|
||||
|
||||
cfg = new_gogcfg(Name);
|
||||
|
||||
cfg->expiration = Expiration;
|
||||
cfg->gop_tree_mode = Tree;
|
||||
cfg->transforms = Transforms;
|
||||
cfg->keys = Keys;
|
||||
|
||||
|
||||
merge_avpl(cfg->extra,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) ::= . { 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;
|
||||
g_ptr_array_add(B,C);
|
||||
}
|
||||
|
@ -688,12 +688,12 @@ transform_list(A) ::= transform(B). {
|
|||
|
||||
transform(A) ::= NAME(B). {
|
||||
AVPL_Transf* t;
|
||||
|
||||
|
||||
if (( t = g_hash_table_lookup(mc->transfs,B) )) {
|
||||
A = t;
|
||||
} else {
|
||||
configuration_error(mc,"There's no such Transformation: %s",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) 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); }
|
||||
|
||||
value(A) ::= QUOTED(B). { A = g_strdup(B); }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* We don't use unput, so don't generate code for it.
|
||||
*/
|
||||
%option nounput
|
||||
%option nounput
|
||||
|
||||
/*
|
||||
* We don't read from the terminal.
|
||||
|
@ -31,20 +31,20 @@
|
|||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 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_parser_lex.h"
|
||||
|
||||
|
@ -62,16 +62,16 @@
|
|||
#endif
|
||||
void MateParserFree( void*, void(*)(void*) );
|
||||
void MateParseTrace(FILE*,char*);
|
||||
|
||||
|
||||
#define MAX_INCLUDE_DEPTH 10
|
||||
static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
|
||||
static int include_stack_ptr = 0;
|
||||
|
||||
|
||||
static void* pParser;
|
||||
static mate_config_frame* current_frame;
|
||||
|
||||
|
||||
static mate_config* mc;
|
||||
|
||||
|
||||
#define MATE_PARSE(token_type) MateParser(pParser, (token_type), g_strdup(yytext), mc );
|
||||
|
||||
/*
|
||||
|
@ -159,11 +159,11 @@ comment "//"[^\n]*\n
|
|||
blk_cmnt_start "/*"
|
||||
cmnt_char .
|
||||
blk_cmnt_stop "*/"
|
||||
|
||||
|
||||
%START OUTSIDE QUOTED INCLUDING COMMENT
|
||||
%%
|
||||
|
||||
{newline} current_frame->linenum++;
|
||||
{newline} current_frame->linenum++;
|
||||
{whitespace} ;
|
||||
|
||||
<OUTSIDE>{include} BEGIN INCLUDING;
|
||||
|
@ -171,46 +171,46 @@ blk_cmnt_stop "*/"
|
|||
<INCLUDING>{filename} {
|
||||
if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
|
||||
g_error("dtd_preparse: include files nested to deeply");
|
||||
|
||||
|
||||
include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
|
||||
yyin = eth_fopen( yytext, "r" );
|
||||
yyin = ws_fopen( yytext, "r" );
|
||||
|
||||
if (!yyin) {
|
||||
yy_delete_buffer( YY_CURRENT_BUFFER );
|
||||
|
||||
|
||||
/* coverity[negative_sink] */
|
||||
yy_switch_to_buffer(include_stack[--include_stack_ptr] );
|
||||
|
||||
|
||||
if (errno)
|
||||
g_string_append_printf(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, strerror(errno) );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
current_frame = g_malloc(sizeof(mate_config_frame));
|
||||
current_frame->filename = g_strdup(yytext);
|
||||
current_frame->linenum = 1;
|
||||
|
||||
|
||||
g_ptr_array_add(mc->config_stack,current_frame);
|
||||
|
||||
yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) );
|
||||
}
|
||||
|
||||
|
||||
BEGIN OUTSIDE;
|
||||
}
|
||||
|
||||
<<EOF>> {
|
||||
<<EOF>> {
|
||||
/* coverity[check_after_sink] */
|
||||
if ( --include_stack_ptr < 0 ) {
|
||||
yyterminate();
|
||||
} else {
|
||||
yy_delete_buffer( YY_CURRENT_BUFFER );
|
||||
yy_switch_to_buffer( include_stack[include_stack_ptr] );
|
||||
|
||||
|
||||
g_free(current_frame->filename);
|
||||
g_free(current_frame);
|
||||
current_frame = g_ptr_array_remove_index(mc->config_stack,mc->config_stack->len-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<OUTSIDE>{comment} ;
|
||||
|
||||
|
@ -289,25 +289,25 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
|
|||
volatile gboolean state = TRUE;
|
||||
mc = matecfg;
|
||||
|
||||
yyin = eth_fopen(filename,"r");
|
||||
|
||||
yyin = ws_fopen(filename,"r");
|
||||
|
||||
if (!yyin) {
|
||||
g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
mc->config_stack = g_ptr_array_new();
|
||||
|
||||
|
||||
current_frame = g_malloc(sizeof(mate_config_frame));
|
||||
current_frame->filename = g_strdup(filename);
|
||||
current_frame->linenum = 1;
|
||||
|
||||
|
||||
g_ptr_array_add(mc->config_stack,current_frame);
|
||||
|
||||
pParser = MateParserAlloc(g_malloc);
|
||||
|
||||
|
||||
/* MateParserTrace(stdout,""); */
|
||||
|
||||
|
||||
TRY {
|
||||
BEGIN OUTSIDE;
|
||||
|
||||
|
@ -316,27 +316,27 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
|
|||
MateParser(pParser, 0, NULL,mc);
|
||||
|
||||
yyrestart(NULL);
|
||||
|
||||
|
||||
MateParserFree(pParser, g_free );
|
||||
|
||||
|
||||
g_free(current_frame->filename);
|
||||
g_free(current_frame);
|
||||
|
||||
|
||||
g_ptr_array_free(mc->config_stack,FALSE);
|
||||
} CATCH(MateConfigError) {
|
||||
state = FALSE;
|
||||
} CATCH_ALL {
|
||||
state = FALSE;
|
||||
state = FALSE;
|
||||
g_string_append_printf(mc->config_error,"An unexpected error occurred");
|
||||
}
|
||||
ENDTRY;
|
||||
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
* warnings by the Windows VC compiler).
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "mate.h"
|
||||
#include "mate_util.h"
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
/***************************************************************************
|
||||
* dbg_print
|
||||
|
@ -81,7 +81,7 @@ void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... )
|
|||
struct _scs_collection {
|
||||
GHashTable* hash; /* key: a string value: guint number of subscribers */
|
||||
GMemChunk* ctrs;
|
||||
GMemChunk* mate_small;
|
||||
GMemChunk* mate_small;
|
||||
GMemChunk* mate_medium;
|
||||
GMemChunk* mate_large;
|
||||
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_large ) g_mem_chunk_destroy(c->mate_large);
|
||||
if ( c->mate_huge ) g_mem_chunk_destroy(c->mate_huge);
|
||||
|
||||
|
||||
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));
|
||||
|
||||
c->hash = g_hash_table_new(g_str_hash,g_str_equal);
|
||||
|
||||
|
||||
c->ctrs = g_mem_chunk_new("ints_scs_chunk", sizeof(guint),
|
||||
sizeof(guint) * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE);
|
||||
|
||||
|
||||
c->mate_small = g_mem_chunk_new("small_scs_chunk", SCS_SMALL_SIZE,
|
||||
SCS_SMALL_SIZE * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE);
|
||||
|
||||
|
||||
c->mate_medium = g_mem_chunk_new("medium_scs_chunk", SCS_MEDIUM_SIZE,
|
||||
SCS_MEDIUM_SIZE * SCS_MEDIUM_CHUNK_SIZE, G_ALLOC_AND_FREE);
|
||||
|
||||
|
||||
c->mate_large = g_mem_chunk_new("large_scs_chunk", SCS_LARGE_SIZE,
|
||||
SCS_LARGE_SIZE * SCS_LARGE_CHUNK_SIZE, G_ALLOC_AND_FREE);
|
||||
|
||||
|
||||
c->mate_huge = g_mem_chunk_new("huge_scs_chunk", SCS_HUGE_SIZE,
|
||||
SCS_HUGE_SIZE * SCS_HUGE_CHUNK_SIZE, G_ALLOC_AND_FREE);
|
||||
return c;
|
||||
|
@ -137,7 +137,7 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
|
|||
guint* ip = NULL;
|
||||
size_t len = 0;
|
||||
GMemChunk* chunk = NULL;
|
||||
|
||||
|
||||
g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer)&orig,(gpointer)&ip);
|
||||
|
||||
if (ip) {
|
||||
|
@ -145,9 +145,9 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
|
|||
} else {
|
||||
ip = g_mem_chunk_alloc(c->ctrs);
|
||||
*ip = 0;
|
||||
|
||||
|
||||
len = strlen(s) + 1;
|
||||
|
||||
|
||||
if (len <= SCS_SMALL_SIZE) {
|
||||
chunk = c->mate_small;
|
||||
len = SCS_SMALL_SIZE;
|
||||
|
@ -165,10 +165,10 @@ gchar* scs_subscribe(SCS_collection* c, const gchar* s) {
|
|||
len = SCS_HUGE_SIZE;
|
||||
g_warning("mate SCS: string truncated to huge size");
|
||||
}
|
||||
|
||||
|
||||
orig = g_mem_chunk_alloc(chunk);
|
||||
strncpy(orig,s,len);
|
||||
|
||||
|
||||
g_hash_table_insert(c->hash,orig,ip);
|
||||
}
|
||||
|
||||
|
@ -188,15 +188,15 @@ void scs_unsubscribe(SCS_collection* c, gchar* s) {
|
|||
guint* ip = NULL;
|
||||
size_t len = 0xffff;
|
||||
GMemChunk* chunk = NULL;
|
||||
|
||||
|
||||
g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer)&orig,(gpointer)&ip);
|
||||
|
||||
if (ip) {
|
||||
if (*ip == 0) {
|
||||
g_hash_table_remove(c->hash,orig);
|
||||
|
||||
|
||||
len = strlen(orig);
|
||||
|
||||
|
||||
if (len < SCS_SMALL_SIZE) {
|
||||
chunk = c->mate_small;
|
||||
} else if (len < SCS_MEDIUM_SIZE) {
|
||||
|
@ -205,8 +205,8 @@ void scs_unsubscribe(SCS_collection* c, gchar* s) {
|
|||
chunk = c->mate_large;
|
||||
} else {
|
||||
chunk = c->mate_huge;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
g_mem_chunk_free(chunk,orig);
|
||||
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, ...) {
|
||||
va_list list;
|
||||
static gchar buf[SCS_HUGE_SIZE];
|
||||
|
||||
|
||||
va_start( list, fmt );
|
||||
g_vsnprintf(buf, SCS_HUGE_SIZE-1 ,fmt, 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) {
|
||||
AVP* new = g_mem_chunk_alloc(avp_chunk);
|
||||
gchar* value;
|
||||
|
||||
|
||||
new->n = scs_subscribe(avp_strings, name);
|
||||
|
||||
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* copy;
|
||||
gboolean matches;
|
||||
|
||||
|
||||
#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);
|
||||
#endif
|
||||
if (src->len == 0) return NULL;
|
||||
|
||||
|
||||
newavpl = new_avpl(scs_subscribe(avp_strings, name));
|
||||
|
||||
|
||||
if (op->len == 0)
|
||||
return newavpl;
|
||||
|
||||
|
||||
matches = TRUE;
|
||||
|
||||
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)
|
||||
return newavpl;
|
||||
|
||||
|
||||
if (src->len == 0) {
|
||||
delete_avpl(newavpl,FALSE);
|
||||
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) {
|
||||
AVPL* avpl = NULL;
|
||||
|
||||
|
||||
switch (mode) {
|
||||
case AVPL_STRICT:
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return avpl;
|
||||
}
|
||||
|
||||
|
@ -1325,7 +1325,7 @@ extern void avpl_transform(AVPL* src, AVPL_Transf* op) {
|
|||
#endif
|
||||
|
||||
for ( ; op ; op = op->next) {
|
||||
|
||||
|
||||
avpl = new_avpl_from_match(op->match_mode, src->name,src, op->match, TRUE);
|
||||
|
||||
if (avpl) {
|
||||
|
@ -1556,7 +1556,7 @@ static LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, cons
|
|||
gchar* desc;
|
||||
LoAL* ret = NULL;
|
||||
gchar* err;
|
||||
|
||||
|
||||
va_start( list, fmt );
|
||||
desc = g_strdup_vprintf(fmt, list);
|
||||
va_end( list );
|
||||
|
@ -1630,7 +1630,7 @@ extern LoAL* loal_from_file(gchar* filename) {
|
|||
|
||||
state = START;
|
||||
|
||||
if (( fp = eth_fopen(filename,"r") )) {
|
||||
if (( fp = ws_fopen(filename,"r") )) {
|
||||
while(( c = (gchar) fgetc(fp) )){
|
||||
|
||||
if ( feof(fp) ) {
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,7 +93,7 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fdstats_tree.pdb -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -53,5 +53,5 @@ distclean: clean
|
|||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(TAP_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include <win32.mak>
|
|||
|
||||
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)
|
||||
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fdmate.pdb -c $<
|
||||
|
||||
|
||||
LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -57,12 +57,12 @@ mate_parser.c : mate_parser.l
|
|||
|
||||
mate_grammar.h : mate_grammar.c
|
||||
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:
|
||||
cd ../../tools/lemon
|
||||
$(MAKE) /$(MAKEFLAGS) -f makefile.nmake
|
||||
cd ../../plugins/mate
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,11 +93,11 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -9,12 +9,12 @@ include moduleinfo.nmake
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!IFDEF ENABLE_LIBWIRESHARK
|
||||
|
@ -93,13 +93,13 @@ plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl \
|
||||
$(DISSECTOR_SRC) \
|
||||
$(DISSECTOR_SUPPORT_SRC)
|
||||
|
|
|
@ -10,16 +10,16 @@ include ..\..\Makefile.nmake.inc
|
|||
|
||||
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)
|
||||
|
||||
.c.obj::
|
||||
$(CC) $(CFLAGS) -Fd.\ -c $<
|
||||
|
||||
|
||||
LDFLAGS = $(PLUGIN_LDFLAGS)
|
||||
|
||||
!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)
|
||||
|
||||
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
|
||||
|
@ -100,12 +100,12 @@ wimaxasncp_dict.obj : wimaxasncp_dict.c
|
|||
clean:
|
||||
rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
|
||||
$(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
$(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
|
||||
|
||||
distclean: clean
|
||||
rm -f wimaxasncp_dict.c wimaxasncp_dict_lex.h
|
||||
|
||||
maintainer-clean: distclean
|
||||
|
||||
checkapi:
|
||||
checkapi:
|
||||
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include <epan/emem.h>
|
||||
#include <epan/value_string.h>
|
||||
#include <epan/packet.h> /* array_length */
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "wimaxasncp_dict.h"
|
||||
#include "wimaxasncp_dict_lex.h"
|
||||
|
@ -592,7 +592,7 @@ static FILE *wimaxasncp_dict_open(
|
|||
fname = g_strdup(filename);
|
||||
}
|
||||
|
||||
fh = eth_fopen(fname,"r");
|
||||
fh = ws_fopen(fname,"r");
|
||||
|
||||
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.
|
||||
* (%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
|
||||
* warnings by the Windows VC compiler).
|
||||
*/
|
||||
|
|
32
print.c
32
print.c
|
@ -40,7 +40,7 @@
|
|||
#include "packet-range.h"
|
||||
#include "print.h"
|
||||
#include "ps.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
#include <epan/charsets.h>
|
||||
#include <epan/dissectors/packet-data.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 */
|
||||
if (to_file)
|
||||
fh = eth_fopen(dest, "w");
|
||||
fh = ws_fopen(dest, "w");
|
||||
else
|
||||
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);
|
||||
|
||||
#if 0
|
||||
/* PDML spec, see:
|
||||
/* PDML spec, see:
|
||||
* http://analyzer.polito.it/30alpha/docs/dissectors/PDMLSpec.htm
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* (like it's contained in the fi->rep->representation).
|
||||
* Unfortunately, we don't have the field data representation for
|
||||
* XXX - the showname shouldn't contain the field data itself
|
||||
* (like it's contained in the fi->rep->representation).
|
||||
* Unfortunately, we don't have the field data representation for
|
||||
* all fields, so this isn't currently possible */
|
||||
fputs("\" showname=\"", pdata->fh);
|
||||
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->field_indicies = NULL;
|
||||
fields->field_values = NULL;
|
||||
fields->quote='\0';
|
||||
fields->quote='\0';
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ void output_fields_free(output_fields_t* fields)
|
|||
g_ptr_array_free(fields->fields, TRUE);
|
||||
}
|
||||
|
||||
g_free(fields);
|
||||
g_free(fields);
|
||||
}
|
||||
|
||||
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;
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(0 == strcmp(option_name, "quote")) {
|
||||
|
@ -1360,7 +1360,7 @@ gboolean output_fields_set_option(output_fields_t* info, gchar* option)
|
|||
info->quote='\0';
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -1392,11 +1392,11 @@ void write_fields_preamble(output_fields_t* fields, FILE *fh)
|
|||
fputc(fields->separator, fh);
|
||||
}
|
||||
fputs(field, 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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Recurse here. */
|
||||
if (node->first_child != NULL) {
|
||||
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;
|
||||
while( i < fields->fields->len) {
|
||||
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.
|
||||
*/
|
||||
++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 */
|
||||
fields->field_values = ep_alloc_array0(const gchar*, fields->fields->len);
|
||||
|
||||
|
||||
proto_tree_children_foreach(edt->tree, proto_tree_get_node_field_values,
|
||||
&data);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
#include <epan/epan.h>
|
||||
#include <epan/filesystem.h>
|
||||
#include <epan/privileges.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include <epan/packet.h>
|
||||
|
@ -268,7 +268,7 @@ raw_pipe_open(const char *pipe_name)
|
|||
#endif /* _WIN32 */
|
||||
} else {
|
||||
#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,
|
||||
"The capture session could not be initiated "
|
||||
"due to error on pipe: %s", strerror(errno));
|
||||
|
@ -288,7 +288,7 @@ raw_pipe_open(const char *pipe_name)
|
|||
}
|
||||
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) {
|
||||
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
|
||||
"The capture session could not be initiated "
|
||||
|
|
24
ringbuffer.c
24
ringbuffer.c
|
@ -26,18 +26,18 @@
|
|||
* <laurent.deniel@free.fr>
|
||||
*
|
||||
* Almost completely rewritten in order to:
|
||||
*
|
||||
*
|
||||
* - be able to use a unlimited number of ringbuffer files
|
||||
* - close the current file and open (truncating) the next file at switch
|
||||
* - set the final file name once open (or reopen)
|
||||
* - avoid the deletion of files that could not be truncated (can't arise now)
|
||||
* 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
|
||||
* 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
|
||||
* 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).
|
||||
*
|
||||
*/
|
||||
|
@ -67,7 +67,7 @@
|
|||
|
||||
#include "pcapio.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
|
|||
if (rfile->name != NULL) {
|
||||
if (rb_data.unlimited == FALSE) {
|
||||
/* remove old file (if any, so ignore error) */
|
||||
eth_unlink(rfile->name);
|
||||
ws_unlink(rfile->name);
|
||||
}
|
||||
g_free(rfile->name);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
|
|||
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) {
|
||||
*err = errno;
|
||||
|
@ -246,7 +246,7 @@ ringbuf_init_libpcap_fdopen(int linktype, int snaplen,
|
|||
* Switches to the next ringbuffer file
|
||||
*/
|
||||
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)
|
||||
{
|
||||
int next_file_index;
|
||||
|
@ -255,7 +255,7 @@ ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd,
|
|||
/* close current file */
|
||||
|
||||
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.fd = -1;
|
||||
return FALSE;
|
||||
|
@ -298,7 +298,7 @@ ringbuf_libpcap_dump_close(gchar **save_file, int *err)
|
|||
/* close current file, if it's open */
|
||||
if (rb_data.pdh != NULL) {
|
||||
if (!libpcap_dump_close(rb_data.pdh, err)) {
|
||||
eth_close(rb_data.fd);
|
||||
ws_close(rb_data.fd);
|
||||
ret_val = FALSE;
|
||||
}
|
||||
|
||||
|
@ -359,14 +359,14 @@ ringbuf_error_cleanup(void)
|
|||
/* XXX - it shouldn't still be open; "libpcap_dump_close()" should leave the
|
||||
file closed even if it fails */
|
||||
if (rb_data.fd != -1) {
|
||||
eth_close(rb_data.fd);
|
||||
ws_close(rb_data.fd);
|
||||
rb_data.fd = -1;
|
||||
}
|
||||
|
||||
if (rb_data.files != NULL) {
|
||||
for (i=0; i < rb_data.num_files; i++) {
|
||||
if (rb_data.files[i].name != NULL) {
|
||||
eth_unlink(rb_data.files[i].name);
|
||||
ws_unlink(rb_data.files[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,13 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "file_util.h"
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "tempfile.h"
|
||||
#include "mkstemp.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
static const char *
|
||||
setup_tmpdir(const char *dir)
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wiretap/file_util.h>
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <glib.h>
|
||||
|
@ -1264,7 +1264,7 @@ parse_options (int argc, char *argv[])
|
|||
|
||||
if (strcmp(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) {
|
||||
fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
|
||||
input_filename, strerror(errno));
|
||||
|
@ -1277,7 +1277,7 @@ parse_options (int argc, char *argv[])
|
|||
|
||||
if (strcmp(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) {
|
||||
fprintf(stderr, "Cannot open file [%s] for writing: %s\n",
|
||||
output_filename, strerror(errno));
|
||||
|
|
|
@ -76,7 +76,7 @@ my @prohibitedAPIs=
|
|||
'g_strdown',
|
||||
'g_string_up',
|
||||
'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
|
||||
# so we must tweak that to UTF16 before operating on the file. Code
|
||||
# using these functions will work unless the file/path name contains
|
||||
|
|
3
tshark.c
3
tshark.c
|
@ -63,7 +63,6 @@
|
|||
#include <epan/epan.h>
|
||||
#include <epan/filesystem.h>
|
||||
#include <epan/privileges.h>
|
||||
#include <wiretap/file_util.h>
|
||||
|
||||
#include "globals.h"
|
||||
#include <epan/timestamp.h>
|
||||
|
@ -863,7 +862,7 @@ main(int argc, char *argv[])
|
|||
we can just process it with the other arguments. */
|
||||
if (argc >= 2 && strcmp(argv[1], "-G") == 0) {
|
||||
proto_initialize_all_prefixes();
|
||||
|
||||
|
||||
if (argc == 2)
|
||||
proto_registrar_dump_fields(1);
|
||||
else {
|
||||
|
|
24
update.c
24
update.c
|
@ -41,7 +41,7 @@
|
|||
#include "capture-pcap-util.h"
|
||||
#endif
|
||||
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <wininet.h>
|
||||
#include "nio-ie5.h"
|
||||
|
@ -74,7 +74,7 @@ download_file(const char *url, const char *filename) {
|
|||
|
||||
|
||||
/* 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) {
|
||||
g_warning("Couldn't open output file %s!", filename);
|
||||
return -1;
|
||||
|
@ -89,12 +89,12 @@ download_file(const char *url, const char *filename) {
|
|||
|
||||
do {
|
||||
/* XXX - maybe add a progress bar here */
|
||||
|
||||
|
||||
/* read some bytes from the url */
|
||||
chunk_len = netio_ie5_read (conn, buf, sizeof(buf));
|
||||
|
||||
/* 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) {
|
||||
g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len);
|
||||
ret = -1;
|
||||
|
@ -104,7 +104,7 @@ download_file(const char *url, const char *filename) {
|
|||
|
||||
netio_ie5_disconnect(conn);
|
||||
|
||||
eth_close(fd);
|
||||
ws_close(fd);
|
||||
|
||||
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)
|
||||
{
|
||||
GString *check = g_string_new(check_prefix);
|
||||
|
||||
|
||||
g_string_append(check, check_name);
|
||||
|
||||
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_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, "description", &update_info->description);
|
||||
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->prefix = "wireshark.setup.";
|
||||
|
||||
pf = eth_fopen(local_file, "r");
|
||||
pf = ws_fopen(local_file, "r");
|
||||
if(pf != NULL) {
|
||||
/* read in update_info of Wireshark */
|
||||
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_vend;
|
||||
|
||||
|
||||
|
||||
update_info->prefix = "winpcap.";
|
||||
|
||||
pf = eth_fopen(local_file, "r");
|
||||
pf = ws_fopen(local_file, "r");
|
||||
if(pf != NULL) {
|
||||
/* read in update_info of WinPcap */
|
||||
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!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* download update file */
|
||||
if(download_file(url_file, local_file) == -1) {
|
||||
g_warning("Couldn't download update file: %s", local_file);
|
||||
|
@ -330,7 +330,7 @@ update_check(gboolean interactive)
|
|||
|
||||
/* check winpcap */
|
||||
update_info_winpcap = update_check_winpcap(local_file);
|
||||
|
||||
|
||||
/* display results */
|
||||
if(update_info_wireshark->needs_update || update_info_winpcap->needs_update) {
|
||||
if(update_info_wireshark->needs_update)
|
||||
|
|
|
@ -87,7 +87,6 @@ NONGENERATED_HEADER_FILES = \
|
|||
erf.h \
|
||||
etherpeek.h \
|
||||
eyesdn.h \
|
||||
file_util.h \
|
||||
file_wrappers.h \
|
||||
hcidump.h \
|
||||
i4btrace.h \
|
||||
|
|
|
@ -17,7 +17,7 @@ CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
|
|||
.c.obj::
|
||||
$(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 = \
|
||||
$(GLIB_LIBS) \
|
||||
|
@ -36,7 +36,7 @@ wiretap-$(WTAP_VERSION).dll : $(OBJECTS) wtap.def ..\image\wiretap.res
|
|||
/IMPLIB:wiretap-$(WTAP_VERSION).lib \
|
||||
..\image\wiretap.res \
|
||||
$(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
|
||||
!ENDIF
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "ascend.h"
|
||||
#include "ascend-int.h"
|
||||
#include "file_wrappers.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
|
||||
typedef struct _ascend_magic_string {
|
||||
guint type;
|
||||
const gchar *strptr;
|
||||
const gchar *strptr;
|
||||
} ascend_magic_string;
|
||||
|
||||
#define ASCEND_MAGIC_STRINGS 11
|
||||
|
@ -100,7 +100,7 @@ static gint64 ascend_seek(wtap *wth, int *err)
|
|||
|
||||
while (((byte = file_getc(wth->fh)) != EOF)) {
|
||||
excessive_read_count--;
|
||||
|
||||
|
||||
if (!excessive_read_count) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ static gint64 ascend_seek(wtap *wth, int *err)
|
|||
if (strcmp(strptr, ASCEND_DATE) == 0) {
|
||||
date_off = cur_off - len;
|
||||
} else {
|
||||
if (date_off == -1) {
|
||||
if (date_off == -1) {
|
||||
/* Back up over the header we just read; that's where a read
|
||||
of this packet should start. */
|
||||
packet_off = cur_off - len;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
#include "wtap-int.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
|
||||
* false positives with my test-files (Sake Blok, July 2007)
|
||||
*/
|
||||
netscreen_open,
|
||||
netscreen_open,
|
||||
erf_open,
|
||||
k12text_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 */
|
||||
static void init_open_routines(void) {
|
||||
|
||||
|
||||
if (open_routines_arr) return;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
else
|
||||
g_array_append_val(open_routines_arr,open_routine);
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
if (eth_stat(filename, &statb) < 0) {
|
||||
if (ws_stat(filename, &statb) < 0) {
|
||||
*err = errno;
|
||||
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
|
||||
* input of the process.
|
||||
*/
|
||||
wth->fd = eth_dup(0);
|
||||
wth->fd = ws_dup(0);
|
||||
#ifdef _WIN32
|
||||
_setmode(wth->fd, O_BINARY);
|
||||
#endif
|
||||
} 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) {
|
||||
*err = errno;
|
||||
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"))) {
|
||||
*err = errno;
|
||||
eth_close(wth->fd);
|
||||
ws_close(wth->fd);
|
||||
g_free(wth);
|
||||
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_close = NULL;
|
||||
wth->tsprecision = WTAP_FILE_TSPREC_USEC;
|
||||
|
||||
|
||||
init_open_routines();
|
||||
|
||||
|
||||
/* Try all file types */
|
||||
for (i = 0; i < open_routines_arr->len; i++) {
|
||||
/* 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;
|
||||
}
|
||||
wth->data_offset = 0;
|
||||
|
||||
|
||||
switch ((*open_routines[i])(wth, err, err_info)) {
|
||||
|
||||
case -1:
|
||||
|
@ -464,7 +464,7 @@ static const struct file_type_info dump_open_table_base[] = {
|
|||
/* WTAP_FILE_EYESDN */
|
||||
{ "EyeSDN USB S0/E1 ISDN trace format", "eyesdn", "*.*", NULL, FALSE,
|
||||
NULL, NULL },
|
||||
|
||||
|
||||
/* WTAP_FILE_NETTL */
|
||||
{ "HP-UX nettl trace", "nettl", "*.TRC0;*.TRC1", ".TRC0", FALSE,
|
||||
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 */
|
||||
{ "Wildpacket Ether/AiroPeek (V9)", "peek9", "*.tpc;*.apc;*.pkt;*.wpz", ".pkt", FALSE,
|
||||
NULL, NULL },
|
||||
|
||||
|
||||
/* WTAP_FILE_MPEG */
|
||||
{ "MPEG", "mpeg", "*.mpeg;*.mpg;*.mp3", ".mpeg", FALSE,
|
||||
NULL, NULL },
|
||||
|
@ -576,7 +576,7 @@ static const struct file_type_info dump_open_table_base[] = {
|
|||
/* WTAP_FILE_COMMVIEW */
|
||||
{ "TamoSoft CommView", "commview", "*.ncf", ".ncf", TRUE,
|
||||
commview_dump_can_write_encap, commview_dump_open },
|
||||
|
||||
|
||||
/* WTAP_FILE_PCAPNG */
|
||||
{ "Wireshark - pcapng (experimental)", "pcapng", "*.pcapng", NULL, FALSE,
|
||||
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 */
|
||||
static void init_file_types(void) {
|
||||
|
||||
|
||||
if (dump_open_table_arr) return;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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();
|
||||
|
||||
g_array_append_val(dump_open_table_arr,*fi);
|
||||
|
||||
|
||||
dump_open_table = (void*)dump_open_table_arr->data;
|
||||
|
||||
|
||||
return wtap_num_file_types++;
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,7 @@ wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap,
|
|||
opening it. */
|
||||
if (wdh->fh != stdout) {
|
||||
wtap_dump_file_close(wdh);
|
||||
eth_unlink(filename);
|
||||
ws_unlink(filename);
|
||||
}
|
||||
g_free(wdh);
|
||||
return NULL;
|
||||
|
@ -894,7 +894,7 @@ void wtap_dump_flush(wtap_dumper *wdh)
|
|||
#ifdef HAVE_LIBZ
|
||||
if(wdh->compressed) {
|
||||
gzflush(wdh->fh, Z_SYNC_FLUSH); /* XXX - is Z_SYNC_FLUSH the right one? */
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
fflush(wdh->fh);
|
||||
|
@ -950,10 +950,10 @@ static FILE *wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
|
|||
#ifdef HAVE_LIBZ
|
||||
if(wdh->compressed) {
|
||||
return gzopen(filename, "wb");
|
||||
} else
|
||||
} else
|
||||
#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
|
||||
if(wdh->compressed) {
|
||||
return gzdopen(fd, "wb");
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
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
|
||||
if(wdh->compressed) {
|
||||
return gzwrite(wdh->fh, buf, bufsize);
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
return fwrite(buf, 1, bufsize, wdh->fh);
|
||||
|
@ -989,7 +989,7 @@ static int wtap_dump_file_close(wtap_dumper *wdh)
|
|||
#ifdef HAVE_LIBZ
|
||||
if(wdh->compressed) {
|
||||
return gzclose(wdh->fh);
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
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? */
|
||||
return errnum;
|
||||
}
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
return ferror(wdh->fh);
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
#endif /* HAVE_LIBZ */
|
||||
#include "wtap-int.h"
|
||||
#include "file_wrappers.h"
|
||||
#include "file_util.h"
|
||||
#include <wsutil/file_util.h>
|
||||
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
|
@ -149,13 +149,13 @@ file_open(const char *path, const char *mode)
|
|||
oflag |= O_BINARY;
|
||||
#endif
|
||||
/* 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;
|
||||
|
||||
/* open zlib file handle */
|
||||
ft = gzdopen(fd, mode);
|
||||
if (ft == NULL) {
|
||||
eth_close(fd);
|
||||
ws_close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue