aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture_opts.h14
-rw-r--r--editcap.c12
-rw-r--r--tshark.c11
-rw-r--r--ui/cli/tap-exportobject.h2
-rw-r--r--ui/clopts_common.h16
-rw-r--r--ui/commandline.c11
-rw-r--r--ui/dissect_opts.h21
7 files changed, 35 insertions, 52 deletions
diff --git a/capture_opts.h b/capture_opts.h
index 7ad9df6ea8..ccbab03ed3 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -35,14 +35,6 @@ extern "C" {
* We do not currently have long options corresponding to all short
* options; we should probably pick appropriate option names for them.
*
- * For long options with no corresponding short options, we define values
- * outside the range of ASCII graphic characters, make that the last
- * component of the entry for the long option, and have a case for that
- * option in the switch statement.
- *
- * We also pick values < 4096, so as to leave values >= 4096 for
- * other long options.
- *
* NOTE:
* for tshark, we're using a leading - in the optstring to prevent getopt()
* from permuting the argv[] entries, in this case, unknown argv[] entries
@@ -50,9 +42,9 @@ extern "C" {
* In short: we must not use 1 here, which is another reason to use
* values outside the range of ASCII graphic characters.
*/
-#define LONGOPT_NUM_CAP_COMMENT 128
-#define LONGOPT_LIST_TSTAMP_TYPES 129
-#define LONGOPT_SET_TSTAMP_TYPE 130
+#define LONGOPT_NUM_CAP_COMMENT LONGOPT_BASE_CAPTURE+1
+#define LONGOPT_LIST_TSTAMP_TYPES LONGOPT_BASE_CAPTURE+2
+#define LONGOPT_SET_TSTAMP_TYPE LONGOPT_BASE_CAPTURE+3
/*
* Options for capturing common to all capturing programs.
diff --git a/editcap.c b/editcap.c
index 40c36df566..2f6e6f7566 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1017,11 +1017,13 @@ main(int argc, char *argv[])
int i, j, read_err, write_err;
gchar *read_err_info, *write_err_info;
int opt;
-#define LONGOPT_NO_VLAN 0x8100
-#define LONGOPT_SKIP_RADIOTAP_HEADER 0x8101
-#define LONGOPT_SEED 0x8102
-#define LONGOPT_INJECT_SECRETS 0x8103
-#define LONGOPT_DISCARD_ALL_SECRETS 0x8104
+
+#define LONGOPT_NO_VLAN LONGOPT_BASE_APPLICATION+1
+#define LONGOPT_SKIP_RADIOTAP_HEADER LONGOPT_BASE_APPLICATION+2
+#define LONGOPT_SEED LONGOPT_BASE_APPLICATION+3
+#define LONGOPT_INJECT_SECRETS LONGOPT_BASE_APPLICATION+4
+#define LONGOPT_DISCARD_ALL_SECRETS LONGOPT_BASE_APPLICATION+5
+
static const struct option long_options[] = {
{"novlan", no_argument, NULL, LONGOPT_NO_VLAN},
{"skip-radiotap-header", no_argument, NULL, LONGOPT_SKIP_RADIOTAP_HEADER},
diff --git a/tshark.c b/tshark.c
index bcd180e2e8..7473d3b5a6 100644
--- a/tshark.c
+++ b/tshark.c
@@ -137,13 +137,10 @@
#define INVALID_CAPTURE 2
#define INIT_FAILED 2
-/*
- * values 128..65535 are capture+dissect options, 65536 is used by
- * ui/commandline.c, so start tshark-specific options 1000 after this
- */
-#define LONGOPT_COLOR (65536+1000)
-#define LONGOPT_NO_DUPLICATE_KEYS (65536+1001)
-#define LONGOPT_ELASTIC_MAPPING_FILTER (65536+1002)
+#define LONGOPT_EXPORT_OBJECTS LONGOPT_BASE_APPLICATION+1
+#define LONGOPT_COLOR LONGOPT_BASE_APPLICATION+2
+#define LONGOPT_NO_DUPLICATE_KEYS LONGOPT_BASE_APPLICATION+3
+#define LONGOPT_ELASTIC_MAPPING_FILTER LONGOPT_BASE_APPLICATION+4
#if 0
#define tshark_debug(...) g_warning(__VA_ARGS__)
diff --git a/ui/cli/tap-exportobject.h b/ui/cli/tap-exportobject.h
index 83b117db54..180eca9f84 100644
--- a/ui/cli/tap-exportobject.h
+++ b/ui/cli/tap-exportobject.h
@@ -14,8 +14,6 @@
extern "C" {
#endif /* __cplusplus */
-#define LONGOPT_EXPORT_OBJECTS 5001
-
void eo_list_object_types(void);
/* will be called by main each time a --export-objects option is found */
diff --git a/ui/clopts_common.h b/ui/clopts_common.h
index 6b8a6504a2..cd9ff161d6 100644
--- a/ui/clopts_common.h
+++ b/ui/clopts_common.h
@@ -15,6 +15,22 @@
extern "C" {
#endif /* __cplusplus */
+/*
+ * Long options.
+ * For long options with no corresponding short options, we define values
+ * outside the range of ASCII graphic characters, make that the last
+ * component of the entry for the long option, and have a case for that
+ * option in the switch statement.
+ */
+// Base value for capture related long options
+#define LONGOPT_BASE_CAPTURE 1000
+// Base value for dissector related long options
+#define LONGOPT_BASE_DISSECTOR 2000
+// Base value for application specific long options
+#define LONGOPT_BASE_APPLICATION 3000
+// Base value for GUI specific long options
+#define LONGOPT_BASE_GUI 4000
+
extern int
get_natural_int(const char *string, const char *name);
diff --git a/ui/commandline.c b/ui/commandline.c
index 39a192fc41..52bc33d681 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -188,16 +188,7 @@ commandline_print_usage(gboolean for_help_option) {
#endif
}
-/*
- * For long options with no corresponding short options, we define values
- * outside the range of ASCII graphic characters, make that the last
- * component of the entry for the long option, and have a case for that
- * option in the switch statement.
- *
- * We also pick values >= 65536, so as to leave values from 128 to 65535
- * for capture and dissection options.
- */
-#define LONGOPT_FULL_SCREEN 65536
+#define LONGOPT_FULL_SCREEN LONGOPT_BASE_GUI+1
#define OPTSTRING OPTSTRING_CAPTURE_COMMON OPTSTRING_DISSECT_COMMON "C:g:HhjJ:klm:o:P:r:R:Svw:X:Y:z:"
static const struct option long_options[] = {
diff --git a/ui/dissect_opts.h b/ui/dissect_opts.h
index 0ad341beaf..4133799b61 100644
--- a/ui/dissect_opts.h
+++ b/ui/dissect_opts.h
@@ -26,25 +26,12 @@ extern "C" {
* Long options.
* We do not currently have long options corresponding to all short
* options; we should probably pick appropriate option names for them.
- *
- * For long options with no corresponding short options, we define values
- * outside the range of ASCII graphic characters, make that the last
- * component of the entry for the long option, and have a case for that
- * option in the switch statement.
- *
- * We also pick values >= 4096, so as not to collide with capture options,
- * and <= 65535, so as to leave values > 65535 for options specific to a
- * program.
*/
-/*
- * Non-capture long-only options should start here, to avoid collision
- * with capture options.
- */
-#define LONGOPT_DISABLE_PROTOCOL 4096
-#define LONGOPT_ENABLE_HEURISTIC 4097
-#define LONGOPT_DISABLE_HEURISTIC 4098
-#define LONGOPT_ENABLE_PROTOCOL 4099
+#define LONGOPT_DISABLE_PROTOCOL LONGOPT_BASE_DISSECTOR+1
+#define LONGOPT_ENABLE_HEURISTIC LONGOPT_BASE_DISSECTOR+2
+#define LONGOPT_DISABLE_HEURISTIC LONGOPT_BASE_DISSECTOR+3
+#define LONGOPT_ENABLE_PROTOCOL LONGOPT_BASE_DISSECTOR+4
/*
* Options for dissecting common to all dissecting programs.