diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2017-05-16 07:52:13 +0200 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2017-05-16 16:25:12 +0000 |
commit | b1225fec997a17d6a7a758389da40d2282c31581 (patch) | |
tree | 8c8fea24c6ac3b596a294d834e9ee67119ed12de /sharkd_session.c | |
parent | 3fbb5836b7efc02045f5d0c628be3f29e1d22ba6 (diff) |
sharkd: add more information about currently loaded file.
Change-Id: I59c34a0c92963822f02b16479e1ebb3bca6e64f6
Reviewed-on: https://code.wireshark.org/review/21678
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Diffstat (limited to 'sharkd_session.c')
-rw-r--r-- | sharkd_session.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sharkd_session.c b/sharkd_session.c index 591aa5ce02..3ea1e3f125 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -584,13 +584,35 @@ sharkd_session_process_load(const char *buf, const jsmntok_t *tokens, int count) * Process status request * * Output object with attributes: - * (m) frames - count of currently loaded frames + * (m) frames - count of currently loaded frames + * (m) duration - time difference between time of first frame, and last loaded frame + * (o) filename - capture filename + * (o) filesize - capture filesize */ static void sharkd_session_process_status(void) { printf("{\"frames\":%u", cfile.count); + printf(",\"duration\":%.9f", nstime_to_sec(&cfile.elapsed_time)); + + if (cfile.filename) + { + char *name = g_path_get_basename(cfile.filename); + + printf(",\"filename\":"); + json_puts_string(name); + g_free(name); + } + + if (cfile.wth) + { + gint64 file_size = wtap_file_size(cfile.wth, NULL); + + if (file_size > 0) + printf(",\"filesize\":%" G_GINT64_FORMAT, file_size); + } + printf("}\n"); } |