#include "packet-range.h"
#include "print.h"
#include "ps.h"
-#include "file_util.h"
+#include "version_info.h"
+#include <wsutil/file_util.h>
#include <epan/charsets.h>
#include <epan/dissectors/packet-data.h>
#include <epan/dissectors/packet-frame.h>
/* Open the file or command for output */
if (to_file)
- fh = eth_fopen(dest, "w");
+ fh = ws_fopen(dest, "w");
else
fh = popen(dest, "w");
print_escaped_xml(pdata->fh, fi->hfinfo->abbrev);
#if 0
- /* PDML spec, see:
+ /* PDML spec, see:
* http://analyzer.polito.it/30alpha/docs/dissectors/PDMLSpec.htm
*
* the show fields contains things in 'human readable' format
* showdtl: contains additional details of the field data
* showmap: contains mappings of the field data (e.g. the hostname to an IP address)
*
- * XXX - the showname shouldn't contain the field data itself
- * (like it's contained in the fi->rep->representation).
- * Unfortunately, we don't have the field data representation for
+ * XXX - the showname shouldn't contain the field data itself
+ * (like it's contained in the fi->rep->representation).
+ * Unfortunately, we don't have the field data representation for
* all fields, so this isn't currently possible */
fputs("\" showname=\"", pdata->fh);
print_escaped_xml(pdata->fh, fi->hfinfo->name);
num = fvalue_get_uinteger(&((field_info*)finfo_array->pdata[0])->value);
g_ptr_array_free(finfo_array, FALSE);
- /* frame.pkt_len --> geninfo.len */
- finfo_array = proto_find_finfo(tree, hf_frame_packet_len);
+ /* frame.frame_len --> geninfo.len */
+ finfo_array = proto_find_finfo(tree, hf_frame_len);
if (g_ptr_array_len(finfo_array) < 1) {
return;
}
/* Print geninfo.len */
fprintf(fh,
-" <field name=\"len\" pos=\"0\" show=\"%u\" showname=\"Packet Length\" value=\"%x\" size=\"%u\"/>\n",
+" <field name=\"len\" pos=\"0\" show=\"%u\" showname=\"Frame Length\" value=\"%x\" size=\"%u\"/>\n",
len, len, frame_finfo->length);
/* Print geninfo.caplen */
int i;
const guint8 *pd;
+ if (!fi->ds_tvb)
+ return;
+
if (fi->length > tvb_length_remaining(fi->ds_tvb, fi->start)) {
fprintf(pdata->fh, "field length invalid!");
return;
print_ps_preamble(output->fh);
- fputs("%% Set the font to 10 point\n", output->fh);
- fputs("/Courier findfont 10 scalefont setfont\n", output->fh);
+ fputs("%% Set the font to 8 point\n", output->fh);
+ fputs("/Courier findfont 8 scalefont setfont\n", output->fh);
fputs("\n", output->fh);
fputs("%% the page title\n", output->fh);
ps_clean_string(psbuffer, filename, MAX_PS_LINE_LENGTH);
- fprintf(output->fh, "/eth_pagetitle (%s - Wireshark) def\n", psbuffer);
+ fprintf(output->fh, "/ws_pagetitle (%s - Wireshark " VERSION "%s) def\n", psbuffer, wireshark_svnversion);
fputs("\n", output->fh);
return !ferror(output->fh);
}
fields->fields = NULL; /*Do lazy initialisation */
fields->field_indicies = NULL;
fields->field_values = NULL;
- fields->quote='\0';
+ fields->quote='\0';
return fields;
}
g_ptr_array_free(fields->fields, TRUE);
}
- g_free(fields);
+ g_free(fields);
}
void output_fields_add(output_fields_t* fields, const gchar* field)
info->separator = *option_value;
break;
}
- return TRUE;
+ return TRUE;
}
if(0 == strcmp(option_name, "quote")) {
info->quote='\0';
break;
}
- return TRUE;
+ return TRUE;
}
return FALSE;
fputc(fields->separator, fh);
}
fputs(field, fh);
- }
+ }
fputc('\n', fh);
}
-static void proto_tree_get_node_field_values(proto_node *node, gpointer data)
+static void proto_tree_get_node_field_values(proto_node *node, gpointer data)
{
write_field_data_t *call_data;
field_info *fi;
call_data->fields->field_values[actual_index - 1] = value;
}
}
-
+
/* Recurse here. */
if (node->first_child != NULL) {
proto_tree_children_foreach(node, proto_tree_get_node_field_values,
i = 0;
while( i < fields->fields->len) {
gchar* field = g_ptr_array_index(fields->fields, i);
- /* Store field indicies +1 so that zero is not a valid value,
+ /* Store field indicies +1 so that zero is not a valid value,
* and can be distinguished from NULL as a pointer.
*/
++i;
- g_hash_table_insert(fields->field_indicies, field, GUINT_TO_POINTER(i));
+ g_hash_table_insert(fields->field_indicies, field, GUINT_TO_POINTER(i));
}
}
/* Buffer to store values for this packet */
fields->field_values = ep_alloc_array0(const gchar*, fields->fields->len);
-
+
proto_tree_children_foreach(edt->tree, proto_tree_get_node_field_values,
&data);
{
const guint8 *pd;
+ if (!fi->ds_tvb)
+ return NULL;
+
if (fi->length > tvb_length_remaining(fi->ds_tvb, fi->start)) {
return "field length invalid!";
}