diff options
author | Maksim Salau <maksim.salau@gmail.com> | 2019-07-18 21:20:03 +0300 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-07-20 07:29:33 +0000 |
commit | 40e0e5d282daf3b21bc614a64e4e16e289f65768 (patch) | |
tree | 845eaae50a8febfb6567f5187724de31536060df /wiretap/candump_priv.h | |
parent | c43bd0def1aaf6db2febcd008d7e83021ef85427 (diff) |
wiretap: candump: Don't generate a temporary PCAP file
It's preferable to parse text files and generate packets on demand,
rather than generate a temporary PCAP file and dump all available
packets into it.
Parsing on the fly has a benefit of handling damaged files up to the
point of damage, while the approach with a temporary file doesn't
allow either to report that the original file is damaged or perform
conversion in the first place.
This version works faster than the previous one.
Command:
time ./run/tshark -r ./candump-2019-07-01_111120.log.gz > /dev/null
The test file is attached to the bug 15889
The current version:
real 0m0,597s
user 0m0,533s
sys 0m0,118s
The previous version:
real 0m2,176s
user 0m1,966s
sys 0m0,100s
Bug: 15889
Change-Id: I862ce47752531c2e9d9459f5d865c1fc08f32fea
Reviewed-on: https://code.wireshark.org/review/34007
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap/candump_priv.h')
-rw-r--r-- | wiretap/candump_priv.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/wiretap/candump_priv.h b/wiretap/candump_priv.h index 9b10ec8220..5d3ad7b156 100644 --- a/wiretap/candump_priv.h +++ b/wiretap/candump_priv.h @@ -63,9 +63,12 @@ typedef struct { } candump_priv_t; typedef struct { - GSList *packets; + gboolean is_msg_valid; + msg_t msg; FILE_T fh; + guint64 file_bytes_read; + int err; gchar *err_info; gchar *parse_error; @@ -73,8 +76,8 @@ typedef struct { token_t token; } candump_state_t; -GSList * -run_candump_parser(FILE_T fh, int *err, gchar **err_info); +gboolean +run_candump_parser(candump_state_t *state, int *err, gchar **err_info); #include <wsutil/ws_printf.h> |