aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.h
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad.fatoum@siemens.com>2017-08-07 16:38:52 +0200
committerAnders Broman <a.broman58@gmail.com>2017-08-22 07:55:26 +0000
commitaca55a29f7b982e7a0bd9911d1d176561c8d7a84 (patch)
tree35b4f2b92ba79f49d26ebb06ae805e9eb6f4e4ac /capture_opts.h
parent2845f6be8db0b1720e23db0877ec837f00967bdc (diff)
Add hardware timestamping support
pcap provides a pcap_set_tstamp_type function, which can be used to request hardware timestamps from a supporting kernel. This patch adds support for aforementioned function as well as two new command line options to dumpcap, wireshark and tshark: --list-time-stamp-types List time stamp types supported for the interface --time-stamp-type <type> Change the interface's timestamp method Name choice mimics those used by tcpdump(1), which already supports this feature. However, unlike tcpdump, we provide both options unconditionally. If Wireshark was configured without pcap_set_tstamp_type being available, --list-time-stamp-types reports an empty list. Change-Id: I418a4b2b84cb01949cd262aad0ad8427f5ac0652 Signed-off-by: Ahmad Fatoum <ahmad.fatoum@siemens.com> Reviewed-on: https://code.wireshark.org/review/23113 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'capture_opts.h')
-rw-r--r--capture_opts.h37
1 files changed, 25 insertions, 12 deletions
diff --git a/capture_opts.h b/capture_opts.h
index 2fc04a339c..c3b830e3b3 100644
--- a/capture_opts.h
+++ b/capture_opts.h
@@ -60,7 +60,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_NUM_CAP_COMMENT 128
+#define LONGOPT_LIST_TSTAMP_TYPES 129
+#define LONGOPT_SET_TSTAMP_TYPE 130
/*
* Options for capturing common to all capturing programs.
@@ -89,17 +91,20 @@ extern "C" {
#endif
#define LONGOPT_CAPTURE_COMMON \
- {"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
- {"autostop", required_argument, NULL, 'a'}, \
- {"ring-buffer", required_argument, NULL, 'b'}, \
+ {"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
+ {"autostop", required_argument, NULL, 'a'}, \
+ {"ring-buffer", required_argument, NULL, 'b'}, \
LONGOPT_BUFFER_SIZE \
- {"list-interfaces", no_argument, NULL, 'D'}, \
- {"interface", required_argument, NULL, 'i'}, \
+ {"list-interfaces", no_argument, NULL, 'D'}, \
+ {"interface", required_argument, NULL, 'i'}, \
LONGOPT_MONITOR_MODE \
- {"list-data-link-types", no_argument, NULL, 'L'}, \
- {"no-promiscuous-mode", no_argument, NULL, 'p'}, \
- {"snapshot-length", required_argument, NULL, 's'}, \
- {"linktype", required_argument, NULL, 'y'}, \
+ {"list-data-link-types", no_argument, NULL, 'L'}, \
+ {"no-promiscuous-mode", no_argument, NULL, 'p'}, \
+ {"snapshot-length", required_argument, NULL, 's'}, \
+ {"linktype", required_argument, NULL, 'y'}, \
+ {"list-time-stamp-types", no_argument, NULL, LONGOPT_LIST_TSTAMP_TYPES}, \
+ {"time-stamp-type", required_argument, NULL, LONGOPT_SET_TSTAMP_TYPE},
+
#define OPTSTRING_CAPTURE_COMMON \
"a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:i:" OPTSTRING_I "Lps:y:"
@@ -248,6 +253,9 @@ typedef struct interface_options_tag {
capture_sampling sampling_method;
int sampling_param;
#endif
+ gchar *timestamp_type; /* requested timestamp as string */
+ int timestamp_type_id; /* Timestamp type to pass to pcap_set_tstamp_type.
+ only valid if timestamp_type != NULL */
} interface_options;
/** Capture options coming from user interface */
@@ -342,10 +350,15 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
extern void
capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_options *capture_opts);
+enum caps_query {
+ CAPS_MONITOR_MODE = 0x1,
+ CAPS_QUERY_LINK_TYPES = 0x2,
+ CAPS_QUERY_TIMESTAMP_TYPES = 0x4
+};
+
/* print interface capabilities, including link layer types */
extern void
-capture_opts_print_if_capabilities(if_capabilities_t *caps, char *name,
- gboolean monitor_mode);
+capture_opts_print_if_capabilities(if_capabilities_t *caps, char *name, int queries);
/* print list of interfaces */
extern void