3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef __EXTCAP_PARSER_H__
11 #define __EXTCAP_PARSER_H__
20 EXTCAP_SENTENCE_UNKNOWN,
22 EXTCAP_SENTENCE_VALUE,
23 EXTCAP_SENTENCE_EXTCAP,
24 EXTCAP_SENTENCE_INTERFACE,
26 EXTCAP_SENTENCE_CONTROL
27 } extcap_sentence_type;
40 /* Complex GUI types which are populated with value sentences */
43 EXTCAP_ARG_MULTICHECK,
44 EXTCAP_ARG_FILESELECT,
60 EXTCAP_PARAM_PLACEHOLDER,
63 EXTCAP_PARAM_FILE_MUSTEXIST,
64 EXTCAP_PARAM_FILE_EXTENSION,
66 EXTCAP_PARAM_REQUIRED,
69 EXTCAP_PARAM_VALIDATION,
76 #define ENUM_KEY(s) GUINT_TO_POINTER((guint)s)
78 /* Values for a given sentence; values are all stored as a call
79 * and a value string, or a valid range, so we only need to store
80 * those and repeat them */
81 typedef struct _extcap_value {
91 /* Complex-ish struct for storing complex values */
92 typedef struct _extcap_complex {
93 extcap_arg_type complex_type;
97 /* An argument sentence and accompanying options */
98 typedef struct _extcap_arg {
106 gchar * fileextension;
109 gboolean is_required;
116 extcap_arg_type arg_type;
118 extcap_complex *range_start;
119 extcap_complex *range_end;
120 extcap_complex *default_complex;
122 gchar ** pref_valptr; /**< A copy of the pointer containing the current preference value. */
128 typedef struct _extcap_interface {
135 extcap_sentence_type if_type;
138 typedef struct _extcap_dlt {
144 typedef struct _extcap_token_sentence {
147 GHashTable *param_list;
148 } extcap_token_sentence;
154 /* Parse a string into a complex type */
155 extcap_complex *extcap_parse_complex(extcap_arg_type complex_type,
159 void extcap_free_complex(extcap_complex *comp);
161 /* Print a complex value out for debug */
162 void extcap_printf_complex(extcap_complex *comp);
165 * Return a string representation of a complex type
166 * Caller is responsible for calling g_free on the returned string
168 gchar *extcap_get_complex_as_string(extcap_complex *comp);
170 gint extcap_complex_get_int(extcap_complex *comp);
171 guint extcap_complex_get_uint(extcap_complex *comp);
172 gint64 extcap_complex_get_long(extcap_complex *comp);
173 gdouble extcap_complex_get_double(extcap_complex *comp);
174 gboolean extcap_complex_get_bool(extcap_complex *comp);
175 gchar *extcap_complex_get_string(extcap_complex *comp);
177 /* compares the default value of an element with a given parameter */
178 gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test);
181 /* Free a single argument */
182 void extcap_free_arg(extcap_arg *a);
184 /* Free an entire arg list */
185 void extcap_free_arg_list(GList *a);
188 /** Parser for extcap data */
190 /* Parse all sentences for args and values */
191 GList * extcap_parse_args(gchar *output);
193 /* Parse all sentences for values */
194 GList * extcap_parse_values(gchar *output);
196 /* Parse all sentences for interfaces */
197 GList * extcap_parse_interfaces(gchar *output, GList **control_items);
199 /* Parse all sentences for DLTs */
200 GList * extcap_parse_dlts(gchar *output);
209 * Editor modelines - http://www.wireshark.org/tools/modelines.html
214 * indent-tabs-mode: nil
217 * vi: set shiftwidth=4 tabstop=8 expandtab:
218 * :indentSize=4:tabSize=8:noTabs=true: