Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

/home/wireshark/builders/wireshark-master/ubuntu-16.04-x64/build/extcap_parser.h
1 /* extcap_parser.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
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 <config.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_RADIO,
43 EXTCAP_ARG_MULTICHECK,
44 EXTCAP_ARG_FILESELECT,
45 EXTCAP_ARG_TIMESTAMP
46 } extcap_arg_type;
47
48 typedef enum {
49 /* value types */
50 EXTCAP_PARAM_UNKNOWN,
51 EXTCAP_PARAM_ARGNUM,
52 EXTCAP_PARAM_CALL,
53 EXTCAP_PARAM_DISPLAY,
54 EXTCAP_PARAM_TYPE,
55 EXTCAP_PARAM_ARG,
56 EXTCAP_PARAM_DEFAULT,
57 EXTCAP_PARAM_VALUE,
58 EXTCAP_PARAM_RANGE,
59 EXTCAP_PARAM_TOOLTIP,
60 EXTCAP_PARAM_PLACEHOLDER,
61 EXTCAP_PARAM_NAME,
62 EXTCAP_PARAM_ENABLED,
63 EXTCAP_PARAM_FILE_MUSTEXIST,
64 EXTCAP_PARAM_FILE_EXTENSION,
65 EXTCAP_PARAM_GROUP,
66 EXTCAP_PARAM_PARENT,
67 EXTCAP_PARAM_REQUIRED,
68 EXTCAP_PARAM_RELOAD,
69 EXTCAP_PARAM_SAVE,
70 EXTCAP_PARAM_VALIDATION,
71 EXTCAP_PARAM_VERSION,
72 EXTCAP_PARAM_HELP,
73 EXTCAP_PARAM_CONTROL,
74 EXTCAP_PARAM_ROLE
75 } extcap_param_type;
76
77 #define ENUM_KEY(s) GUINT_TO_POINTER((guint)s)
78
79 /* Values for a given sentence; values are all stored as a call
80 * and a value string, or a valid range, so we only need to store
81 * those and repeat them */
82 typedef struct _extcap_value {
83 int arg_num;
84
85 gchar *call;
86 gchar *display;
87 gboolean enabled;
88 gboolean is_default;
89 gchar *parent;
90 } extcap_value;
91
92 /* Complex-ish struct for storing complex values */
93 typedef struct _extcap_complex {
94 extcap_arg_type complex_type;
95 gchar * _val;
96 } extcap_complex;
97
98 /* An argument sentence and accompanying options */
99 typedef struct _extcap_arg {
100 int arg_num;
101
102 gchar *call;
103 gchar *display;
104 gchar *tooltip;
105 gchar *placeholder;
106
107 gchar * fileextension;
108 gboolean fileexists;
109
110 gboolean is_required;
111 gboolean save;
112
113 gboolean reload;
114
115 gchar * regexp;
116
117 gchar * group;
118
119 extcap_arg_type arg_type;
120
121 extcap_complex *range_start;
122 extcap_complex *range_end;
123 extcap_complex *default_complex;
124
125 gchar ** pref_valptr;
126 gchar * device_name;
127
128 GList * values;
129 } extcap_arg;
130
131 typedef struct _extcap_interface {
132 gchar * call;
133 gchar * display;
134 gchar * version;
135 gchar * help;
136 gchar * extcap_path;
137
138 extcap_sentence_type if_type;
139 } extcap_interface;
140
141 typedef struct _extcap_dlt {
142 gint number;
143 gchar *name;
144 gchar *display;
145 } extcap_dlt;
146
147 typedef struct _extcap_token_sentence {
148 gchar *sentence;
149
150 GHashTable *param_list;
151 } extcap_token_sentence;
152
153 #ifdef __cplusplus
154 extern "C" {
155 #endif
156
157 /* Parse a string into a complex type */
158 extcap_complex *extcap_parse_complex(extcap_arg_type complex_type,
159 const gchar *data);
160
161 /* Free a complex */
162 void extcap_free_complex(extcap_complex *comp);
163
164 /* Print a complex value out for debug */
165 void extcap_printf_complex(extcap_complex *comp);
166
167 /*
168 * Return a string representation of a complex type
169 * Caller is responsible for calling g_free on the returned string
170 */
171 gchar *extcap_get_complex_as_string(extcap_complex *comp);
172
173 gint extcap_complex_get_int(extcap_complex *comp);
174 guint extcap_complex_get_uint(extcap_complex *comp);
175 gint64 extcap_complex_get_long(extcap_complex *comp);
176 gdouble extcap_complex_get_double(extcap_complex *comp);
177 gboolean extcap_complex_get_bool(extcap_complex *comp);
178 gchar *extcap_complex_get_string(extcap_complex *comp);
179
180 /* compares the default value of an element with a given parameter */
181 gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test);
182
183
184 /* Free a single argument */
185 void extcap_free_arg(extcap_arg *a);
186
187 /* Free an entire arg list */
188 void extcap_free_arg_list(GList *a);
189
190
193 /* Parse all sentences for args and values */
194 GList * extcap_parse_args(gchar *output);
195
196 /* Parse all sentences for values */
197 GList * extcap_parse_values(gchar *output);
198
199 /* Parse all sentences for interfaces */
200 GList * extcap_parse_interfaces(gchar *output, GList **control_items);
201
202 /* Parse all sentences for DLTs */
203 GList * extcap_parse_dlts(gchar *output);
204
205 #ifdef __cplusplus
206 }
207 #endif
208
209 #endif
210
211 /*
212 * Editor modelines - http://www.wireshark.org/tools/modelines.html
213 *
214 * Local variables:
215 * c-basic-offset: 4
216 * tab-width: 8
217 * indent-tabs-mode: nil
218 * End:
219 *
220 * vi: set shiftwidth=4 tabstop=8 expandtab:
221 * :indentSize=4:tabSize=8:noTabs=true:
222 */
_extcap_dlt
Definition: extcap_parser.h:141
_extcap_value
Definition: extcap_parser.h:82
_extcap_arg::pref_valptr
gchar ** pref_valptr
Definition: extcap_parser.h:125
_extcap_token_sentence
Definition: extcap_parser.h:147
_extcap_arg
Definition: extcap_parser.h:99
_extcap_interface
Definition: extcap_parser.h:131
_extcap_complex
Definition: extcap_parser.h:93