Wiretap: Add support for files contain GIF, PNG images

From Michal Labedzki, bug 8278 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8278)

svn path=/trunk/; revision=47368
This commit is contained in:
Michael Mann 2013-01-30 19:26:05 +00:00
parent 942ac68bdc
commit d6901da1d1
3 changed files with 10 additions and 2 deletions

View File

@ -688,4 +688,5 @@ proto_reg_handoff_gif(void)
/* Register the GIF media type */
dissector_add_string("media_type", "image/gif", gif_handle);
heur_dissector_add("http", dissect_gif_heur, proto_gif);
heur_dissector_add("wtap_file", dissect_gif_heur, proto_gif);
}

View File

@ -435,4 +435,5 @@ proto_reg_handoff_png(void)
dissector_handle_t png_handle = new_create_dissector_handle(dissect_png, proto_png);
dissector_add_string("media_type", "image/png", png_handle);
heur_dissector_add("http", dissect_png_heur, proto_png);
heur_dissector_add("wtap_file", dissect_png_heur, proto_png);
}

View File

@ -72,11 +72,17 @@ static const guint8 jpeg_jfif_magic[] = { 0xFF, 0xD8, /* SOF */
};
/* <?xml */
static const guint8 xml_magic[] = { '<', '?', 'x', 'm', 'l' };
static const guint8 xml_magic[] = { '<', '?', 'x', 'm', 'l' };
static const guint8 png_magic[] = { 137, 80, 78, 71, 13, 10, 26, 10 };
static const guint8 gif87a_magic[] = { 'G', 'I', 'F', '8', '7', 'a'};
static const guint8 gif89a_magic[] = { 'G', 'I', 'F', '8', '9', 'a'};
static const mime_files_t magic_files[] = {
{ jpeg_jfif_magic, sizeof(jpeg_jfif_magic) },
{ xml_magic, sizeof(xml_magic) }
{ xml_magic, sizeof(xml_magic) },
{ png_magic, sizeof(png_magic) },
{ gif87a_magic, sizeof(gif87a_magic) },
{ gif89a_magic, sizeof(gif89a_magic) }
};
#define N_MAGIC_TYPES (sizeof(magic_files) / sizeof(magic_files[0]))