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