| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
/builds/wireshark/wireshark/extcap_parser.h
Go to the documentation of this file.
1
10#ifndef __EXTCAP_PARSER_H__
11#define __EXTCAP_PARSER_H__
12
13#include <stdio.h>
14#include <glib.h>
15#include <string.h>
16
17#include "ui/iface_toolbar.h"
18
19 typedef enum {
20 EXTCAP_SENTENCE_UNKNOWN,
21 EXTCAP_SENTENCE_ARG,
22 EXTCAP_SENTENCE_VALUE,
23 EXTCAP_SENTENCE_EXTCAP,
24 EXTCAP_SENTENCE_INTERFACE,
25 EXTCAP_SENTENCE_DLT,
26 EXTCAP_SENTENCE_CONTROL
27} extcap_sentence_type;
28
29 typedef enum {
30 /* Simple types */
31 EXTCAP_ARG_UNKNOWN,
32 EXTCAP_ARG_INTEGER,
33 EXTCAP_ARG_UNSIGNED,
34 EXTCAP_ARG_LONG,
35 EXTCAP_ARG_DOUBLE,
36 EXTCAP_ARG_BOOLEAN,
37 EXTCAP_ARG_BOOLFLAG,
38 EXTCAP_ARG_STRING,
39 EXTCAP_ARG_PASSWORD,
40 /* Complex GUI types which are populated with value sentences */
41 EXTCAP_ARG_SELECTOR,
42 EXTCAP_ARG_EDIT_SELECTOR,
43 EXTCAP_ARG_RADIO,
44 EXTCAP_ARG_MULTICHECK,
45 EXTCAP_ARG_TABLE,
46 EXTCAP_ARG_FILESELECT,
47 EXTCAP_ARG_TIMESTAMP
48} extcap_arg_type;
49
50 typedef enum {
51 /* value types */
52 EXTCAP_PARAM_UNKNOWN,
53 EXTCAP_PARAM_ARGNUM,
54 EXTCAP_PARAM_CALL,
55 EXTCAP_PARAM_DISPLAY,
56 EXTCAP_PARAM_TYPE,
57 EXTCAP_PARAM_ARG,
58 EXTCAP_PARAM_DEFAULT,
59 EXTCAP_PARAM_VALUE,
60 EXTCAP_PARAM_RANGE,
61 EXTCAP_PARAM_TOOLTIP,
62 EXTCAP_PARAM_PLACEHOLDER,
63 EXTCAP_PARAM_NAME,
64 EXTCAP_PARAM_ENABLED,
65 EXTCAP_PARAM_FILE_MUSTEXIST,
66 EXTCAP_PARAM_FILE_EXTENSION,
67 EXTCAP_PARAM_GROUP,
68 EXTCAP_PARAM_PARENT,
69 EXTCAP_PARAM_REQUIRED,
70 EXTCAP_PARAM_RELOAD,
71 EXTCAP_PARAM_CONFIGURABLE,
72 EXTCAP_PARAM_PREFIX,
73 EXTCAP_PARAM_SAVE,
74 EXTCAP_PARAM_VALIDATION,
75 EXTCAP_PARAM_VERSION,
76 EXTCAP_PARAM_HELP,
77 EXTCAP_PARAM_CONTROL,
78 EXTCAP_PARAM_ROLE
79} extcap_param_type;
80
81#define ENUM_KEY(s) GUINT_TO_POINTER((unsigned)s)
82
83/* Values for a given sentence; values are all stored as a call
84 * and a value string, or a valid range, so we only need to store
85 * those and repeat them */
86 typedef struct _extcap_value {
87 int arg_num;
88
89 char *call;
90 char *display;
91 bool enabled;
92 bool is_default;
93 char *parent;
94} extcap_value;
95
96/* Complex-ish struct for storing complex values */
97 typedef struct _extcap_complex {
98 extcap_arg_type complex_type;
99 char * _val;
100} extcap_complex;
101
102/* required=sufficient has a special meaning */
103#define EXTCAP_PARAM_REQUIRED_SUFFICIENT "sufficient"
104
105/* An argument sentence and accompanying options */
106 typedef struct _extcap_arg {
107 int arg_num;
108
109 char *call;
110 char *display;
111 char *tooltip;
112 char *placeholder;
113
114 char * fileextension;
115 bool fileexists;
116
117 bool is_required;
118 bool is_sufficient;
119 bool save;
120
121 bool reload;
122
123 bool configurable;
124 char * prefix;
125
126 char * regexp;
127
128 char * group;
129
130 extcap_arg_type arg_type;
131
132 extcap_complex *range_start;
133 extcap_complex *range_end;
134 extcap_complex *default_complex;
135
136 char ** pref_valptr;
137 char * device_name;
138
139 GList * values;
140} extcap_arg;
141
142 typedef struct _extcap_interface {
143 char * call;
144 char * display;
145 char * version;
146 char * help;
147 char * extcap_path;
148
149 extcap_sentence_type if_type;
150} extcap_interface;
151
152 typedef struct _extcap_dlt {
153 int number;
154 char *name;
155 char *display;
156} extcap_dlt;
157
158 typedef struct _extcap_token_sentence {
159 char *sentence;
160
161 GHashTable *param_list;
162} extcap_token_sentence;
163
164#ifdef __cplusplus
165 extern "C" {
166#endif
167
168/* Parse a string into a complex type */
169 extcap_complex *extcap_parse_complex(extcap_arg_type complex_type,
170 const char *data);
171
172/* Free a complex */
173 void extcap_free_complex(extcap_complex *comp);
174
175/* Print a complex value out for debug */
176 void extcap_printf_complex(extcap_complex *comp);
177
178/*
179 * Return a string representation of a complex type
180 * Caller is responsible for calling g_free on the returned string
181 */
182 char *extcap_get_complex_as_string(extcap_complex *comp);
183
184 int extcap_complex_get_int(extcap_complex *comp);
185 unsigned extcap_complex_get_uint(extcap_complex *comp);
186int64_t extcap_complex_get_long(extcap_complex *comp);
187 double extcap_complex_get_double(extcap_complex *comp);
188 bool extcap_complex_get_bool(extcap_complex *comp);
189 char *extcap_complex_get_string(extcap_complex *comp);
190
191/* compares the default value of an element with a given parameter */
192 bool extcap_compare_is_default(extcap_arg *element, extcap_complex *test);
193
194
195/* Free a single argument */
196 void extcap_free_arg(extcap_arg *a);
197
198/* Free entire toolbar control structure */
199 void extcap_free_toolbar_control(iface_toolbar_control *control);
200
201/* Free an entire arg list */
202 void extcap_free_arg_list(GList *a);
203
204
207/* Parse all sentences for args and values */
208GList * extcap_parse_args(char *output);
209
210/* Parse all sentences for values */
211GList * extcap_parse_values(char *output);
212
213/* Parse all sentences for interfaces */
214GList * extcap_parse_interfaces(char *output, GList **control_items);
215
216/* Parse all sentences for DLTs */
217GList * extcap_parse_dlts(char *output);
218
219#ifdef __cplusplus
220}
221#endif
222
223#endif
224
225/*
226 * Editor modelines - https://www.wireshark.org/tools/modelines.html
227 *
228 * Local variables:
229 * c-basic-offset: 4
230 * tab-width: 8
231 * indent-tabs-mode: nil
232 * End:
233 *
234 * vi: set shiftwidth=4 tabstop=8 expandtab:
235 * :indentSize=4:tabSize=8:noTabs=true:
236 */
extcap_parse_args
GList * extcap_parse_args(char *output)
Definition extcap_parser.c:638
iface_toolbar.h
_extcap_arg
Definition extcap_parser.h:106
_extcap_arg::pref_valptr
char ** pref_valptr
Definition extcap_parser.h:136
_extcap_complex
Definition extcap_parser.h:97
_extcap_dlt
Definition extcap_parser.h:152
_extcap_interface
Definition extcap_parser.h:142
_extcap_token_sentence
Definition extcap_parser.h:158
_extcap_value
Definition extcap_parser.h:86
_iface_toolbar_control
Definition iface_toolbar.h:44