Add a routine to allow dissectors to specify ports that carry HTTP

traffic *without* claiming all that traffic for themselves; they might
want, instead, to register for a particular media type.

Not all traffic to or from port 3689 is DAAP - not even traffic between
two Apple machines doing media stuff (e.g., some FairPlay traffic
isn't).  Register for the media type application/x-dmap-tagged, and just
say port 3689 is HTTP.  This means we can get rid of the FPLY hack, as
that traffic is application/octet-stream.  Update some comments.

Leave it up to the DAAP dissector to tag traffic as DAAP in the protocol
column.

svn path=/trunk/; revision=47376
This commit is contained in:
Guy Harris 2013-01-30 21:49:33 +00:00
parent 8499f78705
commit a4714f643a
4 changed files with 30 additions and 29 deletions

View File

@ -206,7 +206,6 @@
#define dacp_canp 0x63616e70
#define daap_png 0x89504e47
#define daap_FPLY 0x46504c59
/* date/time */
/* TODO:
#define daap_mstc 0xMMSSTTCC utctime
@ -325,7 +324,6 @@ static const value_string vals_tag_code[] = {
{ dacp_cmsr, "status revision" },
{ dacp_cmst, "control container" },
{ dacp_cmvo, "volume" },
{ daap_FPLY, "FairPlay negotiation" },
{ daap_mbcl, "bag (mbcl)" },
{ daap_mccr, "content codes response" },
{ daap_mcna, "content codes name" },
@ -393,21 +391,27 @@ dissect_daap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *ti;
proto_tree *daap_tree;
guint first_tag = 0;
/*
* XXX - we now go by media type rather than TCP port,
* so is there another way to determine whether this
* is a request or response?
*/
gboolean is_request = (pinfo->destport == TCP_PORT_DAAP);
first_tag = tvb_get_ntohl(tvb, 0);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DAAP");
/* This catches album art coming back from iTunes */
/*
* This catches album art coming back from iTunes.
* XXX - will those have a media type of image/png
* rather than application/x-dmap-tagged? If so,
* this is no longer necessary.
*/
if (first_tag == daap_png) {
call_dissector(png_handle, tvb, pinfo, tree);
return;
}
/*
* XXX - what if the body is gzipped? This isn't the only protocol
* running atop HTTP that might have a problem with that....
*/
if (is_request) {
col_set_str(pinfo->cinfo, COL_INFO, "DAAP Request");
} else {
@ -415,26 +419,15 @@ dissect_daap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* functions fail, at least something will be in the info column
*/
col_set_str(pinfo->cinfo, COL_INFO, "DAAP Response");
/* This catches FairPlay negotiation */
if (first_tag == daap_FPLY) {
col_append_fstr(pinfo->cinfo, COL_INFO, " [first tag: %s]",
tvb_format_text(tvb, 0, 4));
} else {
col_append_fstr(pinfo->cinfo, COL_INFO, " [first tag: %s, size: %d]",
tvb_format_text(tvb, 0, 4),
tvb_get_ntohl(tvb, 4));
}
col_append_fstr(pinfo->cinfo, COL_INFO, " [first tag: %s, size: %d]",
tvb_format_text(tvb, 0, 4),
tvb_get_ntohl(tvb, 4));
}
if (tree) {
ti = proto_tree_add_item(tree, proto_daap, tvb, 0, -1, ENC_NA);
daap_tree = proto_item_add_subtree(ti, ett_daap);
/* This catches FairPlay negotiation */
if (first_tag == daap_FPLY) {
proto_tree_add_item(tree, hf_daap_name, tvb, 0, 4, ENC_ASCII|ENC_NA);
proto_tree_add_text(tree, tvb, 4, -1, "FPLY data");
} else
dissect_daap_one_tag(daap_tree, tvb);
dissect_daap_one_tag(daap_tree, tvb);
}
}
@ -751,7 +744,8 @@ proto_reg_handoff_daap(void)
dissector_handle_t daap_handle;
daap_handle = create_dissector_handle(dissect_daap, proto_daap);
http_dissector_add(TCP_PORT_DAAP, daap_handle);
http_port_add(TCP_PORT_DAAP);
dissector_add_string("media_type", "application/x-dmap-tagged", daap_handle);
png_handle = find_dissector("png");
}

View File

@ -224,8 +224,6 @@ static gboolean http_decompress_body = TRUE;
static gboolean http_decompress_body = FALSE;
#endif
#define TCP_PORT_DAAP 3689
/* Simple Service Discovery Protocol
* SSDP is implemented atop HTTP (yes, it really *does* run over UDP).
* SSDP is the discovery protocol of Universal Plug and Play
@ -697,10 +695,6 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tag = "SSDP";
break;
case TCP_PORT_DAAP:
proto_tag = "DAAP";
break;
default:
proto_tag = "HTTP";
break;
@ -2865,6 +2859,17 @@ http_dissector_add(guint32 port, dissector_handle_t handle)
dissector_add_uint("http.port", port, handle);
}
void
http_port_add(guint32 port)
{
/*
* Register ourselves as the handler for that port number
* over TCP. We rely on our caller having registered
* themselves for the appropriate media type.
*/
dissector_add_uint("tcp.port", port, http_handle);
}
void
proto_reg_handoff_http(void)
{

View File

@ -27,6 +27,7 @@
#include <epan/packet.h>
void http_dissector_add(guint32 port, dissector_handle_t handle);
void http_port_add(guint32 port);
/* Used for HTTP statistics */
typedef struct _http_info_value_t {

View File

@ -638,6 +638,7 @@ hf_text_only DATA
host_ip_af
host_name_lookup_process
http_dissector_add
http_port_add
ieee80211_chan_to_mhz
ieee80211_mhz_to_chan
ieee80211_mhz_to_str