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,
67 EXTCAP_PARAM_REQUIRED,
70 EXTCAP_PARAM_VALIDATION,
77 #define ENUM_KEY(s) GUINT_TO_POINTER((guint)s)
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 {
92 /* Complex-ish struct for storing complex values */
93 typedef struct _extcap_complex {
94 extcap_arg_type complex_type;
98 /* An argument sentence and accompanying options */
99 typedef struct _extcap_arg {
107 gchar * fileextension;
110 gboolean is_required;
119 extcap_arg_type arg_type;
121 extcap_complex *range_start;
122 extcap_complex *range_end;
123 extcap_complex *default_complex;
125 gchar ** pref_valptr; /**< A copy of the pointer containing the current preference value. */
131 typedef struct _extcap_interface {
138 extcap_sentence_type if_type;
141 typedef struct _extcap_dlt {
147 typedef struct _extcap_token_sentence {
150 GHashTable *param_list;
151 } extcap_token_sentence;
157 /* Parse a string into a complex type */
158 extcap_complex *extcap_parse_complex(extcap_arg_type complex_type,
162 void extcap_free_complex(extcap_complex *comp);
164 /* Print a complex value out for debug */
165 void extcap_printf_complex(extcap_complex *comp);
168 * Return a string representation of a complex type
169 * Caller is responsible for calling g_free on the returned string
171 gchar *extcap_get_complex_as_string(extcap_complex *comp);
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);
180 /* compares the default value of an element with a given parameter */
181 gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test);
184 /* Free a single argument */
185 void extcap_free_arg(extcap_arg *a);
187 /* Free an entire arg list */
188 void extcap_free_arg_list(GList *a);
191 /** Parser for extcap data */
193 /* Parse all sentences for args and values */
194 GList * extcap_parse_args(gchar *output);
196 /* Parse all sentences for values */
197 GList * extcap_parse_values(gchar *output);
199 /* Parse all sentences for interfaces */
200 GList * extcap_parse_interfaces(gchar *output, GList **control_items);
202 /* Parse all sentences for DLTs */
203 GList * extcap_parse_dlts(gchar *output);
212 * Editor modelines - http://www.wireshark.org/tools/modelines.html
217 * indent-tabs-mode: nil
220 * vi: set shiftwidth=4 tabstop=8 expandtab:
221 * :indentSize=4:tabSize=8:noTabs=true: