Add editor modelines; Adjust whitespace as needed.

Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad
Reviewed-on: https://code.wireshark.org/review/4626
Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
Bill Meier 2014-10-12 14:56:12 -04:00
parent 4e328e4709
commit 1b8b2a8aa8
54 changed files with 1907 additions and 1211 deletions

View File

@ -375,3 +375,16 @@ capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd,
#endif /* HAVE_LIBPCAP */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -79,4 +79,17 @@ capture_info *cinfo);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* capture_info.h */

View File

@ -55,74 +55,74 @@ static gboolean capture_opts_output_to_pipe(const char *save_file, gboolean *is_
void
capture_opts_init(capture_options *capture_opts)
{
capture_opts->ifaces = g_array_new(FALSE, FALSE, sizeof(interface_options));
capture_opts->all_ifaces = g_array_new(FALSE, FALSE, sizeof(interface_t));
capture_opts->num_selected = 0;
capture_opts->default_options.name = NULL;
capture_opts->default_options.descr = NULL;
capture_opts->default_options.cfilter = NULL;
capture_opts->default_options.has_snaplen = FALSE;
capture_opts->default_options.snaplen = WTAP_MAX_PACKET_SIZE;
capture_opts->default_options.linktype = -1; /* use interface default */
capture_opts->default_options.promisc_mode = TRUE;
capture_opts->default_options.if_type = IF_WIRED;
capture_opts->ifaces = g_array_new(FALSE, FALSE, sizeof(interface_options));
capture_opts->all_ifaces = g_array_new(FALSE, FALSE, sizeof(interface_t));
capture_opts->num_selected = 0;
capture_opts->default_options.name = NULL;
capture_opts->default_options.descr = NULL;
capture_opts->default_options.cfilter = NULL;
capture_opts->default_options.has_snaplen = FALSE;
capture_opts->default_options.snaplen = WTAP_MAX_PACKET_SIZE;
capture_opts->default_options.linktype = -1; /* use interface default */
capture_opts->default_options.promisc_mode = TRUE;
capture_opts->default_options.if_type = IF_WIRED;
#ifdef HAVE_EXTCAP
capture_opts->default_options.extcap = NULL;
capture_opts->default_options.extcap_fifo = NULL;
capture_opts->default_options.extcap_args = NULL;
capture_opts->default_options.extcap_pid = INVALID_EXTCAP_PID;
capture_opts->default_options.extcap = NULL;
capture_opts->default_options.extcap_fifo = NULL;
capture_opts->default_options.extcap_args = NULL;
capture_opts->default_options.extcap_pid = INVALID_EXTCAP_PID;
#endif
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
capture_opts->default_options.buffer_size = DEFAULT_CAPTURE_BUFFER_SIZE;
capture_opts->default_options.buffer_size = DEFAULT_CAPTURE_BUFFER_SIZE;
#endif
capture_opts->default_options.monitor_mode = FALSE;
capture_opts->default_options.monitor_mode = FALSE;
#ifdef HAVE_PCAP_REMOTE
capture_opts->default_options.src_type = CAPTURE_IFLOCAL;
capture_opts->default_options.remote_host = NULL;
capture_opts->default_options.remote_port = NULL;
capture_opts->default_options.auth_type = CAPTURE_AUTH_NULL;
capture_opts->default_options.auth_username = NULL;
capture_opts->default_options.auth_password = NULL;
capture_opts->default_options.datatx_udp = FALSE;
capture_opts->default_options.nocap_rpcap = TRUE;
capture_opts->default_options.nocap_local = FALSE;
capture_opts->default_options.src_type = CAPTURE_IFLOCAL;
capture_opts->default_options.remote_host = NULL;
capture_opts->default_options.remote_port = NULL;
capture_opts->default_options.auth_type = CAPTURE_AUTH_NULL;
capture_opts->default_options.auth_username = NULL;
capture_opts->default_options.auth_password = NULL;
capture_opts->default_options.datatx_udp = FALSE;
capture_opts->default_options.nocap_rpcap = TRUE;
capture_opts->default_options.nocap_local = FALSE;
#endif
#ifdef HAVE_PCAP_SETSAMPLING
capture_opts->default_options.sampling_method = CAPTURE_SAMP_NONE;
capture_opts->default_options.sampling_param = 0;
capture_opts->default_options.sampling_method = CAPTURE_SAMP_NONE;
capture_opts->default_options.sampling_param = 0;
#endif
capture_opts->saving_to_file = FALSE;
capture_opts->save_file = NULL;
capture_opts->group_read_access = FALSE;
capture_opts->saving_to_file = FALSE;
capture_opts->save_file = NULL;
capture_opts->group_read_access = FALSE;
#ifdef PCAP_NG_DEFAULT
capture_opts->use_pcapng = TRUE; /* Save as pcap-ng by default */
capture_opts->use_pcapng = TRUE; /* Save as pcap-ng by default */
#else
capture_opts->use_pcapng = FALSE; /* Save as pcap by default */
capture_opts->use_pcapng = FALSE; /* Save as pcap by default */
#endif
capture_opts->real_time_mode = TRUE;
capture_opts->show_info = TRUE;
capture_opts->quit_after_cap = getenv("WIRESHARK_QUIT_AFTER_CAPTURE") ? TRUE : FALSE;
capture_opts->restart = FALSE;
capture_opts->orig_save_file = NULL;
capture_opts->real_time_mode = TRUE;
capture_opts->show_info = TRUE;
capture_opts->quit_after_cap = getenv("WIRESHARK_QUIT_AFTER_CAPTURE") ? TRUE : FALSE;
capture_opts->restart = FALSE;
capture_opts->orig_save_file = NULL;
capture_opts->multi_files_on = FALSE;
capture_opts->has_file_duration = FALSE;
capture_opts->file_duration = 60; /* 1 min */
capture_opts->has_ring_num_files = FALSE;
capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
capture_opts->multi_files_on = FALSE;
capture_opts->has_file_duration = FALSE;
capture_opts->file_duration = 60; /* 1 min */
capture_opts->has_ring_num_files = FALSE;
capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
capture_opts->has_autostop_files = FALSE;
capture_opts->autostop_files = 1;
capture_opts->has_autostop_packets = FALSE;
capture_opts->autostop_packets = 0;
capture_opts->has_autostop_filesize = FALSE;
capture_opts->autostop_filesize = 1000; /* 1 MB */
capture_opts->has_autostop_duration = FALSE;
capture_opts->autostop_duration = 60; /* 1 min */
capture_opts->capture_comment = NULL;
capture_opts->has_autostop_files = FALSE;
capture_opts->autostop_files = 1;
capture_opts->has_autostop_packets = FALSE;
capture_opts->autostop_packets = 0;
capture_opts->has_autostop_filesize = FALSE;
capture_opts->autostop_filesize = 1000; /* 1 MB */
capture_opts->has_autostop_duration = FALSE;
capture_opts->autostop_duration = 60; /* 1 min */
capture_opts->capture_comment = NULL;
capture_opts->output_to_pipe = FALSE;
capture_opts->capture_child = FALSE;
capture_opts->output_to_pipe = FALSE;
capture_opts->capture_child = FALSE;
}
@ -245,46 +245,46 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
static gboolean
set_autostop_criterion(capture_options *capture_opts, const char *autostoparg)
{
gchar *p, *colonp;
gchar *p, *colonp;
colonp = strchr(autostoparg, ':');
if (colonp == NULL)
return FALSE;
colonp = strchr(autostoparg, ':');
if (colonp == NULL)
return FALSE;
p = colonp;
*p++ = '\0';
p = colonp;
*p++ = '\0';
/*
* Skip over any white space (there probably won't be any, but
* as we allow it in the preferences file, we might as well
* allow it here).
*/
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*
* Put the colon back, so if our caller uses, in an
* error message, the string they passed us, the message
* looks correct.
* Skip over any white space (there probably won't be any, but
* as we allow it in the preferences file, we might as well
* allow it here).
*/
*colonp = ':';
return FALSE;
}
if (strcmp(autostoparg,"duration") == 0) {
capture_opts->has_autostop_duration = TRUE;
capture_opts->autostop_duration = get_positive_int(p,"autostop duration");
} else if (strcmp(autostoparg,"filesize") == 0) {
capture_opts->has_autostop_filesize = TRUE;
capture_opts->autostop_filesize = get_positive_int(p,"autostop filesize");
} else if (strcmp(autostoparg,"files") == 0) {
capture_opts->multi_files_on = TRUE;
capture_opts->has_autostop_files = TRUE;
capture_opts->autostop_files = get_positive_int(p,"autostop files");
} else {
return FALSE;
}
*colonp = ':'; /* put the colon back */
return TRUE;
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*
* Put the colon back, so if our caller uses, in an
* error message, the string they passed us, the message
* looks correct.
*/
*colonp = ':';
return FALSE;
}
if (strcmp(autostoparg,"duration") == 0) {
capture_opts->has_autostop_duration = TRUE;
capture_opts->autostop_duration = get_positive_int(p,"autostop duration");
} else if (strcmp(autostoparg,"filesize") == 0) {
capture_opts->has_autostop_filesize = TRUE;
capture_opts->autostop_filesize = get_positive_int(p,"autostop filesize");
} else if (strcmp(autostoparg,"files") == 0) {
capture_opts->multi_files_on = TRUE;
capture_opts->has_autostop_files = TRUE;
capture_opts->autostop_files = get_positive_int(p,"autostop files");
} else {
return FALSE;
}
*colonp = ':'; /* put the colon back */
return TRUE;
}
/*
@ -296,45 +296,45 @@ set_autostop_criterion(capture_options *capture_opts, const char *autostoparg)
static gboolean
get_ring_arguments(capture_options *capture_opts, const char *arg)
{
gchar *p = NULL, *colonp;
gchar *p = NULL, *colonp;
colonp = strchr(arg, ':');
if (colonp == NULL)
return FALSE;
colonp = strchr(arg, ':');
if (colonp == NULL)
return FALSE;
p = colonp;
*p++ = '\0';
p = colonp;
*p++ = '\0';
/*
* Skip over any white space (there probably won't be any, but
* as we allow it in the preferences file, we might as well
* allow it here).
*/
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*
* Put the colon back, so if our caller uses, in an
* error message, the string they passed us, the message
* looks correct.
* Skip over any white space (there probably won't be any, but
* as we allow it in the preferences file, we might as well
* allow it here).
*/
*colonp = ':';
return FALSE;
}
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*
* Put the colon back, so if our caller uses, in an
* error message, the string they passed us, the message
* looks correct.
*/
*colonp = ':';
return FALSE;
}
if (strcmp(arg,"files") == 0) {
capture_opts->has_ring_num_files = TRUE;
capture_opts->ring_num_files = get_positive_int(p, "number of ring buffer files");
} else if (strcmp(arg,"filesize") == 0) {
capture_opts->has_autostop_filesize = TRUE;
capture_opts->autostop_filesize = get_positive_int(p, "ring buffer filesize");
} else if (strcmp(arg,"duration") == 0) {
capture_opts->has_file_duration = TRUE;
capture_opts->file_duration = get_positive_int(p, "ring buffer duration");
}
if (strcmp(arg,"files") == 0) {
capture_opts->has_ring_num_files = TRUE;
capture_opts->ring_num_files = get_positive_int(p, "number of ring buffer files");
} else if (strcmp(arg,"filesize") == 0) {
capture_opts->has_autostop_filesize = TRUE;
capture_opts->autostop_filesize = get_positive_int(p, "ring buffer filesize");
} else if (strcmp(arg,"duration") == 0) {
capture_opts->has_file_duration = TRUE;
capture_opts->file_duration = get_positive_int(p, "ring buffer duration");
}
*colonp = ':'; /* put the colon back */
return TRUE;
*colonp = ':'; /* put the colon back */
return TRUE;
}
#ifdef HAVE_PCAP_SETSAMPLING
@ -977,64 +977,64 @@ capture_opts_default_iface_if_necessary(capture_options *capture_opts,
static int
capture_opts_test_for_fifo(const char *path)
{
ws_statb64 statb;
ws_statb64 statb;
if (ws_stat64(path, &statb) < 0)
return errno;
if (ws_stat64(path, &statb) < 0)
return errno;
if (S_ISFIFO(statb.st_mode))
return ESPIPE;
else
return 0;
if (S_ISFIFO(statb.st_mode))
return ESPIPE;
else
return 0;
}
static gboolean
capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe)
{
int err;
int err;
*is_pipe = FALSE;
*is_pipe = FALSE;
if (save_file != NULL) {
/* We're writing to a capture file. */
if (strcmp(save_file, "-") == 0) {
/* Writing to stdout. */
/* XXX - should we check whether it's a pipe? It's arguably
silly to do "-w - >output_file" rather than "-w output_file",
but by not checking we might be violating the Principle Of
Least Astonishment. */
*is_pipe = TRUE;
} else {
/* not writing to stdout, test for a FIFO (aka named pipe) */
err = capture_opts_test_for_fifo(save_file);
switch (err) {
if (save_file != NULL) {
/* We're writing to a capture file. */
if (strcmp(save_file, "-") == 0) {
/* Writing to stdout. */
/* XXX - should we check whether it's a pipe? It's arguably
silly to do "-w - >output_file" rather than "-w output_file",
but by not checking we might be violating the Principle Of
Least Astonishment. */
*is_pipe = TRUE;
} else {
/* not writing to stdout, test for a FIFO (aka named pipe) */
err = capture_opts_test_for_fifo(save_file);
switch (err) {
case ENOENT: /* it doesn't exist, so we'll be creating it,
and it won't be a FIFO */
case 0: /* found it, but it's not a FIFO */
break;
case ENOENT: /* it doesn't exist, so we'll be creating it,
and it won't be a FIFO */
case 0: /* found it, but it's not a FIFO */
break;
case ESPIPE: /* it is a FIFO */
*is_pipe = TRUE;
break;
case ESPIPE: /* it is a FIFO */
*is_pipe = TRUE;
break;
default: /* couldn't stat it */
break; /* ignore: later attempt to open */
/* will generate a nice msg */
}
default: /* couldn't stat it */
break; /* ignore: later attempt to open */
/* will generate a nice msg */
}
}
}
}
return 0;
return 0;
}
void
capture_opts_del_iface(capture_options *capture_opts, guint if_index)
{
interface_options interface_opts;
interface_options interface_opts;
interface_opts = g_array_index(capture_opts->ifaces, interface_options, if_index);
/* XXX - check if found? */
interface_opts = g_array_index(capture_opts->ifaces, interface_options, if_index);
/* XXX - check if found? */
g_free(interface_opts.name);
g_free(interface_opts.descr);
@ -1051,10 +1051,10 @@ capture_opts_del_iface(capture_options *capture_opts, guint if_index)
#endif
#ifdef HAVE_PCAP_REMOTE
if (interface_opts.src_type == CAPTURE_IFREMOTE) {
g_free(interface_opts.remote_host);
g_free(interface_opts.remote_port);
g_free(interface_opts.auth_username);
g_free(interface_opts.auth_password);
g_free(interface_opts.remote_host);
g_free(interface_opts.remote_port);
g_free(interface_opts.auth_username);
g_free(interface_opts.auth_password);
}
#endif
capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, if_index);
@ -1069,62 +1069,75 @@ capture_opts_del_iface(capture_options *capture_opts, guint if_index)
void
collect_ifaces(capture_options *capture_opts)
{
guint i;
interface_t device;
interface_options interface_opts;
guint i;
interface_t device;
interface_options interface_opts;
/* Empty out the existing list of interfaces. */
for (i = capture_opts->ifaces->len; i != 0; i--)
capture_opts_del_iface(capture_opts, i-1);
/* Empty out the existing list of interfaces. */
for (i = capture_opts->ifaces->len; i != 0; i--)
capture_opts_del_iface(capture_opts, i-1);
/* Now fill the list up again. */
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
device = g_array_index(capture_opts->all_ifaces, interface_t, i);
if (!device.hidden && device.selected) {
interface_opts.name = g_strdup(device.name);
interface_opts.descr = g_strdup(device.display_name);
interface_opts.console_display_name = g_strdup(device.name);
interface_opts.linktype = device.active_dlt;
interface_opts.cfilter = g_strdup(device.cfilter);
interface_opts.snaplen = device.snaplen;
interface_opts.has_snaplen = device.has_snaplen;
interface_opts.promisc_mode = device.pmode;
interface_opts.if_type = device.if_info.type;
/* Now fill the list up again. */
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
device = g_array_index(capture_opts->all_ifaces, interface_t, i);
if (!device.hidden && device.selected) {
interface_opts.name = g_strdup(device.name);
interface_opts.descr = g_strdup(device.display_name);
interface_opts.console_display_name = g_strdup(device.name);
interface_opts.linktype = device.active_dlt;
interface_opts.cfilter = g_strdup(device.cfilter);
interface_opts.snaplen = device.snaplen;
interface_opts.has_snaplen = device.has_snaplen;
interface_opts.promisc_mode = device.pmode;
interface_opts.if_type = device.if_info.type;
#ifdef HAVE_EXTCAP
interface_opts.extcap = g_strdup(device.if_info.extcap);
interface_opts.extcap_fifo = NULL;
interface_opts.extcap_args = device.external_cap_args_settings;
interface_opts.extcap_pid = INVALID_EXTCAP_PID;
if (interface_opts.extcap_args)
g_hash_table_ref(interface_opts.extcap_args);
interface_opts.extcap = g_strdup(device.if_info.extcap);
interface_opts.extcap_fifo = NULL;
interface_opts.extcap_args = device.external_cap_args_settings;
interface_opts.extcap_pid = INVALID_EXTCAP_PID;
if (interface_opts.extcap_args)
g_hash_table_ref(interface_opts.extcap_args);
#endif
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
interface_opts.buffer_size = device.buffer;
interface_opts.buffer_size = device.buffer;
#endif
#ifdef HAVE_PCAP_CREATE
interface_opts.monitor_mode = device.monitor_mode_enabled;
interface_opts.monitor_mode = device.monitor_mode_enabled;
#endif
#ifdef HAVE_PCAP_REMOTE
interface_opts.src_type = CAPTURE_IFREMOTE;
interface_opts.remote_host = g_strdup(device.remote_opts.remote_host_opts.remote_host);
interface_opts.remote_port = g_strdup(device.remote_opts.remote_host_opts.remote_port);
interface_opts.auth_type = device.remote_opts.remote_host_opts.auth_type;
interface_opts.auth_username = g_strdup(device.remote_opts.remote_host_opts.auth_username);
interface_opts.auth_password = g_strdup(device.remote_opts.remote_host_opts.auth_password);
interface_opts.datatx_udp = device.remote_opts.remote_host_opts.datatx_udp;
interface_opts.nocap_rpcap = device.remote_opts.remote_host_opts.nocap_rpcap;
interface_opts.nocap_local = device.remote_opts.remote_host_opts.nocap_local;
interface_opts.src_type = CAPTURE_IFREMOTE;
interface_opts.remote_host = g_strdup(device.remote_opts.remote_host_opts.remote_host);
interface_opts.remote_port = g_strdup(device.remote_opts.remote_host_opts.remote_port);
interface_opts.auth_type = device.remote_opts.remote_host_opts.auth_type;
interface_opts.auth_username = g_strdup(device.remote_opts.remote_host_opts.auth_username);
interface_opts.auth_password = g_strdup(device.remote_opts.remote_host_opts.auth_password);
interface_opts.datatx_udp = device.remote_opts.remote_host_opts.datatx_udp;
interface_opts.nocap_rpcap = device.remote_opts.remote_host_opts.nocap_rpcap;
interface_opts.nocap_local = device.remote_opts.remote_host_opts.nocap_local;
#endif
#ifdef HAVE_PCAP_SETSAMPLING
interface_opts.sampling_method = device.remote_opts.sampling_method;
interface_opts.sampling_param = device.remote_opts.sampling_param;
interface_opts.sampling_method = device.remote_opts.sampling_method;
interface_opts.sampling_param = device.remote_opts.sampling_param;
#endif
g_array_append_val(capture_opts->ifaces, interface_opts);
} else {
continue;
g_array_append_val(capture_opts->ifaces, interface_opts);
} else {
continue;
}
}
}
}
#endif /* HAVE_LIBPCAP */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -92,20 +92,20 @@ extern "C" {
#endif
#define LONGOPT_CAPTURE_COMMON \
{(char *)"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
{(char *)"autostop", required_argument, NULL, 'a'}, \
{(char *)"ring-buffer", required_argument, NULL, 'b'}, \
LONGOPT_BUFFER_SIZE \
{(char *)"list-interfaces", no_argument, NULL, 'D'}, \
{(char *)"interface", required_argument, NULL, 'i'}, \
LONGOPT_MONITOR_MODE \
{(char *)"list-data-link-types", no_argument, NULL, 'L'}, \
{(char *)"no-promiscuous-mode", no_argument, NULL, 'p'}, \
{(char *)"snapshot-length", required_argument, NULL, 's'}, \
{(char *)"linktype", required_argument, NULL, 'y'},
{(char *)"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
{(char *)"autostop", required_argument, NULL, 'a'}, \
{(char *)"ring-buffer", required_argument, NULL, 'b'}, \
LONGOPT_BUFFER_SIZE \
{(char *)"list-interfaces", no_argument, NULL, 'D'}, \
{(char *)"interface", required_argument, NULL, 'i'}, \
LONGOPT_MONITOR_MODE \
{(char *)"list-data-link-types", no_argument, NULL, 'L'}, \
{(char *)"no-promiscuous-mode", no_argument, NULL, 'p'}, \
{(char *)"snapshot-length", required_argument, NULL, 's'}, \
{(char *)"linktype", required_argument, NULL, 'y'},
#define OPTSTRING_CAPTURE_COMMON \
"a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:i:" OPTSTRING_I "Lps:y:"
"a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:i:" OPTSTRING_I "Lps:y:"
#ifdef HAVE_PCAP_REMOTE
/* Type of capture source */
@ -137,22 +137,22 @@ typedef enum {
#ifdef HAVE_PCAP_REMOTE
struct remote_host_info {
gchar *remote_host; /**< Host name or network address for remote capturing */
gchar *remote_port; /**< TCP port of remote RPCAP server */
gint auth_type; /**< Authentication type */
gchar *auth_username; /**< Remote authentication parameters */
gchar *auth_password; /**< Remote authentication parameters */
gboolean datatx_udp;
gboolean nocap_rpcap;
gboolean nocap_local;
gchar *remote_host; /**< Host name or network address for remote capturing */
gchar *remote_port; /**< TCP port of remote RPCAP server */
gint auth_type; /**< Authentication type */
gchar *auth_username; /**< Remote authentication parameters */
gchar *auth_password; /**< Remote authentication parameters */
gboolean datatx_udp;
gboolean nocap_rpcap;
gboolean nocap_local;
};
struct remote_host {
gchar *r_host; /**< Host name or network address for remote capturing */
gchar *remote_port; /**< TCP port of remote RPCAP server */
gint auth_type; /**< Authentication type */
gchar *auth_username; /**< Remote authentication parameters */
gchar *auth_password; /**< Remote authentication parameters */
gchar *r_host; /**< Host name or network address for remote capturing */
gchar *remote_port; /**< TCP port of remote RPCAP server */
gint auth_type; /**< Authentication type */
gchar *auth_username; /**< Remote authentication parameters */
gchar *auth_password; /**< Remote authentication parameters */
};
typedef struct remote_options_tag {
@ -166,38 +166,38 @@ typedef struct remote_options_tag {
#endif /* HAVE_PCAP_REMOTE */
typedef struct interface_tag {
gchar *name;
gchar *display_name;
gchar *friendly_name;
guint type;
gchar *addresses;
gint no_addresses;
gchar *cfilter;
GList *links;
gint active_dlt;
gboolean pmode;
gboolean has_snaplen;
guint snaplen;
gboolean local;
gchar *name;
gchar *display_name;
gchar *friendly_name;
guint type;
gchar *addresses;
gint no_addresses;
gchar *cfilter;
GList *links;
gint active_dlt;
gboolean pmode;
gboolean has_snaplen;
guint snaplen;
gboolean local;
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
gint buffer;
gint buffer;
#endif
#ifdef HAVE_PCAP_CREATE
gboolean monitor_mode_enabled;
gboolean monitor_mode_supported;
gboolean monitor_mode_enabled;
gboolean monitor_mode_supported;
#endif
#ifdef HAVE_PCAP_REMOTE
remote_options remote_opts;
remote_options remote_opts;
#endif
guint32 last_packets;
guint32 packet_diff;
if_info_t if_info;
gboolean selected;
gboolean hidden;
gboolean locked;
guint32 last_packets;
guint32 packet_diff;
if_info_t if_info;
gboolean selected;
gboolean hidden;
gboolean locked;
#ifdef HAVE_EXTCAP
/* External capture cached data */
GHashTable *external_cap_args_settings;
GHashTable *external_cap_args_settings;
#endif
} interface_t;
@ -213,55 +213,55 @@ typedef struct link_row_tag {
#endif
typedef struct interface_options_tag {
gchar *name; /* the name of the interface provided to winpcap/libpcap to specify the interface */
gchar *descr;
gchar *console_display_name; /* the name displayed in the console, also the basis for autonamed pcap filenames */
gchar *cfilter;
gboolean has_snaplen;
int snaplen;
int linktype;
gboolean promisc_mode;
interface_type if_type;
gchar *name; /* the name of the interface provided to winpcap/libpcap to specify the interface */
gchar *descr;
gchar *console_display_name; /* the name displayed in the console, also the basis for autonamed pcap filenames */
gchar *cfilter;
gboolean has_snaplen;
int snaplen;
int linktype;
gboolean promisc_mode;
interface_type if_type;
#ifdef HAVE_EXTCAP
gchar *extcap;
gchar *extcap_fifo;
GHashTable *extcap_args;
GPid extcap_pid; /* pid of running process or INVALID_EXTCAP_PID */
guint extcap_child_watch;
gchar *extcap;
gchar *extcap_fifo;
GHashTable *extcap_args;
GPid extcap_pid; /* pid of running process or INVALID_EXTCAP_PID */
guint extcap_child_watch;
#endif
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
int buffer_size;
int buffer_size;
#endif
gboolean monitor_mode;
gboolean monitor_mode;
#ifdef HAVE_PCAP_REMOTE
capture_source src_type;
gchar *remote_host;
gchar *remote_port;
capture_auth auth_type;
gchar *auth_username;
gchar *auth_password;
gboolean datatx_udp;
gboolean nocap_rpcap;
gboolean nocap_local;
capture_source src_type;
gchar *remote_host;
gchar *remote_port;
capture_auth auth_type;
gchar *auth_username;
gchar *auth_password;
gboolean datatx_udp;
gboolean nocap_rpcap;
gboolean nocap_local;
#endif
#ifdef HAVE_PCAP_SETSAMPLING
capture_sampling sampling_method;
int sampling_param;
capture_sampling sampling_method;
int sampling_param;
#endif
} interface_options;
/** Capture options coming from user interface */
typedef struct capture_options_tag {
/* general */
GArray *ifaces; /**< the interfaces to use for the
next capture, entries are of
type interface_options */
GArray *all_ifaces; /**< all interfaces, entries are
of type interface_t */
int ifaces_err; /**< if all_ifaces is null, the error
when it was fetched, if any */
gchar *ifaces_err_info; /**< error string for that error */
guint num_selected;
GArray *ifaces; /**< the interfaces to use for the
next capture, entries are of
type interface_options */
GArray *all_ifaces; /**< all interfaces, entries are
of type interface_t */
int ifaces_err; /**< if all_ifaces is null, the error
when it was fetched, if any */
gchar *ifaces_err_info; /**< error string for that error */
guint num_selected;
/*
* Options to be applied to all interfaces.
@ -280,49 +280,49 @@ typedef struct capture_options_tag {
*
* These can be overridden per-interface.
*/
interface_options default_options;
interface_options default_options;
gboolean saving_to_file; /**< TRUE if capture is writing to a file */
gchar *save_file; /**< the capture file name */
gboolean group_read_access; /**< TRUE is group read permission needs to be set */
gboolean use_pcapng; /**< TRUE if file format is pcapng */
gboolean saving_to_file; /**< TRUE if capture is writing to a file */
gchar *save_file; /**< the capture file name */
gboolean group_read_access; /**< TRUE is group read permission needs to be set */
gboolean use_pcapng; /**< TRUE if file format is pcapng */
/* GUI related */
gboolean real_time_mode; /**< Update list of packets in real time */
gboolean show_info; /**< show the info dialog */
gboolean quit_after_cap; /**< Makes a "capture only mode". Implies -k */
gboolean restart; /**< restart after closing is done */
gchar *orig_save_file; /**< the original capture file name (saved for a restart) */
gboolean real_time_mode; /**< Update list of packets in real time */
gboolean show_info; /**< show the info dialog */
gboolean quit_after_cap; /**< Makes a "capture only mode". Implies -k */
gboolean restart; /**< restart after closing is done */
gchar *orig_save_file; /**< the original capture file name (saved for a restart) */
/* multiple files (and ringbuffer) */
gboolean multi_files_on; /**< TRUE if ring buffer in use */
gboolean multi_files_on; /**< TRUE if ring buffer in use */
gboolean has_file_duration; /**< TRUE if ring duration specified */
gint32 file_duration; /**< Switch file after n seconds */
gboolean has_ring_num_files; /**< TRUE if ring num_files specified */
guint32 ring_num_files; /**< Number of multiple buffer files */
gboolean has_file_duration; /**< TRUE if ring duration specified */
gint32 file_duration; /**< Switch file after n seconds */
gboolean has_ring_num_files; /**< TRUE if ring num_files specified */
guint32 ring_num_files; /**< Number of multiple buffer files */
/* autostop conditions */
gboolean has_autostop_files; /**< TRUE if maximum number of capture files
are specified */
gint32 autostop_files; /**< Maximum number of capture files */
gboolean has_autostop_files; /**< TRUE if maximum number of capture files
are specified */
gint32 autostop_files; /**< Maximum number of capture files */
gboolean has_autostop_packets; /**< TRUE if maximum packet count is
specified */
int autostop_packets; /**< Maximum packet count */
gboolean has_autostop_filesize; /**< TRUE if maximum capture file size
is specified */
guint32 autostop_filesize; /**< Maximum capture file size */
gboolean has_autostop_duration; /**< TRUE if maximum capture duration
is specified */
gint32 autostop_duration; /**< Maximum capture duration */
gboolean has_autostop_packets; /**< TRUE if maximum packet count is
specified */
int autostop_packets; /**< Maximum packet count */
gboolean has_autostop_filesize; /**< TRUE if maximum capture file size
is specified */
guint32 autostop_filesize; /**< Maximum capture file size */
gboolean has_autostop_duration; /**< TRUE if maximum capture duration
is specified */
gint32 autostop_duration; /**< Maximum capture duration */
gchar *capture_comment; /** capture comment to write to the
output file */
gchar *capture_comment; /** capture comment to write to the
output file */
/* internally used (don't touch from outside) */
gboolean output_to_pipe; /**< save_file is a pipe (named or stdout) */
gboolean capture_child; /**< hidden option: Wireshark child mode */
gboolean output_to_pipe; /**< save_file is a pipe (named or stdout) */
gboolean capture_child; /**< hidden option: Wireshark child mode */
} capture_options;
/* initialize the capture_options with some reasonable values */
@ -372,4 +372,17 @@ collect_ifaces(capture_options *capture_opts);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* capture_opts.h */

View File

@ -208,3 +208,16 @@ static gboolean _cnd_eval_capturesize(condition* cnd, va_list ap){
*/
static void _cnd_reset_capturesize(condition *cnd _U_){
} /* END _cnd_reset_capturesize() */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -23,5 +23,18 @@
void init_capture_stop_conditions(void);
void cleanup_capture_stop_conditions(void);
extern const char* CND_CLASS_TIMEOUT;
extern const char* CND_CLASS_CAPTURESIZE;
extern const char *CND_CLASS_TIMEOUT;
extern const char *CND_CLASS_CAPTURESIZE;
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

13
cfile.c
View File

@ -59,3 +59,16 @@ cap_file_init(capture_file *cf)
memset(cf, 0, sizeof(capture_file));
cf->snap = WTAP_MAX_PACKET_SIZE;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

19
cfile.h
View File

@ -36,7 +36,7 @@ extern "C" {
/* Current state of file. */
typedef enum {
FILE_CLOSED, /* No file open */
FILE_CLOSED, /* No file open */
FILE_READ_IN_PROGRESS, /* Reading a file we've opened */
FILE_READ_ABORTED, /* Read aborted by user */
FILE_READ_DONE /* Read completed */
@ -116,11 +116,11 @@ typedef struct _capture_file {
frame_data *current_frame; /* Frame data for current frame */
gint current_row; /* Row number for current frame */
epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
field_info *finfo_selected; /* Field info for currently selected field */
field_info *finfo_selected; /* Field info for currently selected field */
#ifdef WANT_PACKET_EDITOR
GTree *edited_frames; /* BST with modified frames */
#endif
gpointer window; /* Top-level window associated with file */
gpointer window; /* Top-level window associated with file */
GTree *frames_user_comments; /* BST with user comments for frames (key = frame_data) */
gulong computed_elapsed;
@ -138,4 +138,17 @@ extern const char *cap_file_get_interface_name(void *data, guint32 interface_id)
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* cfile.h */

13
color.h
View File

@ -58,4 +58,17 @@ gboolean initialize_color(color_t *color, guint16 red, guint16 green, guint16 bl
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
#endif /* __COLOR_H__ */

View File

@ -129,4 +129,17 @@ void* cnd_get_user_data(condition*);
*/
void cnd_set_user_data(condition *, void *);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* CONDITIONS_H */

View File

@ -192,3 +192,16 @@ write_failure_message(const char *filename, int err)
fprintf(stderr, "dftest: An error occurred while writing to the file \"%s\": %s.\n",
filename, g_strerror(err));
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

View File

@ -411,3 +411,16 @@ int main(int argc _U_, char** argv _U_) {
echld_terminate();
return 0;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

21
file.h
View File

@ -42,7 +42,7 @@ typedef enum {
/** Return values from functions that read capture files. */
typedef enum {
CF_READ_OK, /**< operation succeeded */
CF_READ_OK, /**< operation succeeded */
CF_READ_ERROR, /**< operation got an error (function may provide err with details) */
CF_READ_ABORTED /**< operation aborted by user */
} cf_read_status_t;
@ -56,9 +56,9 @@ typedef enum {
/** Return values from functions that print sets of packets. */
typedef enum {
CF_PRINT_OK, /**< print operation succeeded */
CF_PRINT_OPEN_ERROR, /**< print operation failed while opening printer */
CF_PRINT_WRITE_ERROR /**< print operation failed while writing to the printer */
CF_PRINT_OK, /**< print operation succeeded */
CF_PRINT_OPEN_ERROR, /**< print operation failed while opening printer */
CF_PRINT_WRITE_ERROR /**< print operation failed while writing to the printer */
} cf_print_status_t;
typedef enum {
@ -682,4 +682,17 @@ void read_keytab_file(const char *);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* file.h */

View File

@ -429,3 +429,16 @@ void fileset_delete(void)
set.dirname = NULL;
}
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -28,12 +28,12 @@ extern "C" {
#endif /* __cplusplus */
typedef struct _fileset_entry {
char *fullname; /* File name with path (g_strdup'ed) */
char *name; /* File name without path (g_strdup'ed) */
time_t ctime; /* create time */
time_t mtime; /* last modified time */
gint64 size; /* size of file in bytes */
gboolean current; /* is this the currently loaded file? */
char *fullname; /* File name with path (g_strdup'ed) */
char *name; /* File name without path (g_strdup'ed) */
time_t ctime; /* create time */
time_t mtime; /* last modified time */
gint64 size; /* size of file in bytes */
gboolean current; /* is this the currently loaded file? */
} fileset_entry;
@ -63,4 +63,17 @@ extern void fileset_update_file(const char *path);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __FILESET_H__ */

View File

@ -338,3 +338,16 @@ file_tvbuff_new_buffer(const frame_data *fd, Buffer *buf)
{
return frame_tvbuff_new(fd, ws_buffer_start_ptr(buf));
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

View File

@ -41,4 +41,17 @@ extern tvbuff_t *file_tvbuff_new_buffer(const frame_data *fd, Buffer *buf);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
#endif /* __FRAME_TVBUFF_H__ */

View File

@ -36,4 +36,17 @@ extern capture_file cfile;
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __GLOBALS_H__ */

12
log.h
View File

@ -36,5 +36,17 @@
/* (might slightly degrade performance) */
/*#define LOG_CAPTURE_VERBOSE*/
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif

520
mkcap.c
View File

@ -105,7 +105,7 @@ struct seg_hist_s {
/* but a retransmit will have a new seg */
int flags; /* Flags as above for ack and seg loss */
int acks_first_seq; /* How many times we have seen an ack
for the first seq number in this seg */
for the first seq number in this seg */
};
#define SEG_HIST_SIZE 128
@ -120,25 +120,25 @@ int delayed_ack_wait = 30000; /* 30 mS before an ACK is generated if */
void
makeseg(char *eth1, char *eth2, char *ip1, char *ip2, char *p1, char *p2, int *s1, int *s2, char *flags, int len)
{
int i;
int i;
printf("2002/01/07 00:00:%02d.%06d\n", ts/1000000, ts%1000000);
printf("0000 %s %s 08 00\n", eth1, eth2);
printf("000e 45 00 %02x %02x 00 00 00 00 40 06 00 00 %s %s\n", (len+40)>>8, (len+40)&0xff, ip1, ip2);
printf("0022 %s %s %02x %02x %02x %02x %02x %02x %02x %02x 50 %s 80 00 00 00 00 00", p1, p2,
((*s1)>>24)&0xff,
((*s1)>>16)&0xff,
((*s1)>>8)&0xff,
((*s1))&0xff,
((*s2)>>24)&0xff,
((*s2)>>16)&0xff,
((*s2)>>8)&0xff,
((*s2))&0xff,
flags );
for(i=0;i<(len<(snap_len-40)?len:snap_len-40);i++)printf(" 00");
printf("\n");
printf("\n");
(*s1)+=len;
printf("2002/01/07 00:00:%02d.%06d\n", ts/1000000, ts%1000000);
printf("0000 %s %s 08 00\n", eth1, eth2);
printf("000e 45 00 %02x %02x 00 00 00 00 40 06 00 00 %s %s\n", (len+40)>>8, (len+40)&0xff, ip1, ip2);
printf("0022 %s %s %02x %02x %02x %02x %02x %02x %02x %02x 50 %s 80 00 00 00 00 00", p1, p2,
((*s1)>>24)&0xff,
((*s1)>>16)&0xff,
((*s1)>>8)&0xff,
((*s1))&0xff,
((*s2)>>24)&0xff,
((*s2)>>16)&0xff,
((*s2)>>8)&0xff,
((*s2))&0xff,
flags );
for(i=0;i<(len<(snap_len-40)?len:snap_len-40);i++)printf(" 00");
printf("\n");
printf("\n");
(*s1)+=len;
}
/*
@ -204,12 +204,12 @@ int next_ack_due()
if (ack_lost) {
if (delayed_ack) {
if (((first_slot + 1 + 2 * ack_lost) % SEG_HIST_SIZE) >= next_slot)
/* XXX: FIXME, what about when the window is closed */
/* XXX: FIXME, use the correct value for this */
return (((unsigned int)(1<<31)) - 1);
/* XXX: FIXME, what about when the window is closed */
/* XXX: FIXME, use the correct value for this */
return (((unsigned int)(1<<31)) - 1);
else
return seg_hist[(first_slot + 1 + 2 * ack_lost) % SEG_HIST_SIZE].ts +
ack_delay + jitter;
return seg_hist[(first_slot + 1 + 2 * ack_lost) % SEG_HIST_SIZE].ts +
ack_delay + jitter;
}
else
return seg_hist[slot].ts + ack_delay + jitter;
@ -311,88 +311,88 @@ gen_next_ack(int force, int spacing)
else
cwnd = cwnd + data_acked;
if (verbose) fprintf(stderr, "Ack rcvd. ts: %d, data_acked: %d, cwnd: %d, window: %d\n",
ts, data_acked, cwnd, window);
ts, data_acked, cwnd, window);
if (cwnd > window) cwnd = window;
}
void
makeackedrun(int len, int spacing, int ackdelay)
{
int next_ack_ts=0;
if (verbose) fprintf(stderr, "makeackedrun: Len=%d, spacing=%d, ackdelay=%d\n",
len, spacing, ackdelay);
while(len>0){
int next_ack_ts=0;
if (verbose) fprintf(stderr, "makeackedrun: Len=%d, spacing=%d, ackdelay=%d\n",
len, spacing, ackdelay);
while(len>0){
/*
* Each time we output a segment, we should check to see if an
* ack is due back before the next segment is due ...
*/
int seglen, saved_seq;
seglen=(len>1460)?1460:len;
/*
* Only output what is left in the cwnd.
* We assume there is space in the congestion window here
*/
if (seglen > (cwnd - used_win)) seglen = cwnd - used_win;
/*
* Each time we output a segment, we should check to see if an
* ack is due back before the next segment is due ...
*/
int seglen, saved_seq;
seglen=(len>1460)?1460:len;
/*
* Only output what is left in the cwnd.
* We assume there is space in the congestion window here
*/
if (seglen > (cwnd - used_win)) seglen = cwnd - used_win;
len-=seglen;
saved_seq = seq_1;
if (verbose) fprintf(stderr, "Sending segment. ts: %d, jitter: %d\n", ts, jitter);
if(len){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "18", seglen);
}
add_seg_sent(saved_seq, seglen);
len-=seglen;
saved_seq = seq_1;
if (verbose) fprintf(stderr, "Sending segment. ts: %d, jitter: %d\n", ts, jitter);
if(len){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "18", seglen);
}
add_seg_sent(saved_seq, seglen);
/*
* Now, if the window is closed, then we have to eject an
* ack, otherwise we can eject more data.
* Also, the other end will tend to ack two segments at
* a time ... and that ack might fall between two
* outgoing segments
*/
jitter = (rand()%10) - 5; /* What if spacing too small */
/*
* Now, if the window is closed, then we have to eject an
* ack, otherwise we can eject more data.
* Also, the other end will tend to ack two segments at
* a time ... and that ack might fall between two
* outgoing segments
*/
jitter = (rand()%10) - 5; /* What if spacing too small */
if (verbose) fprintf(stderr, "used win: %d, cwnd: %d\n", used_win, cwnd);
if (verbose) fprintf(stderr, "used win: %d, cwnd: %d\n", used_win, cwnd);
if ((next_ack_ts = next_ack_due()) < ts + spacing + jitter) {
int old_ts = ts;
if ((next_ack_ts = next_ack_due()) < ts + spacing + jitter) {
int old_ts = ts;
/*
* Generate the ack and retire the segments
* If delayed ACK in use, there should be two
* or more outstanding segments ...
*/
if (verbose) fprintf(stderr, "Non forced ACK ...ts + spacing + jitter:%d, jitter: %d\n", ts + spacing + jitter, jitter);
gen_next_ack(NO_FORCE_ACK, spacing);
/*
* We don't want time to go backwards ...
*/
if (old_ts + spacing + jitter <= ts)
ts++;
else
ts = old_ts + spacing + jitter;
/*
* Generate the ack and retire the segments
* If delayed ACK in use, there should be two
* or more outstanding segments ...
*/
if (verbose) fprintf(stderr, "Non forced ACK ...ts + spacing + jitter:%d, jitter: %d\n", ts + spacing + jitter, jitter);
gen_next_ack(NO_FORCE_ACK, spacing);
/*
* We don't want time to go backwards ...
*/
if (old_ts + spacing + jitter <= ts)
ts++;
else
ts = old_ts + spacing + jitter;
} else if (used_win == cwnd) {
} else if (used_win == cwnd) {
/*
* We need an ACK, so generate it and retire the
* segments and advance the ts to the time of the ack
*/
/*
* We need an ACK, so generate it and retire the
* segments and advance the ts to the time of the ack
*/
if (verbose) fprintf(stderr, "Forced ACK ... \n");
gen_next_ack(FORCE_ACK, spacing);
if (verbose) fprintf(stderr, "Forced ACK ... \n");
gen_next_ack(FORCE_ACK, spacing);
ts+=(spacing+jitter); /* Should not use spacing here */
ts+=(spacing+jitter); /* Should not use spacing here */
}
else {
ts+=(spacing+jitter);
}
}
else {
ts+=(spacing+jitter);
}
if (verbose) fprintf(stderr, "Next Ack Due: %d\n", next_ack_ts);
}
if (verbose) fprintf(stderr, "Next Ack Due: %d\n", next_ack_ts);
}
}
@ -400,88 +400,88 @@ makeackedrun(int len, int spacing, int ackdelay)
void
makeackedrundroppedtail8kb(int len, int spacing, int ackdelay)
{
int old_seq1;
int dropped_tail;
int i;
int num_dupes;
if (verbose) fprintf(stderr, "makeackedrundroppedtail8kB: Len=%d, spacing=%d, ackdelay=%d\n",
len, spacing, ackdelay);
old_seq1=seq_1;
while(len>0){
int seglen;
seglen=(len>1460)?1460:len;
len-=seglen;
if(seglen==1460){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "18", seglen);
}
ts+=spacing;
}
int old_seq1;
int dropped_tail;
int i;
int num_dupes;
if (verbose) fprintf(stderr, "makeackedrundroppedtail8kB: Len=%d, spacing=%d, ackdelay=%d\n",
len, spacing, ackdelay);
old_seq1=seq_1;
while(len>0){
int seglen;
seglen=(len>1460)?1460:len;
len-=seglen;
if(seglen==1460){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &seq_1, &seq_2, "18", seglen);
}
ts+=spacing;
}
ts+=ackdelay;
ts+=ackdelay;
i=0;
num_dupes=-1;
dropped_tail=0;
while(old_seq1!=seq_1){
int ack_len;
i=0;
num_dupes=-1;
dropped_tail=0;
while(old_seq1!=seq_1){
int ack_len;
ack_len=((seq_1-old_seq1)>2920)?2920:(seq_1-old_seq1);
ack_len=((seq_1-old_seq1)>2920)?2920:(seq_1-old_seq1);
i++;
if(i==6){
dropped_tail=old_seq1;
}
old_seq1+=ack_len;
if(i<6){
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &old_seq1, "10", 0);
} else if (i==6) {
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &dropped_tail, "10", 0);
num_dupes+=2;
} else {
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &dropped_tail, "10", 0);
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &dropped_tail, "10", 0);
num_dupes+=2;
}
ts+=spacing/2;
}
i++;
if(i==6){
dropped_tail=old_seq1;
}
old_seq1+=ack_len;
if(i<6){
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &old_seq1, "10", 0);
} else if (i==6) {
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &dropped_tail, "10", 0);
num_dupes+=2;
} else {
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &dropped_tail, "10", 0);
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &dropped_tail, "10", 0);
num_dupes+=2;
}
ts+=spacing/2;
}
if(!dropped_tail){
return;
}
if(!dropped_tail){
return;
}
if(num_dupes<3){
int seglen;
ts+=1000000;
seglen=((seq_1-dropped_tail)>1460)?1460:(seq_1-dropped_tail);
if(seglen==1460){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "18", seglen);
}
ts+=ackdelay;
if(num_dupes<3){
int seglen;
ts+=1000000;
seglen=((seq_1-dropped_tail)>1460)?1460:(seq_1-dropped_tail);
if(seglen==1460){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "18", seglen);
}
ts+=ackdelay;
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &seq_1, "10", 0);
ts+=spacing;
return;
}
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &seq_1, "10", 0);
ts+=spacing;
return;
}
while(dropped_tail!=seq_1){
int seglen;
int ack;
seglen=((seq_1-dropped_tail)>1460)?1460:(seq_1-dropped_tail);
if(seglen==1460){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "18", seglen);
}
ts+=ackdelay;
while(dropped_tail!=seq_1){
int seglen;
int ack;
seglen=((seq_1-dropped_tail)>1460)?1460:(seq_1-dropped_tail);
if(seglen==1460){
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "10", seglen);
} else {
makeseg(eth_1, eth_2, ip_1, ip_2, port_1, port_2, &dropped_tail, &seq_2, "18", seglen);
}
ts+=ackdelay;
ack=dropped_tail;
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &ack, "10", 0);
ts+=spacing;
}
ack=dropped_tail;
makeseg(eth_2, eth_1, ip_2, ip_1, port_2, port_1, &seq_2, &ack, "10", 0);
ts+=spacing;
}
}
void usage()
@ -556,7 +556,7 @@ process_drop_list(char *drop_list)
if (!all_digits(tok)) {
fprintf(stderr, "Error in segment offset or count. Not all digits: %s\n",
tok);
tok);
fprintf(stderr, "No packet drops being performed!\n");
g_free(save);
g_free(drops);
@ -577,116 +577,128 @@ process_drop_list(char *drop_list)
int
main(int argc, char *argv[])
{
int i;
int len;
int type;
int cnt;
extern char *optarg;
extern int optind;
int opt;
int i;
int len;
int type;
int cnt;
extern char *optarg;
extern int optind;
int opt;
while ((opt = getopt(argc, argv, "a:b:d:Di:I:j:l:n:N:p:P:r:s:vw:")) != EOF) {
switch (opt) {
case 'a':
ack_delay = atoi(optarg);
break;
while ((opt = getopt(argc, argv, "a:b:d:Di:I:j:l:n:N:p:P:r:s:vw:")) != EOF) {
switch (opt) {
case 'a':
ack_delay = atoi(optarg);
break;
case 'b': /* Bytes ... */
total_bytes = atoi(optarg);
break;
case 'b': /* Bytes ... */
total_bytes = atoi(optarg);
break;
case 'd': /* A list of drops to simulate */
process_drop_list(optarg);
break;
case 'd': /* A list of drops to simulate */
process_drop_list(optarg);
break;
case 'D': /* Toggle tcp_nodelay */
tcp_nodelay = (tcp_nodelay + 1) % 1;
break;
case 'D': /* Toggle tcp_nodelay */
tcp_nodelay = (tcp_nodelay + 1) % 1;
break;
case 'i':
ip_1 = optarg;
break;
case 'i':
ip_1 = optarg;
break;
case 'I':
ip_2 = optarg;
break;
case 'I':
ip_2 = optarg;
break;
case 'l':
snap_len = atoi(optarg);
break;
case 'l':
snap_len = atoi(optarg);
break;
case 'n': /* ISN for send dirn, ie, seq_1 */
seq_1 = atoi(optarg);
break;
case 'n': /* ISN for send dirn, ie, seq_1 */
seq_1 = atoi(optarg);
break;
case 'N': /* ISN for recv dirn, ie, seq_2 */
seq_2 = atoi(optarg);
break;
case 'N': /* ISN for recv dirn, ie, seq_2 */
seq_2 = atoi(optarg);
break;
case 'p':
port_1 = optarg;
break;
case 'p':
port_1 = optarg;
break;
case 'P':
port_2 = optarg;
break;
case 'P':
port_2 = optarg;
break;
case 'r':
run_type = atoi(optarg);
break;
case 'r':
run_type = atoi(optarg);
break;
case 's':
send_spacing = atoi(optarg);
break;
case 's':
send_spacing = atoi(optarg);
break;
case 'v':
verbose++;
break;
case 'v':
verbose++;
break;
case 'w': /* Window ... */
window = atoi(optarg);
ssthresh = window / 2; /* Have to recalc this ... */
break;
case 'w': /* Window ... */
window = atoi(optarg);
ssthresh = window / 2; /* Have to recalc this ... */
break;
default:
usage();
break;
}
}
default:
usage();
break;
}
}
if (verbose) fprintf(stderr, "IP1: %s, IP2: %s, P1: %s, P2: %s, Ack Delay: %d, Send Spacing: %d\n",
ip_1, ip_2, port_1, port_2, ack_delay, send_spacing);
if (verbose) fprintf(stderr, "IP1: %s, IP2: %s, P1: %s, P2: %s, Ack Delay: %d, Send Spacing: %d\n",
ip_1, ip_2, port_1, port_2, ack_delay, send_spacing);
/*return 0; */
/*return 0; */
if (run_type == 0) {
makeackedrun(total_bytes, send_spacing, ack_delay);
}
else {
for(cnt=0;cnt<200;cnt++){
type=rand()%150;
if(type<75){
int j;
j=5+rand()%10;
for(i=0;i<j;i++){
makeackedrun(32768, send_spacing, ack_delay);
}
} else if(type<90) {
int j;
j=4+rand()%4;
for(i=0;i<j;i++){
len=100+rand()&0xfff;
makeackedrun(len, send_spacing, ack_delay);
}
} else {
for(i=0;i<5;i++){
len=100+rand()&0x3fff+0x1fff;
makeackedrun(len, send_spacing, ack_delay);
/*makeackedrundroppedtail8kb(len, send_spacing, ack_delay);*/
}
}
}
}
return 0;
if (run_type == 0) {
makeackedrun(total_bytes, send_spacing, ack_delay);
}
else {
for(cnt=0;cnt<200;cnt++){
type=rand()%150;
if(type<75){
int j;
j=5+rand()%10;
for(i=0;i<j;i++){
makeackedrun(32768, send_spacing, ack_delay);
}
} else if(type<90) {
int j;
j=4+rand()%4;
for(i=0;i<j;i++){
len=100+rand()&0xfff;
makeackedrun(len, send_spacing, ack_delay);
}
} else {
for(i=0;i<5;i++){
len=100+rand()&0x3fff+0x1fff;
makeackedrun(len, send_spacing, ack_delay);
/*makeackedrundroppedtail8kb(len, send_spacing, ack_delay);*/
}
}
}
}
return 0;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -1,5 +1,5 @@
/* pcapio.h
* Declarations of our own routins for writing libpcap files.
* Declarations of our own routines for writing libpcap files.
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
@ -101,3 +101,16 @@ pcapng_write_enhanced_packet_block(FILE* pfile,
guint32 flags,
guint64 *bytes_written,
int *err);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -57,4 +57,17 @@ WS_DLL_PUBLIC gulong register_count(void);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* __REGISTER_H__ */

View File

@ -67,7 +67,7 @@
/* Ringbuffer file structure */
typedef struct _rb_file {
gchar *name;
gchar *name;
} rb_file;
/* Ringbuffer data structure */
@ -79,7 +79,7 @@ typedef struct _ringbuf_data {
gchar *fsuffix; /* Filename suffix */
gboolean unlimited; /* TRUE if unlimited number of files */
int fd; /* Current ringbuffer file descriptor */
int fd; /* Current ringbuffer file descriptor */
FILE *pdh;
gboolean group_read_access; /* TRUE if files need to be opened with group read access */
} ringbuf_data;
@ -112,7 +112,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
g_snprintf(filenum, sizeof(filenum), "%05u", (rb_data.curr_file_num + 1) % RINGBUFFER_MAX_NUM_FILES);
strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(&current_time));
rfile->name = g_strconcat(rb_data.fprefix, "_", filenum, "_", timestr,
rb_data.fsuffix, NULL);
rb_data.fsuffix, NULL);
if (rfile->name == NULL) {
if (err != NULL)
@ -253,8 +253,8 @@ ringbuf_switch_file(FILE **pdh, gchar **save_file, int *save_file_fd, int *err)
if (err != NULL) {
*err = errno;
}
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 */
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;
}
@ -321,8 +321,8 @@ ringbuf_free(void)
if (rb_data.files != NULL) {
for (i=0; i < rb_data.num_files; i++) {
if (rb_data.files[i].name != NULL) {
g_free(rb_data.files[i].name);
rb_data.files[i].name = NULL;
g_free(rb_data.files[i].name);
rb_data.files[i].name = NULL;
}
}
g_free(rb_data.files);
@ -372,3 +372,16 @@ ringbuf_error_cleanup(void)
}
#endif /* HAVE_LIBPCAP */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -45,4 +45,17 @@ gboolean ringbuf_libpcap_dump_close(gchar **save_file, int *err);
void ringbuf_free(void);
void ringbuf_error_cleanup(void);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* ringbuffer.h */

View File

@ -224,3 +224,16 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_
}
}
#endif
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

109
summary.h
View File

@ -32,57 +32,57 @@ extern "C" {
#endif /* __cplusplus */
typedef struct iface_options_tag {
char *name;
char *descr;
char *cfilter;
char *isb_comment;
guint64 drops; /**< number of packet drops */
gboolean drops_known; /**< TRUE if number of packet drops is known */
gboolean has_snap; /**< TRUE if maximum capture packet length is known */
int snap; /**< Maximum captured packet length */
int encap_type; /**< wiretap encapsulation type */
char *name;
char *descr;
char *cfilter;
char *isb_comment;
guint64 drops; /**< number of packet drops */
gboolean drops_known; /**< TRUE if number of packet drops is known */
gboolean has_snap; /**< TRUE if maximum capture packet length is known */
int snap; /**< Maximum captured packet length */
int encap_type; /**< wiretap encapsulation type */
} iface_options;
typedef struct _summary_tally {
guint64 bytes; /**< total bytes */
double start_time; /**< seconds, with msec resolution */
double stop_time; /**< seconds, with msec resolution */
double elapsed_time; /**< seconds, with msec resolution,
includes time before first packet
and after last packet */
guint32 marked_count; /**< number of marked packets */
guint32 marked_count_ts; /**< number of time-stamped marked packets */
guint64 marked_bytes; /**< total bytes in the marked packets */
double marked_start; /**< time in seconds, with msec resolution */
double marked_stop; /**< time in seconds, with msec resolution */
guint32 ignored_count; /**< number of ignored packets */
guint32 packet_count; /**< total number of packets in trace */
guint32 packet_count_ts; /**< total number of time-stamped packets in trace */
guint32 filtered_count; /**< number of filtered packets */
guint32 filtered_count_ts; /**< number of time-stamped filtered packets */
guint64 filtered_bytes; /**< total bytes in the filtered packets */
double filtered_start; /**< time in seconds, with msec resolution */
double filtered_stop; /**< time in seconds, with msec resolution */
const char *filename;
gint64 file_length; /**< file length in bytes */
int file_type; /**< wiretap file type */
int iscompressed; /**< TRUE if file is compressed */
int file_encap_type; /**< wiretap encapsulation type for file */
GArray *packet_encap_types; /**< wiretap encapsulation types for packets */
gboolean has_snap; /**< TRUE if maximum capture packet length is known */
int snap; /**< Maximum captured packet length */
gboolean drops_known; /**< TRUE if number of packet drops is known */
guint64 drops; /**< number of packet drops */
const char *dfilter; /**< display filter */
gboolean is_tempfile;
/* from SHB, use summary_fill_shb_inf() to get values */
gchar *opt_comment; /**< comment from SHB block */
gchar *shb_hardware; /**< Capture HW from SHB block */
gchar *shb_os; /**< The OS the capture was made on from SHB block */
const gchar *shb_user_appl; /**< The application that made the capture from SHB block */
/* capture related, use summary_fill_in_capture() to get values */
GArray *ifaces;
gboolean legacy;
guint64 bytes; /**< total bytes */
double start_time; /**< seconds, with msec resolution */
double stop_time; /**< seconds, with msec resolution */
double elapsed_time; /**< seconds, with msec resolution,
includes time before first packet
and after last packet */
guint32 marked_count; /**< number of marked packets */
guint32 marked_count_ts; /**< number of time-stamped marked packets */
guint64 marked_bytes; /**< total bytes in the marked packets */
double marked_start; /**< time in seconds, with msec resolution */
double marked_stop; /**< time in seconds, with msec resolution */
guint32 ignored_count; /**< number of ignored packets */
guint32 packet_count; /**< total number of packets in trace */
guint32 packet_count_ts; /**< total number of time-stamped packets in trace */
guint32 filtered_count; /**< number of filtered packets */
guint32 filtered_count_ts; /**< number of time-stamped filtered packets */
guint64 filtered_bytes; /**< total bytes in the filtered packets */
double filtered_start; /**< time in seconds, with msec resolution */
double filtered_stop; /**< time in seconds, with msec resolution */
const char *filename;
gint64 file_length; /**< file length in bytes */
int file_type; /**< wiretap file type */
int iscompressed; /**< TRUE if file is compressed */
int file_encap_type; /**< wiretap encapsulation type for file */
GArray *packet_encap_types; /**< wiretap encapsulation types for packets */
gboolean has_snap; /**< TRUE if maximum capture packet length is known */
int snap; /**< Maximum captured packet length */
gboolean drops_known; /**< TRUE if number of packet drops is known */
guint64 drops; /**< number of packet drops */
const char *dfilter; /**< display filter */
gboolean is_tempfile;
/* from SHB, use summary_fill_shb_inf() to get values */
gchar *opt_comment; /**< comment from SHB block */
gchar *shb_hardware; /**< Capture HW from SHB block */
gchar *shb_os; /**< The OS the capture was made on from SHB block */
const gchar *shb_user_appl; /**< The application that made the capture from SHB block */
/* capture related, use summary_fill_in_capture() to get values */
GArray *ifaces;
gboolean legacy;
} summary_tally;
extern void
@ -97,4 +97,17 @@ summary_fill_in_capture(capture_file *cf, capture_options *capture_opts, summary
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* summary.h */

View File

@ -86,4 +86,17 @@ sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
#define SIGNAL_PIPE_FORMAT "\\\\.\\pipe\\wireshark.%s.signal"
#endif
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* sync_pipe.h */

View File

@ -108,3 +108,16 @@ sync_pipe_errmsg_to_parent(int pipe_fd, const char *error_msg,
pipe_write_block(pipe_fd, SP_ERROR_MSG, error_msg);
pipe_write_block(pipe_fd, SP_ERROR_MSG, secondary_error_msg);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -44,4 +44,17 @@ void parse_token(token_t token, char *str);
int yylex(void);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif

View File

@ -290,3 +290,16 @@ int main(int argc, char** argv) {
return 0;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

View File

@ -797,3 +797,16 @@ capture_stat_stop(if_stat_cache_t *sc) {
}
#endif /* HAVE_LIBPCAP */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -37,15 +37,15 @@ extern "C" {
#endif /* __cplusplus */
typedef enum {
capture_cb_capture_prepared,
capture_cb_capture_update_started,
capture_cb_capture_update_continue,
capture_cb_capture_update_finished,
capture_cb_capture_fixed_started,
capture_cb_capture_fixed_continue,
capture_cb_capture_fixed_finished,
capture_cb_capture_stopping,
capture_cb_capture_failed
capture_cb_capture_prepared,
capture_cb_capture_update_started,
capture_cb_capture_update_continue,
capture_cb_capture_update_finished,
capture_cb_capture_fixed_started,
capture_cb_capture_fixed_continue,
capture_cb_capture_fixed_finished,
capture_cb_capture_stopping,
capture_cb_capture_failed
} capture_cbs;
typedef void (*capture_callback_t) (gint event, capture_session *cap_session,
@ -105,4 +105,17 @@ void capture_stat_stop(if_stat_cache_t *sc);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* capture.h */

View File

@ -495,3 +495,16 @@ get_iface_description_for_interface(capture_options *capture_opts, guint i)
}
#endif /* HAVE_LIBPCAP */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -123,4 +123,17 @@ const char *get_iface_description_for_interface(capture_options *capture_opts, g
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* __CAPTURE_UI_UTILS_H__ */

View File

@ -77,4 +77,17 @@ void decode_clear_all(void);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __DECODE_AS_UTILS_H__ */

View File

@ -600,25 +600,38 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
*/
void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type)
{
GList **flpp_dest;
GList **flpp_src;
GList *flp_src;
filter_def *filt;
GList **flpp_dest;
GList **flpp_src;
GList *flp_src;
filter_def *filt;
g_assert(dest_type != src_type);
g_assert(dest_type != src_type);
flpp_dest = get_filter_list(dest_type);
flpp_src = get_filter_list(src_type);
/* throw away the "old" destination list - a NULL list is ok here */
while(*flpp_dest) {
*flpp_dest = remove_filter_entry(*flpp_dest, g_list_first(*flpp_dest));
}
g_assert(g_list_length(*flpp_dest) == 0);
flpp_dest = get_filter_list(dest_type);
flpp_src = get_filter_list(src_type);
/* throw away the "old" destination list - a NULL list is ok here */
while(*flpp_dest) {
*flpp_dest = remove_filter_entry(*flpp_dest, g_list_first(*flpp_dest));
}
g_assert(g_list_length(*flpp_dest) == 0);
/* copy the list entries */
for(flp_src = g_list_first(*flpp_src); flp_src; flp_src = g_list_next(flp_src)) {
filt = (filter_def *)(flp_src->data);
/* copy the list entries */
for(flp_src = g_list_first(*flpp_src); flp_src; flp_src = g_list_next(flp_src)) {
filt = (filter_def *)(flp_src->data);
*flpp_dest = add_filter_entry(*flpp_dest, filt->name, filt->strval);
}
*flpp_dest = add_filter_entry(*flpp_dest, filt->name, filt->strval);
}
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -31,18 +31,18 @@ extern "C" {
* Filter lists.
*/
typedef enum {
CFILTER_LIST, /* capture filter list - saved */
DFILTER_LIST, /* display filter list - saved */
CFILTER_EDITED_LIST, /* capture filter list - currently edited */
DFILTER_EDITED_LIST /* display filter list - currently edited */
CFILTER_LIST, /* capture filter list - saved */
DFILTER_LIST, /* display filter list - saved */
CFILTER_EDITED_LIST, /* capture filter list - currently edited */
DFILTER_EDITED_LIST /* display filter list - currently edited */
} filter_list_type_t;
/*
* Item in a list of filters.
*/
typedef struct {
char *name; /* filter name */
char *strval; /* filter expression */
char *name; /* filter name */
char *strval; /* filter expression */
} filter_def;
/*
@ -54,7 +54,7 @@ typedef struct {
* and "*errno_return" is set to the error.
*/
void read_filter_list(filter_list_type_t list_type, char **pref_path_return,
int *errno_return);
int *errno_return);
/*
* Get a pointer to the first entry in a filter list.
@ -66,7 +66,7 @@ GList *get_filter_list_first(filter_list_type_t list);
* Returns a pointer to the newly-added entry.
*/
GList *add_to_filter_list(filter_list_type_t list, const char *name,
const char *expression);
const char *expression);
/*
* Remove a filter from a list.
@ -82,7 +82,7 @@ void remove_from_filter_list(filter_list_type_t list, GList *fl_entry);
* and "*errno_return" is set to the error.
*/
void save_filter_list(filter_list_type_t list_type, char **pref_path_return,
int *errno_return);
int *errno_return);
/*
* Clone the filter list so it can be edited.
@ -93,4 +93,17 @@ void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type)
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* __UI_FILTERS_H__ */

View File

@ -90,3 +90,16 @@ persfilepath_opt(int opt _U_, const char *optstr)
*colonp = ':'; /* put the colon back */
return TRUE;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -39,4 +39,17 @@ extern gboolean persfilepath_opt(int opt, const char *optstr);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* PERSFILEPATH_OPT_H */

View File

@ -108,4 +108,17 @@ void column_prefs_remove_nth(gint col);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* __PREFRENCE_UTILS_H__ */

View File

@ -40,11 +40,11 @@ extern "C" {
#define PROF_STAT_COPY 5
typedef struct {
char *name; /* profile name */
char *reference; /* profile reference */
int status;
gboolean is_global;
gboolean from_global;
char *name; /* profile name */
char *reference; /* profile reference */
int status;
gboolean is_global;
gboolean from_global;
} profile_def;
/** @file
@ -66,8 +66,8 @@ void init_profile_list(void);
*
* @return A pointer to the new profile list
*/
GList * add_to_profile_list(const char *name, const char *parent, int status,
gboolean is_global, gboolean from_global);
GList *add_to_profile_list(const char *name, const char *parent, int status,
gboolean is_global, gboolean from_global);
/** Refresh the current (non-edited) profile list.
*/
@ -89,7 +89,7 @@ void remove_from_profile_list(GList *fl_entry);
*
* @return The head of the current profile list
*/
GList * current_profile_list(void);
GList *current_profile_list(void);
/** Edited profile list
*
@ -128,4 +128,17 @@ gboolean delete_current_profile(void);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __PROFILE_H__ */

View File

@ -293,7 +293,7 @@ ph_stats_new(void)
}
/* We're done calculating the statistics; destroy the progress bar
if it was created. */
if it was created. */
if (progbar != NULL)
destroy_progress_dlg(progbar);
@ -337,3 +337,16 @@ ph_stats_free(ph_stats_t *ps)
g_free(ps);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

View File

@ -42,8 +42,21 @@ typedef struct {
} ph_stats_t;
ph_stats_t* ph_stats_new(void);
ph_stats_t *ph_stats_new(void);
void ph_stats_free(ph_stats_t *ps);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
#endif /* __UI_PROTO_HIER_STATS_H__ */

View File

@ -48,39 +48,39 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
#define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show"
#define RECENT_KEY_FILTER_TOOLBAR_SHOW "gui.filter_toolbar_show"
#define RECENT_KEY_WIRELESS_TOOLBAR_SHOW "gui.wireless_toolbar_show"
#define RECENT_KEY_DRIVER_CHECK_SHOW "gui.airpcap_driver_check_show"
#define RECENT_KEY_PACKET_LIST_SHOW "gui.packet_list_show"
#define RECENT_KEY_TREE_VIEW_SHOW "gui.tree_view_show"
#define RECENT_KEY_BYTE_VIEW_SHOW "gui.byte_view_show"
#define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show"
#define RECENT_KEY_PACKET_LIST_COLORIZE "gui.packet_list_colorize"
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
#define RECENT_GUI_TIME_PRECISION "gui.time_precision"
#define RECENT_GUI_SECONDS_FORMAT "gui.seconds_format"
#define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level"
#define RECENT_GUI_BYTES_VIEW "gui.bytes_view"
#define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x"
#define RECENT_GUI_GEOMETRY_MAIN_Y "gui.geometry_main_y"
#define RECENT_GUI_GEOMETRY_MAIN_WIDTH "gui.geometry_main_width"
#define RECENT_GUI_GEOMETRY_MAIN_HEIGHT "gui.geometry_main_height"
#define RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED "gui.geometry_main_maximized"
#define RECENT_GUI_GEOMETRY_MAIN_UPPER_PANE "gui.geometry_main_upper_pane"
#define RECENT_GUI_GEOMETRY_MAIN_LOWER_PANE "gui.geometry_main_lower_pane"
#define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show"
#define RECENT_KEY_FILTER_TOOLBAR_SHOW "gui.filter_toolbar_show"
#define RECENT_KEY_WIRELESS_TOOLBAR_SHOW "gui.wireless_toolbar_show"
#define RECENT_KEY_DRIVER_CHECK_SHOW "gui.airpcap_driver_check_show"
#define RECENT_KEY_PACKET_LIST_SHOW "gui.packet_list_show"
#define RECENT_KEY_TREE_VIEW_SHOW "gui.tree_view_show"
#define RECENT_KEY_BYTE_VIEW_SHOW "gui.byte_view_show"
#define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show"
#define RECENT_KEY_PACKET_LIST_COLORIZE "gui.packet_list_colorize"
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
#define RECENT_GUI_TIME_PRECISION "gui.time_precision"
#define RECENT_GUI_SECONDS_FORMAT "gui.seconds_format"
#define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level"
#define RECENT_GUI_BYTES_VIEW "gui.bytes_view"
#define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x"
#define RECENT_GUI_GEOMETRY_MAIN_Y "gui.geometry_main_y"
#define RECENT_GUI_GEOMETRY_MAIN_WIDTH "gui.geometry_main_width"
#define RECENT_GUI_GEOMETRY_MAIN_HEIGHT "gui.geometry_main_height"
#define RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED "gui.geometry_main_maximized"
#define RECENT_GUI_GEOMETRY_MAIN_UPPER_PANE "gui.geometry_main_upper_pane"
#define RECENT_GUI_GEOMETRY_MAIN_LOWER_PANE "gui.geometry_main_lower_pane"
#define RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT "gui.geometry_status_pane"
#define RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT "gui.geometry_status_pane_right"
#define RECENT_GUI_GEOMETRY_WLAN_STATS_PANE "gui.geometry_status_wlan_stats_pane"
#define RECENT_LAST_USED_PROFILE "gui.last_used_profile"
#define RECENT_GUI_FILEOPEN_REMEMBERED_DIR "gui.fileopen_remembered_dir"
#define RECENT_GUI_CONVERSATION_TABS "gui.conversation_tabs"
#define RECENT_GUI_ENDPOINT_TABS "gui.endpoint_tabs"
#define RECENT_GUI_GEOMETRY_WLAN_STATS_PANE "gui.geometry_status_wlan_stats_pane"
#define RECENT_LAST_USED_PROFILE "gui.last_used_profile"
#define RECENT_GUI_FILEOPEN_REMEMBERED_DIR "gui.fileopen_remembered_dir"
#define RECENT_GUI_CONVERSATION_TABS "gui.conversation_tabs"
#define RECENT_GUI_ENDPOINT_TABS "gui.endpoint_tabs"
#define RECENT_GUI_GEOMETRY "gui.geom."
#define RECENT_GUI_GEOMETRY "gui.geom."
#define RECENT_KEY_PRIVS_WARN_IF_ELEVATED "privs.warn_if_elevated"
#define RECENT_KEY_PRIVS_WARN_IF_NO_NPF "privs.warn_if_no_npf"
#define RECENT_KEY_PRIVS_WARN_IF_ELEVATED "privs.warn_if_elevated"
#define RECENT_KEY_PRIVS_WARN_IF_NO_NPF "privs.warn_if_no_npf"
#define RECENT_FILE_NAME "recent"
#define RECENT_COMMON_FILE_NAME "recent_common"
@ -91,7 +91,7 @@ static const char *ts_type_text[] =
{ "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", "DELTA_DIS", "EPOCH", "UTC", "UTC_WITH_DATE", NULL };
static const char *ts_precision_text[] =
{ "AUTO", "SEC", "DSEC", "CSEC", "MSEC", "USEC", "NSEC", NULL };
{ "AUTO", "SEC", "DSEC", "CSEC", "MSEC", "USEC", "NSEC", NULL };
static const char *ts_seconds_text[] =
{ "SECONDS", "HOUR_MIN_SEC", NULL };
@ -104,15 +104,15 @@ static const char *ts_seconds_text[] =
static int
find_index_from_string_array(const char *needle, const char **haystack, int default_value)
{
int i = 0;
int i = 0;
while (haystack[i] != NULL) {
if (strcmp(needle, haystack[i]) == 0) {
return i;
}
i++;
}
return default_value;
while (haystack[i] != NULL) {
if (strcmp(needle, haystack[i]) == 0) {
return i;
}
i++;
}
return default_value;
}
static void
@ -139,21 +139,21 @@ free_col_width_info(recent_settings_t *rs)
static void
write_recent_geom(gpointer key _U_, gpointer value, gpointer rfh)
{
window_geometry_t *geom = (window_geometry_t *)value;
FILE *rf = (FILE *)rfh;
window_geometry_t *geom = (window_geometry_t *)value;
FILE *rf = (FILE *)rfh;
fprintf(rf, "\n# Geometry and maximized state of %s window.\n", geom->key);
fprintf(rf, "# Decimal integers.\n");
fprintf(rf, RECENT_GUI_GEOMETRY "%s.x: %d\n", geom->key, geom->x);
fprintf(rf, RECENT_GUI_GEOMETRY "%s.y: %d\n", geom->key, geom->y);
fprintf(rf, RECENT_GUI_GEOMETRY "%s.width: %d\n", geom->key,
geom->width);
fprintf(rf, RECENT_GUI_GEOMETRY "%s.height: %d\n", geom->key,
geom->height);
fprintf(rf, "\n# Geometry and maximized state of %s window.\n", geom->key);
fprintf(rf, "# Decimal integers.\n");
fprintf(rf, RECENT_GUI_GEOMETRY "%s.x: %d\n", geom->key, geom->x);
fprintf(rf, RECENT_GUI_GEOMETRY "%s.y: %d\n", geom->key, geom->y);
fprintf(rf, RECENT_GUI_GEOMETRY "%s.width: %d\n", geom->key,
geom->width);
fprintf(rf, RECENT_GUI_GEOMETRY "%s.height: %d\n", geom->key,
geom->height);
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_GUI_GEOMETRY "%s.maximized: %s\n", geom->key,
geom->maximized == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_GUI_GEOMETRY "%s.maximized: %s\n", geom->key,
geom->maximized == TRUE ? "TRUE" : "FALSE");
}
@ -165,27 +165,27 @@ static GHashTable *window_geom_hash = NULL;
void
window_geom_save(const gchar *name, window_geometry_t *geom)
{
gchar *key;
window_geometry_t *work;
gchar *key;
window_geometry_t *work;
/* init hashtable, if not already done */
if(!window_geom_hash) {
window_geom_hash = g_hash_table_new(g_str_hash, g_str_equal);
}
/* if we have an old one, remove and free it first */
work = (window_geometry_t *)g_hash_table_lookup(window_geom_hash, name);
if(work) {
g_hash_table_remove(window_geom_hash, name);
g_free(work->key);
g_free(work);
}
/* init hashtable, if not already done */
if (!window_geom_hash) {
window_geom_hash = g_hash_table_new(g_str_hash, g_str_equal);
}
/* if we have an old one, remove and free it first */
work = (window_geometry_t *)g_hash_table_lookup(window_geom_hash, name);
if (work) {
g_hash_table_remove(window_geom_hash, name);
g_free(work->key);
g_free(work);
}
/* g_malloc and insert the new one */
work = (window_geometry_t *)g_malloc(sizeof(window_geometry_t));
*work = *geom;
key = g_strdup(name);
work->key = key;
g_hash_table_insert(window_geom_hash, key, work);
/* g_malloc and insert the new one */
work = (window_geometry_t *)g_malloc(sizeof(window_geometry_t));
*work = *geom;
key = g_strdup(name);
work->key = key;
g_hash_table_insert(window_geom_hash, key, work);
}
/* load the desired geometry for this window from the geometry hashtable */
@ -193,20 +193,20 @@ gboolean
window_geom_load(const gchar *name,
window_geometry_t *geom)
{
window_geometry_t *p;
window_geometry_t *p;
/* init hashtable, if not already done */
if(!window_geom_hash) {
window_geom_hash = g_hash_table_new(g_str_hash, g_str_equal);
}
/* init hashtable, if not already done */
if (!window_geom_hash) {
window_geom_hash = g_hash_table_new(g_str_hash, g_str_equal);
}
p = (window_geometry_t *)g_hash_table_lookup(window_geom_hash, name);
if(p) {
*geom = *p;
return TRUE;
} else {
return FALSE;
}
p = (window_geometry_t *)g_hash_table_lookup(window_geom_hash, name);
if (p) {
*geom = *p;
return TRUE;
} else {
return FALSE;
}
}
/** Read in a single geometry key value pair from the recent file.
@ -223,7 +223,7 @@ window_geom_recent_read_pair(const char *name,
window_geometry_t geom;
/* find window geometry maybe already in hashtable */
if(!window_geom_load(name, &geom)) {
if (!window_geom_load(name, &geom)) {
/* not in table, init geom with "basic" values */
geom.key = NULL; /* Will be set in window_geom_save() */
geom.set_pos = FALSE;
@ -280,7 +280,7 @@ static void
window_geom_recent_write_all(FILE *rf)
{
/* init hashtable, if not already done */
if(!window_geom_hash) {
if (!window_geom_hash) {
window_geom_hash = g_hash_table_new(g_str_hash, g_str_equal);
}
@ -375,15 +375,15 @@ static GHashTable *remote_host_list=NULL;
int recent_get_remote_host_list_size(void)
{
return g_hash_table_size (remote_host_list);
return g_hash_table_size (remote_host_list);
}
void recent_add_remote_host(gchar *host, struct remote_host *rh)
{
if (remote_host_list == NULL) {
remote_host_list = g_hash_table_new (g_str_hash, g_str_equal);
}
g_hash_table_insert (remote_host_list, g_strdup(host), rh);
if (remote_host_list == NULL) {
remote_host_list = g_hash_table_new (g_str_hash, g_str_equal);
}
g_hash_table_insert (remote_host_list, g_strdup(host), rh);
}
static gboolean
@ -401,7 +401,7 @@ free_remote_host (gpointer key _U_, gpointer value, gpointer user _U_)
GHashTable *get_remote_host_list(void)
{
return remote_host_list;
return remote_host_list;
}
static void
@ -425,7 +425,7 @@ capture_remote_combo_recent_write_all(FILE *rf)
void free_remote_host_list(void)
{
g_hash_table_foreach_remove(remote_host_list, free_remote_host, NULL);
g_hash_table_foreach_remove(remote_host_list, free_remote_host, NULL);
}
struct remote_host *
@ -610,26 +610,26 @@ write_recent(void)
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_X ": %d\n", recent.gui_geometry_main_x);
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_Y ": %d\n", recent.gui_geometry_main_y);
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_WIDTH ": %d\n",
recent.gui_geometry_main_width);
recent.gui_geometry_main_width);
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_HEIGHT ": %d\n",
recent.gui_geometry_main_height);
recent.gui_geometry_main_height);
fprintf(rf, "\n# Main window maximized.\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED ": %s\n",
recent.gui_geometry_main_maximized == TRUE ? "TRUE" : "FALSE");
recent.gui_geometry_main_maximized == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Statusbar left pane size.\n");
fprintf(rf, "# Decimal number.\n");
if (recent.gui_geometry_status_pane_left != 0) {
fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT ": %d\n",
recent.gui_geometry_status_pane_left);
recent.gui_geometry_status_pane_left);
}
fprintf(rf, "\n# Statusbar middle pane size.\n");
fprintf(rf, "# Decimal number.\n");
if (recent.gui_geometry_status_pane_right != 0) {
fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT ": %d\n",
recent.gui_geometry_status_pane_right);
recent.gui_geometry_status_pane_right);
}
fprintf(rf, "\n# Last used Configuration Profile.\n");
@ -638,17 +638,17 @@ write_recent(void)
fprintf(rf, "\n# WLAN statistics upper pane size.\n");
fprintf(rf, "# Decimal number.\n");
fprintf(rf, RECENT_GUI_GEOMETRY_WLAN_STATS_PANE ": %d\n",
recent.gui_geometry_wlan_stats_pane);
recent.gui_geometry_wlan_stats_pane);
fprintf(rf, "\n# Warn if running with elevated permissions (e.g. as root).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_PRIVS_WARN_IF_ELEVATED ": %s\n",
recent.privs_warn_if_elevated == TRUE ? "TRUE" : "FALSE");
recent.privs_warn_if_elevated == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Warn if npf.sys isn't loaded on Windows >= 6.0.\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_PRIVS_WARN_IF_NO_NPF ": %s\n",
recent.privs_warn_if_no_npf == TRUE ? "TRUE" : "FALSE");
recent.privs_warn_if_no_npf == TRUE ? "TRUE" : "FALSE");
window_geom_recent_write_all(rf);
@ -709,49 +709,49 @@ write_profile_recent(void)
fprintf(rf, "\n# Main Toolbar show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_MAIN_TOOLBAR_SHOW ": %s\n",
recent.main_toolbar_show == TRUE ? "TRUE" : "FALSE");
recent.main_toolbar_show == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Filter Toolbar show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_FILTER_TOOLBAR_SHOW ": %s\n",
recent.filter_toolbar_show == TRUE ? "TRUE" : "FALSE");
recent.filter_toolbar_show == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Wireless Settings Toolbar show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_WIRELESS_TOOLBAR_SHOW ": %s\n",
recent.wireless_toolbar_show == TRUE ? "TRUE" : "FALSE");
recent.wireless_toolbar_show == TRUE ? "TRUE" : "FALSE");
#ifdef HAVE_AIRPCAP
fprintf(rf, "\n# Show (hide) old AirPcap driver warning dialog box.\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_DRIVER_CHECK_SHOW ": %s\n",
recent.airpcap_driver_check_show == TRUE ? "TRUE" : "FALSE");
recent.airpcap_driver_check_show == TRUE ? "TRUE" : "FALSE");
#endif
fprintf(rf, "\n# Packet list show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_PACKET_LIST_SHOW ": %s\n",
recent.packet_list_show == TRUE ? "TRUE" : "FALSE");
recent.packet_list_show == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Tree view show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_TREE_VIEW_SHOW ": %s\n",
recent.tree_view_show == TRUE ? "TRUE" : "FALSE");
recent.tree_view_show == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Byte view show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_BYTE_VIEW_SHOW ": %s\n",
recent.byte_view_show == TRUE ? "TRUE" : "FALSE");
recent.byte_view_show == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Statusbar show (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_STATUSBAR_SHOW ": %s\n",
recent.statusbar_show == TRUE ? "TRUE" : "FALSE");
recent.statusbar_show == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Packet list colorize (hide).\n");
fprintf(rf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(rf, RECENT_KEY_PACKET_LIST_COLORIZE ": %s\n",
recent.packet_list_colorize == TRUE ? "TRUE" : "FALSE");
recent.packet_list_colorize == TRUE ? "TRUE" : "FALSE");
fprintf(rf, "\n# Timestamp display format.\n");
fprintf(rf, "# One of: RELATIVE, ABSOLUTE, ABSOLUTE_WITH_DATE, DELTA, DELTA_DIS, EPOCH, UTC, UTC_WITH_DATE\n");
@ -771,24 +771,24 @@ write_profile_recent(void)
fprintf(rf, "\n# Zoom level.\n");
fprintf(rf, "# A decimal number.\n");
fprintf(rf, RECENT_GUI_ZOOM_LEVEL ": %d\n",
recent.gui_zoom_level);
recent.gui_zoom_level);
fprintf(rf, "\n# Bytes view.\n");
fprintf(rf, "# A decimal number.\n");
fprintf(rf, RECENT_GUI_BYTES_VIEW ": %d\n",
recent.gui_bytes_view);
recent.gui_bytes_view);
fprintf(rf, "\n# Main window upper (or leftmost) pane size.\n");
fprintf(rf, "# Decimal number.\n");
if (recent.gui_geometry_main_upper_pane != 0) {
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_UPPER_PANE ": %d\n",
recent.gui_geometry_main_upper_pane);
recent.gui_geometry_main_upper_pane);
}
fprintf(rf, "\n# Main window middle pane size.\n");
fprintf(rf, "# Decimal number.\n");
if (recent.gui_geometry_main_lower_pane != 0) {
fprintf(rf, RECENT_GUI_GEOMETRY_MAIN_LOWER_PANE ": %d\n",
recent.gui_geometry_main_lower_pane);
recent.gui_geometry_main_lower_pane);
}
fprintf(rf, "\n# Packet list column pixel widths.\n");
@ -810,7 +810,7 @@ write_profile_recent(void)
if (get_last_open_dir() != NULL) {
fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n");
if(u3_active())
if (u3_active())
fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", u3_contract_device_path(get_last_open_dir()));
else
fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
@ -828,8 +828,8 @@ write_profile_recent(void)
/* set one user's recent common file key/value pair */
static prefs_set_pref_e
read_set_recent_common_pair_static(gchar *key, const gchar *value,
void *private_data _U_,
gboolean return_range_errors _U_)
void *private_data _U_,
gboolean return_range_errors _U_)
{
long num;
char *p;
@ -845,41 +845,41 @@ read_set_recent_common_pair_static(gchar *key, const gchar *value,
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_X) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
recent.gui_geometry_main_x = (gint)num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_Y) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
recent.gui_geometry_main_y = (gint)num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_WIDTH) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_main_width = (gint)num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_HEIGHT) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_main_height = (gint)num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_status_pane_right = (gint)num;
recent.has_gui_geometry_status_pane = TRUE;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_status_pane_left = (gint)num;
recent.has_gui_geometry_status_pane = TRUE;
} else if (strcmp(key, RECENT_LAST_USED_PROFILE) == 0) {
@ -889,15 +889,15 @@ read_set_recent_common_pair_static(gchar *key, const gchar *value,
} else if (strcmp(key, RECENT_GUI_GEOMETRY_WLAN_STATS_PANE) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_wlan_stats_pane = (gint)num;
} else if (strncmp(key, RECENT_GUI_GEOMETRY, sizeof(RECENT_GUI_GEOMETRY)-1) == 0) {
/* now have something like "gui.geom.main.x", split it into win and sub_key */
char *win = &key[sizeof(RECENT_GUI_GEOMETRY)-1];
char *sub_key = strchr(win, '.');
if(sub_key) {
if (sub_key) {
*sub_key = '\0';
sub_key++;
window_geom_recent_read_pair(win, sub_key, value);
@ -924,8 +924,8 @@ read_set_recent_common_pair_static(gchar *key, const gchar *value,
/* set one user's recent file key/value pair */
static prefs_set_pref_e
read_set_recent_pair_static(gchar *key, const gchar *value,
void *private_data _U_,
gboolean return_range_errors _U_)
void *private_data _U_,
gboolean return_range_errors _U_)
{
long num;
char *p;
@ -1000,22 +1000,22 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
}
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
recent.gui_time_format =
(ts_type)find_index_from_string_array(value, ts_type_text, TS_RELATIVE);
(ts_type)find_index_from_string_array(value, ts_type_text, TS_RELATIVE);
} else if (strcmp(key, RECENT_GUI_TIME_PRECISION) == 0) {
recent.gui_time_precision =
find_index_from_string_array(value, ts_precision_text, TS_PREC_AUTO);
find_index_from_string_array(value, ts_precision_text, TS_PREC_AUTO);
} else if (strcmp(key, RECENT_GUI_SECONDS_FORMAT) == 0) {
recent.gui_seconds_format =
(ts_seconds_type)find_index_from_string_array(value, ts_seconds_text, TS_SECONDS_DEFAULT);
(ts_seconds_type)find_index_from_string_array(value, ts_seconds_text, TS_SECONDS_DEFAULT);
} else if (strcmp(key, RECENT_GUI_ZOOM_LEVEL) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
recent.gui_zoom_level = (gint)num;
} else if (strcmp(key, RECENT_GUI_BYTES_VIEW) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
recent.gui_bytes_view = (gint)num;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED) == 0) {
if (g_ascii_strcasecmp(value, "true") == 0) {
@ -1028,17 +1028,17 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_UPPER_PANE) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_main_upper_pane = (gint)num;
recent.has_gui_geometry_main_upper_pane = TRUE;
} else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_LOWER_PANE) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_main_lower_pane = (gint)num;
recent.has_gui_geometry_main_lower_pane = TRUE;
} else if (strcmp(key, RECENT_GUI_CONVERSATION_TABS) == 0) {
@ -1056,10 +1056,10 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
}
/* Check to make sure all column formats are valid. */
col_l_elt = g_list_first(col_l);
while(col_l_elt) {
while (col_l_elt) {
/* Make sure the format isn't empty. */
if (strcmp((const char *)col_l_elt->data, "") == 0) {
/* It is. */
/* It is. */
prefs_clear_string_list(col_l);
return PREFS_SET_SYNTAX_ERR;
}
@ -1082,29 +1082,29 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
free_col_width_info(&recent);
recent.col_width_list = NULL;
col_l_elt = g_list_first(col_l);
while(col_l_elt) {
while (col_l_elt) {
gchar *fmt = g_strdup((const gchar *)col_l_elt->data);
cfmt = (col_width_data *) g_malloc(sizeof(col_width_data));
if (strncmp(fmt, cust_format, cust_format_len) != 0) {
cfmt->cfmt = get_column_format_from_str(fmt);
cfmt->cfield = NULL;
cfmt->cfmt = get_column_format_from_str(fmt);
cfmt->cfield = NULL;
} else {
cfmt->cfmt = COL_CUSTOM;
cfmt->cfield = g_strdup(&fmt[cust_format_len+1]); /* add 1 for ':' */
cfmt->cfmt = COL_CUSTOM;
cfmt->cfield = g_strdup(&fmt[cust_format_len+1]); /* add 1 for ':' */
}
g_free (fmt);
if (cfmt->cfmt == -1) {
g_free(cfmt->cfield);
g_free(cfmt);
return PREFS_SET_SYNTAX_ERR; /* string was bad */
g_free(cfmt);
return PREFS_SET_SYNTAX_ERR; /* string was bad */
}
col_l_elt = col_l_elt->next;
cfmt->width = (gint)strtol((const char *)col_l_elt->data, &p, 0);
if (p == col_l_elt->data || (*p != '\0' && *p != ':')) {
g_free(cfmt->cfield);
g_free(cfmt);
return PREFS_SET_SYNTAX_ERR; /* number was bad */
g_free(cfmt->cfield);
g_free(cfmt);
return PREFS_SET_SYNTAX_ERR; /* number was bad */
}
if (*p == ':') {
@ -1131,8 +1131,8 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
/* set one user's recent file key/value pair */
static prefs_set_pref_e
read_set_recent_pair_dynamic(gchar *key, const gchar *value,
void *private_data _U_,
gboolean return_range_errors _U_)
void *private_data _U_,
gboolean return_range_errors _U_)
{
if (!isprint_string(value)) {
return PREFS_SET_SYNTAX_ERR;
@ -1143,7 +1143,7 @@ read_set_recent_pair_dynamic(gchar *key, const gchar *value,
else
add_menu_recent_capture_file(value);
} else if (strcmp(key, RECENT_KEY_DISPLAY_FILTER) == 0) {
dfilter_combo_add_recent(value);
dfilter_combo_add_recent(value);
} else if (strcmp(key, RECENT_KEY_CAPTURE_FILTER) == 0) {
recent_add_cfilter(NULL, value);
} else if (g_str_has_prefix(key, RECENT_KEY_CAPTURE_FILTER ".")) {
@ -1151,7 +1151,7 @@ read_set_recent_pair_dynamic(gchar *key, const gchar *value,
recent_add_cfilter(strrchr(key, '.') + 1, value);
#ifdef HAVE_PCAP_REMOTE
} else if (strcmp(key, RECENT_KEY_REMOTE_HOST) == 0) {
capture_remote_combo_add_recent(value);
capture_remote_combo_add_recent(value);
#endif
}
@ -1168,36 +1168,36 @@ read_set_recent_pair_dynamic(gchar *key, const gchar *value,
int
recent_set_arg(char *prefarg)
{
gchar *p, *colonp;
int ret;
gchar *p, *colonp;
int ret;
colonp = strchr(prefarg, ':');
if (colonp == NULL)
return PREFS_SET_SYNTAX_ERR;
colonp = strchr(prefarg, ':');
if (colonp == NULL)
return PREFS_SET_SYNTAX_ERR;
p = colonp;
*p++ = '\0';
p = colonp;
*p++ = '\0';
/*
* Skip over any white space (there probably won't be any, but
* as we allow it in the preferences file, we might as well
* allow it here).
*/
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*
* Put the colon back, so if our caller uses, in an
* error message, the string they passed us, the message
* looks correct.
*/
*colonp = ':';
return PREFS_SET_SYNTAX_ERR;
}
/*
* Skip over any white space (there probably won't be any, but
* as we allow it in the preferences file, we might as well
* allow it here).
*/
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*
* Put the colon back, so if our caller uses, in an
* error message, the string they passed us, the message
* looks correct.
*/
*colonp = ':';
return PREFS_SET_SYNTAX_ERR;
}
ret = read_set_recent_pair_static(prefarg, p, NULL, TRUE);
*colonp = ':'; /* put the colon back */
return ret;
ret = read_set_recent_pair_static(prefarg, p, NULL, TRUE);
*colonp = ':'; /* put the colon back */
return ret;
}
@ -1217,7 +1217,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
recent.gui_geometry_status_pane_left = (DEF_WIDTH/3);
recent.gui_geometry_status_pane_right = (DEF_WIDTH/3);
recent.gui_geometry_wlan_stats_pane = 200;
recent.gui_geometry_wlan_stats_pane = 200;
recent.privs_warn_if_elevated = TRUE;
recent.privs_warn_if_no_npf = TRUE;
@ -1258,20 +1258,20 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
FILE *rf;
/* set defaults */
recent.main_toolbar_show = TRUE;
recent.filter_toolbar_show = TRUE;
recent.wireless_toolbar_show = FALSE;
recent.airpcap_driver_check_show = TRUE;
recent.packet_list_show = TRUE;
recent.tree_view_show = TRUE;
recent.byte_view_show = TRUE;
recent.statusbar_show = TRUE;
recent.packet_list_colorize = TRUE;
recent.gui_time_format = TS_RELATIVE;
recent.gui_time_precision = TS_PREC_AUTO;
recent.gui_seconds_format = TS_SECONDS_DEFAULT;
recent.gui_zoom_level = 0;
recent.gui_bytes_view = 0;
recent.main_toolbar_show = TRUE;
recent.filter_toolbar_show = TRUE;
recent.wireless_toolbar_show = FALSE;
recent.airpcap_driver_check_show = TRUE;
recent.packet_list_show = TRUE;
recent.tree_view_show = TRUE;
recent.byte_view_show = TRUE;
recent.statusbar_show = TRUE;
recent.packet_list_colorize = TRUE;
recent.gui_time_format = TS_RELATIVE;
recent.gui_time_precision = TS_PREC_AUTO;
recent.gui_seconds_format = TS_SECONDS_DEFAULT;
recent.gui_zoom_level = 0;
recent.gui_bytes_view = 0;
/* pane size of zero will autodetect */
recent.gui_geometry_main_upper_pane = 0;
@ -1279,7 +1279,7 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
recent.has_gui_geometry_main_upper_pane = TRUE;
recent.has_gui_geometry_main_lower_pane = TRUE;
recent.has_gui_geometry_status_pane = TRUE;
recent.has_gui_geometry_status_pane = TRUE;
if (recent.col_width_list) {
free_col_width_info(&recent);
@ -1386,7 +1386,7 @@ recent_get_column_width(gint col)
col_w = (col_width_data *) col_l->data;
if (col_w->cfmt == cfmt) {
if (cfmt != COL_CUSTOM || strcmp (cfield, col_w->cfield) == 0) {
return col_w->width;
return col_w->width;
}
}
col_l = col_l->next;
@ -1414,9 +1414,9 @@ recent_set_column_width(gint col, gint width)
col_w = (col_width_data *) col_l->data;
if (col_w->cfmt == cfmt) {
if (cfmt != COL_CUSTOM || strcmp (cfield, col_w->cfield) == 0) {
col_w->width = width;
found = TRUE;
break;
col_w->width = width;
found = TRUE;
break;
}
}
col_l = col_l->next;
@ -1503,3 +1503,16 @@ recent_set_column_xalign(gint col, gchar xalign)
recent.col_width_list = g_list_append(recent.col_width_list, col_w);
}
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/

View File

@ -40,92 +40,104 @@
*/
void rtp_analysis(
address *ip_src_fwd,
guint32 port_src_fwd,
address *ip_dst_fwd,
guint32 port_dst_fwd,
guint32 ssrc_fwd,
address *ip_src_rev,
guint32 port_src_rev,
address *ip_dst_rev,
guint32 port_dst_rev,
guint32 ssrc_rev
);
address *ip_src_fwd,
guint32 port_src_fwd,
address *ip_dst_fwd,
guint32 port_dst_fwd,
guint32 ssrc_fwd,
address *ip_src_rev,
guint32 port_src_rev,
address *ip_dst_rev,
guint32 port_dst_rev,
guint32 ssrc_rev
);
/****************************************************************************/
/* structure that holds the information about the forward and reversed direction */
typedef struct _bw_history_item {
double time;
guint32 bytes;
double time;
guint32 bytes;
} bw_history_item;
#define BUFF_BW 300
typedef struct _tap_rtp_stat_t {
gboolean first_packet; /**< do not use in code that is called after rtp_packet_analyse */
/* use (flags & STAT_FLAG_FIRST) instead */
/* all of the following fields will be initialized after
* rtp_packet_analyse has been called
*/
address first_packet_mac_addr; /**< MAC address of first packet, used to determine duplicates due to mirroring */
guint32 flags; /* see STAT_FLAG-defines below */
guint16 seq_num;
guint32 timestamp;
guint32 first_timestamp;
guint32 delta_timestamp;
double bandwidth;
bw_history_item bw_history[BUFF_BW];
guint16 bw_start_index;
guint16 bw_index;
guint32 total_bytes;
guint32 clock_rate;
double delta;
double jitter;
double diff;
double skew;
double sumt;
double sumTS;
double sumt2;
double sumtTS;
double time; /**< Unit is ms */
double start_time;
double lastnominaltime;
double max_delta;
double max_jitter;
double max_skew;
double mean_jitter;
guint32 max_nr;
guint16 start_seq_nr;
guint16 stop_seq_nr;
guint32 total_nr;
guint32 sequence;
gboolean under;
gint cycles;
guint16 pt;
int reg_pt;
gboolean first_packet; /**< do not use in code that is called after rtp_packet_analyse */
/* use (flags & STAT_FLAG_FIRST) instead */
/* all of the following fields will be initialized after
* rtp_packet_analyse has been called
*/
address first_packet_mac_addr; /**< MAC address of first packet, used to determine duplicates due to mirroring */
guint32 flags; /* see STAT_FLAG-defines below */
guint16 seq_num;
guint32 timestamp;
guint32 first_timestamp;
guint32 delta_timestamp;
double bandwidth;
bw_history_item bw_history[BUFF_BW];
guint16 bw_start_index;
guint16 bw_index;
guint32 total_bytes;
guint32 clock_rate;
double delta;
double jitter;
double diff;
double skew;
double sumt;
double sumTS;
double sumt2;
double sumtTS;
double time; /**< Unit is ms */
double start_time;
double lastnominaltime;
double max_delta;
double max_jitter;
double max_skew;
double mean_jitter;
guint32 max_nr;
guint16 start_seq_nr;
guint16 stop_seq_nr;
guint32 total_nr;
guint32 sequence;
gboolean under;
gint cycles;
guint16 pt;
int reg_pt;
} tap_rtp_stat_t;
#define PT_UNDEFINED -1
/* status flags for the flags parameter in tap_rtp_stat_t */
#define STAT_FLAG_FIRST 0x001
#define STAT_FLAG_MARKER 0x002
#define STAT_FLAG_WRONG_SEQ 0x004
#define STAT_FLAG_PT_CHANGE 0x008
#define STAT_FLAG_PT_CN 0x010
#define STAT_FLAG_FOLLOW_PT_CN 0x020
#define STAT_FLAG_REG_PT_CHANGE 0x040
#define STAT_FLAG_WRONG_TIMESTAMP 0x080
#define STAT_FLAG_PT_T_EVENT 0x100
#define STAT_FLAG_DUP_PKT 0x200
#define STAT_FLAG_FIRST 0x001
#define STAT_FLAG_MARKER 0x002
#define STAT_FLAG_WRONG_SEQ 0x004
#define STAT_FLAG_PT_CHANGE 0x008
#define STAT_FLAG_PT_CN 0x010
#define STAT_FLAG_FOLLOW_PT_CN 0x020
#define STAT_FLAG_REG_PT_CHANGE 0x040
#define STAT_FLAG_WRONG_TIMESTAMP 0x080
#define STAT_FLAG_PT_T_EVENT 0x100
#define STAT_FLAG_DUP_PKT 0x200
/* forward */
struct _rtp_info;
/* function for analysing an RTP packet. Called from rtp_analysis and rtp_streams */
extern int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
packet_info *pinfo,
const struct _rtp_info *rtpinfo);
packet_info *pinfo,
const struct _rtp_info *rtpinfo);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __RTP_ANALYSIS_H__ */

View File

@ -35,7 +35,7 @@
/****************************************************************************/
/* type for storing rtp frame information */
typedef struct st_rtp_sample_header {
guint32 rec_time; /**< milliseconds since start of recording */
guint32 rec_time; /**< milliseconds since start of recording */
guint16 frame_length; /**< number of bytes in *frame */
} rtp_sample_header_t;
@ -50,30 +50,30 @@ typedef rtp_sample_t* rtp_sample_p;
/** Defines an rtp stream */
typedef struct _rtp_stream_info {
address src_addr;
guint32 src_port;
address dest_addr;
guint32 dest_port;
guint32 ssrc;
guint8 pt;
const gchar *info_payload_type_str;
guint32 npackets;
address src_addr;
guint32 src_port;
address dest_addr;
guint32 dest_port;
guint32 ssrc;
guint8 pt;
const gchar *info_payload_type_str;
guint32 npackets;
guint32 first_frame_num; /**< frame number of first frame */
guint32 setup_frame_number; /**< frame number of setup message */
guint32 first_frame_num; /**< frame number of first frame */
guint32 setup_frame_number; /**< frame number of setup message */
/* start of recording (GMT) of this stream */
guint32 start_sec; /**< seconds */
guint32 start_usec; /**< microseconds */
gboolean tag_vlan_error;
guint32 start_rel_sec; /**< start stream rel seconds */
guint32 start_rel_usec; /**< start stream rel microseconds */
guint32 stop_rel_sec; /**< stop stream rel seconds */
guint32 stop_rel_usec; /**< stop stream rel microseconds */
gboolean tag_diffserv_error;
guint16 vlan_id;
guint32 start_sec; /**< seconds */
guint32 start_usec; /**< microseconds */
gboolean tag_vlan_error;
guint32 start_rel_sec; /**< start stream rel seconds */
guint32 start_rel_usec; /**< start stream rel microseconds */
guint32 stop_rel_sec; /**< stop stream rel seconds */
guint32 stop_rel_usec; /**< stop stream rel microseconds */
gboolean tag_diffserv_error;
guint16 vlan_id;
tap_rtp_stat_t rtp_stats; /**< here goes the RTP statistics info */
gboolean problem; /**< if the streams had wrong sequence numbers or wrong timerstamps */
tap_rtp_stat_t rtp_stats; /**< here goes the RTP statistics info */
gboolean problem; /**< if the streams had wrong sequence numbers or wrong timerstamps */
} rtp_stream_info_t;
@ -89,16 +89,16 @@ typedef enum
/* structure that holds the information about all detected streams */
/** struct holding all information of the tap */
typedef struct _rtpstream_tapinfo {
int nstreams; /**< number of streams in the list */
GList* strinfo_list; /**< list with all streams */
int npackets; /**< total number of rtp packets of all streams */
int nstreams; /**< number of streams in the list */
GList *strinfo_list; /**< list with all streams */
int npackets; /**< total number of rtp packets of all streams */
/* used while tapping. user shouldn't modify these */
tap_mode_t mode;
rtp_stream_info_t* filter_stream_fwd; /**< used as filter in some tap modes */
rtp_stream_info_t* filter_stream_rev; /**< used as filter in some tap modes */
FILE* save_file;
guint32 launch_count; /**< number of times the tap has been run */
gboolean is_registered; /**< if the tap listener is currently registered or not */
tap_mode_t mode;
rtp_stream_info_t *filter_stream_fwd; /**< used as filter in some tap modes */
rtp_stream_info_t *filter_stream_rev; /**< used as filter in some tap modes */
FILE *save_file;
guint32 launch_count; /**< number of times the tap has been run */
gboolean is_registered; /**< if the tap listener is currently registered or not */
} rtpstream_tapinfo_t;
/****************************************************************************/
@ -149,5 +149,17 @@ gboolean rtpstream_save(rtp_stream_info_t* stream, const gchar *filename);
*/
void rtpstream_mark(rtp_stream_info_t* stream_fwd, rtp_stream_info_t* stream_rev);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __RTP_STREAM_H__ */

View File

@ -45,7 +45,7 @@ megacostat_is_duplicate_reply(const gcp_cmd_t* cmd)
{
switch (cmd->type) {
GCP_CMD_REPLY_CASE
GCP_CMD_REPLY_CASE
{
gcp_cmd_msg_t *cmd_msg;
/* cycle through commands to find same command in the transaction */
@ -72,7 +72,7 @@ megacostat_had_request(const gcp_cmd_t* cmd)
{
switch (cmd->type) {
GCP_CMD_REPLY_CASE
GCP_CMD_REPLY_CASE
{
gcp_cmd_msg_t *cmd_msg;
/* cycle through commands to find a request in the transaction */
@ -82,7 +82,7 @@ megacostat_had_request(const gcp_cmd_t* cmd)
switch (cmd_msg->cmd->type) {
GCP_CMD_REQ_CASE
GCP_CMD_REQ_CASE
return TRUE;
break;
default:
@ -110,7 +110,7 @@ megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const
switch (mi->type) {
GCP_CMD_REQ_CASE
GCP_CMD_REQ_CASE
if(!mi->trx->initial) {
/* Track Context is probably disabled, we cannot
* measure service response time */
@ -126,7 +126,7 @@ megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const
}
break;
GCP_CMD_REPLY_CASE
GCP_CMD_REPLY_CASE
if(megacostat_is_duplicate_reply(mi)){
/* Duplicate is ignored */
ms->rsp_dup_num++;
@ -188,3 +188,15 @@ megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const
return ret;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

View File

@ -33,34 +33,34 @@
#define NUM_TIMESTATS 12
#define GCP_CMD_REPLY_CASE \
case GCP_CMD_ADD_REPLY: \
case GCP_CMD_MOVE_REPLY: \
case GCP_CMD_MOD_REPLY: \
case GCP_CMD_SUB_REPLY: \
case GCP_CMD_AUDITCAP_REPLY: \
case GCP_CMD_AUDITVAL_REPLY: \
case GCP_CMD_NOTIFY_REPLY: \
case GCP_CMD_SVCCHG_REPLY: \
case GCP_CMD_TOPOLOGY_REPLY: \
case GCP_CMD_REPLY:
case GCP_CMD_ADD_REPLY: \
case GCP_CMD_MOVE_REPLY: \
case GCP_CMD_MOD_REPLY: \
case GCP_CMD_SUB_REPLY: \
case GCP_CMD_AUDITCAP_REPLY: \
case GCP_CMD_AUDITVAL_REPLY: \
case GCP_CMD_NOTIFY_REPLY: \
case GCP_CMD_SVCCHG_REPLY: \
case GCP_CMD_TOPOLOGY_REPLY: \
case GCP_CMD_REPLY:
#define GCP_CMD_REQ_CASE \
case GCP_CMD_ADD_REQ: \
case GCP_CMD_MOVE_REQ: \
case GCP_CMD_MOD_REQ: \
case GCP_CMD_SUB_REQ: \
case GCP_CMD_AUDITCAP_REQ: \
case GCP_CMD_AUDITVAL_REQ: \
case GCP_CMD_NOTIFY_REQ: \
case GCP_CMD_SVCCHG_REQ: \
case GCP_CMD_TOPOLOGY_REQ: \
case GCP_CMD_CTX_ATTR_AUDIT_REQ: \
case GCP_CMD_OTHER_REQ:
case GCP_CMD_ADD_REQ: \
case GCP_CMD_MOVE_REQ: \
case GCP_CMD_MOD_REQ: \
case GCP_CMD_SUB_REQ: \
case GCP_CMD_AUDITCAP_REQ: \
case GCP_CMD_AUDITVAL_REQ: \
case GCP_CMD_NOTIFY_REQ: \
case GCP_CMD_SVCCHG_REQ: \
case GCP_CMD_TOPOLOGY_REQ: \
case GCP_CMD_CTX_ATTR_AUDIT_REQ: \
case GCP_CMD_OTHER_REQ:
/* used to keep track of the statistics for an entire program interface */
typedef struct _megacostat_t {
char *filter;
timestat_t rtd[NUM_TIMESTATS];
timestat_t rtd[NUM_TIMESTATS];
guint32 open_req_num;
guint32 disc_rsp_num;
guint32 req_dup_num;
@ -74,20 +74,33 @@ typedef struct _megacostat_t {
} megacostat_t;
static const value_string megaco_message_type[] = {
{ 0, "ADD "},
{ 1, "MOVE"},
{ 2, "MDFY"},
{ 3, "SUBT"},
{ 4, "AUCP"},
{ 5, "AUVL"},
{ 6, "NTFY"},
{ 7, "SVCC"},
{ 8, "TOPO"},
{ 9, "NONE"},
{ 10,"ALL "},
{ 0, NULL}
{ 0, "ADD "},
{ 1, "MOVE"},
{ 2, "MDFY"},
{ 3, "SUBT"},
{ 4, "AUCP"},
{ 5, "AUVL"},
{ 6, "NTFY"},
{ 7, "SVCC"},
{ 8, "TOPO"},
{ 9, "NONE"},
{ 10, "ALL "},
{ 0, NULL}
};
int megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
#endif /*TAP_MEGACO_COMMON_H*/

View File

@ -36,4 +36,17 @@ void rtp_write_header(rtp_stream_info_t*, FILE*);
void rtp_write_sample(rtp_sample_t*, FILE*);
int rtpstream_packet(void*, packet_info*, epan_dissect_t *, const void *);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /*TAP_RTP_COMMON_H_INCLUDED*/

View File

@ -399,8 +399,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
tmp_info.initiate_tag = 0;
}
tmp_info.direction = sctp_info->direction;
tmp_info.assoc_id = sctp_info->assoc_index;
tmp_info.direction = sctp_info->direction;
tmp_info.assoc_id = sctp_info->assoc_index;
info = find_assoc(&tmp_info);
if (!info)
{
@ -1204,3 +1204,16 @@ register_tap_listener_sctp_stat(void)
sctp_tapinfo_struct.is_registered=TRUE;
}
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/

View File

@ -12,7 +12,7 @@
*
* 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
* 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
@ -39,135 +39,135 @@ extern "C" {
#endif
#endif
#define SCTP_DATA_CHUNK_ID 0
#define SCTP_INIT_CHUNK_ID 1
#define SCTP_INIT_ACK_CHUNK_ID 2
#define SCTP_SACK_CHUNK_ID 3
#define SCTP_HEARTBEAT_CHUNK_ID 4
#define SCTP_HEARTBEAT_ACK_CHUNK_ID 5
#define SCTP_ABORT_CHUNK_ID 6
#define SCTP_SHUTDOWN_CHUNK_ID 7
#define SCTP_SHUTDOWN_ACK_CHUNK_ID 8
#define SCTP_ERROR_CHUNK_ID 9
#define SCTP_COOKIE_ECHO_CHUNK_ID 10
#define SCTP_COOKIE_ACK_CHUNK_ID 11
#define SCTP_ECNE_CHUNK_ID 12
#define SCTP_CWR_CHUNK_ID 13
#define SCTP_DATA_CHUNK_ID 0
#define SCTP_INIT_CHUNK_ID 1
#define SCTP_INIT_ACK_CHUNK_ID 2
#define SCTP_SACK_CHUNK_ID 3
#define SCTP_HEARTBEAT_CHUNK_ID 4
#define SCTP_HEARTBEAT_ACK_CHUNK_ID 5
#define SCTP_ABORT_CHUNK_ID 6
#define SCTP_SHUTDOWN_CHUNK_ID 7
#define SCTP_SHUTDOWN_ACK_CHUNK_ID 8
#define SCTP_ERROR_CHUNK_ID 9
#define SCTP_COOKIE_ECHO_CHUNK_ID 10
#define SCTP_COOKIE_ACK_CHUNK_ID 11
#define SCTP_ECNE_CHUNK_ID 12
#define SCTP_CWR_CHUNK_ID 13
#define SCTP_SHUTDOWN_COMPLETE_CHUNK_ID 14
#define SCTP_AUTH_CHUNK_ID 15
#define SCTP_NR_SACK_CHUNK_ID 16
#define SCTP_AUTH_CHUNK_ID 15
#define SCTP_NR_SACK_CHUNK_ID 16
#define SCTP_ASCONF_ACK_CHUNK_ID 0x80
#define SCTP_PKTDROP_CHUNK_ID 0x81
#define SCTP_RE_CONFIG_CHUNK_ID 0x82
#define SCTP_PAD_CHUNK_ID 0x84
#define SCTP_PKTDROP_CHUNK_ID 0x81
#define SCTP_RE_CONFIG_CHUNK_ID 0x82
#define SCTP_PAD_CHUNK_ID 0x84
#define SCTP_FORWARD_TSN_CHUNK_ID 0xC0
#define SCTP_ASCONF_CHUNK_ID 0xC1
#define SCTP_IETF_EXT 0xFF
#define SCTP_ASCONF_CHUNK_ID 0xC1
#define SCTP_IETF_EXT 0xFF
#define IS_SCTP_CHUNK_TYPE(t) \
(((t) <= 16) || ((t) == 0xC0) || ((t) == 0xC1) || ((t) == 0x80) || ((t) == 0x81))
(((t) <= 16) || ((t) == 0xC0) || ((t) == 0xC1) || ((t) == 0x80) || ((t) == 0x81))
#define CHUNK_TYPE_LENGTH 1
#define CHUNK_FLAGS_LENGTH 1
#define CHUNK_LENGTH_LENGTH 2
#define CHUNK_TYPE_LENGTH 1
#define CHUNK_FLAGS_LENGTH 1
#define CHUNK_LENGTH_LENGTH 2
#define CHUNK_HEADER_OFFSET 0
#define CHUNK_TYPE_OFFSET CHUNK_HEADER_OFFSET
#define CHUNK_FLAGS_OFFSET (CHUNK_TYPE_OFFSET + CHUNK_TYPE_LENGTH)
#define CHUNK_LENGTH_OFFSET (CHUNK_FLAGS_OFFSET + CHUNK_FLAGS_LENGTH)
#define CHUNK_VALUE_OFFSET (CHUNK_LENGTH_OFFSET + CHUNK_LENGTH_LENGTH)
#define CHUNK_HEADER_OFFSET 0
#define CHUNK_TYPE_OFFSET CHUNK_HEADER_OFFSET
#define CHUNK_FLAGS_OFFSET (CHUNK_TYPE_OFFSET + CHUNK_TYPE_LENGTH)
#define CHUNK_LENGTH_OFFSET (CHUNK_FLAGS_OFFSET + CHUNK_FLAGS_LENGTH)
#define CHUNK_VALUE_OFFSET (CHUNK_LENGTH_OFFSET + CHUNK_LENGTH_LENGTH)
#define INIT_CHUNK_INITIATE_TAG_LENGTH 4
#define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH 4
#define INIT_CHUNK_INITIATE_TAG_LENGTH 4
#define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH 4
#define INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH 2
#define INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH 2
#define INIT_CHUNK_INITIATE_TAG_OFFSET CHUNK_VALUE_OFFSET
#define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET (INIT_CHUNK_INITIATE_TAG_OFFSET + \
INIT_CHUNK_INITIATE_TAG_LENGTH )
#define INIT_CHUNK_INITIATE_TAG_OFFSET CHUNK_VALUE_OFFSET
#define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET (INIT_CHUNK_INITIATE_TAG_OFFSET + \
INIT_CHUNK_INITIATE_TAG_LENGTH )
#define INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_OFFSET (INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET + \
INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH )
INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH )
#define INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET (INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_OFFSET + \
INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH )
#define INIT_CHUNK_INITIAL_TSN_OFFSET (INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET + \
INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH )
INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH )
#define INIT_CHUNK_INITIAL_TSN_OFFSET (INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET + \
INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH )
#define DATA_CHUNK_TSN_LENGTH 4
#define DATA_CHUNK_TSN_OFFSET (CHUNK_VALUE_OFFSET + 0)
#define DATA_CHUNK_TSN_LENGTH 4
#define DATA_CHUNK_TSN_OFFSET (CHUNK_VALUE_OFFSET + 0)
#define DATA_CHUNK_STREAM_ID_OFFSET (DATA_CHUNK_TSN_OFFSET + DATA_CHUNK_TSN_LENGTH)
#define DATA_CHUNK_STREAM_ID_LENGTH 2
#define DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH 2
#define DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4
#define DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \
DATA_CHUNK_TSN_LENGTH + \
DATA_CHUNK_STREAM_ID_LENGTH + \
DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH + \
DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
#define MAX_ADDRESS_LEN 47
DATA_CHUNK_TSN_LENGTH + \
DATA_CHUNK_STREAM_ID_LENGTH + \
DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH + \
DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH)
#define MAX_ADDRESS_LEN 47
#define SCTP_ABORT_CHUNK_T_BIT 0x01
#define SCTP_ABORT_CHUNK_T_BIT 0x01
#define PARAMETER_TYPE_LENGTH 2
#define PARAMETER_LENGTH_LENGTH 2
#define PARAMETER_HEADER_LENGTH (PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_LENGTH)
#define PARAMETER_TYPE_LENGTH 2
#define PARAMETER_LENGTH_LENGTH 2
#define PARAMETER_HEADER_LENGTH (PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_LENGTH)
#define PARAMETER_HEADER_OFFSET 0
#define PARAMETER_TYPE_OFFSET PARAMETER_HEADER_OFFSET
#define PARAMETER_LENGTH_OFFSET (PARAMETER_TYPE_OFFSET + PARAMETER_TYPE_LENGTH)
#define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
#define PARAMETER_HEADER_OFFSET 0
#define PARAMETER_TYPE_OFFSET PARAMETER_HEADER_OFFSET
#define PARAMETER_LENGTH_OFFSET (PARAMETER_TYPE_OFFSET + PARAMETER_TYPE_LENGTH)
#define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
#define IPV6_ADDRESS_LENGTH 16
#define IPV6_ADDRESS_OFFSET PARAMETER_VALUE_OFFSET
#define IPV4_ADDRESS_LENGTH 4
#define IPV4_ADDRESS_OFFSET PARAMETER_VALUE_OFFSET
#define IPV4ADDRESS_PARAMETER_ID 0x0005
#define IPV6ADDRESS_PARAMETER_ID 0x0006
#define IPV4ADDRESS_PARAMETER_ID 0x0005
#define IPV6ADDRESS_PARAMETER_ID 0x0006
#define SACK_CHUNK_CUMULATIVE_TSN_ACK_LENGTH 4
#define SACK_CHUNK_CUMULATIVE_TSN_ACK_LENGTH 4
#define SACK_CHUNK_CUMULATIVE_TSN_ACK_OFFSET (CHUNK_VALUE_OFFSET + 0)
#define SACK_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH 4
#define SACK_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET (SACK_CHUNK_CUMULATIVE_TSN_ACK_OFFSET + \
SACK_CHUNK_CUMULATIVE_TSN_ACK_LENGTH)
SACK_CHUNK_CUMULATIVE_TSN_ACK_LENGTH)
#define INIT_CHUNK_INITIAL_TSN_LENGTH 4
#define INIT_CHUNK_FIXED_PARAMTERS_LENGTH (INIT_CHUNK_INITIATE_TAG_LENGTH + \
INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH + \
INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH + \
INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH + \
INIT_CHUNK_INITIAL_TSN_LENGTH)
#define CHUNK_HEADER_LENGTH (CHUNK_TYPE_LENGTH + \
CHUNK_FLAGS_LENGTH + \
CHUNK_LENGTH_LENGTH)
#define INIT_CHUNK_INITIAL_TSN_LENGTH 4
#define INIT_CHUNK_FIXED_PARAMTERS_LENGTH (INIT_CHUNK_INITIATE_TAG_LENGTH + \
INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH + \
INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH + \
INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH + \
INIT_CHUNK_INITIAL_TSN_LENGTH)
#define CHUNK_HEADER_LENGTH (CHUNK_TYPE_LENGTH + \
CHUNK_FLAGS_LENGTH + \
CHUNK_LENGTH_LENGTH)
#define INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET (INIT_CHUNK_INITIAL_TSN_OFFSET + \
INIT_CHUNK_INITIAL_TSN_LENGTH )
INIT_CHUNK_INITIAL_TSN_LENGTH )
static const value_string chunk_type_values[] = {
{ SCTP_DATA_CHUNK_ID, "DATA" },
{ SCTP_INIT_CHUNK_ID, "INIT" },
{ SCTP_INIT_ACK_CHUNK_ID, "INIT_ACK" },
{ SCTP_SACK_CHUNK_ID, "SACK" },
{ SCTP_HEARTBEAT_CHUNK_ID, "HEARTBEAT" },
{ SCTP_HEARTBEAT_ACK_CHUNK_ID, "HEARTBEAT_ACK" },
{ SCTP_ABORT_CHUNK_ID, "ABORT" },
{ SCTP_SHUTDOWN_CHUNK_ID, "SHUTDOWN" },
{ SCTP_SHUTDOWN_ACK_CHUNK_ID, "SHUTDOWN_ACK" },
{ SCTP_ERROR_CHUNK_ID, "ERROR" },
{ SCTP_COOKIE_ECHO_CHUNK_ID, "COOKIE_ECHO" },
{ SCTP_COOKIE_ACK_CHUNK_ID, "COOKIE_ACK" },
{ SCTP_ECNE_CHUNK_ID, "ECNE" },
{ SCTP_CWR_CHUNK_ID, "CWR" },
{ SCTP_DATA_CHUNK_ID, "DATA" },
{ SCTP_INIT_CHUNK_ID, "INIT" },
{ SCTP_INIT_ACK_CHUNK_ID, "INIT_ACK" },
{ SCTP_SACK_CHUNK_ID, "SACK" },
{ SCTP_HEARTBEAT_CHUNK_ID, "HEARTBEAT" },
{ SCTP_HEARTBEAT_ACK_CHUNK_ID, "HEARTBEAT_ACK" },
{ SCTP_ABORT_CHUNK_ID, "ABORT" },
{ SCTP_SHUTDOWN_CHUNK_ID, "SHUTDOWN" },
{ SCTP_SHUTDOWN_ACK_CHUNK_ID, "SHUTDOWN_ACK" },
{ SCTP_ERROR_CHUNK_ID, "ERROR" },
{ SCTP_COOKIE_ECHO_CHUNK_ID, "COOKIE_ECHO" },
{ SCTP_COOKIE_ACK_CHUNK_ID, "COOKIE_ACK" },
{ SCTP_ECNE_CHUNK_ID, "ECNE" },
{ SCTP_CWR_CHUNK_ID, "CWR" },
{ SCTP_SHUTDOWN_COMPLETE_CHUNK_ID, "SHUTDOWN_COMPLETE" },
{ SCTP_AUTH_CHUNK_ID, "AUTH" },
{ SCTP_NR_SACK_CHUNK_ID, "NR-SACK" },
{ SCTP_ASCONF_ACK_CHUNK_ID, "ASCONF_ACK" },
{ SCTP_PKTDROP_CHUNK_ID, "PKTDROP" },
{ SCTP_RE_CONFIG_CHUNK_ID, "RE_CONFIG" },
{ SCTP_PAD_CHUNK_ID, "PAD" },
{ SCTP_FORWARD_TSN_CHUNK_ID, "FORWARD_TSN" },
{ SCTP_ASCONF_CHUNK_ID, "ASCONF" },
{ SCTP_IETF_EXT, "IETF_EXTENSION" },
{ 0, NULL } };
{ SCTP_AUTH_CHUNK_ID, "AUTH" },
{ SCTP_NR_SACK_CHUNK_ID, "NR-SACK" },
{ SCTP_ASCONF_ACK_CHUNK_ID, "ASCONF_ACK" },
{ SCTP_PKTDROP_CHUNK_ID, "PKTDROP" },
{ SCTP_RE_CONFIG_CHUNK_ID, "RE_CONFIG" },
{ SCTP_PAD_CHUNK_ID, "PAD" },
{ SCTP_FORWARD_TSN_CHUNK_ID, "FORWARD_TSN" },
{ SCTP_ASCONF_CHUNK_ID, "ASCONF" },
{ SCTP_IETF_EXT, "IETF_EXTENSION" },
{ 0, NULL } };
/* The below value is 255 */
#define NUM_CHUNKS 0x100
@ -186,13 +186,13 @@ static const value_string chunk_type_values[] = {
#define MAX_SCTP_CHUNK_TYPE 256
typedef struct _tsn {
guint32 frame_number;
guint32 secs; /* Absolute seconds */
guint32 usecs;
address src;
address dst;
guint32 first_tsn;
GList *tsns;
guint32 frame_number;
guint32 secs; /* Absolute seconds */
guint32 usecs;
address src;
address dst;
guint32 first_tsn;
GList *tsns;
} tsn_t;
typedef struct _sctp_tmp_info {
@ -217,7 +217,7 @@ typedef struct _sctp_min_max {
guint32 tmp_min_tsn2;
guint32 tmp_max_tsn1;
guint32 tmp_max_tsn2;
gint tmp_secs;
gint tmp_secs;
} sctp_min_max_t;
struct tsn_sort{
@ -230,107 +230,107 @@ struct tsn_sort{
};
typedef struct _sctp_addr_chunk {
guint32 direction;
address* addr;
guint32 direction;
address *addr;
/* The array is initialized to MAX_SCTP_CHUNK_TYPE
* so that there is no memory overwrite
* when accessed using sctp chunk type as index.
*/
guint32 addr_count[MAX_SCTP_CHUNK_TYPE];
guint32 addr_count[MAX_SCTP_CHUNK_TYPE];
} sctp_addr_chunk;
typedef struct _sctp_assoc_info {
guint16 assoc_id;
address src;
address dst;
guint16 port1;
guint16 port2;
guint32 verification_tag1;
guint32 verification_tag2;
guint32 initiate_tag;
guint32 n_tvbs;
GList *addr1;
GList *addr2;
guint16 instream1;
guint16 outstream1;
guint16 instream2;
guint16 outstream2;
guint32 n_adler32_calculated;
guint32 n_adler32_correct;
guint32 n_crc32c_calculated;
guint32 n_crc32c_correct;
gchar checksum_type[8];
guint32 n_checksum_errors;
guint32 n_bundling_errors;
guint32 n_padding_errors;
guint32 n_length_errors;
guint32 n_value_errors;
guint32 n_data_chunks;
guint32 n_forward_chunks;
guint32 n_forward_chunks_ep1;
guint32 n_forward_chunks_ep2;
guint32 n_data_bytes;
guint32 n_packets;
guint32 n_data_chunks_ep1;
guint32 n_data_bytes_ep1;
guint32 n_data_chunks_ep2;
guint32 n_data_bytes_ep2;
guint32 n_sack_chunks_ep1;
guint32 n_sack_chunks_ep2;
guint32 n_array_tsn1;
guint32 n_array_tsn2;
guint32 max_window1;
guint32 max_window2;
guint32 arwnd1;
guint32 arwnd2;
gboolean init;
gboolean initack;
guint16 initack_dir;
guint16 direction;
guint32 min_secs;
guint32 min_usecs;
guint32 max_secs;
guint32 max_usecs;
guint32 min_tsn1;
guint32 min_tsn2;
guint32 max_tsn1;
guint32 max_tsn2;
guint32 max_bytes1;
guint32 max_bytes2;
GSList *min_max;
GList *frame_numbers;
GList *tsn1;
guint16 assoc_id;
address src;
address dst;
guint16 port1;
guint16 port2;
guint32 verification_tag1;
guint32 verification_tag2;
guint32 initiate_tag;
guint32 n_tvbs;
GList *addr1;
GList *addr2;
guint16 instream1;
guint16 outstream1;
guint16 instream2;
guint16 outstream2;
guint32 n_adler32_calculated;
guint32 n_adler32_correct;
guint32 n_crc32c_calculated;
guint32 n_crc32c_correct;
gchar checksum_type[8];
guint32 n_checksum_errors;
guint32 n_bundling_errors;
guint32 n_padding_errors;
guint32 n_length_errors;
guint32 n_value_errors;
guint32 n_data_chunks;
guint32 n_forward_chunks;
guint32 n_forward_chunks_ep1;
guint32 n_forward_chunks_ep2;
guint32 n_data_bytes;
guint32 n_packets;
guint32 n_data_chunks_ep1;
guint32 n_data_bytes_ep1;
guint32 n_data_chunks_ep2;
guint32 n_data_bytes_ep2;
guint32 n_sack_chunks_ep1;
guint32 n_sack_chunks_ep2;
guint32 n_array_tsn1;
guint32 n_array_tsn2;
guint32 max_window1;
guint32 max_window2;
guint32 arwnd1;
guint32 arwnd2;
gboolean init;
gboolean initack;
guint16 initack_dir;
guint16 direction;
guint32 min_secs;
guint32 min_usecs;
guint32 max_secs;
guint32 max_usecs;
guint32 min_tsn1;
guint32 min_tsn2;
guint32 max_tsn1;
guint32 max_tsn2;
guint32 max_bytes1;
guint32 max_bytes2;
GSList *min_max;
GList *frame_numbers;
GList *tsn1;
GPtrArray *sort_tsn1;
GPtrArray *sort_sack1;
GList *sack1;
GList *tsn2;
GList *sack1;
GList *tsn2;
GPtrArray *sort_tsn2;
GPtrArray *sort_sack2;
GList *sack2;
gboolean check_address;
GList* error_info_list;
GList *sack2;
gboolean check_address;
GList* error_info_list;
/* The array is initialized to MAX_SCTP_CHUNK_TYPE
* so that there is no memory overwrite
* when accessed using sctp chunk type as index.
*/
guint32 chunk_count[MAX_SCTP_CHUNK_TYPE];
guint32 ep1_chunk_count[MAX_SCTP_CHUNK_TYPE];
guint32 ep2_chunk_count[MAX_SCTP_CHUNK_TYPE];
GList* addr_chunk_count;
guint32 chunk_count[MAX_SCTP_CHUNK_TYPE];
guint32 ep1_chunk_count[MAX_SCTP_CHUNK_TYPE];
guint32 ep2_chunk_count[MAX_SCTP_CHUNK_TYPE];
GList *addr_chunk_count;
} sctp_assoc_info_t;
typedef struct _sctp_error_info {
guint32 frame_number;
gchar chunk_info[200];
const gchar *info_text;
guint32 frame_number;
gchar chunk_info[200];
const gchar *info_text;
} sctp_error_info_t;
typedef struct _sctp_allassocs_info {
guint32 sum_tvbs;
GList* assoc_info_list;
gboolean is_registered;
GList* children;
guint32 sum_tvbs;
GList *assoc_info_list;
gboolean is_registered;
GList *children;
} sctp_allassocs_info_t;
@ -350,5 +350,17 @@ const sctp_assoc_info_t* get_selected_assoc(void);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
#endif /* __TAP_SCTP_ANALYSIS_H__ */

View File

@ -98,4 +98,17 @@ const gchar * time_shift_undo(capture_file *cf);
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __TIME_SHIFT_H__ */

View File

@ -55,4 +55,17 @@ void get_runtime_version_info(GString *str,
}
#endif /* __cplusplus */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
#endif /* __VERSION_INFO_H__ */

View File

@ -178,6 +178,19 @@
*
* Either can be used for exported *function* declarations and definitions.
*/
#define WS_DLL_PUBLIC WS_DLL_PUBLIC_DEF extern
#define WS_DLL_PUBLIC WS_DLL_PUBLIC_DEF extern
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
#endif /* SYMBOL_EXPORT_H */