http://bugs.ethereal.com/bugzilla/show_bug.cgi?id=377
[obnox/wireshark/wip.git] / print.c
diff --git a/print.c b/print.c
index 9c5f8f0f63c6ce11f306b2d853437b82c1e0fbef..63adb1f9c6c3d19e08c5304194a62074b915f14b 100644 (file)
--- a/print.c
+++ b/print.c
@@ -228,7 +228,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
 {
        field_info      *fi = PITEM_FINFO(node);
        write_pdml_data *pdata = (write_pdml_data*) data;
-       gchar           *label_ptr;
+       const gchar     *label_ptr;
        gchar           label_str[ITEM_LABEL_LENGTH];
        char            *dfilter_string;
        int             chop_len;
@@ -346,7 +346,15 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
                        }
                        if (fi->length > 0) {
                                fputs("\" value=\"", pdata->fh);
-                               write_pdml_field_hex_value(pdata, fi);
+
+                               if (fi->hfinfo->bitmask!=0) {
+                                       fprintf(pdata->fh, "%X", fvalue_get_integer(&fi->value));
+                                       fputs("\" unmaskedvalue=\"", pdata->fh);
+                                       write_pdml_field_hex_value(pdata, fi);
+                               }
+                               else {
+                    write_pdml_field_hex_value(pdata, fi);
+                }
                        }
                }
 
@@ -513,6 +521,37 @@ write_psml_finale(FILE *fh)
        fputs("</psml>\n", fh);
 }
 
+void
+write_csv_preamble(FILE *fh _U_)
+{
+
+}
+
+void
+proto_tree_write_csv(epan_dissect_t *edt, FILE *fh)
+{
+        gint    i;
+
+        /* if this is the first packet, we have to write the CSV header */
+        if(edt->pi.fd->num == 1) {
+            for(i=0; i < edt->pi.cinfo->num_cols - 1; i++)
+               fprintf(fh, "\"%s\", ", edt->pi.cinfo->col_title[i]);
+
+            fprintf(fh, "\"%s\"\n", edt->pi.cinfo->col_title[i]);
+        }
+
+        for(i=0; i < edt->pi.cinfo->num_cols - 1; i++)
+            fprintf(fh, "\"%s\", ", edt->pi.cinfo->col_data[i]);
+
+        fprintf(fh, "\"%s\"\n", edt->pi.cinfo->col_data[i]);
+}
+
+void
+write_csv_finale(FILE *fh _U_)
+{
+
+}
+
 /*
  * Find the data source for a specified field, and return a pointer
  * to the data in it. Returns NULL if the data is out of bounds.
@@ -640,6 +679,8 @@ print_hex_data(print_stream_t *stream, epan_dissect_t *edt)
                        g_free(line);
                }
                length = tvb_length(tvb);
+               if (length == 0)
+                   return TRUE;
                cp = tvb_get_ptr(tvb, 0, length);
                if (!print_hex_data_buffer(stream, cp, length,
                    edt->pi.fd->flags.encoding))