Ethereal-dev: [Ethereal-dev] Patch (PDML fields less than one byte)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Tue, 24 May 2005 15:31:30 +0100
Title: Message
The export PDML features creates an xml file where the value of the subfields less than 1 byte have the wrong value. Instead of just the bit or part of the byte the value field contains the entire byte.
 
Example:-
 
<field name="tcp.flags.cwr" showname="0... .... = Congestion Window Reduced (CWR): Not set" size="1" pos="47" show="0" value="18" />
 
 
The value field is supposed to represent only the 1st bit but the entire byte is represented as value 18.
This caused a lot of problem in applications which process the xml file for further use.
 
The below patch seems to solve this problem by modifying the value field that is written to the xml file
 
 
-------------------------------------------------
 
--- print.c 2005-05-24 12:52:55.000000000 +0100
+++ print_new.c 2005-05-24 13:08:56.593591576 +0100
@@ -346,6 +346,10 @@
}
    if (fi->length > 0) {
    fputs("\" value=\"", pdata->fh);
+     if (!fi->rep)
+     print_escaped_xml(pdata->fh, &dfilter_string[chop_len]);
+     else
      write_pdml_field_hex_value(pdata, fi);
    }
}