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,
68 EXTCAP_PARAM_VALIDATION,
75 #define ENUM_KEY(s) GUINT_TO_POINTER((guint)s)
77 /* Values for a given sentence; values are all stored as a call
78 * and a value string, or a valid range, so we only need to store
79 * those and repeat them */
80 typedef struct _extcap_value {
90 /* Complex-ish struct for storing complex values */
91 typedef struct _extcap_complex {
92 extcap_arg_type complex_type;
96 /* An argument sentence and accompanying options */
97 typedef struct _extcap_arg {
105 gchar * fileextension;
108 gboolean is_required;
113 extcap_arg_type arg_type;
115 extcap_complex *range_start;
116 extcap_complex *range_end;
117 extcap_complex *default_complex;
119 gchar ** pref_valptr; /**< A copy of the pointer containing the current preference value. */
125 typedef struct _extcap_interface {
132 extcap_sentence_type if_type;
135 typedef struct _extcap_dlt {
141 typedef struct _extcap_token_sentence {
144 GHashTable *param_list;
145 } extcap_token_sentence;
151 /* Parse a string into a complex type */
152 extcap_complex *extcap_parse_complex(extcap_arg_type complex_type,
156 void extcap_free_complex(extcap_complex *comp);
158 /* Print a complex value out for debug */
159 void extcap_printf_complex(extcap_complex *comp);
162 * Return a string representation of a complex type
163 * Caller is responsible for calling g_free on the returned string
165 gchar *extcap_get_complex_as_string(extcap_complex *comp);
167 gint extcap_complex_get_int(extcap_complex *comp);
168 guint extcap_complex_get_uint(extcap_complex *comp);
169 gint64 extcap_complex_get_long(extcap_complex *comp);
170 gdouble extcap_complex_get_double(extcap_complex *comp);
171 gboolean extcap_complex_get_bool(extcap_complex *comp);
172 gchar *extcap_complex_get_string(extcap_complex *comp);
174 /* compares the default value of an element with a given parameter */
175 gboolean extcap_compare_is_default(extcap_arg *element, extcap_complex *test);
178 /* Free a single argument */
179 void extcap_free_arg(extcap_arg *a);
181 /* Free an entire arg list */
182 void extcap_free_arg_list(GList *a);
185 /** Parser for extcap data */
187 /* Parse all sentences for args and values */
188 GList * extcap_parse_args(gchar *output);
190 /* Parse all sentences for interfaces */
191 GList * extcap_parse_interfaces(gchar *output, GList **control_items);
193 /* Parse all sentences for DLTs */
194 GList * extcap_parse_dlts(gchar *output);
203 * Editor modelines - http://www.wireshark.org/tools/modelines.html
208 * indent-tabs-mode: nil
211 * vi: set shiftwidth=4 tabstop=8 expandtab:
212 * :indentSize=4:tabSize=8:noTabs=true: