aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt_core/randpkt_core.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-06-29 21:22:09 -0700
committerAnders Broman <a.broman58@gmail.com>2018-07-01 06:57:23 +0000
commitf7b91633c447fb313f299392500eb12fda0e5612 (patch)
tree71451f239fc1ee491a763ccd64ce6e081aa78585 /randpkt_core/randpkt_core.c
parent61656dd2e62f91b194b803f15c6faf0a647dcdf9 (diff)
randpktdump: add --delay option
For testing live capture mode in the Qt UI, it is useful to have a continous capture source with some dummy packets. Change-Id: Id76ecbf24828dd3212b208c96679524e4c25b00f Reviewed-on: https://code.wireshark.org/review/28537 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'randpkt_core/randpkt_core.c')
-rw-r--r--randpkt_core/randpkt_core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c
index b156fb9b67..738395fbd1 100644
--- a/randpkt_core/randpkt_core.c
+++ b/randpkt_core/randpkt_core.c
@@ -555,7 +555,7 @@ randpkt_example* randpkt_find_example(int type)
return NULL;
}
-void randpkt_loop(randpkt_example* example, guint64 produce_count)
+void randpkt_loop(randpkt_example* example, guint64 produce_count, guint64 packet_delay_ms)
{
guint i, j;
int err;
@@ -624,6 +624,10 @@ void randpkt_loop(randpkt_example* example, guint64 produce_count)
example->filename, err, err_info, 0,
WTAP_FILE_TYPE_SUBTYPE_PCAP);
}
+ if (packet_delay_ms) {
+ g_usleep(1000 * (gulong)packet_delay_ms);
+ wtap_dump_flush(example->dump);
+ }
}
g_free(rec);