forked from osmocom/wireshark
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>
This commit is contained in:
parent
3fbb5836b7
commit
b1225fec99
|
@ -584,13 +584,35 @@ sharkd_session_process_load(const char *buf, const jsmntok_t *tokens, int count)
|
||||||
* Process status request
|
* Process status request
|
||||||
*
|
*
|
||||||
* Output object with attributes:
|
* 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
|
static void
|
||||||
sharkd_session_process_status(void)
|
sharkd_session_process_status(void)
|
||||||
{
|
{
|
||||||
printf("{\"frames\":%u", cfile.count);
|
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");
|
printf("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue