added PSML output to the printing dialog
svn path=/trunk/; revision=10628
This commit is contained in:
parent
5c550c3788
commit
f4564cf6aa
|
@ -1,7 +1,7 @@
|
||||||
/* print_dlg.c
|
/* print_dlg.c
|
||||||
* Dialog boxes for printing
|
* Dialog boxes for printing
|
||||||
*
|
*
|
||||||
* $Id: print_dlg.c,v 1.66 2004/04/16 18:17:48 ulfl Exp $
|
* $Id: print_dlg.c,v 1.67 2004/04/17 11:50:14 ulfl Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -83,6 +83,7 @@ static gchar * print_cmd;
|
||||||
|
|
||||||
#define PRINT_PS_RB_KEY "printer_ps_radio_button"
|
#define PRINT_PS_RB_KEY "printer_ps_radio_button"
|
||||||
#define PRINT_PDML_RB_KEY "printer_pdml_radio_button"
|
#define PRINT_PDML_RB_KEY "printer_pdml_radio_button"
|
||||||
|
#define PRINT_PSML_RB_KEY "printer_psml_radio_button"
|
||||||
#define PRINT_DEST_CB_KEY "printer_destination_check_button"
|
#define PRINT_DEST_CB_KEY "printer_destination_check_button"
|
||||||
|
|
||||||
#define PRINT_SUMMARY_CB_KEY "printer_summary_check_button"
|
#define PRINT_SUMMARY_CB_KEY "printer_summary_check_button"
|
||||||
|
@ -321,7 +322,7 @@ file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
||||||
GtkWidget *main_vb;
|
GtkWidget *main_vb;
|
||||||
|
|
||||||
GtkWidget *printer_fr, *printer_vb;
|
GtkWidget *printer_fr, *printer_vb;
|
||||||
GtkWidget *text_rb, *ps_rb, *pdml_rb;
|
GtkWidget *text_rb, *ps_rb, *pdml_rb, *psml_rb;
|
||||||
GtkWidget *printer_tb, *dest_cb;
|
GtkWidget *printer_tb, *dest_cb;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
GtkWidget *cmd_lb, *cmd_te;
|
GtkWidget *cmd_lb, *cmd_te;
|
||||||
|
@ -410,7 +411,7 @@ file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
||||||
gtk_box_pack_start(GTK_BOX(printer_vb), ps_rb, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(printer_vb), ps_rb, FALSE, FALSE, 0);
|
||||||
gtk_widget_show(ps_rb);
|
gtk_widget_show(ps_rb);
|
||||||
|
|
||||||
pdml_rb = RADIO_BUTTON_NEW_WITH_MNEMONIC(text_rb, "PDM_L (XML)", accel_group);
|
pdml_rb = RADIO_BUTTON_NEW_WITH_MNEMONIC(text_rb, "PDM_L (XML: Packet Details Markup Language)", accel_group);
|
||||||
if (print_format == PR_FMT_PDML)
|
if (print_format == PR_FMT_PDML)
|
||||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(pdml_rb), TRUE);
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(pdml_rb), TRUE);
|
||||||
gtk_tooltips_set_tip (tooltips, pdml_rb, (
|
gtk_tooltips_set_tip (tooltips, pdml_rb, (
|
||||||
|
@ -420,6 +421,16 @@ file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
||||||
gtk_box_pack_start(GTK_BOX(printer_vb), pdml_rb, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(printer_vb), pdml_rb, FALSE, FALSE, 0);
|
||||||
gtk_widget_show(pdml_rb);
|
gtk_widget_show(pdml_rb);
|
||||||
|
|
||||||
|
psml_rb = RADIO_BUTTON_NEW_WITH_MNEMONIC(text_rb, "PSML (XML: Packet Summary Markup Language)", accel_group);
|
||||||
|
if (print_format == PR_FMT_PSML)
|
||||||
|
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(psml_rb), TRUE);
|
||||||
|
gtk_tooltips_set_tip (tooltips, psml_rb, (
|
||||||
|
"Print output in \"PSML\" (Packet Summary Markup Language), "
|
||||||
|
"an XML based packet summary interchange format. "
|
||||||
|
"Usually used in combination with the \"Output to file\" option to export packet data into an XML file."), NULL);
|
||||||
|
gtk_box_pack_start(GTK_BOX(printer_vb), psml_rb, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show(psml_rb);
|
||||||
|
|
||||||
/* printer table */
|
/* printer table */
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
printer_tb = gtk_table_new(2, 3, FALSE);
|
printer_tb = gtk_table_new(2, 3, FALSE);
|
||||||
|
@ -700,6 +711,7 @@ file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
|
||||||
|
|
||||||
OBJECT_SET_DATA(ok_bt, PRINT_PS_RB_KEY, ps_rb);
|
OBJECT_SET_DATA(ok_bt, PRINT_PS_RB_KEY, ps_rb);
|
||||||
OBJECT_SET_DATA(ok_bt, PRINT_PDML_RB_KEY, pdml_rb);
|
OBJECT_SET_DATA(ok_bt, PRINT_PDML_RB_KEY, pdml_rb);
|
||||||
|
OBJECT_SET_DATA(ok_bt, PRINT_PSML_RB_KEY, psml_rb);
|
||||||
OBJECT_SET_DATA(ok_bt, PRINT_DEST_CB_KEY, dest_cb);
|
OBJECT_SET_DATA(ok_bt, PRINT_DEST_CB_KEY, dest_cb);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
OBJECT_SET_DATA(ok_bt, PRINT_CMD_TE_KEY, cmd_te);
|
OBJECT_SET_DATA(ok_bt, PRINT_CMD_TE_KEY, cmd_te);
|
||||||
|
@ -868,6 +880,9 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
|
||||||
button = (GtkWidget *)OBJECT_GET_DATA(ok_bt, PRINT_PDML_RB_KEY);
|
button = (GtkWidget *)OBJECT_GET_DATA(ok_bt, PRINT_PDML_RB_KEY);
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button)))
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button)))
|
||||||
print_format = PR_FMT_PDML;
|
print_format = PR_FMT_PDML;
|
||||||
|
button = (GtkWidget *)OBJECT_GET_DATA(ok_bt, PRINT_PSML_RB_KEY);
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button)))
|
||||||
|
print_format = PR_FMT_PSML;
|
||||||
print_args.format = print_format;
|
print_args.format = print_format;
|
||||||
|
|
||||||
button = (GtkWidget *)OBJECT_GET_DATA(ok_bt, PRINT_SUMMARY_CB_KEY);
|
button = (GtkWidget *)OBJECT_GET_DATA(ok_bt, PRINT_SUMMARY_CB_KEY);
|
||||||
|
|
54
print.c
54
print.c
|
@ -1,7 +1,7 @@
|
||||||
/* print.c
|
/* print.c
|
||||||
* Routines for printing packet analysis trees.
|
* Routines for printing packet analysis trees.
|
||||||
*
|
*
|
||||||
* $Id: print.c,v 1.75 2004/04/17 09:02:32 ulfl Exp $
|
* $Id: print.c,v 1.76 2004/04/17 11:50:13 ulfl Exp $
|
||||||
*
|
*
|
||||||
* Gilbert Ramirez <gram@alumni.rice.edu>
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
||||||
*
|
*
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
#include "packet-frame.h"
|
#include "packet-frame.h"
|
||||||
|
|
||||||
#define PDML_VERSION "0"
|
#define PDML_VERSION "0"
|
||||||
|
#define PSML_VERSION "0"
|
||||||
|
|
||||||
static void proto_tree_print_node(proto_node *node, gpointer data);
|
static void proto_tree_print_node(proto_node *node, gpointer data);
|
||||||
static void proto_tree_print_node_pdml(proto_node *node, gpointer data);
|
static void proto_tree_print_node_pdml(proto_node *node, gpointer data);
|
||||||
|
@ -51,6 +52,7 @@ static void print_hex_data_buffer(FILE *fh, register const guchar *cp,
|
||||||
register guint length, char_enc encoding, gint format);
|
register guint length, char_enc encoding, gint format);
|
||||||
static void ps_clean_string(unsigned char *out, const unsigned char *in,
|
static void ps_clean_string(unsigned char *out, const unsigned char *in,
|
||||||
int outbuf_size);
|
int outbuf_size);
|
||||||
|
static void print_escaped_xml(FILE *fh, char *unescaped_string);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int level;
|
int level;
|
||||||
|
@ -93,6 +95,7 @@ proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
|
||||||
FILE *fh)
|
FILE *fh)
|
||||||
{
|
{
|
||||||
print_data data;
|
print_data data;
|
||||||
|
gint i;
|
||||||
|
|
||||||
/* Create the output */
|
/* Create the output */
|
||||||
data.level = 0;
|
data.level = 0;
|
||||||
|
@ -106,8 +109,12 @@ proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
|
||||||
data.format = print_args->format;
|
data.format = print_args->format;
|
||||||
data.edt = edt;
|
data.edt = edt;
|
||||||
|
|
||||||
if (data.format == PR_FMT_PDML) {
|
switch(data.format) {
|
||||||
|
case(PR_FMT_TEXT): /* fall through */
|
||||||
|
case(PR_FMT_PS):
|
||||||
|
proto_tree_children_foreach(edt->tree, proto_tree_print_node, &data);
|
||||||
|
break;
|
||||||
|
case(PR_FMT_PDML):
|
||||||
fprintf(fh, "<packet>\n");
|
fprintf(fh, "<packet>\n");
|
||||||
|
|
||||||
/* Print a "geninfo" protocol as required by PDML */
|
/* Print a "geninfo" protocol as required by PDML */
|
||||||
|
@ -116,9 +123,33 @@ proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
|
||||||
proto_tree_children_foreach(edt->tree, proto_tree_print_node_pdml, &data);
|
proto_tree_children_foreach(edt->tree, proto_tree_print_node_pdml, &data);
|
||||||
|
|
||||||
fprintf(fh, "</packet>\n\n");
|
fprintf(fh, "</packet>\n\n");
|
||||||
}
|
break;
|
||||||
else {
|
case(PR_FMT_PSML):
|
||||||
proto_tree_children_foreach(edt->tree, proto_tree_print_node, &data);
|
/* if this is the first packet, we have to create the PSML structure output */
|
||||||
|
if(edt->pi.fd->num == 1) {
|
||||||
|
fprintf(fh, "<structure>\n");
|
||||||
|
|
||||||
|
for(i=0; i < edt->pi.cinfo->num_cols; i++) {
|
||||||
|
fprintf(fh, "<section>");
|
||||||
|
print_escaped_xml(fh, edt->pi.cinfo->col_title[i]);
|
||||||
|
fprintf(fh, "</section>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fh, "</structure>\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fh, "<packet>\n");
|
||||||
|
|
||||||
|
for(i=0; i < edt->pi.cinfo->num_cols; i++) {
|
||||||
|
fprintf(fh, "<section>");
|
||||||
|
print_escaped_xml(fh, edt->pi.cinfo->col_data[i]);
|
||||||
|
fprintf(fh, "</section>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fh, "</packet>\n\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,6 +718,11 @@ print_preamble(FILE *fh, gint format)
|
||||||
fputs("<pdml version=\"" PDML_VERSION "\" ", fh);
|
fputs("<pdml version=\"" PDML_VERSION "\" ", fh);
|
||||||
fprintf(fh, "creator=\"%s/%s\">\n", PACKAGE, VERSION);
|
fprintf(fh, "creator=\"%s/%s\">\n", PACKAGE, VERSION);
|
||||||
break;
|
break;
|
||||||
|
case(PR_FMT_PSML):
|
||||||
|
fputs("<?xml version=\"1.0\"?>\n", fh);
|
||||||
|
fputs("<psml version=\"" PSML_VERSION "\" ", fh);
|
||||||
|
fprintf(fh, "creator=\"%s/%s\">\n", PACKAGE, VERSION);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
|
@ -706,6 +742,9 @@ print_finale(FILE *fh, gint format)
|
||||||
case(PR_FMT_PDML):
|
case(PR_FMT_PDML):
|
||||||
fputs("</pdml>\n", fh);
|
fputs("</pdml>\n", fh);
|
||||||
break;
|
break;
|
||||||
|
case(PR_FMT_PSML):
|
||||||
|
fputs("</psml>\n", fh);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
|
@ -743,6 +782,9 @@ print_line(FILE *fh, int indent, gint format, char *line)
|
||||||
case(PR_FMT_PDML):
|
case(PR_FMT_PDML):
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
break;
|
break;
|
||||||
|
case(PR_FMT_PSML):
|
||||||
|
/* do nothing */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
|
|
3
print.h
3
print.h
|
@ -1,7 +1,7 @@
|
||||||
/* print.h
|
/* print.h
|
||||||
* Definitions for printing packet analysis trees.
|
* Definitions for printing packet analysis trees.
|
||||||
*
|
*
|
||||||
* $Id: print.h,v 1.38 2004/04/15 19:56:15 ulfl Exp $
|
* $Id: print.h,v 1.39 2004/04/17 11:50:14 ulfl Exp $
|
||||||
*
|
*
|
||||||
* Gilbert Ramirez <gram@alumni.rice.edu>
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
||||||
*
|
*
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
#define PR_FMT_TEXT 0
|
#define PR_FMT_TEXT 0
|
||||||
#define PR_FMT_PS 1
|
#define PR_FMT_PS 1
|
||||||
#define PR_FMT_PDML 2
|
#define PR_FMT_PDML 2
|
||||||
|
#define PR_FMT_PSML 3
|
||||||
|
|
||||||
/* print_range, enum which frames should be printed */
|
/* print_range, enum which frames should be printed */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Reference in New Issue