Ethereal-dev: [Ethereal-dev] [PATCH][WSP]Parsing of Parameter and Content-Disposition
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Loïc Minier <lool+ethereal@xxxxxxxxxx>
Date: Wed, 19 Nov 2003 16:35:52 +0100
'evening, here's a set of typo-corrections for the new WSP-dissector: - a copy-paste with a missing replacement ; - content-disposition uses parameters not q-values ; - missing "+" for the calculation of parameter-offsets ; - a space ; - a comment. nothing big, but parameter parsing and content-disposition works again here! Kind regards, and sorry for my previous quoted-string patch, -- Loïc Minier <lool@xxxxxxxx>
Index: packet-wsp.c =================================================================== RCS file: /cvsroot/ethereal/packet-wsp.c,v retrieving revision 1.88 diff -u -b -r1.88 packet-wsp.c --- packet-wsp.c 19 Nov 2003 01:45:26 -0000 1.88 +++ packet-wsp.c 19 Nov 2003 15:32:20 -0000 @@ -1852,7 +1852,7 @@ #define wkh_2_TextualValue /* Parse Textual Value */ \ /* END */ \ - } else if ((val_id == 0) || (val_id >=0x20)) { /* Textual value */ \ + } else if ((val_id == 0) || (val_id >= 0x20)) { /* Textual value */ \ val_str = tvb_get_stringz (tvb, val_start, &val_len); \ g_assert(val_str); \ offset = val_start + val_len; \ @@ -1988,7 +1988,7 @@ parameter_tree = proto_item_add_subtree (ti, \ ett_header); \ while (off < offset) { \ - off = parameter (parameter_tree, ti, tvb, off, offset - off); \ + off += parameter (parameter_tree, ti, tvb, off, offset - off); \ } \ } \ \ @@ -2105,7 +2105,7 @@ parameter_tree = proto_item_add_subtree (ti, ett_header); while (off < offset) { - off = parameter (parameter_tree, ti, tvb, off, offset - off); + off += parameter (parameter_tree, ti, tvb, off, offset - off); } } @@ -2158,7 +2158,7 @@ if (ok && (off < offset)) { /* Add Q-value if available */ \ parameter_tree = proto_item_add_subtree (ti, \ ett_header); \ - off = parameter_value_q (parameter_tree, ti, tvb, off); \ + off += parameter_value_q (parameter_tree, ti, tvb, off); \ } \ \ wkh_4_End(hf_hdr_ ## underscored); \ @@ -2513,7 +2513,7 @@ /* Remember: offset == val_start + val_len_len + val_len */ if (off < offset) { /* Add Q-value if available */ parameter_tree = proto_item_add_subtree(ti, ett_header); - off = parameter_value_q(parameter_tree, ti, tvb, off); + off += parameter_value_q(parameter_tree, ti, tvb, off); } } wkh_4_End(hf_hdr_accept_encoding); @@ -2522,6 +2522,12 @@ /* * Content-disposition-value = + * Value-length ( Disposition ) *( Parameter ) + * Disposition = Form-data | Attachment | Inline | Token-text + * Form-data = 0x80 + * Attachment = 0x81 + * Inline = 0x82 + * We handle this as: * Value-length ( Short-integer | Text-string ) *( Parameter ) */ static guint32 @@ -2541,7 +2547,7 @@ off = val_start + val_len_len; peek = tvb_get_guint8(tvb, off); if (is_short_integer(peek)) { - switch (val_id) { + switch (peek) { case 0x80: /* form-data */ ti = proto_tree_add_string(tree, hf_hdr_content_disposition, tvb, hdr_start, offset - hdr_start, "form-data"); @@ -2570,12 +2576,12 @@ } if (ok) { /* Remember: offset == val_start + val_len_len + val_len */ - while (off < offset) { /* Add Q-value if available */ + while (off < offset) { /* Add parameters values if available */ parameter_tree = proto_item_add_subtree(ti, ett_header); - off = parameter_value_q(parameter_tree, ti, tvb, off); + off += parameter(parameter_tree, ti, tvb, off, offset - off); } } - wkh_4_End(hf_hdr_accept_encoding); + wkh_4_End(hf_hdr_content_disposition); } @@ -2931,7 +2937,7 @@ off += len; \ /* Auth-params: parameter - TODO */ \ while (off < offset) /* Parse parameters */ \ - off = parameter(subtree, ti, tvb, off, offset - off); \ + off += parameter(subtree, ti, tvb, off, offset - off); \ } \ } \ } \ @@ -3013,7 +3019,7 @@ off += len; \ /* Auth-params: parameter - TODO */ \ while (off < offset) /* Parse parameters */ \ - off = parameter(subtree, ti, tvb, off, offset - off); \ + off += parameter(subtree, ti, tvb, off, offset - off); \ } \ } \ wkh_4_End(hf_hdr_ ## underscored); \ @@ -3093,7 +3099,7 @@ /* NULL subtree for parameter() results in no subtree * TODO - provide a single parameter dissector that appends data * to the header field data. */ - off = parameter(NULL, ti, tvb, off, offset - off); + off += parameter(NULL, ti, tvb, off, offset - off); ok = TRUE; wkh_4_End(hf_hdr_pragma); }
- Follow-Ups:
- Prev by Date: Re: [Ethereal-dev] Ethereal GUI
- Next by Date: Re: [Ethereal-dev] [PATCH][WSP]Parsing of Parameter and Content-Disposition
- Previous by thread: Re: [Ethereal-dev] RTP Analysis: How to get raw RTP packet offset and size
- Next by thread: Re: [Ethereal-dev] [PATCH][WSP]Parsing of Parameter and Content-Disposition
- Index(es):