From b1225fec997a17d6a7a758389da40d2282c31581 Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Tue, 16 May 2017 07:52:13 +0200 Subject: sharkd: add more information about currently loaded file. Change-Id: I59c34a0c92963822f02b16479e1ebb3bca6e64f6 Reviewed-on: https://code.wireshark.org/review/21678 Petri-Dish: Jakub Zawadzki Tested-by: Petri Dish Buildbot Reviewed-by: Jakub Zawadzki --- sharkd_session.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'sharkd_session.c') 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"); } -- cgit v1.2.1