diff --git a/CMakeLists.txt b/CMakeLists.txt index d3c6273d41..d51ca90821 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -604,6 +604,7 @@ set(INSTALL_FILES ipmap.html manuf ${CMAKE_BINARY_DIR}/mergecap.html + pdml2html.xsl ${CMAKE_BINARY_DIR}/randpkt.html ${CMAKE_BINARY_DIR}/rawshark.html services diff --git a/Makefile.am b/Makefile.am index 3e16025b11..9e62e09a43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,7 @@ idl2wrs: tools/idl2wrs.sh Makefile # Wireshark configuration files are put in $(pkgdatadir). # pkgdata_DATA = COPYING manuf services cfilters colorfilters dfilters \ - smi_modules ipmap.html + smi_modules ipmap.html pdml2html.xsl # # Install the Diameter DTD and XML files in the "diameter" subdirectory diff --git a/Makefile.nmake b/Makefile.nmake index 28d91a03fc..bbdd2b506b 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -960,6 +960,7 @@ install-generated-files: xcopy "doc\AUTHORS-SHORT" $(INSTALL_DIR) /d xcopy ".\manuf" $(INSTALL_DIR) /d xcopy ".\services" $(INSTALL_DIR) /d + xcopy ".\pdml2html.xsl" $(INSTALL_DIR) /d $(TEXTIFY) "./COPYING" $(INSTALL_DIR) $(TEXTIFY) "./NEWS" $(INSTALL_DIR) $(TEXTIFY) "./README" $(INSTALL_DIR) diff --git a/file.c b/file.c index afdaa0d410..bb103fe05a 100644 --- a/file.c +++ b/file.c @@ -2489,7 +2489,7 @@ cf_write_pdml_packets(capture_file *cf, print_args_t *print_args) if (fh == NULL) return CF_PRINT_OPEN_ERROR; /* attempt to open destination failed */ - write_pdml_preamble(fh); + write_pdml_preamble(fh, cf->filename); if (ferror(fh)) { fclose(fh); return CF_PRINT_WRITE_ERROR; diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index 47b4277545..93555f86f8 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -427,6 +427,7 @@ File "..\..\wireshark-gtk2\README.windows.txt" File "..\..\doc\AUTHORS-SHORT" File "..\..\manuf" File "..\..\services" +File "..\..\pdml2html.xsl" File "..\..\doc\ws.css" File "..\..\doc\wireshark.html" File "..\..\doc\wireshark-filter.html" @@ -1107,6 +1108,7 @@ Delete "$INSTDIR\README*" Delete "$INSTDIR\NEWS.txt" Delete "$INSTDIR\manuf" Delete "$INSTDIR\services" +Delete "$INSTDIR\pdml2html.xsl" Delete "$INSTDIR\pcrepattern.3.txt" Delete "$INSTDIR\user-guide.chm" Delete "$INSTDIR\example_snmp_users_file" diff --git a/pdml2html.xsl b/pdml2html.xsl new file mode 100644 index 0000000000..4239d7f41f --- /dev/null +++ b/pdml2html.xsl @@ -0,0 +1,211 @@ + + + + + + + + + +     + + + + +
+
+ +
+
+
+ + +
+ + + + + + + + + + +
+ + Frame : + + , + + [X] +
+ + + + + + +
+ + + Capture Filename: + PDML created: + + + + + + + + + + poor man's Wireshark + + + + + + + + + +
diff --git a/print.c b/print.c index 1fbaf1acfa..a8788b2aad 100644 --- a/print.c +++ b/print.c @@ -47,6 +47,7 @@ #include #include #include +#include #define PDML_VERSION "0" #define PSML_VERSION "0" @@ -243,12 +244,19 @@ void proto_tree_print_node(proto_node *node, gpointer data) } } +#define PDML2HTML_XSL "pdml2html.xsl" void -write_pdml_preamble(FILE *fh) +write_pdml_preamble(FILE *fh, const gchar* filename) { + time_t t=time(NULL); + char *ts=asctime(localtime(&t)); + ts[strlen(ts)-1]=0; /* overwrite \n */ + fputs("\n", fh); + fputs("\n", fh); + fprintf(fh, "\n", get_datafile_dir()); fputs("\n", PACKAGE, VERSION); + fprintf(fh, "creator=\"%s/%s\" time=\"%s\" capture_file=\"%s\">\n", PACKAGE, VERSION, ts, filename); } void diff --git a/print.h b/print.h index ddbd6be1bb..8ab23ac257 100644 --- a/print.h +++ b/print.h @@ -133,7 +133,7 @@ extern gboolean proto_tree_print(print_args_t *print_args, epan_dissect_t *edt, print_stream_t *stream); extern gboolean print_hex_data(print_stream_t *stream, epan_dissect_t *edt); -extern void write_pdml_preamble(FILE *fh); +extern void write_pdml_preamble(FILE *fh, const gchar* filename); extern void proto_tree_write_pdml(epan_dissect_t *edt, FILE *fh); extern void write_pdml_finale(FILE *fh); diff --git a/tools/colorfilters2js.pl b/tools/colorfilters2js.pl new file mode 100644 index 0000000000..03f09025a3 --- /dev/null +++ b/tools/colorfilters2js.pl @@ -0,0 +1,38 @@ +#!/usr/bin/env perl +# +# perl program to convert a Wireshark color scheme to javascript +# code. The javascript function should then be inserted into the +# pdml2html.xsl file. +# +# run this as: perl tools/colorfilters2js.pl colorfilters + +print<<'EOF'; +function set_node_color(node,colorname) +{ + if(dojo.isString(node)) + node = dojo.byId(node); + if(!node) return; + var fg; + var bg; +EOF + +while(<>) +{ + if(/\@(.+?)\@.+\[(\d+),(\d+),(\d+)\]\[(\d+),(\d+),(\d+)\]/) + { + print " if(colorname == '$1') {\n"; + printf(" bg='#%02x%02x%02x';\n", $2/256, $3/256, $4/256); + printf(" fg='#%02x%02x%02x';\n", $5/256, $6/256, $7/256); + print " }\n"; + } +} + +print<<'EOF'; + if(fg.length > 0) + node.style.color = fg; + if(bg.length > 0) + node.style.background = bg; +} +EOF + +exit 0; diff --git a/tshark.c b/tshark.c index 03c090735b..5db00c8da9 100644 --- a/tshark.c +++ b/tshark.c @@ -3015,7 +3015,7 @@ write_preamble(capture_file *cf) case WRITE_XML: if (verbose) - write_pdml_preamble(stdout); + write_pdml_preamble(stdout, cf->filename); else write_psml_preamble(stdout); return !ferror(stdout);