aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-20 13:59:45 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-20 21:00:16 +0000
commit26bbee3fadc68237801e4ed65b87c97b3cdf3156 (patch)
tree9fe9f9e7c11733a34797c1c0694f363d060ed696 /capture_opts.h
parent312ed10900df878ef8476febe72c8f1308aba106 (diff)
Add some long options for capture short options.
The names match tcpdump trunk's names for the corresponding options. Also have capture_opts.h provide a #define for the part of the short option string that corresponds to the capture short options that all our programs that take capture short options take (those are largely the ones we have in common with tcpdump). Change-Id: Ia209425959c801725850b56a7d63441ee99b5001 Reviewed-on: https://code.wireshark.org/review/2492 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'capture_opts.h')
-rw-r--r--capture_opts.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/capture_opts.h b/capture_opts.h
index a48635d68b..afc402e2bc 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -65,6 +65,62 @@ extern "C" {
*/
#define MIN_NON_CAPTURE_LONGOPT 129
+/*
+ * Long options for capturing common to all capturing programs.
+ */
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#define LONGOPT_BUFFER_SIZE \
+ {(char *)"buffer-size", required_argument, NULL, 'B'},
+#else
+#define LONGOPT_BUFFER_SIZE
+#endif
+
+#ifdef HAVE_PCAP_CREATE
+#define LONGOPT_MONITOR_MODE {(char *)"monitor-mode", no_argument, NULL, 'I'},
+#else
+#define LONGOPT_MONITOR_MODE
+#endif
+
+#define LONGOPT_CAPTURE_COMMON \
+ LONGOPT_BUFFER_SIZE \
+ {(char *)"list-interfaces", no_argument, NULL, 'D'}, \
+ {(char *)"interface", required_argument, NULL, 'i'}, \
+ LONGOPT_MONITOR_MODE \
+ {(char *)"list-data-link-types", no_argument, NULL, 'L'}, \
+ {(char *)"snapshot-length", required_argument, NULL, 's'}, \
+ {(char *)"linktype", required_argument, NULL, 'y'}
+
+/*
+ * Short options for capturing common to all capturing programs.
+ */
+
+#ifdef HAVE_PCAP_REMOTE
+#define OPTSTRING_A "A:"
+#else
+#define OPTSTRING_A ""
+#endif
+
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#define OPTSTRING_B "B:"
+#else
+#define OPTSTRING_B ""
+#endif /* _WIN32 or HAVE_PCAP_CREATE */
+
+#ifdef HAVE_PCAP_CREATE
+#define OPTSTRING_I "I"
+#else
+#define OPTSTRING_I ""
+#endif
+
+#ifdef HAVE_BPF_IMAGE
+#define OPTSTRING_d "d"
+#else
+#define OPTSTRING_d ""
+#endif
+
+#define OPTSTRING_CAPTURE_COMMON \
+ "a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:i:" OPTSTRING_I "Lps:y:"
+
#ifdef HAVE_PCAP_REMOTE
/* Type of capture source */
typedef enum {