Wireshark  4.3.0
The Wireshark network protocol analyzer
filter_files.h
Go to the documentation of this file.
1 
12 #ifndef __FILTER_FILES_H__
13 #define __FILTER_FILES_H__
14 
15 #include <wireshark.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20 
21 /*
22  * Capture filter file name.
23  */
24 #define CFILTER_FILE_NAME "cfilters"
25 
26 /*
27  * Display filter file name.
28  */
29 #define DFILTER_FILE_NAME "dfilters"
30 
31 /*
32  * Display filter file name.
33  */
34 #define DMACROS_FILE_NAME "dmacros"
35 
36 /*
37  * Filter lists.
38  */
39 typedef enum {
40  CFILTER_LIST, /* capture filter list - saved */
41  DFILTER_LIST, /* display filter list - saved */
42  DMACROS_LIST, /* display filter macro list - saved */
43 } filter_list_type_t;
44 
45 /*
46  * Item in a list of filters.
47  */
48 typedef struct {
49  char *name; /* filter name */
50  char *strval; /* filter expression */
51 } filter_def;
52 
53 typedef struct {
54  filter_list_type_t type;
55  GList *list;
57 
58 /*
59  * Read in a list of filters.
60  *
61  * On error, report the error via the UI.
62  */
63 WS_DLL_PUBLIC
64 WS_RETNONNULL
65 filter_list_t *ws_filter_list_read(filter_list_type_t list_type);
66 
67 /*
68  * Add a new filter to the end of a list.
69  * Returns a pointer to the newly-added entry.
70  */
71 WS_DLL_PUBLIC
72 void ws_filter_list_add(filter_list_t *list, const char *name,
73  const char *expression);
74 
75 /*
76  * Find a filter in a list by name.
77  * Returns a pointer to the found entry.
78  */
79 WS_DLL_PUBLIC
80 GList *ws_filter_list_find(filter_list_t *list, const char *name);
81 
82 /*
83  * Remove a filter from a list.
84  */
85 WS_DLL_PUBLIC
86 bool ws_filter_list_remove(filter_list_t *list, const char *name);
87 
88 /*
89  * Write out a list of filters.
90  *
91  * On error, report the error via the UI.
92  */
93 WS_DLL_PUBLIC
94 void ws_filter_list_write(filter_list_t *list);
95 
96 /*
97  * Free all filter lists
98  */
99 WS_DLL_PUBLIC
100 void ws_filter_list_free(filter_list_t *list);
101 
102 #ifdef __cplusplus
103 }
104 #endif /* __cplusplus */
105 
106 #endif /* __FILTER_FILES_H__ */
Definition: filter_files.h:48
Definition: filter_files.h:53