Sharkd: Add column header labels to the "status" output
This commit is contained in:
parent
a9a7dcec21
commit
5c0af364f1
|
@ -1100,6 +1100,7 @@ sharkd_session_process_load(const char *buf, const jsmntok_t *tokens, int count)
|
|||
* (m) duration - time difference between time of first frame, and last loaded frame
|
||||
* (o) filename - capture filename
|
||||
* (o) filesize - capture filesize
|
||||
* (o) columns - array of column titles
|
||||
*/
|
||||
static void
|
||||
sharkd_session_process_status(void)
|
||||
|
@ -1125,6 +1126,16 @@ sharkd_session_process_status(void)
|
|||
sharkd_json_value_anyf("filesize", "%" PRId64, file_size);
|
||||
}
|
||||
|
||||
if (cfile.cinfo.num_cols > 0)
|
||||
{
|
||||
sharkd_json_array_open("columns");
|
||||
for (int i = 0; i < cfile.cinfo.num_cols; ++i)
|
||||
{
|
||||
sharkd_json_value_string(NULL, get_column_title(i));
|
||||
}
|
||||
sharkd_json_array_close();
|
||||
}
|
||||
|
||||
sharkd_json_result_epilogue();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class case_sharkd(subprocesstest.SubprocessTestCase):
|
|||
check_sharkd_session((
|
||||
{"jsonrpc":"2.0", "id":1, "method":"status"},
|
||||
), (
|
||||
{"jsonrpc":"2.0","id":1,"result":{"frames":0,"duration":0.000000000}},
|
||||
{"jsonrpc":"2.0","id":1,"result":{"frames":0,"duration":0.000000000,"columns":["No.","Time","Source","Destination","Protocol","Length","Info"]}},
|
||||
))
|
||||
|
||||
def test_sharkd_req_status(self, check_sharkd_session, capture_file):
|
||||
|
@ -86,7 +86,8 @@ class case_sharkd(subprocesstest.SubprocessTestCase):
|
|||
), (
|
||||
{"jsonrpc":"2.0","id":1,"result":{"status":"OK"}},
|
||||
{"jsonrpc":"2.0","id":2,"result":{"frames": 4, "duration": 0.070345000,
|
||||
"filename": "dhcp.pcap", "filesize": 1400}},
|
||||
"filename": "dhcp.pcap", "filesize": 1400,
|
||||
"columns":["No.","Time","Source","Destination","Protocol","Length","Info"]}},
|
||||
))
|
||||
|
||||
def test_sharkd_req_analyse(self, check_sharkd_session, capture_file):
|
||||
|
|
Loading…
Reference in New Issue