aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/file-jpeg.c
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2015-01-23 15:09:50 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2015-01-23 16:00:26 +0000
commitd8d2d8e09cdbc6c258ef212cd439c9a4ecf55239 (patch)
treed3ac3cb79b594d53a618fb7b74dcbfd94ae9021c /epan/dissectors/file-jpeg.c
parentcce3ad281e6e26f5d8101d6f70d1336ebc7d1b55 (diff)
jpeg: Add handling for comment marker
Change-Id: I10ad7021f6535d65d88faf734fb5800e4415a811 Reviewed-on: https://code.wireshark.org/review/6759 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Diffstat (limited to 'epan/dissectors/file-jpeg.c')
-rw-r--r--epan/dissectors/file-jpeg.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/epan/dissectors/file-jpeg.c b/epan/dissectors/file-jpeg.c
index ab16d27fba..5d25deff8b 100644
--- a/epan/dissectors/file-jpeg.c
+++ b/epan/dissectors/file-jpeg.c
@@ -36,7 +36,6 @@
#include "config.h"
-
#include <epan/packet.h>
#include <wiretap/wtap.h>
@@ -341,6 +340,10 @@ static gint hf_sos_se = -1;
static gint hf_sos_ah = -1;
static gint hf_sos_al = -1;
+/* Comment */
+static gint hf_comment_header = -1;
+static gint hf_comment = -1;
+
/* Initialize the subtree pointers */
static gint ett_jfif = -1;
static gint ett_marker_segment = -1;
@@ -463,6 +466,32 @@ process_sos_header(proto_tree *tree, tvbuff_t *tvb, guint32 len _U_,
/* offset ++ */;
}
+/*
+ * Process a Comment header (with length).
+ */
+static void
+process_comment_header(proto_tree *tree, tvbuff_t *tvb, guint32 len _U_,
+ guint16 marker, const char *marker_name)
+{
+ proto_item *ti = NULL;
+ proto_tree *subtree = NULL;
+
+ if (! tree)
+ return;
+
+ ti = proto_tree_add_item(tree, hf_comment_header,
+ tvb, 0, -1, ENC_NA);
+ subtree = proto_item_add_subtree(ti, ett_marker_segment);
+
+ proto_item_append_text(ti, ": %s (0x%04X)", marker_name, marker);
+ proto_tree_add_item(subtree, hf_marker, tvb, 0, 2, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(subtree, hf_len, tvb, 2, 2, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(subtree, hf_comment, tvb, 4, len-2, ENC_ASCII|ENC_NA);
+}
+
+
/* Process an APP0 block.
*
* XXX - This code only works on US-ASCII systems!!!
@@ -846,6 +875,9 @@ dissect_jfif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
case MARKER_SOS:
process_sos_header(subtree, tmp_tvb, len, marker, str);
break;
+ case MARKER_COM:
+ process_comment_header(subtree, tmp_tvb, len, marker, str);
+ break;
default:
process_marker_segment(subtree, tmp_tvb, len, marker, str);
break;
@@ -1163,6 +1195,24 @@ proto_register_jfif(void)
HFILL
}
},
+
+ /* Header: Comment (MARKER_COM) */
+ { &hf_comment_header,
+ { "Comment header",
+ IMG_JFIF ".header.comment",
+ FT_NONE, BASE_NONE, NULL, 0x00,
+ NULL,
+ HFILL
+ }
+ },
+ { &hf_comment,
+ { "Comment",
+ IMG_JFIF ".comment",
+ FT_STRING, STR_ASCII, NULL, 0x0,
+ NULL,
+ HFILL
+ }
+ },
};
/* Setup protocol subtree array */