aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2017-09-26 23:42:20 +0200
committerMichael Mann <mmann78@netscape.net>2017-09-27 01:56:33 +0000
commit5ecfe0c565e106960c3a13a6e835bd09f0b3e244 (patch)
treed0d256d735ddcb2ff3be72e9083c3809ae3c2583
parente8492934d6cf1f7d71b8d3cd10e5fd257f0d8fc0 (diff)
sharkd: support for frame comments.
Change-Id: If51cd6a7f4989fee16563809a997dc2f46f67c22 Reviewed-on: https://code.wireshark.org/review/23759 Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--sharkd_session.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/sharkd_session.c b/sharkd_session.c
index be5601737f..e960fdfefb 100644
--- a/sharkd_session.c
+++ b/sharkd_session.c
@@ -725,10 +725,11 @@ sharkd_session_process_analyse(void)
* Output array of frames with attributes:
* (m) c - array of column data
* (m) num - frame number
- * (m) i - if frame is ignored
- * (m) m - if frame is marked
- * (m) bg - color filter - background color in hex
- * (m) fg - color filter - foreground color in hex
+ * (o) i - if frame is ignored
+ * (o) m - if frame is marked
+ * (o) ct - if frame is commented
+ * (o) bg - color filter - background color in hex
+ * (o) fg - color filter - foreground color in hex
*/
static void
sharkd_session_process_frames(const char *buf, const jsmntok_t *tokens, int count)
@@ -797,6 +798,9 @@ sharkd_session_process_frames(const char *buf, const jsmntok_t *tokens, int coun
}
printf("],\"num\":%u", framenum);
+ if (fdata->flags.has_phdr_comment)
+ printf(",\"ct\":true");
+
if (fdata->flags.ignored)
printf(",\"i\":true");
@@ -2672,13 +2676,24 @@ sharkd_follower_visit_layers_cb(const void *key _U_, void *value, void *user_dat
static void
sharkd_session_process_frame_cb(packet_info *pi, proto_tree *tree, struct epan_column_info *cinfo, const GSList *data_src, void *data)
{
- (void) pi;
+ frame_data *fdata = pi->fd;
+ const char *pkt_comment = NULL;
+
(void) data;
printf("{");
printf("\"err\":0");
+ if (fdata->flags.has_phdr_comment)
+ pkt_comment = pi->phdr->opt_comment;
+
+ if (pkt_comment)
+ {
+ printf(",\"comment\":");
+ json_puts_string(pkt_comment);
+ }
+
if (tree)
{
tvbuff_t **tvbs = NULL;
@@ -2943,6 +2958,7 @@ sharkd_session_process_intervals(char *buf, const jsmntok_t *tokens, int count)
* (o) col - array of column data
* (o) bytes - base64 of frame bytes
* (o) ds - array of other data srcs
+ * (o) comment - frame comment
* (o) fol - array of follow filters:
* [0] - protocol
* [1] - filter string
@@ -3423,7 +3439,7 @@ sharkd_session_process_dumpconf(char *buf, const jsmntok_t *tokens, int count)
printf("{\"prefs\":{");
prefs_pref_foreach(pref_mod, sharkd_session_process_dumpconf_cb, &data);
printf("}}\n");
- }
+ }
}
struct sharkd_download_rtp