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
epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \
- wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \
$(GLIB_LIBS) \
+ wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \
!ELSE
epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \
- wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
wsock32.lib user32.lib \
$(GLIB_LIBS) \
+ wsutil\libwsutil.lib \
!IFDEF ENABLE_LIBWIRESHARK
epan\libwireshark.lib \
!ELSE
epan\crypt\airpdcap.lib \
epan\dfilter\dfilter.lib \
epan\ftypes\ftypes.lib \
- wsutil\libwsutil.lib \
$(ADNS_LIBS) \
$(PCRE_LIBS) \
$(ZLIB_LIBS) \
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) \
# 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
# $(TSHARK_TAP_SRC)
# EXTRA_wireshark_SOURCES
-checkapi:
+checkapi:
# checkapi_local
cd wiretap
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
#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 {
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)) {
#include "cmdarg_err.h"
#include "capture-pcap-util.h"
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
typedef struct {
char *name;
{
struct stat statb;
- if (eth_stat(path, &statb) < 0)
+ if (ws_stat(path, &statb) < 0)
return errno;
if (S_ISFIFO(statb.st_mode))
#include "capture-wpcap.h"
#endif
#include "ui_util.h"
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include "log.h"
#ifdef _WIN32
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");
* 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));
#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;
}
* 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));
#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;
}
#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");
/* 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);
}
/* 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);
/* 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);
/* 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);
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;
/* 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.
/*
* Updated 1 Dec 10 jjm
*/
-
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include <epan/filesystem.h>
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include <epan/packet.h>
#include "color.h"
/* 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;
* 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);
/* 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 */
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;
}
/* skip # comments and invalid lines */
- if (c != '@') {
+ if (c != '@') {
skip_end_of_line = TRUE;
continue;
}
name_len *= 2;
name = g_realloc(name, name_len + 1);
}
- name[i++] = c;
+ name[i++] = c;
}
name[i] = '\0';
/* 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,
/* 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,
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));
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;
}
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));
{
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));
#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"
/* 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);
/* 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) {
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);
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;
}
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;
}
#include "tempfile.h"
#include "log.h"
-#include "file_util.h"
+#include "wsutil/file_util.h"
/*
* Get information about libpcap format from "wiretap/libpcap.h".
#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 {
}
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 "
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;
}
/* 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;
}
}
} 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);
}
}
/* 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);
}
}
#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>
{
int hash_idx;
hashport_t *tp;
-
+
hash_idx = HASH_PORT(port);
tp = proto_table[hash_idx];
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;
* 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) == '.') {
}
}
- /* 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);
}
}
if (eth_p)
rewind(eth_p);
else
- eth_p = eth_fopen(path, "r");
+ eth_p = ws_fopen(path, "r");
}
static void end_ethent(void)
if (ipxnet_p)
rewind(ipxnet_p);
else
- ipxnet_p = eth_fopen(path, "r");
+ ipxnet_p = ws_fopen(path, "r");
}
static void end_ipxnetent(void)
* 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) {
/* 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
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) {
}
*cp2 = '\0'; /* Cut token */
++cp2 ;
-
+
/* Check if this is a valid IPv4 address */
if (inet_pton(AF_INET, cp, &host_addr) != 1) {
continue; /* no */
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 */
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);
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);
}
}
}
-
+
subnet_entry.mask = 0;
subnet_entry.mask_length = 0;
subnet_entry.name = NULL;
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!
*/
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]);
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]);
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]);
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;
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);
static gchar *ep_utoa(guint port)
{
gchar *bp = ep_alloc(MAXNAMELEN);
-
+
bp = &bp[MAXNAMELEN -1];
-
+
*bp = 0;
do {
*--bp = (port % 10) +'0';
#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;
}
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) );
/*
* 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.
*/
gchar* newPriv = d->priv;
while(oldText && *oldText) {
*(newPriv++) = *(oldPriv++);
- oldText++;
+ oldText++;
}
}
* 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.
*/
#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").
*/
#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;
fname = strdup(filename);
}
- fh = eth_fopen(fname,"r");
+ fh = ws_fopen(fname,"r");
D(("fname: %s fh: %p\n",fname,fh));
/*
* 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).
*/
#include "packet-giop.h"
#include "packet-tcp.h"
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
/*
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)
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);
}
#include <nettle/cbc.h>
#endif
#include <epan/strutil.h>
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
#endif
#include <epan/packet.h>
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 */
#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
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
}
}
- 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) {
ENDTRY;
if (do_continue) continue;
-
+
data_len = item_len + offset - CONFOUNDER_PLUS_CHECKSUM;
if ((int) item_len + offset > length) {
tvb_free(encr_tvb);
#include <epan/emem.h>
#include <epan/strutil.h>
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
/*
* Lookup tables
{ 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" },
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
/*
* 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,
#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) {
g_free(rsa_params);
#endif
return NULL;
- }
+ }
}
ssl_get_version(&major, &minor, &patch);
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;
}
}
return rsa_priv_key;
#endif
-
+
}
Ssl_private_key_t *
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);
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;
}
if ( !private_key->sexp_pkey ) {
g_free(private_key);
return NULL;
- }
+ }
return private_key;
}
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;
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;
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));
}
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: ;
} /* j */
} /* i */
- return private_key;
+ return private_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);
}
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
}
*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;
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);
}
/* !!! */
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);
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;
}
#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;
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;
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;
* 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;
+ ssl_session->private_key = private_key->sexp_pkey;
}
-
+
}
conv_version= & ssl_session->version;
process_ssl_payload(next_tvb, 0, pinfo, tree, association);
pinfo->fragmented = save_fragmented;
}
-
+
/* restore desegmentation ability */
pinfo->can_desegment = save_can_desegment;
}
#include <glib.h>
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
#include <epan/packet.h>
#include <epan/prefs.h>
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[] = {
{
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;
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);
/*
* 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$
* 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);
<IN_COMMENT>[^-]? |
<IN_COMMENT>[-] ;
<IN_COMMENT>{comment_stop} { current = output; BEGIN OUTSIDE; }
-
+
{newline} {
linenum++;
if (current) g_string_append_printf(current,"%s\n",location());
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;
}
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);
/*
* 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).
*/
#include <glib.h>
#include <proto.h>
#include "emem.h"
-#include <wiretap/file_util.h>
#ifdef _WIN32
#include <windows.h> /* VirtualAlloc, VirtualProtect */
/* 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.
if (i%4 == 3) {
aligned[i/4] = tmp;
tmp = 0;
- }
+ }
}
/* add required padding to the last uint32 */
if (i%4 != 0) {
}
aligned[i/4-1] = tmp;
}
-
+
/* add the terminator */
aligned[div-1] = 0x00000001;
if (i%4 == 3) {
aligned[i/4] = tmp;
tmp = 0;
- }
+ }
}
/* add required padding to the last uint32 */
if (i%4 != 0) {
}
aligned[i/4-1] = tmp;
}
-
+
/* add the terminator */
aligned[div-1] = 0x00000001;
#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"
{
struct stat statb;
- if (eth_stat(path, &statb) < 0)
+ if (ws_stat(path, &statb) < 0)
return errno;
if (S_ISDIR(statb.st_mode))
{
struct stat statb;
- if (eth_stat(path, &statb) < 0)
+ if (ws_stat(path, &statb) < 0)
return errno;
if (S_ISFIFO(statb.st_mode))
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 */
}
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);
}
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);
* 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;
}
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
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 {
/*
}
#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
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.
*/
gboolean
deletefile(const char *path)
{
- return eth_unlink(path) == 0;
+ return ws_unlink(path) == 0;
}
/*
* 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;
/*
* 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);
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
epan_get_version
epan_init
epan_strcasestr
-eth_stdio_fopen
ether_to_str
ex_opt_add
ex_opt_count
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
#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 */
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
continue;
}
version = gp;
-
+
/*
* Do we have a register routine?
*/
g_module_close(handle);
continue;
}
-
+
/*
* Do we have a register_wtap_module routine?
*/
} else {
register_wtap_module = NULL;
}
-
+
/*
* Do we have a register_codec_module routine?
*/
* 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 )
{
g_module_close(handle);
continue;
}
-
+
}
- eth_dir_close(dir);
+ ws_dir_close(dir);
}
}
*/
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 ".." */
/*
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
#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>
* 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");
}
/*
/* 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.
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;
}
#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 */
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) {
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) );
/*
* 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).
*/
#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"
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));
#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 */
}
- if (!(yyin = eth_fopen(fname,"r"))) {
+ if (!(yyin = ws_fopen(fname,"r"))) {
*err = strerror(errno);
g_free(fname);
return FALSE;
/*
* 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).
*/
#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;
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;
}
#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>
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;
}
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
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 {
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,
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 */
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 */
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 */
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;
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 */
/* 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);
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;
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;
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;
}
}
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;
}
#include <glib.h>
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
#include "globals.h"
#include <epan/filesystem.h>
int baselen;
int minlen = strlen("_00001_20050418010750");
char *filename;
-
+
/* d:\dir1\test_00001_20050418010750.cap */
filename = g_strdup(get_basename(fname));
path = g_strdup_printf("%s%s", dirname, fname);
- fh = eth_open( path, O_RDONLY, 0000 /* no creation so don't matter */);
+ fh = ws_open( path, O_RDONLY, 0000 /* no creation so don't matter */);
if(fh != -1) {
/* Get statistics */
set.entries = g_list_append(set.entries, entry);
}
- eth_close(fh);
+ ws_close(fh);
}
g_free(path);
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 */
#include <epan/filesystem.h>
#include "filters.h"
-#include "file_util.h"
+#include <wsutil/file_util.h>
/*
* Old filter file name.
/* 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?
*/
*/
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?
*/
* 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.
/* 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. */
fclose(ff);
g_free(filt_name);
g_free(filt_expr);
-
+
/* init the corresponding edited list */
switch (list_type) {
case CFILTER_LIST:
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);
*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;
}
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;
}
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;
}
/* 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);
#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"
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):
/* 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);
#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>
{
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)
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);
#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>
}
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);
#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>
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;
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);
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(
return 0;
}
-extern gboolean
+extern gboolean
packet_is_ssl(epan_dissect_t* edt);
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,
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);
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;
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);
#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>
print_mswin(print_dest);
/* trash temp file */
- eth_remove(print_dest);
+ ws_remove(print_dest);
}
#endif
return;
#ifdef _WIN32
if (win_printer) {
/* trash temp file */
- eth_remove(print_dest);
+ ws_remove(print_dest);
}
#endif
}
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);
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);
}
#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"
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;
}
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;
}
(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;
}
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,
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;
-
+
}
}
}
#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"
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;
}
/* 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,
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;
/****************************************************************************/
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 {
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;
#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"
#include <epan/prefs.h>
#include "../simple_dialog.h"
-#include "wiretap/file_util.h"
#include "gtk/help_dlg.h"
#include "gtk/text_page_utils.h"
#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
set_menus_for_capture_file(&cfile);
}
-static void
+static void
main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
{
switch(event) {
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));
}
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));
}
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;
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);
#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"
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 */
} else {
end_of_line = (byte_line_part_length == 0 ? TRUE : FALSE);
}
-
+
if (end_of_line){
/* End of line */
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_)
{
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);
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,
}
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 */
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;
}
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);
/*
if (reverse && (reverse != newreverse)) {
gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur,
revstyle, NULL);
-
+
cur = 0;
}
if (i < k) {
"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
#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"
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);
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);
}
/* 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));
/* 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$
#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"
/* 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;
/* 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;
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)){
/* 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;
#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"
/* 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);
}
/* 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);
print_mswin(args->file);
/* trash temp file */
- eth_remove(args->file);
+ ws_remove(args->file);
/* restore old settings */
args->to_file = FALSE;
#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:
"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 );
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 );
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;
#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"
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);
}
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);
}
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) {
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) {
/*
}
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;
}
/* 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);
}
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;
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;
{
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.
*/
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);
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);
#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"
}
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));
}
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));
/* 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);
/* 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);
}
/* 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 */
#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"
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;
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)
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;
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;
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;
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;
}
/* 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) {
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
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 */
/*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;
#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"
{
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;
#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"
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);
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));
#include <process.h> /* getpid */
#endif
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
#include <epan/filesystem.h>
static char *u3_change_path(char *path, const char *old, const char *new);
-gboolean u3_active()
+gboolean u3_active()
{
return (
getenv_utf8
#else
getenv
-#endif
+#endif
("U3_HOST_EXEC_PATH") != NULL);
}
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);
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);
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();
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;
{
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;
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)
}
if((path != NULL) && (u3devicepath != NULL) && (strncmp(path, old, strlen(old)) == 0)) {
-
+
newpath = g_strconcat(new, path + strlen(old), NULL);
return newpath;
#include "svnversion.h"
#include "merge.h"
-#include "file_util.h"
+#include "wsutil/file_util.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
}
/* 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) {
#include <glib.h>
-#include "file_util.h"
+#include <wsutil/file_util.h>
#ifndef __set_errno
#define __set_errno(x) errno=(x)
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;
}
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
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)
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
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)
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)
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)
#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>
(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);
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
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;
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
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)
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
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)
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
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
maintainer-clean: distclean
-checkapi:
+checkapi:
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
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
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)
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::
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)
############### 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)
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) \
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
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
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)
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)
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)
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
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)
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
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)
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
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)
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::
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)
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
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)
%include {
/* mate_grammar.lemon
-* MATE's configuration language grammar
+* MATE's configuration language grammar
*
* Copyright 2005, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
*
* 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.
#include "mate.h"
#include "mate_grammar.h"
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
#define DUMMY void*
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;
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) {
} 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;
}
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:
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;
%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*}
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); }
for ( c = C; c; c = c->next )
c->name = g_strdup(B);
-
+
g_hash_table_insert(mc->transfs,C->name,C);
-
+
A = NULL;
}
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;
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;
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);
}
}
}
-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;
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();
/******************************************* 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)
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;
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; }
/************* 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)
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);
}
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);
}
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; }
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); }
/*
* We don't use unput, so don't generate code for it.
*/
-%option nounput
+%option nounput
/*
* We don't read from the terminal.
* 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"
#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 );
/*
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;
<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} ;
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;
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).
*/
#include "mate.h"
#include "mate_util.h"
-#include <wiretap/file_util.h>
+#include <wsutil/file_util.h>
/***************************************************************************
* dbg_print
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;
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);
}
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;
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) {
} 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;
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);
}
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) {
chunk = c->mate_large;
} else {
chunk = c->mate_huge;
- }
-
+ }
+
g_mem_chunk_free(chunk,orig);
g_mem_chunk_free(c->ctrs,ip);
}
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 );
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) {
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;
if (op->len == 0)
return newavpl;
-
+
if (src->len == 0) {
delete_avpl(newavpl,FALSE);
return NULL;
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);
merge_avpl(avpl, op, copy_avps);
break;
}
-
+
return avpl;
}
#endif
for ( ; op ; op = op->next) {
-
+
avpl = new_avpl_from_match(op->match_mode, src->name,src, op->match, TRUE);
if (avpl) {
gchar* desc;
LoAL* ret = NULL;
gchar* err;
-
+
va_start( list, fmt );
desc = g_strdup_vprintf(fmt, list);
va_end( list );
state = START;
- if (( fp = eth_fopen(filename,"r") )) {
+ if (( fp = ws_fopen(filename,"r") )) {
while(( c = (gchar) fgetc(fp) )){
if ( feof(fp) ) {
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
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)
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
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)
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
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)
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
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)
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
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)
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
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)
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
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)
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
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)
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
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
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
maintainer-clean: distclean
-checkapi:
+checkapi:
$(PERL) ../../tools/checkAPIs.pl $(TAP_SRC)
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
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)
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
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)
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
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)
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
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)
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)
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)
#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"
fname = g_strdup(filename);
}
- fh = eth_fopen(fname,"r");
+ fh = ws_fopen(fname,"r");
D(("fname: %s fh: %p\n",fname,fh));
/*
* 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).
*/
#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>
/* 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");
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
* 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);
fields->fields = NULL; /*Do lazy initialisation */
fields->field_indicies = NULL;
fields->field_values = NULL;
- fields->quote='\0';
+ fields->quote='\0';
return 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)
info->separator = *option_value;
break;
}
- return TRUE;
+ return TRUE;
}
if(0 == strcmp(option_name, "quote")) {
info->quote='\0';
break;
}
- return TRUE;
+ return TRUE;
}
return FALSE;
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;
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,
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);
#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>
#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));
}
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 "
* <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).
*
*/
#include "pcapio.h"
#include "ringbuffer.h"
-#include "file_util.h"
+#include <wsutil/file_util.h>
/* Ringbuffer file structure */
/*
- * 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)
{
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);
}
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;
* 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;
/* 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;
/* 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;
}
/* 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);
}
}
}
#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)
#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>
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));
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));
'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
#include <epan/epan.h>
#include <epan/filesystem.h>
#include <epan/privileges.h>
-#include <wiretap/file_util.h>
#include "globals.h"
#include <epan/timestamp.h>
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 {
#include "capture-pcap-util.h"
#endif
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include <wininet.h>
#include "nio-ie5.h"
/* 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;
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;
netio_ie5_disconnect(conn);
- eth_close(fd);
+ ws_close(fd);
return ret;
}
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) {
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);
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);
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);
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);
/* 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)
erf.h \
etherpeek.h \
eyesdn.h \
- file_util.h \
file_wrappers.h \
hcidump.h \
i4btrace.h \
.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) \
/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
#include "ascend.h"
#include "ascend-int.h"
#include "file_wrappers.h"
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include <errno.h>
typedef struct _ascend_magic_string {
guint type;
- const gchar *strptr;
+ const gchar *strptr;
} ascend_magic_string;
#define ASCEND_MAGIC_STRINGS 11
while (((byte = file_getc(wth->fh)) != EOF)) {
excessive_read_count--;
-
+
if (!excessive_read_count) {
return -1;
}
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;
#include <errno.h>
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include "wtap-int.h"
#include "file_wrappers.h"
/* 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,
/* 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;
}
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;
}
return NULL;
}
} else {
- if (eth_stat(filename, &statb) < 0) {
+ if (ws_stat(filename, &statb) < 0) {
*err = errno;
return NULL;
}
* 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);
}
if (!(wth->fh = filed_open(wth->fd, "rb"))) {
*err = errno;
- eth_close(wth->fd);
+ ws_close(wth->fd);
g_free(wth);
return NULL;
}
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
return NULL;
}
wth->data_offset = 0;
-
+
switch ((*open_routines[i])(wth, err, err_info)) {
case -1:
/* 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 },
/* 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 },
/* 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 },
/* 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;
}
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++;
}
opening it. */
if (wdh->fh != stdout) {
wtap_dump_file_close(wdh);
- eth_unlink(filename);
+ ws_unlink(filename);
}
g_free(wdh);
return NULL;
#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);
#ifdef HAVE_LIBZ
if(wdh->compressed) {
return gzopen(filename, "wb");
- } else
+ } else
#endif
{
- return eth_fopen(filename, "wb");
+ return ws_fopen(filename, "wb");
}
}
#ifdef HAVE_LIBZ
if(wdh->compressed) {
return gzdopen(fd, "wb");
- } else
+ } else
#endif
{
return fdopen(fd, "wb");
#ifdef HAVE_LIBZ
if(wdh->compressed) {
return gzwrite(wdh->fh, buf, bufsize);
- } else
+ } else
#endif
{
return fwrite(buf, 1, bufsize, wdh->fh);
#ifdef HAVE_LIBZ
if(wdh->compressed) {
return gzclose(wdh->fh);
- } else
+ } else
#endif
{
return fclose(wdh->fh);
/* XXX - what to do with this zlib specific number? */
return errnum;
}
- } else
+ } else
#endif
{
return ferror(wdh->fh);
#endif /* HAVE_LIBZ */
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "file_util.h"
+#include <wsutil/file_util.h>
#ifdef HAVE_LIBZ
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;
}
RelativePath=".\file_access.c"\r
>\r
</File>\r
- <File\r
- RelativePath=".\file_util.c"\r
- >\r
- </File>\r
<File\r
RelativePath=".\file_wrappers.c"\r
>\r
RelativePath=".\eyesdn.h"\r
>\r
</File>\r
- <File\r
- RelativePath=".\file_util.h"\r
- >\r
- </File>\r
<File\r
RelativePath=".\file_wrappers.h"\r
>\r
#include "wtap.h"
#include "file_wrappers.h"
-#include "file_util.h"
+#include <wsutil/file_util.h>
#include "buffer.h"
/*
{
off_t file_pos;
- file_pos = eth_lseek(wth->fd, 0, SEEK_CUR);
+ file_pos = ws_lseek(wth->fd, 0, SEEK_CUR);
if (file_pos == -1) {
if (err != NULL)
*err = errno;
buffer_init
buffer_remove_start
-eth_stdio_open
-eth_stdio_rename
-eth_stdio_mkdir
-eth_stdio_stat
-eth_stdio_unlink
-eth_stdio_remove
-eth_stdio_fopen
-eth_stdio_freopen
-
file_seek
file_tell
file_error
lib_LTLIBRARIES = libwsutil.la
-CLEANFILES = \
- libwsutil.a \
- libwsutil.la \
- *~
-
-MAINTAINERCLEANFILES = \
- Makefile.in
+INCLUDES = -I$(srcdir)/..
libwsutil_la_SOURCES = \
mpeg-audio.c \
libwsutil_la_LIBADD = @GLIB_LIBS@
EXTRA_DIST = \
- Makefile.nmake
+ Makefile.nmake \
+ file_util.c
+
+CLEANFILES = \
+ libwsutil.a \
+ libwsutil.la \
+ *~
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
CFLAGS=-WX -DHAVE_CONFIG_H /I. /I.. $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
-CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
+CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
.c.obj::
$(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
-libwsutil_LIBS =
+libwsutil_LIBS = $(GLIB_LIBS)
OBJECTS = \
- mpeg-audio.obj
+ mpeg-audio.obj \
+ file_util.obj
libwsutil.lib: libwsutil.dll
/IMPLIB:libwsutil.lib \
..\image\libwsutil.res \
$(OBJECTS) $(libwsutil_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 "libwsutil.dll.manifest" -outputresource:libwsutil.dll;2
!ENDIF
*
* $Id$
*
- * Wiretap Library
+ * (Originally part of the Wiretap Library, now part of the Wireshark
+ * utility library)
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
*
* This program is free software; you can redistribute it and/or
/* file wrapper functions to prevent the file functions from GLib like g_open(),
* as code compiled with MSVC 7 and above will collide with libs linked with msvcrt.dll (MSVC 6), lib GLib is
*
- * DO NOT USE THESE FUNCTIONS DIRECTLY, USE eth_open() AND ALIKE FUNCTIONS FROM file_util.h INSTEAD!!!
+ * DO NOT USE THESE FUNCTIONS DIRECTLY, USE ws_open() AND ALIKE FUNCTIONS FROM file_util.h INSTEAD!!!
*
- * the following code is stripped down code copied from the GLib file glib/gstdio.h
+ * the following code is stripped down code copied from the GLib file glib/gstdio.h
* stipped down, because this is used on _WIN32 only and we use only wide char functions */
#ifdef HAVE_CONFIG_H
*
* Returns: a new file descriptor, or -1 if an error occurred. The
* return value can be used exactly like the return value from open().
- *
+ *
* Since: 2.6
*/
int
-eth_stdio_open (const gchar *filename,
+ws_stdio_open (const gchar *filename,
int flags,
int mode)
{
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
-
+
if (wfilename == NULL)
{
errno = EINVAL;
* @oldfilename: a pathname in the GLib file name encoding (UTF-8 on Windows)
* @newfilename: a pathname in the GLib file name encoding
*
- * A wrapper for the POSIX rename() function. The rename() function
+ * A wrapper for the POSIX rename() function. The rename() function
* renames a file, moving it between directories if required.
- *
+ *
* See your C library manual for more details about how rename() works
* on your system. Note in particular that on Win9x it is not possible
* to rename a file if a file with the new name already exists. Also
* it is not possible in general on Windows to rename an open file.
*
* Returns: 0 if the renaming succeeded, -1 if an error occurred
- *
+ *
* Since: 2.6
*/
int
-eth_stdio_rename (const gchar *oldfilename,
+ws_stdio_rename (const gchar *oldfilename,
const gchar *newfilename)
{
#ifdef _WIN32
g_free (woldfilename);
g_free (wnewfilename);
-
+
errno = save_errno;
return retval;
#else
}
/**
- * g_mkdir:
+ * g_mkdir:
* @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
* @mode: permissions to use for the newly created directory
*
- * A wrapper for the POSIX mkdir() function. The mkdir() function
+ * A wrapper for the POSIX mkdir() function. The mkdir() function
* attempts to create a directory with the given name and permissions.
- *
+ *
* See the C library manual for more details about mkdir().
*
- * Returns: 0 if the directory was successfully created, -1 if an error
+ * Returns: 0 if the directory was successfully created, -1 if an error
* occurred
- *
+ *
* Since: 2.6
*/
int
-eth_stdio_mkdir (const gchar *filename,
+ws_stdio_mkdir (const gchar *filename,
int mode)
{
#ifdef _WIN32
save_errno = errno;
g_free (wfilename);
-
+
errno = save_errno;
return retval;
#else
}
/**
- * g_stat:
+ * g_stat:
* @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
* @buf: a pointer to a <structname>stat</structname> struct, which
* will be filled with the file information
*
- * A wrapper for the POSIX stat() function. The stat() function
+ * A wrapper for the POSIX stat() function. The stat() function
* returns information about a file.
- *
+ *
* See the C library manual for more details about stat().
*
- * Returns: 0 if the information was successfully retrieved, -1 if an error
+ * Returns: 0 if the information was successfully retrieved, -1 if an error
* occurred
- *
+ *
* Since: 2.6
*/
int
-eth_stdio_stat (const gchar *filename,
+ws_stdio_stat (const gchar *filename,
struct stat *buf)
{
#ifdef _WIN32
* g_unlink:
* @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
*
- * A wrapper for the POSIX unlink() function. The unlink() function
- * deletes a name from the filesystem. If this was the last link to the
+ * A wrapper for the POSIX unlink() function. The unlink() function
+ * deletes a name from the filesystem. If this was the last link to the
* file and no processes have it opened, the diskspace occupied by the
* file is freed.
- *
+ *
* See your C library manual for more details about unlink(). Note
* that on Windows, it is in general not possible to delete files that
* are open to some process, or mapped into memory.
*
- * Returns: 0 if the name was successfully deleted, -1 if an error
+ * Returns: 0 if the name was successfully deleted, -1 if an error
* occurred
- *
+ *
* Since: 2.6
*/
int
-eth_stdio_unlink (const gchar *filename)
+ws_stdio_unlink (const gchar *filename)
{
#ifdef _WIN32
gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
*
* A wrapper for the POSIX remove() function. The remove() function
* deletes a name from the filesystem.
- *
+ *
* See your C library manual for more details about how remove() works
* on your system. On Unix, remove() removes also directories, as it
* calls unlink() for files and rmdir() for directories. On Windows,
* fail. Any errno value set by remove() will be overwritten by that
* set by rmdir().
*
- * Returns: 0 if the file was successfully removed, -1 if an error
+ * Returns: 0 if the file was successfully removed, -1 if an error
* occurred
- *
+ *
* Since: 2.6
*/
int
-eth_stdio_remove (const gchar *filename)
+ws_stdio_remove (const gchar *filename)
{
#ifdef _WIN32
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
/**
* g_fopen:
* @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
- * @mode: a string describing the mode in which the file should be
+ * @mode: a string describing the mode in which the file should be
* opened
*
* A wrapper for the POSIX fopen() function. The fopen() function opens
- * a file and associates a new stream with it.
- *
+ * a file and associates a new stream with it.
+ *
* See the C library manual for more details about fopen().
*
* Returns: A <type>FILE</type> pointer if the file was successfully
* opened, or %NULL if an error occurred
- *
+ *
* Since: 2.6
*/
FILE *
-eth_stdio_fopen (const gchar *filename,
+ws_stdio_fopen (const gchar *filename,
const gchar *mode)
{
#ifdef _WIN32
errno = EINVAL;
return NULL;
}
-
+
retval = _wfopen (wfilename, wmode);
save_errno = errno;
/**
* g_freopen:
* @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
- * @mode: a string describing the mode in which the file should be
+ * @mode: a string describing the mode in which the file should be
* opened
* @stream: an existing stream which will be reused, or %NULL
*
* A wrapper for the POSIX freopen() function. The freopen() function
* opens a file and associates it with an existing stream.
- *
+ *
* See the C library manual for more details about freopen().
*
* Returns: A <type>FILE</type> pointer if the file was successfully
* opened, or %NULL if an error occurred.
- *
+ *
* Since: 2.6
*/
FILE *
-eth_stdio_freopen (const gchar *filename,
+ws_stdio_freopen (const gchar *filename,
const gchar *mode,
FILE *stream)
{
errno = EINVAL;
return NULL;
}
-
+
wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL);
if (wmode == NULL)
errno = EINVAL;
return NULL;
}
-
+
retval = _wfreopen (wfilename, wmode, stream);
save_errno = errno;
#if defined _WIN32 && GLIB_CHECK_VERSION(2,6,0)
#include <stdio.h>
-extern int eth_stdio_open (const gchar *filename, int flags, int mode);
-extern int eth_stdio_rename (const gchar *oldfilename, const gchar *newfilename);
-extern int eth_stdio_mkdir (const gchar *filename, int mode);
-extern int eth_stdio_stat (const gchar *filename, struct stat *buf);
-extern int eth_stdio_unlink (const gchar *filename);
-extern int eth_stdio_remove (const gchar *filename);
-extern FILE * eth_stdio_fopen (const gchar *filename, const gchar *mode);
-extern FILE * eth_stdio_freopen (const gchar *filename, const gchar *mode, FILE *stream);
-
-#define eth_open eth_stdio_open
-#define eth_rename eth_stdio_rename
-#define eth_mkdir eth_stdio_mkdir
-#define eth_stat eth_stdio_stat
-#define eth_unlink eth_stdio_unlink
-#define eth_remove eth_stdio_remove
-#define eth_fopen eth_stdio_fopen
-#define eth_freopen eth_stdio_freopen
+extern int ws_stdio_open (const gchar *filename, int flags, int mode);
+extern int ws_stdio_rename (const gchar *oldfilename, const gchar *newfilename);
+extern int ws_stdio_mkdir (const gchar *filename, int mode);
+extern int ws_stdio_stat (const gchar *filename, struct stat *buf);
+extern int ws_stdio_unlink (const gchar *filename);
+extern int ws_stdio_remove (const gchar *filename);
+extern FILE * ws_stdio_fopen (const gchar *filename, const gchar *mode);
+extern FILE * ws_stdio_freopen (const gchar *filename, const gchar *mode, FILE *stream);
+
+#define ws_open ws_stdio_open
+#define ws_rename ws_stdio_rename
+#define ws_mkdir ws_stdio_mkdir
+#define ws_stat ws_stdio_stat
+#define ws_unlink ws_stdio_unlink
+#define ws_remove ws_stdio_remove
+#define ws_fopen ws_stdio_fopen
+#define ws_freopen ws_stdio_freopen
#else /* _WIN32 && GLIB_CHECK_VERSION */
/* GLib 2.4 or below, using "old school" functions */
#ifdef _WIN32
-#define eth_open _open
-#define eth_stat _stat
-#define eth_unlink _unlink
-#define eth_mkdir(dir,mode) _mkdir(dir)
+#define ws_open _open
+#define ws_stat _stat
+#define ws_unlink _unlink
+#define ws_mkdir(dir,mode) _mkdir(dir)
#else
-#define eth_open open
-#define eth_stat stat
-#define eth_unlink unlink
-#define eth_mkdir(dir,mode) mkdir(dir,mode)
+#define ws_open open
+#define ws_stat stat
+#define ws_unlink unlink
+#define ws_mkdir(dir,mode) mkdir(dir,mode)
#endif /* _WIN32 */
-#define eth_rename rename
-#define eth_remove remove
-#define eth_fopen fopen
-#define eth_freopen freopen
+#define ws_rename rename
+#define ws_remove remove
+#define ws_fopen fopen
+#define ws_freopen freopen
#endif /* _WIN32 && GLIB_CHECK_VERSION */
/* some common file function differences between UNIX and WIN32 */
#ifdef _WIN32
/* the Win32 API prepends underscores for whatever reasons */
-#define eth_read _read
-#define eth_write _write
-#define eth_close _close
-#define eth_dup _dup
-#define eth_lseek _lseek
+#define ws_read _read
+#define ws_write _write
+#define ws_close _close
+#define ws_dup _dup
+#define ws_lseek _lseek
#else
-#define eth_read read
-#define eth_write write
-#define eth_close close
-#define eth_dup dup
-#define eth_lseek lseek
+#define ws_read read
+#define ws_write write
+#define ws_close close
+#define ws_dup dup
+#define ws_lseek lseek
#define O_BINARY 0 /* Win32 needs the O_BINARY flag for open() */
#endif /* _WIN32 */
/* directory handling */
#define ETH_DIR GDir
#define ETH_DIRENT const char
-#define eth_dir_open g_dir_open
-#define eth_dir_read_name g_dir_read_name
-#define eth_dir_get_name(dirent) dirent
-#define eth_dir_rewind g_dir_rewind
-#define eth_dir_close g_dir_close
+#define ws_dir_open g_dir_open
+#define ws_dir_read_name g_dir_read_name
+#define ws_dir_get_name(dirent) dirent
+#define ws_dir_rewind g_dir_rewind
+#define ws_dir_close g_dir_close
/* XXX - remove include "dirent.h" */
/* XXX - remove include "direct.h" */
mpa_padding
mpa_samples
mpa_version
+
+ws_stdio_open
+ws_stdio_rename
+ws_stdio_mkdir
+ws_stdio_stat
+ws_stdio_unlink
+ws_stdio_remove
+ws_stdio_fopen
+ws_stdio_freopen