aboutsummaryrefslogtreecommitdiffstats
path: root/print.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-07-27 20:10:02 +0000
committerGuy Harris <guy@alum.mit.edu>2004-07-27 20:10:02 +0000
commit999867b7109f584f2fcb5fb043d4e7e5bc9bd725 (patch)
treee6b6bdbf14c68a335daab799ef0b60ae657ff00d /print.h
parentd03b6c614a7a9c1b341efd5a2091410a9e7e1651 (diff)
downloadwireshark-999867b7109f584f2fcb5fb043d4e7e5bc9bd725.tar.gz
wireshark-999867b7109f584f2fcb5fb043d4e7e5bc9bd725.tar.bz2
wireshark-999867b7109f584f2fcb5fb043d4e7e5bc9bd725.zip
Move the code to open the printer/print file from "print_packets()" to
"print_ok_cb()", and have "print_packets()" just work on a "print_stream_t" handed to it, so that different platforms can open the printer/print file in different ways (opening the file is probably not going to be platform-dependent, but opening the printer will be). svn path=/trunk/; revision=11544
Diffstat (limited to 'print.h')
-rw-r--r--print.h79
1 files changed, 43 insertions, 36 deletions
diff --git a/print.h b/print.h
index 3a0848cc2b..4d32a7a42f 100644
--- a/print.h
+++ b/print.h
@@ -29,6 +29,41 @@
#include <epan/packet.h>
+/*
+ * Print stream code; this provides a "print stream" class with subclasses
+ * of various sorts. Additional subclasses might be implemented elsewhere.
+ */
+struct print_stream;
+
+typedef struct print_stream_ops {
+ gboolean (*print_preamble)(struct print_stream *self, gchar *filename);
+ gboolean (*print_line)(struct print_stream *self, int indent,
+ const char *line);
+ gboolean (*print_bookmark)(struct print_stream *self,
+ const gchar *name, const gchar *title);
+ gboolean (*new_page)(struct print_stream *self);
+ gboolean (*print_finale)(struct print_stream *self);
+ gboolean (*destroy)(struct print_stream *self);
+} print_stream_ops_t;
+
+typedef struct print_stream {
+ const print_stream_ops_t *ops;
+ void *data;
+} print_stream_t;
+
+extern print_stream_t *print_stream_text_new(int to_file, const char *dest);
+extern print_stream_t *print_stream_text_stdio_new(FILE *fh);
+extern print_stream_t *print_stream_ps_new(int to_file, const char *dest);
+extern print_stream_t *print_stream_ps_stdio_new(FILE *fh);
+
+extern gboolean print_preamble(print_stream_t *self, gchar *filename);
+extern gboolean print_line(print_stream_t *self, int indent, const char *line);
+extern gboolean print_bookmark(print_stream_t *self, const gchar *name,
+ const gchar *title);
+extern gboolean new_page(print_stream_t *self);
+extern gboolean print_finale(print_stream_t *self);
+extern gboolean destroy_print_stream(print_stream_t *self);
+
/* print output format */
typedef enum {
PR_FMT_TEXT, /* plain text */
@@ -52,6 +87,7 @@ typedef enum {
} print_dissections_e;
typedef struct {
+ print_stream_t *stream; /* the stream to which we're printing */
print_format_e format; /* plain text or PostScript */
gboolean to_file; /* TRUE if we're printing to a file */
char *file; /* file output pathname */
@@ -67,7 +103,13 @@ typedef struct {
before each new packet */
} print_args_t;
-/* Functions in print.h */
+/*
+ * Higher-level packet-printing code.
+ */
+
+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 proto_tree_write_pdml(epan_dissect_t *edt, FILE *fh);
@@ -77,39 +119,4 @@ extern void write_psml_preamble(FILE *fh);
extern void proto_tree_write_psml(epan_dissect_t *edt, FILE *fh);
extern void write_psml_finale(FILE *fh);
-struct print_stream;
-
-typedef struct print_stream_ops {
- gboolean (*print_preamble)(struct print_stream *self, gchar *filename);
- gboolean (*print_line)(struct print_stream *self, int indent,
- const char *line);
- gboolean (*print_bookmark)(struct print_stream *self,
- const gchar *name, const gchar *title);
- gboolean (*new_page)(struct print_stream *self);
- gboolean (*print_finale)(struct print_stream *self);
- gboolean (*destroy)(struct print_stream *self);
-} print_stream_ops_t;
-
-typedef struct print_stream {
- const print_stream_ops_t *ops;
- void *data;
-} print_stream_t;
-
-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 print_stream_t *print_stream_text_new(int to_file, const char *dest);
-extern print_stream_t *print_stream_text_stdio_new(FILE *fh);
-extern print_stream_t *print_stream_ps_new(int to_file, const char *dest);
-extern print_stream_t *print_stream_ps_stdio_new(FILE *fh);
-
-extern gboolean print_preamble(print_stream_t *self, gchar *filename);
-extern gboolean print_line(print_stream_t *self, int indent, const char *line);
-extern gboolean print_bookmark(print_stream_t *self, const gchar *name,
- const gchar *title);
-extern gboolean new_page(print_stream_t *self);
-extern gboolean print_finale(print_stream_t *self);
-extern gboolean destroy_print_stream(print_stream_t *self);
-
#endif /* print.h */