Ethereal-dev: [Ethereal-dev] IP Fix and SSDP support
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: dhampton@xxxxxxx
Date: Tue, 02 Jan 2001 18:32:15 -0800
Attached are changes that add SSDP and other tweaks to the HTTP code, and a change that fixes pure IP packets to display properly (they display as raw Ethernet packets for me.) David Index: packet-http.c =================================================================== RCS file: /cvsroot/ethereal/packet-http.c,v retrieving revision 1.30 diff -u -r1.30 packet-http.c --- packet-http.c 2000/11/21 22:40:40 1.30 +++ packet-http.c 2001/01/03 01:17:42 @@ -45,10 +45,12 @@ typedef enum _http_type { HTTP_REQUEST, HTTP_RESPONSE, + HTTP_NOTIFICATION, HTTP_OTHERS } http_type_t; static int proto_http = -1; +static int hf_http_notification = -1; static int hf_http_response = -1; static int hf_http_request = -1; @@ -59,6 +61,9 @@ #define TCP_PORT_PROXY_ADMIN_HTTP 3132 #define TCP_ALT_PORT_HTTP 8080 +#define TCP_PORT_SSDP 1900 +#define UDP_PORT_SSDP 1900 + static int is_http_request_or_reply(const u_char *data, int linelen, http_type_t *type); static dissector_handle_t ipp_handle; @@ -202,6 +207,11 @@ switch (http_type) { + case HTTP_NOTIFICATION: + proto_tree_add_boolean_hidden(http_tree, + hf_http_notification, tvb, 0, 0, 1); + break; + case HTTP_RESPONSE: proto_tree_add_boolean_hidden(http_tree, hf_http_response, tvb, 0, 0, 1); @@ -243,6 +253,24 @@ static int is_http_request_or_reply(const u_char *data, int linelen, http_type_t *type) { + /* + * From RFC 2774 - An HTTP Extension Framework + * + * Support the command prefix that identifies the presence of + * a "mandatory" header. + */ + if (strncmp(data, "M-", 2) == 0) { + data += 2; + linelen -= 2; + } + + /* + * From draft-cohen-gena-client-01.txt, available from the uPnP forum: + * NOTIFY, SUBSCRIBE, UNSUBSCRIBE + * + * From draft-ietf-dasl-protocol-00.txt, a now vanished Microsoft draft: + * SEARCH + */ if (linelen >= 4) { if (strncmp(data, "GET ", 4) == 0 || strncmp(data, "PUT ", 4) == 0) { @@ -277,6 +305,12 @@ *type = HTTP_REQUEST; return TRUE; } + if (strncmp(data, "NOTIFY ", 7) == 0 || + strncmp(data, "SEARCH ", 7) == 0) { + if (*type == HTTP_OTHERS) + *type = HTTP_NOTIFICATION; + return TRUE; + } } if (linelen >= 8) { if (strncmp(data, "OPTIONS ", 8) == 0 || @@ -286,6 +320,20 @@ return TRUE; } } + if (linelen >= 10) { + if (strncmp(data, "SUBSCRIBE ", 10) == 0) { + if (*type == HTTP_OTHERS) + *type = HTTP_NOTIFICATION; + return TRUE; + } + } + if (linelen >= 12) { + if (strncmp(data, "UNSUBSCRIBE ", 10) == 0) { + if (*type == HTTP_OTHERS) + *type = HTTP_NOTIFICATION; + return TRUE; + } + } return FALSE; } @@ -293,6 +341,10 @@ proto_register_http(void) { static hf_register_info hf[] = { + { &hf_http_notification, + { "Notification", "http.notification", + FT_BOOLEAN, BASE_NONE, NULL, 0x0, + "TRUE if HTTP notification" }}, { &hf_http_response, { "Response", "http.response", FT_BOOLEAN, BASE_NONE, NULL, 0x0, @@ -319,6 +371,9 @@ dissector_add("tcp.port", TCP_ALT_PORT_HTTP, dissect_http); dissector_add("tcp.port", TCP_PORT_PROXY_HTTP, dissect_http); dissector_add("tcp.port", TCP_PORT_PROXY_ADMIN_HTTP, dissect_http); + + dissector_add("tcp.port", TCP_PORT_SSDP, dissect_http); + dissector_add("udp.port", UDP_PORT_SSDP, dissect_http); /* * Get a handle for the IPP dissector. Index: packet-ip.c =================================================================== RCS file: /cvsroot/ethereal/packet-ip.c,v retrieving revision 1.115 diff -u -r1.115 packet-ip.c --- packet-ip.c 2000/12/29 04:16:57 1.115 +++ packet-ip.c 2001/01/03 01:17:44 @@ -840,6 +840,11 @@ /* XXX - check to make sure this is at least IPH_MIN_LEN. */ hlen = lo_nibble(iph.ip_v_hl) * 4; /* IP header length, in bytes */ + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "IP"); + if (check_col(pinfo->fd, COL_INFO)) + col_set_str(pinfo->fd, COL_INFO, "IP Packet"); + if (tree) { ti = proto_tree_add_item(tree, proto_ip, tvb, offset, hlen, FALSE); ip_tree = proto_item_add_subtree(ti, ett_ip);
- Follow-Ups:
- Re: [Ethereal-dev] IP Fix and SSDP support
- From: Guy Harris
- Re: [Ethereal-dev] IP Fix and SSDP support
- From: Guy Harris
- Re: [Ethereal-dev] IP Fix and SSDP support
- Prev by Date: Re: [Ethereal-dev] ranges for dfilter
- Next by Date: Re: [Ethereal-dev] Set-UID (and set-GID) GTK+ programs are insecure
- Previous by thread: Re: [Ethereal-dev] Selsius Station Protocol
- Next by thread: Re: [Ethereal-dev] IP Fix and SSDP support
- Index(es):