From c5416e9b23db34b3110383ab427093c14a823ce2 Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Mon, 24 Sep 2018 09:24:55 +0200 Subject: sharkd: add field checking in check request. Change-Id: I5467dda6eaa931e0648ce178bf6412fcd1b9661c Reviewed-on: https://code.wireshark.org/review/29801 Petri-Dish: Jakub Zawadzki Tested-by: Petri Dish Buildbot Reviewed-by: Jakub Zawadzki --- sharkd_session.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sharkd_session.c') diff --git a/sharkd_session.c b/sharkd_session.c index 416c835799..2db25846cd 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -3314,17 +3314,21 @@ sharkd_session_process_frame(char *buf, const jsmntok_t *tokens, int count) * * Input: * (o) filter - filter to be checked + * (o) field - field to be checked * * Output object with attributes: * (m) err - always 0 * (o) filter - 'ok', 'warn' or error message + * (o) field - 'ok', or 'notfound' */ static int sharkd_session_process_check(char *buf, const jsmntok_t *tokens, int count) { const char *tok_filter = json_find_attr(buf, tokens, count, "filter"); + const char *tok_field = json_find_attr(buf, tokens, count, "field"); printf("{\"err\":0"); + if (tok_filter != NULL) { char *err_msg = NULL; @@ -3348,6 +3352,13 @@ sharkd_session_process_check(char *buf, const jsmntok_t *tokens, int count) } } + if (tok_field != NULL) + { + header_field_info *hfi = proto_registrar_get_byname(tok_field); + + printf(",\"field\":\"%s\"", (hfi) ? "ok" : "notfound"); + } + printf("}\n"); return 0; } -- cgit v1.2.3