From f59ea5f7690c9a01ef6f7f6508084a66c40b1dae Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2024 19:44:25 +0200 Subject: Merging upstream version 4.2.4. Signed-off-by: Daniel Baumann --- sharkd_session.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'sharkd_session.c') diff --git a/sharkd_session.c b/sharkd_session.c index 18071d77..8c378260 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -1220,11 +1220,16 @@ 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) 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 + * (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 + * (o) columns - array of column titles + * (o) column_info - array of column infos, array of object with attributes: + * 'title' - column title + * 'format' - column format (%x or %Cus:: if COL_CUSTOM) + * 'visible' - true if column is visible + * 'resolved' - true if column is resolved */ static void sharkd_session_process_status(void) @@ -1258,6 +1263,24 @@ sharkd_session_process_status(void) sharkd_json_value_string(NULL, get_column_title(i)); } sharkd_json_array_close(); + + sharkd_json_array_open("column_info"); + for (int i = 0; i < cfile.cinfo.num_cols; ++i) + { + int fmt = get_column_format(i); + sharkd_json_object_open(NULL); + sharkd_json_value_string("title", get_column_title(i)); + if (fmt != COL_CUSTOM) + { + sharkd_json_value_string("format", col_format_to_string(fmt)); + } else { + sharkd_json_value_stringf("format", "%s:%s:%d", col_format_to_string(fmt), get_column_custom_fields(i), get_column_custom_occurrence(i)); + } + sharkd_json_value_anyf("visible", get_column_visible(i) ? "true" : "false"); + sharkd_json_value_anyf("resolved", get_column_resolved(i) ? "true" : "false"); + sharkd_json_object_close(); + } + sharkd_json_array_close(); } sharkd_json_result_epilogue(); @@ -5836,7 +5859,7 @@ sharkd_session_process(char *buf, const jsmntok_t *tokens, int count) int sharkd_session_main(int mode_setting) { - char buf[2 * 1024]; + char buf[8 * 1024]; jsmntok_t *tokens = NULL; int tokens_max = -1; -- cgit v1.2.3