Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
dissect_opts.h
Go to the documentation of this file.
1 /* dissect_opts.h
2  * Dissection options (parameters that affect dissection)
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 
18 #ifndef __DISSECT_OPTS_H__
19 #define __DISSECT_OPTS_H__
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 /*
26  * Long options.
27  * We do not currently have long options corresponding to all short
28  * options; we should probably pick appropriate option names for them.
29  *
30  * For long options with no corresponding short options, we define values
31  * outside the range of ASCII graphic characters, make that the last
32  * component of the entry for the long option, and have a case for that
33  * option in the switch statement.
34  *
35  * We also pick values >= 4096, so as not to collide with capture options,
36  * and <= 65535, so as to leave values > 65535 for options specific to a
37  * program.
38  */
39 
40 /*
41  * Non-capture long-only options should start here, to avoid collision
42  * with capture options.
43  */
44 #define LONGOPT_DISABLE_PROTOCOL 4096
45 #define LONGOPT_ENABLE_HEURISTIC 4097
46 #define LONGOPT_DISABLE_HEURISTIC 4098
47 #define LONGOPT_ENABLE_PROTOCOL 4099
48 
49 /*
50  * Options for dissecting common to all dissecting programs.
51  */
52 #define LONGOPT_DISSECT_COMMON \
53  {"disable-protocol", required_argument, NULL, LONGOPT_DISABLE_PROTOCOL }, \
54  {"enable-heuristic", required_argument, NULL, LONGOPT_ENABLE_HEURISTIC }, \
55  {"disable-heuristic", required_argument, NULL, LONGOPT_DISABLE_HEURISTIC }, \
56  {"enable-protocol", required_argument, NULL, LONGOPT_ENABLE_PROTOCOL }, \
57 
58 #define OPTSTRING_DISSECT_COMMON \
59  "d:K:nN:t:u:"
60 
62 typedef struct dissect_options_tag {
63  ts_type time_format;
64  GSList *enable_protocol_slist; //enable protocols that are disabled by default
65  GSList *disable_protocol_slist;
66  GSList *enable_heur_slist;
67  GSList *disable_heur_slist;
69 
70 extern dissect_options global_dissect_options;
71 
72 /* initialize the dissect_options with some reasonable values */
73 extern void
74 dissect_opts_init(void);
75 
76 /*
77  * Handle a command line option.
78  * Returns TRUE if the option is valid, FALSE if not; an error message
79  * is reported with cmdarg_err() if it's not valid.
80  */
81 extern gboolean
82 dissect_opts_handle_opt(int opt, char *optarg_str_p);
83 
84 /*
85  * Set up disabled protocols and enabled/disabled heuristic protocols
86  * as per specified command-line options.
87  *
88  * Returns TRUE if all specified heuristic protocols exist, FALSE
89  * otherwise.
90  */
91 extern gboolean
92 setup_enabled_and_disabled_protocols(void);
93 
94 #ifdef __cplusplus
95 }
96 #endif /* __cplusplus */
97 
98 #endif /* dissect_opts.h */
99 
100 /*
101  * Editor modelines - http://www.wireshark.org/tools/modelines.html
102  *
103  * Local variables:
104  * c-basic-offset: 4
105  * tab-width: 8
106  * indent-tabs-mode: nil
107  * End:
108  *
109  * vi: set shiftwidth=4 tabstop=8 expandtab:
110  * :indentSize=4:tabSize=8:noTabs=true:
111  */
struct dissect_options_tag dissect_options
Definition: dissect_opts.h:62