diff options
author | Olivier Biot <obiot.ethereal@gmail.com> | 2004-01-09 21:45:29 +0000 |
---|---|---|
committer | Olivier Biot <obiot.ethereal@gmail.com> | 2004-01-09 21:45:29 +0000 |
commit | 36e48a332251776d7d68576610e89ab85590ef92 (patch) | |
tree | 26159c2bcdfce3c3fd3fdae3c3aa6686c5036442 /packet-http.c | |
parent | 84dcd53b03d15474bebc7431c52aa8029d2b3f97 (diff) |
Add support for the message/http media type defined in HTTP.
TODO: the HTTP dissector does not deal yet with chunked coding.
svn path=/trunk/; revision=9617
Diffstat (limited to 'packet-http.c')
-rw-r--r-- | packet-http.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/packet-http.c b/packet-http.c index 7555f777eb..647dd33675 100644 --- a/packet-http.c +++ b/packet-http.c @@ -6,7 +6,7 @@ * Copyright 2002, Tim Potter <tpot@samba.org> * Copyright 1999, Andrew Tridgell <tridge@samba.org> * - * $Id: packet-http.c,v 1.88 2004/01/01 23:34:06 guy Exp $ + * $Id: packet-http.c,v 1.89 2004/01/09 21:45:29 obiot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1243,3 +1243,64 @@ proto_reg_handoff_http(void) ntlmssp_handle = find_dissector("ntlmssp"); } + +/* + * Content-Type: message/http + */ + +static gint proto_message_http = -1; +static gint ett_message_http = -1; +static dissector_handle_t message_http_handle; + +static void +dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *subtree; + proto_item *ti; + gint offset = 0, next_offset; + gint len; + + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_str(pinfo->cinfo, COL_INFO, " (message/http)"); + if (tree) { + ti = proto_tree_add_item(tree, proto_message_http, + tvb, 0, -1, FALSE); + subtree = proto_item_add_subtree(ti, ett_message_http); + while (tvb_reported_length_remaining(tvb, offset) != 0) { + len = tvb_find_line_end(tvb, offset, + tvb_ensure_length_remaining(tvb, offset), + &next_offset, FALSE); + if (len == -1) + break; + proto_tree_add_text(subtree, tvb, offset, next_offset - offset, + "%s", tvb_format_text(tvb, offset, len)); + offset = next_offset; + } + } +} + +void +proto_register_message_http(void) +{ + static gint *ett[] = { + &ett_message_http, + }; + + proto_message_http = proto_register_protocol( + "Media Type: message/http", + "message/http", + "message-http" + ); + proto_register_subtree_array(ett, array_length(ett)); + message_http_handle = create_dissector_handle(dissect_message_http, + proto_message_http); +} + +void +proto_reg_handoff_message_http(void) +{ + message_http_handle = create_dissector_handle(dissect_message_http, + proto_message_http); + + dissector_add_string("media_type", "message/http", message_http_handle); +} |