2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
|
|
|
*
|
2001-01-28 04:43:26 +00:00
|
|
|
* Declarations of routines for reading and writing the filters file.
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
2008-01-08 22:54:51 +00:00
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-01-28 04:43:26 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2001-01-28 04:43:26 +00:00
|
|
|
|
2023-02-06 23:08:14 +00:00
|
|
|
#ifndef __FILTER_FILES_H__
|
|
|
|
#define __FILTER_FILES_H__
|
|
|
|
|
|
|
|
#include <wireshark.h>
|
2011-12-29 00:08:47 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2018-10-09 09:46:00 +00:00
|
|
|
/*
|
|
|
|
* Old filter file name.
|
|
|
|
*/
|
|
|
|
#define FILTER_FILE_NAME "filters"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Capture filter file name.
|
|
|
|
*/
|
|
|
|
#define CFILTER_FILE_NAME "cfilters"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Display filter file name.
|
|
|
|
*/
|
|
|
|
#define DFILTER_FILE_NAME "dfilters"
|
|
|
|
|
2001-01-28 04:43:26 +00:00
|
|
|
/*
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
* Filter lists.
|
2001-01-28 04:43:26 +00:00
|
|
|
*/
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
typedef enum {
|
2021-03-01 22:29:52 +00:00
|
|
|
CFILTER_LIST, /* capture filter list - saved */
|
|
|
|
DFILTER_LIST /* display filter list - saved */
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
} filter_list_type_t;
|
2001-01-28 04:43:26 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Item in a list of filters.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2021-03-01 22:29:52 +00:00
|
|
|
char *name; /* filter name */
|
|
|
|
char *strval; /* filter expression */
|
2001-01-28 04:43:26 +00:00
|
|
|
} filter_def;
|
|
|
|
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
/*
|
|
|
|
* Read in a list of filters.
|
|
|
|
*
|
2017-04-09 09:01:05 +00:00
|
|
|
* On error, report the error via the UI.
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
*/
|
2023-02-06 23:08:14 +00:00
|
|
|
WS_DLL_PUBLIC
|
2017-04-09 09:01:05 +00:00
|
|
|
void read_filter_list(filter_list_type_t list_type);
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a pointer to the first entry in a filter list.
|
|
|
|
*/
|
2023-02-06 23:08:14 +00:00
|
|
|
WS_DLL_PUBLIC
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
GList *get_filter_list_first(filter_list_type_t list);
|
2001-01-28 04:43:26 +00:00
|
|
|
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
/*
|
|
|
|
* Add a new filter to the end of a list.
|
|
|
|
* Returns a pointer to the newly-added entry.
|
|
|
|
*/
|
2023-02-06 23:08:14 +00:00
|
|
|
WS_DLL_PUBLIC
|
2003-12-04 00:45:39 +00:00
|
|
|
GList *add_to_filter_list(filter_list_type_t list, const char *name,
|
2014-10-12 18:56:12 +00:00
|
|
|
const char *expression);
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove a filter from a list.
|
|
|
|
*/
|
2023-02-06 23:08:14 +00:00
|
|
|
WS_DLL_PUBLIC
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
void remove_from_filter_list(filter_list_type_t list, GList *fl_entry);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write out a list of filters.
|
|
|
|
*
|
2017-04-09 09:01:05 +00:00
|
|
|
* On error, report the error via the UI.
|
Have separate capture and display filter lists; some filter dialog boxes
use the capture filter lists, and others use the display filter list, as
appropriate.
Have separate menu items for editing the capture and display filter
lists.
Have separate "~/.ethereal/cfilters" and "~/.ethereal/dfilters" files
for the two lists; if either of those files isn't found, we try
"~/.ethereal/filters", which means that you will start out with two
identical lists holding all your filters - if certain filters belong
only in one list, you'll have to delete them by hand from the other
list.
Do I/O error checking when reading and writing filter lists; when
writing a filter list, write it to a new file, and then rename the new
file on top of the old file, so that you don't lose your old filter list
if, for example, you run out of disk space or disk quota.
svn path=/trunk/; revision=2948
2001-01-28 09:13:10 +00:00
|
|
|
*/
|
2023-02-06 23:08:14 +00:00
|
|
|
WS_DLL_PUBLIC
|
2017-04-09 09:01:05 +00:00
|
|
|
void save_filter_list(filter_list_type_t list_type);
|
2006-10-01 17:59:30 +00:00
|
|
|
|
2017-02-03 22:15:56 +00:00
|
|
|
/*
|
|
|
|
* Free all filter lists
|
|
|
|
*/
|
2023-02-06 23:08:14 +00:00
|
|
|
WS_DLL_PUBLIC
|
2017-02-03 22:15:56 +00:00
|
|
|
void free_filter_lists(void);
|
|
|
|
|
2011-12-29 00:08:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2023-02-06 23:08:14 +00:00
|
|
|
#endif /* __FILTER_FILES_H__ */
|