Make ui/*.[ch] indentation consistent.

Switch ui/clopts_common.c, ui/filter_files.[ch], and ui/summary.[ch] to
4 space indentation. This brings them in line with all of the other
files in that directory and with ui/qt.

Fix the modelines in ui/qt/models/filter_list_model.cpp.
This commit is contained in:
Gerald Combs 2021-03-01 14:29:52 -08:00 committed by Wireshark GitLab Utility
parent 8f7303df82
commit 25edc7439b
7 changed files with 693 additions and 699 deletions

View File

@ -79,9 +79,6 @@ indent_size = 2
[file.[ch]]
indent_size = 2
[filter_files.[ch]]
indent_size = 2
[frame_tvbuff.[ch]]
indent_style = tab
indent_size = tab
@ -92,9 +89,6 @@ indent_size = 8
[ringbuffer.[ch]]
indent_size = 2
[summary.[ch]]
indent_size = 2
[randpkt_core.[ch]]
indent_style = tab
indent_size = tab

View File

@ -21,101 +21,101 @@
int
get_natural_int(const char *string, const char *name)
{
gint32 number;
gint32 number;
if (!ws_strtoi32(string, NULL, &number)) {
if (errno == EINVAL) {
cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string);
exit(1);
if (!ws_strtoi32(string, NULL, &number)) {
if (errno == EINVAL) {
cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string);
exit(1);
}
if (number < 0) {
cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
exit(1);
}
cmdarg_err("The specified %s \"%s\" is too large (greater than %d)",
name, string, number);
exit(1);
}
if (number < 0) {
cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
exit(1);
cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
exit(1);
}
cmdarg_err("The specified %s \"%s\" is too large (greater than %d)",
name, string, number);
exit(1);
}
if (number < 0) {
cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
exit(1);
}
return (int)number;
return (int)number;
}
int
get_positive_int(const char *string, const char *name)
{
int number;
int number;
number = get_natural_int(string, name);
number = get_natural_int(string, name);
if (number == 0) {
cmdarg_err("The specified %s is zero", name);
exit(1);
}
if (number == 0) {
cmdarg_err("The specified %s is zero", name);
exit(1);
}
return number;
return number;
}
guint32
get_guint32(const char *string, const char *name)
{
guint32 number;
guint32 number;
if (!ws_strtou32(string, NULL, &number)) {
if (errno == EINVAL) {
cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string);
exit(1);
if (!ws_strtou32(string, NULL, &number)) {
if (errno == EINVAL) {
cmdarg_err("The specified %s \"%s\" isn't a decimal number", name, string);
exit(1);
}
cmdarg_err("The specified %s \"%s\" is too large (greater than %d)",
name, string, number);
exit(1);
}
cmdarg_err("The specified %s \"%s\" is too large (greater than %d)",
name, string, number);
exit(1);
}
return number;
return number;
}
guint32
get_nonzero_guint32(const char *string, const char *name)
{
guint32 number;
guint32 number;
number = get_guint32(string, name);
number = get_guint32(string, name);
if (number == 0) {
cmdarg_err("The specified %s is zero", name);
exit(1);
}
if (number == 0) {
cmdarg_err("The specified %s is zero", name);
exit(1);
}
return number;
return number;
}
double
get_positive_double(const char *string, const char *name)
{
double number = g_ascii_strtod(string, NULL);
double number = g_ascii_strtod(string, NULL);
if (errno == EINVAL) {
cmdarg_err("The specified %s \"%s\" isn't a floating point number", name, string);
exit(1);
}
if (number < 0.0) {
cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
exit(1);
}
if (errno == EINVAL) {
cmdarg_err("The specified %s \"%s\" isn't a floating point number", name, string);
exit(1);
}
if (number < 0.0) {
cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
exit(1);
}
return number;
return number;
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -75,291 +75,291 @@ void free_filter_lists(void)
static GList *
remove_filter_entry(GList *fl, GList *fl_entry)
{
filter_def *filt;
filter_def *filt;
filt = (filter_def *) fl_entry->data;
g_free(filt->name);
g_free(filt->strval);
g_free(filt);
return g_list_remove_link(fl, fl_entry);
filt = (filter_def *) fl_entry->data;
g_free(filt->name);
g_free(filt->strval);
g_free(filt);
return g_list_remove_link(fl, fl_entry);
}
static int
skip_whitespace(FILE *ff)
{
int c;
int c;
while ((c = getc(ff)) != EOF && c != '\n' && g_ascii_isspace(c))
;
return c;
while ((c = getc(ff)) != EOF && c != '\n' && g_ascii_isspace(c))
;
return c;
}
static int
getc_crlf(FILE *ff)
{
int c;
int c;
c = getc(ff);
if (c == '\r') {
/* Treat CR-LF at the end of a line like LF, so that if we're reading
* a Windows-format file on UN*X, we handle it the same way we'd handle
* a UN*X-format file. */
c = getc(ff);
if (c != EOF && c != '\n') {
/* Put back the character after the CR, and process the CR normally. */
ungetc(c, ff);
c = '\r';
if (c == '\r') {
/* Treat CR-LF at the end of a line like LF, so that if we're reading
* a Windows-format file on UN*X, we handle it the same way we'd handle
* a UN*X-format file. */
c = getc(ff);
if (c != EOF && c != '\n') {
/* Put back the character after the CR, and process the CR normally. */
ungetc(c, ff);
c = '\r';
}
}
}
return c;
return c;
}
void
read_filter_list(filter_list_type_t list_type)
{
const char *ff_name, *ff_description;
char *ff_path;
FILE *ff;
GList **flpp;
int c;
char *filt_name, *filt_expr;
int filt_name_len, filt_expr_len;
int filt_name_index, filt_expr_index;
int line = 1;
const char *ff_name, *ff_description;
char *ff_path;
FILE *ff;
GList **flpp;
int c;
char *filt_name, *filt_expr;
int filt_name_len, filt_expr_len;
int filt_name_index, filt_expr_index;
int line = 1;
switch (list_type) {
switch (list_type) {
case CFILTER_LIST:
ff_name = CFILTER_FILE_NAME;
ff_description = "capture";
flpp = &capture_filters;
break;
case CFILTER_LIST:
ff_name = CFILTER_FILE_NAME;
ff_description = "capture";
flpp = &capture_filters;
break;
case DFILTER_LIST:
ff_name = DFILTER_FILE_NAME;
ff_description = "display";
flpp = &display_filters;
break;
case DFILTER_LIST:
ff_name = DFILTER_FILE_NAME;
ff_description = "display";
flpp = &display_filters;
break;
default:
g_assert_not_reached();
return;
}
/* try to open personal "cfilters"/"dfilters" file */
ff_path = get_persconffile_path(ff_name, TRUE);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Did that fail because the file didn't exist?
*/
if (errno != ENOENT) {
/*
* No. Just give up.
*/
report_warning("Could not open your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
g_free(ff_path);
return;
default:
g_assert_not_reached();
return;
}
/*
* Yes. See if there's an "old style" personal "filters" file; if so, read it.
* This means that a user will start out with their capture and
* display filter lists being identical; each list may contain
* filters that don't belong in that list. The user can edit
* the filter lists, and delete the ones that don't belong in
* a particular list.
*/
g_free(ff_path);
ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE);
/* try to open personal "cfilters"/"dfilters" file */
ff_path = get_persconffile_path(ff_name, TRUE);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Did that fail because the file didn't exist?
*/
if (errno != ENOENT) {
/*
* No. Just give up.
*/
report_warning("Could not open your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
g_free(ff_path);
return;
}
/*
* Try to open the global "cfilters/dfilters" file.
*/
g_free(ff_path);
ff_path = get_datafile_path(ff_name);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Well, that didn't work, either. Just give up.
* Report an error if the file existed but we couldn't open it.
* Did that fail because the file didn't exist?
*/
if (errno != ENOENT) {
report_warning("Could not open your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
/*
* No. Just give up.
*/
report_warning("Could not open your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
g_free(ff_path);
return;
}
/*
* Yes. See if there's an "old style" personal "filters" file; if so, read it.
* This means that a user will start out with their capture and
* display filter lists being identical; each list may contain
* filters that don't belong in that list. The user can edit
* the filter lists, and delete the ones that don't belong in
* a particular list.
*/
g_free(ff_path);
return;
}
}
}
ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Did that fail because the file didn't exist?
*/
if (errno != ENOENT) {
/*
* No. Just give up.
*/
report_warning("Could not open your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
g_free(ff_path);
return;
}
/* If we already have a list of filters, discard it. */
/* this should never happen - this function is called only once for each list! */
while(*flpp) {
*flpp = remove_filter_entry(*flpp, g_list_first(*flpp));
}
/* Allocate the filter name buffer. */
filt_name_len = INIT_BUF_SIZE;
filt_name = (char *)g_malloc(filt_name_len + 1);
filt_expr_len = INIT_BUF_SIZE;
filt_expr = (char *)g_malloc(filt_expr_len + 1);
for (line = 1; ; line++) {
/* Lines in a filter file are of the form
"name" expression
where "name" is a name, in quotes - backslashes in the name
escape the next character, so quotes and backslashes can appear
in the name - and "expression" is a filter expression, not in
quotes, running to the end of the line. */
/* Skip over leading white space, if any. */
c = skip_whitespace(ff);
if (c == EOF)
break; /* Nothing more to read */
if (c == '\n')
continue; /* Blank line. */
/* "c" is the first non-white-space character.
If it's not a quote, it's an error. */
if (c != '"') {
g_warning("'%s' line %d doesn't have a quoted filter name.", ff_path,
line);
while (c != '\n')
c = getc(ff); /* skip to the end of the line */
continue;
}
/* Get the name of the filter. */
filt_name_index = 0;
for (;;) {
c = getc_crlf(ff);
if (c == EOF || c == '\n')
break; /* End of line - or end of file */
if (c == '"') {
/* Closing quote. */
if (filt_name_index >= filt_name_len) {
/* Filter name buffer isn't long enough; double its length. */
filt_name_len *= 2;
filt_name = (char *)g_realloc(filt_name, filt_name_len + 1);
/*
* Try to open the global "cfilters/dfilters" file.
*/
g_free(ff_path);
ff_path = get_datafile_path(ff_name);
if ((ff = ws_fopen(ff_path, "r")) == NULL) {
/*
* Well, that didn't work, either. Just give up.
* Report an error if the file existed but we couldn't open it.
*/
if (errno != ENOENT) {
report_warning("Could not open your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
}
g_free(ff_path);
return;
}
}
filt_name[filt_name_index] = '\0';
break;
}
if (c == '\\') {
/* Next character is escaped */
c = getc_crlf(ff);
if (c == EOF || c == '\n')
break; /* End of line - or end of file */
}
/* Add this character to the filter name string. */
if (filt_name_index >= filt_name_len) {
/* Filter name buffer isn't long enough; double its length. */
filt_name_len *= 2;
filt_name = (char *)g_realloc(filt_name, filt_name_len + 1);
}
filt_name[filt_name_index] = c;
filt_name_index++;
}
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
g_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
/* If we already have a list of filters, discard it. */
/* this should never happen - this function is called only once for each list! */
while(*flpp) {
*flpp = remove_filter_entry(*flpp, g_list_first(*flpp));
}
if (c != '"') {
/* No newline seen before end-of-line */
g_warning("'%s' line %d doesn't have a closing quote.", ff_path,
line);
continue;
/* Allocate the filter name buffer. */
filt_name_len = INIT_BUF_SIZE;
filt_name = (char *)g_malloc(filt_name_len + 1);
filt_expr_len = INIT_BUF_SIZE;
filt_expr = (char *)g_malloc(filt_expr_len + 1);
for (line = 1; ; line++) {
/* Lines in a filter file are of the form
"name" expression
where "name" is a name, in quotes - backslashes in the name
escape the next character, so quotes and backslashes can appear
in the name - and "expression" is a filter expression, not in
quotes, running to the end of the line. */
/* Skip over leading white space, if any. */
c = skip_whitespace(ff);
if (c == EOF)
break; /* Nothing more to read */
if (c == '\n')
continue; /* Blank line. */
/* "c" is the first non-white-space character.
If it's not a quote, it's an error. */
if (c != '"') {
g_warning("'%s' line %d doesn't have a quoted filter name.", ff_path,
line);
while (c != '\n')
c = getc(ff); /* skip to the end of the line */
continue;
}
/* Get the name of the filter. */
filt_name_index = 0;
for (;;) {
c = getc_crlf(ff);
if (c == EOF || c == '\n')
break; /* End of line - or end of file */
if (c == '"') {
/* Closing quote. */
if (filt_name_index >= filt_name_len) {
/* Filter name buffer isn't long enough; double its length. */
filt_name_len *= 2;
filt_name = (char *)g_realloc(filt_name, filt_name_len + 1);
}
filt_name[filt_name_index] = '\0';
break;
}
if (c == '\\') {
/* Next character is escaped */
c = getc_crlf(ff);
if (c == EOF || c == '\n')
break; /* End of line - or end of file */
}
/* Add this character to the filter name string. */
if (filt_name_index >= filt_name_len) {
/* Filter name buffer isn't long enough; double its length. */
filt_name_len *= 2;
filt_name = (char *)g_realloc(filt_name, filt_name_len + 1);
}
filt_name[filt_name_index] = c;
filt_name_index++;
}
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
g_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
}
if (c != '"') {
/* No newline seen before end-of-line */
g_warning("'%s' line %d doesn't have a closing quote.", ff_path,
line);
continue;
}
/* Skip over separating white space, if any. */
c = skip_whitespace(ff);
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
g_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
}
if (c == '\n') {
/* No filter expression */
g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
line);
continue;
}
/* "c" is the first non-white-space character; it's the first
character of the filter expression. */
filt_expr_index = 0;
for (;;) {
/* Add this character to the filter expression string. */
if (filt_expr_index >= filt_expr_len) {
/* Filter expressioin buffer isn't long enough; double its length. */
filt_expr_len *= 2;
filt_expr = (char *)g_realloc(filt_expr, filt_expr_len + 1);
}
filt_expr[filt_expr_index] = c;
filt_expr_index++;
/* Get the next character. */
c = getc_crlf(ff);
if (c == EOF || c == '\n')
break;
}
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
g_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
}
/* We saw the ending newline; terminate the filter expression string */
if (filt_expr_index >= filt_expr_len) {
/* Filter expressioin buffer isn't long enough; double its length. */
filt_expr_len *= 2;
filt_expr = (char *)g_realloc(filt_expr, filt_expr_len + 1);
}
filt_expr[filt_expr_index] = '\0';
/* Add the new filter to the list of filters */
*flpp = add_filter_entry(*flpp, filt_name, filt_expr);
}
/* Skip over separating white space, if any. */
c = skip_whitespace(ff);
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
g_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
if (ferror(ff)) {
report_warning("Error reading your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
}
if (c == '\n') {
/* No filter expression */
g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
line);
continue;
}
/* "c" is the first non-white-space character; it's the first
character of the filter expression. */
filt_expr_index = 0;
for (;;) {
/* Add this character to the filter expression string. */
if (filt_expr_index >= filt_expr_len) {
/* Filter expressioin buffer isn't long enough; double its length. */
filt_expr_len *= 2;
filt_expr = (char *)g_realloc(filt_expr, filt_expr_len + 1);
}
filt_expr[filt_expr_index] = c;
filt_expr_index++;
/* Get the next character. */
c = getc_crlf(ff);
if (c == EOF || c == '\n')
break;
}
if (c == EOF) {
if (!ferror(ff)) {
/* EOF, not error; no newline seen before EOF */
g_warning("'%s' line %d doesn't have a newline.", ff_path,
line);
}
break; /* nothing more to read */
}
/* We saw the ending newline; terminate the filter expression string */
if (filt_expr_index >= filt_expr_len) {
/* Filter expressioin buffer isn't long enough; double its length. */
filt_expr_len *= 2;
filt_expr = (char *)g_realloc(filt_expr, filt_expr_len + 1);
}
filt_expr[filt_expr_index] = '\0';
/* Add the new filter to the list of filters */
*flpp = add_filter_entry(*flpp, filt_name, filt_expr);
}
if (ferror(ff)) {
report_warning("Error reading your %s filter file\n\"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
}
g_free(ff_path);
fclose(ff);
g_free(filt_name);
g_free(filt_expr);
g_free(ff_path);
fclose(ff);
g_free(filt_name);
g_free(filt_expr);
}
/*
@ -368,23 +368,23 @@ read_filter_list(filter_list_type_t list_type)
static GList **
get_filter_list(filter_list_type_t list_type)
{
GList **flpp;
GList **flpp;
switch (list_type) {
switch (list_type) {
case CFILTER_LIST:
flpp = &capture_filters;
break;
case CFILTER_LIST:
flpp = &capture_filters;
break;
case DFILTER_LIST:
flpp = &display_filters;
break;
case DFILTER_LIST:
flpp = &display_filters;
break;
default:
g_assert_not_reached();
flpp = NULL;
}
return flpp;
default:
g_assert_not_reached();
flpp = NULL;
}
return flpp;
}
/*
@ -393,10 +393,10 @@ get_filter_list(filter_list_type_t list_type)
GList *
get_filter_list_first(filter_list_type_t list_type)
{
GList **flpp;
GList **flpp;
flpp = get_filter_list(list_type);
return g_list_first(*flpp);
flpp = get_filter_list(list_type);
return g_list_first(*flpp);
}
/*
@ -407,12 +407,12 @@ GList *
add_to_filter_list(filter_list_type_t list_type, const char *name,
const char *expression)
{
GList **flpp;
GList **flpp;
flpp = get_filter_list(list_type);
*flpp = add_filter_entry(*flpp, name, expression);
flpp = get_filter_list(list_type);
*flpp = add_filter_entry(*flpp, name, expression);
return g_list_last(*flpp);
return g_list_last(*flpp);
}
/*
@ -421,10 +421,10 @@ add_to_filter_list(filter_list_type_t list_type, const char *name,
void
remove_from_filter_list(filter_list_type_t list_type, GList *fl_entry)
{
GList **flpp;
GList **flpp;
flpp = get_filter_list(list_type);
*flpp = remove_filter_entry(*flpp, fl_entry);
flpp = get_filter_list(list_type);
*flpp = remove_filter_entry(*flpp, fl_entry);
}
/*
@ -435,143 +435,143 @@ remove_from_filter_list(filter_list_type_t list_type, GList *fl_entry)
void
save_filter_list(filter_list_type_t list_type)
{
char *pf_dir_path;
const gchar *ff_name, *ff_description;
gchar *ff_path, *ff_path_new;
GList *fl;
GList *flpp;
filter_def *filt;
FILE *ff;
guchar *p, c;
char *pf_dir_path;
const gchar *ff_name, *ff_description;
gchar *ff_path, *ff_path_new;
GList *fl;
GList *flpp;
filter_def *filt;
FILE *ff;
guchar *p, c;
switch (list_type) {
switch (list_type) {
case CFILTER_LIST:
ff_name = CFILTER_FILE_NAME;
ff_description = "capture";
fl = capture_filters;
break;
case CFILTER_LIST:
ff_name = CFILTER_FILE_NAME;
ff_description = "capture";
fl = capture_filters;
break;
case DFILTER_LIST:
ff_name = DFILTER_FILE_NAME;
ff_description = "display";
fl = display_filters;
break;
case DFILTER_LIST:
ff_name = DFILTER_FILE_NAME;
ff_description = "display";
fl = display_filters;
break;
default:
g_assert_not_reached();
return;
}
/* Create the directory that holds personal configuration files,
if necessary. */
if (create_persconffile_dir(&pf_dir_path) == -1) {
report_failure("Can't create directory\n\"%s\"\nfor filter files: %s.",
pf_dir_path, g_strerror(errno));
g_free(pf_dir_path);
return;
}
ff_path = get_persconffile_path(ff_name, TRUE);
/* Write to "XXX.new", and rename if that succeeds.
That means we don't trash the file if we fail to write it out
completely. */
ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = ws_fopen(ff_path_new, "w")) == NULL) {
/* We had an error saving the filter. */
report_failure("Error saving your %s filter file\nCouldn't open \"%s\": %s.",
ff_description, ff_path_new, g_strerror(errno));
g_free(ff_path_new);
g_free(ff_path);
return;
}
flpp = g_list_first(fl);
while (flpp) {
filt = (filter_def *) flpp->data;
/* Write out the filter name as a quoted string; escape any quotes
or backslashes. */
putc('"', ff);
for (p = (guchar *)filt->name; (c = *p) != '\0'; p++) {
if (c == '"' || c == '\\')
putc('\\', ff);
putc(c, ff);
default:
g_assert_not_reached();
return;
}
putc('"', ff);
/* Separate the filter name and value with a space. */
putc(' ', ff);
/* Write out the filter expression and a newline. */
fprintf(ff, "%s\n", filt->strval);
if (ferror(ff)) {
report_failure("Error saving your %s filter file\nWrite to \"%s\" failed: %s.",
ff_description, ff_path_new, g_strerror(errno));
fclose(ff);
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
/* Create the directory that holds personal configuration files,
if necessary. */
if (create_persconffile_dir(&pf_dir_path) == -1) {
report_failure("Can't create directory\n\"%s\"\nfor filter files: %s.",
pf_dir_path, g_strerror(errno));
g_free(pf_dir_path);
return;
}
ff_path = get_persconffile_path(ff_name, TRUE);
/* Write to "XXX.new", and rename if that succeeds.
That means we don't trash the file if we fail to write it out
completely. */
ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = ws_fopen(ff_path_new, "w")) == NULL) {
/* We had an error saving the filter. */
report_failure("Error saving your %s filter file\nCouldn't open \"%s\": %s.",
ff_description, ff_path_new, g_strerror(errno));
g_free(ff_path_new);
g_free(ff_path);
return;
}
flpp = g_list_first(fl);
while (flpp) {
filt = (filter_def *) flpp->data;
/* Write out the filter name as a quoted string; escape any quotes
or backslashes. */
putc('"', ff);
for (p = (guchar *)filt->name; (c = *p) != '\0'; p++) {
if (c == '"' || c == '\\')
putc('\\', ff);
putc(c, ff);
}
putc('"', ff);
/* Separate the filter name and value with a space. */
putc(' ', ff);
/* Write out the filter expression and a newline. */
fprintf(ff, "%s\n", filt->strval);
if (ferror(ff)) {
report_failure("Error saving your %s filter file\nWrite to \"%s\" failed: %s.",
ff_description, ff_path_new, g_strerror(errno));
fclose(ff);
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
}
flpp = flpp->next;
}
if (fclose(ff) == EOF) {
report_failure("Error saving your %s filter file\nWrite to \"%s\" failed: %s.",
ff_description, ff_path_new, g_strerror(errno));
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
}
flpp = flpp->next;
}
if (fclose(ff) == EOF) {
report_failure("Error saving your %s filter file\nWrite to \"%s\" failed: %s.",
ff_description, ff_path_new, g_strerror(errno));
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
}
#ifdef _WIN32
/* ANSI C doesn't say whether "rename()" removes the target if it
exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so.
We must therefore remove the target file first, on Windows.
/* ANSI C doesn't say whether "rename()" removes the target if it
exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so.
We must therefore remove the target file first, on Windows.
XXX - ws_rename() should be ws_stdio_rename() on Windows,
and ws_stdio_rename() uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING,
so it should remove the target if it exists, so this stuff
shouldn't be necessary. Perhaps it dates back to when we were
calling rename(), with that being a wrapper around Microsoft's
_rename(), which didn't remove the target. */
if (ws_remove(ff_path) < 0 && errno != ENOENT) {
/* It failed for some reason other than "it's not there"; if
it's not there, we don't need to remove it, so we just
drive on. */
report_failure("Error saving your %s filter file\nCouldn't remove \"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
}
XXX - ws_rename() should be ws_stdio_rename() on Windows,
and ws_stdio_rename() uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING,
so it should remove the target if it exists, so this stuff
shouldn't be necessary. Perhaps it dates back to when we were
calling rename(), with that being a wrapper around Microsoft's
_rename(), which didn't remove the target. */
if (ws_remove(ff_path) < 0 && errno != ENOENT) {
/* It failed for some reason other than "it's not there"; if
it's not there, we don't need to remove it, so we just
drive on. */
report_failure("Error saving your %s filter file\nCouldn't remove \"%s\": %s.",
ff_description, ff_path, g_strerror(errno));
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
}
#endif
if (ws_rename(ff_path_new, ff_path) < 0) {
report_failure("Error saving your %s filter file\nCouldn't rename \"%s\" to \"%s\": %s.",
ff_description, ff_path_new, ff_path, g_strerror(errno));
ws_unlink(ff_path_new);
if (ws_rename(ff_path_new, ff_path) < 0) {
report_failure("Error saving your %s filter file\nCouldn't rename \"%s\" to \"%s\": %s.",
ff_description, ff_path_new, ff_path, g_strerror(errno));
ws_unlink(ff_path_new);
g_free(ff_path_new);
g_free(ff_path);
return;
}
g_free(ff_path_new);
g_free(ff_path);
return;
}
g_free(ff_path_new);
g_free(ff_path);
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -34,16 +34,16 @@ extern "C" {
* Filter lists.
*/
typedef enum {
CFILTER_LIST, /* capture filter list - saved */
DFILTER_LIST /* display filter list - saved */
CFILTER_LIST, /* capture filter list - saved */
DFILTER_LIST /* display filter list - saved */
} 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;
/*
@ -92,11 +92,11 @@ void free_filter_lists(void);
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -308,11 +308,11 @@ bool FilterListModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -30,69 +30,69 @@
static void
tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
{
double cur_time;
double cur_time;
sum_tally->bytes += cur_frame->pkt_len;
if (cur_frame->passed_dfilter){
sum_tally->filtered_count++;
sum_tally->filtered_bytes += cur_frame->pkt_len;
}
if (cur_frame->marked){
sum_tally->marked_count++;
sum_tally->marked_bytes += cur_frame->pkt_len;
}
if (cur_frame->ignored){
sum_tally->ignored_count++;
}
if (cur_frame->has_ts) {
/* This packet has a time stamp. */
cur_time = nstime_to_sec(&cur_frame->abs_ts);
sum_tally->packet_count_ts++;
if (cur_time < sum_tally->start_time) {
sum_tally->start_time = cur_time;
}
if (cur_time > sum_tally->stop_time){
sum_tally->stop_time = cur_time;
}
sum_tally->bytes += cur_frame->pkt_len;
if (cur_frame->passed_dfilter){
sum_tally->filtered_count_ts++;
/*
* If we've seen one filtered packet, this is the first
* one.
*/
if (sum_tally->filtered_count == 1){
sum_tally->filtered_start= cur_time;
sum_tally->filtered_stop = cur_time;
} else {
if (cur_time < sum_tally->filtered_start) {
sum_tally->filtered_start = cur_time;
}
if (cur_time > sum_tally->filtered_stop) {
sum_tally->filtered_stop = cur_time;
}
}
sum_tally->filtered_count++;
sum_tally->filtered_bytes += cur_frame->pkt_len;
}
if (cur_frame->marked){
sum_tally->marked_count_ts++;
/*
* If we've seen one marked packet, this is the first
* one.
*/
if (sum_tally->marked_count == 1){
sum_tally->marked_start= cur_time;
sum_tally->marked_stop = cur_time;
} else {
if (cur_time < sum_tally->marked_start) {
sum_tally->marked_start = cur_time;
}
if (cur_time > sum_tally->marked_stop) {
sum_tally->marked_stop = cur_time;
}
}
sum_tally->marked_count++;
sum_tally->marked_bytes += cur_frame->pkt_len;
}
if (cur_frame->ignored){
sum_tally->ignored_count++;
}
if (cur_frame->has_ts) {
/* This packet has a time stamp. */
cur_time = nstime_to_sec(&cur_frame->abs_ts);
sum_tally->packet_count_ts++;
if (cur_time < sum_tally->start_time) {
sum_tally->start_time = cur_time;
}
if (cur_time > sum_tally->stop_time){
sum_tally->stop_time = cur_time;
}
if (cur_frame->passed_dfilter){
sum_tally->filtered_count_ts++;
/*
* If we've seen one filtered packet, this is the first
* one.
*/
if (sum_tally->filtered_count == 1){
sum_tally->filtered_start= cur_time;
sum_tally->filtered_stop = cur_time;
} else {
if (cur_time < sum_tally->filtered_start) {
sum_tally->filtered_start = cur_time;
}
if (cur_time > sum_tally->filtered_stop) {
sum_tally->filtered_stop = cur_time;
}
}
}
if (cur_frame->marked){
sum_tally->marked_count_ts++;
/*
* If we've seen one marked packet, this is the first
* one.
*/
if (sum_tally->marked_count == 1){
sum_tally->marked_start= cur_time;
sum_tally->marked_stop = cur_time;
} else {
if (cur_time < sum_tally->marked_start) {
sum_tally->marked_start = cur_time;
}
if (cur_time > sum_tally->marked_stop) {
sum_tally->marked_stop = cur_time;
}
}
}
}
}
}
static void
@ -107,165 +107,165 @@ hash_to_str(const unsigned char *hash, size_t length, char *str) {
void
summary_fill_in(capture_file *cf, summary_tally *st)
{
frame_data *first_frame, *cur_frame;
guint32 framenum;
iface_summary_info iface;
guint i;
wtapng_iface_descriptions_t* idb_info;
wtap_block_t wtapng_if_descr;
wtapng_if_descr_mandatory_t *wtapng_if_descr_mand;
wtap_block_t if_stats;
guint64 isb_ifdrop;
char* if_string;
if_filter_opt_t if_filter;
frame_data *first_frame, *cur_frame;
guint32 framenum;
iface_summary_info iface;
guint i;
wtapng_iface_descriptions_t* idb_info;
wtap_block_t wtapng_if_descr;
wtapng_if_descr_mandatory_t *wtapng_if_descr_mand;
wtap_block_t if_stats;
guint64 isb_ifdrop;
char* if_string;
if_filter_opt_t if_filter;
FILE *fh;
char *hash_buf;
gcry_md_hd_t hd;
size_t hash_bytes;
FILE *fh;
char *hash_buf;
gcry_md_hd_t hd;
size_t hash_bytes;
st->packet_count_ts = 0;
st->start_time = 0;
st->stop_time = 0;
st->bytes = 0;
st->filtered_count = 0;
st->filtered_count_ts = 0;
st->filtered_start = 0;
st->filtered_stop = 0;
st->filtered_bytes = 0;
st->marked_count = 0;
st->marked_count_ts = 0;
st->marked_start = 0;
st->marked_stop = 0;
st->marked_bytes = 0;
st->ignored_count = 0;
st->packet_count_ts = 0;
st->start_time = 0;
st->stop_time = 0;
st->bytes = 0;
st->filtered_count = 0;
st->filtered_count_ts = 0;
st->filtered_start = 0;
st->filtered_stop = 0;
st->filtered_bytes = 0;
st->marked_count = 0;
st->marked_count_ts = 0;
st->marked_start = 0;
st->marked_stop = 0;
st->marked_bytes = 0;
st->ignored_count = 0;
/* initialize the tally */
if (cf->count != 0) {
first_frame = frame_data_sequence_find(cf->provider.frames, 1);
st->start_time = nstime_to_sec(&first_frame->abs_ts);
st->stop_time = nstime_to_sec(&first_frame->abs_ts);
/* initialize the tally */
if (cf->count != 0) {
first_frame = frame_data_sequence_find(cf->provider.frames, 1);
st->start_time = nstime_to_sec(&first_frame->abs_ts);
st->stop_time = nstime_to_sec(&first_frame->abs_ts);
for (framenum = 1; framenum <= cf->count; framenum++) {
cur_frame = frame_data_sequence_find(cf->provider.frames, framenum);
tally_frame_data(cur_frame, st);
for (framenum = 1; framenum <= cf->count; framenum++) {
cur_frame = frame_data_sequence_find(cf->provider.frames, framenum);
tally_frame_data(cur_frame, st);
}
}
}
st->filename = cf->filename;
st->file_length = cf->f_datalen;
st->file_type = cf->cd_t;
st->compression_type = cf->compression_type;
st->is_tempfile = cf->is_tempfile;
st->file_encap_type = cf->lnk_t;
st->packet_encap_types = cf->linktypes;
st->snap = cf->snap;
st->elapsed_time = nstime_to_sec(&cf->elapsed_time);
st->packet_count = cf->count;
st->drops_known = cf->drops_known;
st->drops = cf->drops;
st->dfilter = cf->dfilter;
st->filename = cf->filename;
st->file_length = cf->f_datalen;
st->file_type = cf->cd_t;
st->compression_type = cf->compression_type;
st->is_tempfile = cf->is_tempfile;
st->file_encap_type = cf->lnk_t;
st->packet_encap_types = cf->linktypes;
st->snap = cf->snap;
st->elapsed_time = nstime_to_sec(&cf->elapsed_time);
st->packet_count = cf->count;
st->drops_known = cf->drops_known;
st->drops = cf->drops;
st->dfilter = cf->dfilter;
st->ifaces = g_array_new(FALSE, FALSE, sizeof(iface_summary_info));
idb_info = wtap_file_get_idb_info(cf->provider.wth);
for (i = 0; i < idb_info->interface_data->len; i++) {
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, i);
wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wtapng_if_descr);
if (wtap_block_get_if_filter_option_value(wtapng_if_descr, OPT_IDB_FILTER, &if_filter) == WTAP_OPTTYPE_SUCCESS) {
if (if_filter.type == if_filter_pcap) {
iface.cfilter = g_strdup(if_filter.data.filter_str);
} else {
/* Not a pcap filter string; punt for now */
iface.cfilter = NULL;
}
} else {
iface.cfilter = NULL;
}
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &if_string) == WTAP_OPTTYPE_SUCCESS) {
iface.name = g_strdup(if_string);
} else {
iface.name = NULL;
}
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &if_string) == WTAP_OPTTYPE_SUCCESS) {
iface.descr = g_strdup(if_string);
} else {
iface.descr = NULL;
}
iface.drops_known = FALSE;
iface.drops = 0;
iface.snap = wtapng_if_descr_mand->snap_len;
iface.encap_type = wtapng_if_descr_mand->wtap_encap;
iface.isb_comment = NULL;
if(wtapng_if_descr_mand->num_stat_entries == 1){
/* dumpcap only writes one ISB, only handle that for now */
if_stats = g_array_index(wtapng_if_descr_mand->interface_statistics, wtap_block_t, 0);
if (wtap_block_get_uint64_option_value(if_stats, OPT_ISB_IFDROP, &isb_ifdrop) == WTAP_OPTTYPE_SUCCESS) {
iface.drops_known = TRUE;
iface.drops = isb_ifdrop;
}
/* XXX: this doesn't get used, and might need to be g_strdup'ed when it does */
/* XXX - support multiple comments */
if (wtap_block_get_nth_string_option_value(if_stats, OPT_COMMENT, 0, &iface.isb_comment) != WTAP_OPTTYPE_SUCCESS) {
st->ifaces = g_array_new(FALSE, FALSE, sizeof(iface_summary_info));
idb_info = wtap_file_get_idb_info(cf->provider.wth);
for (i = 0; i < idb_info->interface_data->len; i++) {
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, i);
wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wtapng_if_descr);
if (wtap_block_get_if_filter_option_value(wtapng_if_descr, OPT_IDB_FILTER, &if_filter) == WTAP_OPTTYPE_SUCCESS) {
if (if_filter.type == if_filter_pcap) {
iface.cfilter = g_strdup(if_filter.data.filter_str);
} else {
/* Not a pcap filter string; punt for now */
iface.cfilter = NULL;
}
} else {
iface.cfilter = NULL;
}
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &if_string) == WTAP_OPTTYPE_SUCCESS) {
iface.name = g_strdup(if_string);
} else {
iface.name = NULL;
}
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &if_string) == WTAP_OPTTYPE_SUCCESS) {
iface.descr = g_strdup(if_string);
} else {
iface.descr = NULL;
}
iface.drops_known = FALSE;
iface.drops = 0;
iface.snap = wtapng_if_descr_mand->snap_len;
iface.encap_type = wtapng_if_descr_mand->wtap_encap;
iface.isb_comment = NULL;
}
if(wtapng_if_descr_mand->num_stat_entries == 1){
/* dumpcap only writes one ISB, only handle that for now */
if_stats = g_array_index(wtapng_if_descr_mand->interface_statistics, wtap_block_t, 0);
if (wtap_block_get_uint64_option_value(if_stats, OPT_ISB_IFDROP, &isb_ifdrop) == WTAP_OPTTYPE_SUCCESS) {
iface.drops_known = TRUE;
iface.drops = isb_ifdrop;
}
/* XXX: this doesn't get used, and might need to be g_strdup'ed when it does */
/* XXX - support multiple comments */
if (wtap_block_get_nth_string_option_value(if_stats, OPT_COMMENT, 0, &iface.isb_comment) != WTAP_OPTTYPE_SUCCESS) {
iface.isb_comment = NULL;
}
}
g_array_append_val(st->ifaces, iface);
}
g_array_append_val(st->ifaces, iface);
}
g_free(idb_info);
g_free(idb_info);
g_strlcpy(st->file_sha256, "<unknown>", HASH_STR_SIZE);
g_strlcpy(st->file_rmd160, "<unknown>", HASH_STR_SIZE);
g_strlcpy(st->file_sha1, "<unknown>", HASH_STR_SIZE);
g_strlcpy(st->file_sha256, "<unknown>", HASH_STR_SIZE);
g_strlcpy(st->file_rmd160, "<unknown>", HASH_STR_SIZE);
g_strlcpy(st->file_sha1, "<unknown>", HASH_STR_SIZE);
gcry_md_open(&hd, GCRY_MD_SHA256, 0);
if (hd) {
gcry_md_enable(hd, GCRY_MD_RMD160);
gcry_md_enable(hd, GCRY_MD_SHA1);
}
hash_buf = (char *)g_malloc(HASH_BUF_SIZE);
fh = ws_fopen(cf->filename, "rb");
if (fh && hash_buf && hd) {
while((hash_bytes = fread(hash_buf, 1, HASH_BUF_SIZE, fh)) > 0) {
gcry_md_write(hd, hash_buf, hash_bytes);
gcry_md_open(&hd, GCRY_MD_SHA256, 0);
if (hd) {
gcry_md_enable(hd, GCRY_MD_RMD160);
gcry_md_enable(hd, GCRY_MD_SHA1);
}
gcry_md_final(hd);
hash_to_str(gcry_md_read(hd, GCRY_MD_SHA256), HASH_SIZE_SHA256, st->file_sha256);
hash_to_str(gcry_md_read(hd, GCRY_MD_RMD160), HASH_SIZE_RMD160, st->file_rmd160);
hash_to_str(gcry_md_read(hd, GCRY_MD_SHA1), HASH_SIZE_SHA1, st->file_sha1);
}
if (fh) fclose(fh);
g_free(hash_buf);
gcry_md_close(hd);
hash_buf = (char *)g_malloc(HASH_BUF_SIZE);
fh = ws_fopen(cf->filename, "rb");
if (fh && hash_buf && hd) {
while((hash_bytes = fread(hash_buf, 1, HASH_BUF_SIZE, fh)) > 0) {
gcry_md_write(hd, hash_buf, hash_bytes);
}
gcry_md_final(hd);
hash_to_str(gcry_md_read(hd, GCRY_MD_SHA256), HASH_SIZE_SHA256, st->file_sha256);
hash_to_str(gcry_md_read(hd, GCRY_MD_RMD160), HASH_SIZE_RMD160, st->file_rmd160);
hash_to_str(gcry_md_read(hd, GCRY_MD_SHA1), HASH_SIZE_SHA1, st->file_sha1);
}
if (fh) fclose(fh);
g_free(hash_buf);
gcry_md_close(hd);
}
#ifdef HAVE_LIBPCAP
void
summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_tally *st)
{
iface_summary_info iface;
interface_t *device;
guint i;
iface_summary_info iface;
interface_t *device;
guint i;
if (st->ifaces->len == 0) {
/*
* XXX - do this only if we have a live capture.
*/
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
device = &g_array_index(capture_opts->all_ifaces, interface_t, i);
if (!device->selected) {
continue;
}
iface.cfilter = g_strdup(device->cfilter);
iface.name = g_strdup(device->name);
iface.descr = g_strdup(device->display_name);
iface.drops_known = cf->drops_known;
iface.drops = cf->drops;
iface.snap = device->snaplen;
iface.encap_type = wtap_pcap_encap_to_wtap_encap(device->active_dlt);
g_array_append_val(st->ifaces, iface);
if (st->ifaces->len == 0) {
/*
* XXX - do this only if we have a live capture.
*/
for (i = 0; i < capture_opts->all_ifaces->len; i++) {
device = &g_array_index(capture_opts->all_ifaces, interface_t, i);
if (!device->selected) {
continue;
}
iface.cfilter = g_strdup(device->cfilter);
iface.name = g_strdup(device->name);
iface.descr = g_strdup(device->display_name);
iface.drops_known = cf->drops_known;
iface.drops = cf->drops;
iface.snap = device->snaplen;
iface.encap_type = wtap_pcap_encap_to_wtap_encap(device->active_dlt);
g_array_append_val(st->ifaces, iface);
}
}
}
}
#endif
@ -273,11 +273,11 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -20,55 +20,55 @@ extern "C" {
#endif /* __cplusplus */
typedef struct iface_summary_info_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 */
int snap; /**< Maximum captured packet length; 0 if not known */
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 */
int snap; /**< Maximum captured packet length; 0 if not known */
int encap_type; /**< wiretap encapsulation type */
} iface_summary_info;
#define HASH_STR_SIZE (65) /* Max hash size * 2 + '\0' */
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; /**< path of capture file */
gint64 file_length; /**< file length in bytes */
gchar file_sha256[HASH_STR_SIZE]; /**< SHA256 hash of capture file */
gchar file_rmd160[HASH_STR_SIZE]; /**< RIPEMD160 hash of capture file */
gchar file_sha1[HASH_STR_SIZE]; /**< SHA1 hash of capture file */
int file_type; /**< wiretap file type */
wtap_compression_type compression_type; /**< compression type of file, or uncompressed */
int file_encap_type; /**< wiretap encapsulation type for file */
GArray *packet_encap_types; /**< wiretap encapsulation types for packets */
int snap; /**< Maximum captured packet length; 0 if not known */
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;
/* 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; /**< path of capture file */
gint64 file_length; /**< file length in bytes */
gchar file_sha256[HASH_STR_SIZE]; /**< SHA256 hash of capture file */
gchar file_rmd160[HASH_STR_SIZE]; /**< RIPEMD160 hash of capture file */
gchar file_sha1[HASH_STR_SIZE]; /**< SHA1 hash of capture file */
int file_type; /**< wiretap file type */
wtap_compression_type compression_type; /**< compression type of file, or uncompressed */
int file_encap_type; /**< wiretap encapsulation type for file */
GArray *packet_encap_types; /**< wiretap encapsulation types for packets */
int snap; /**< Maximum captured packet length; 0 if not known */
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;
/* capture related, use summary_fill_in_capture() to get values */
GArray *ifaces;
gboolean legacy;
} summary_tally;
extern void
@ -89,11 +89,11 @@ summary_fill_in_capture(capture_file *cf, capture_options *capture_opts, summary
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/