Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
print_stream.h File Reference
#include "ws_symbol_export.h"
#include <wsutil/color.h>
#include <wsutil/str_util.h>

Go to the source code of this file.

Classes

struct  print_stream_ops
 Vtable of operations implementing a print stream backend for rendering dissection output. More...
 
struct  print_stream
 Represents an abstract print stream, pairing a backend operations vtable with instance-specific state. More...
 

Typedefs

typedef struct print_stream_ops print_stream_ops_t
 Vtable of operations implementing a print stream backend for rendering dissection output.
 
typedef struct print_stream print_stream_t
 Represents an abstract print stream, pairing a backend operations vtable with instance-specific state.
 

Functions

WS_DLL_PUBLIC print_stream_tprint_stream_text_new (bool to_file, const char *dest)
 Create a new print stream for text output.
 
WS_DLL_PUBLIC print_stream_tprint_stream_text_stdio_new (FILE *fh)
 Create a new print stream for text output using standard I/O.
 
WS_DLL_PUBLIC print_stream_tprint_stream_ps_new (bool to_file, const char *dest)
 Create a new print stream for PostScript output.
 
WS_DLL_PUBLIC print_stream_tprint_stream_ps_stdio_new (FILE *fh)
 Create a new print stream for PostScript output using standard I/O.
 
WS_DLL_PUBLIC bool print_preamble (print_stream_t *self, char *filename, const char *version_string)
 Print the preamble to a print stream.
 
WS_DLL_PUBLIC bool print_line (print_stream_t *self, int indent, const char *line)
 Prints a line to the print stream.
 
WS_DLL_PUBLIC bool print_line_color (print_stream_t *self, int indent, const char *line, const color_t *fg, const color_t *bg)
 Print a colored line to a print stream.
 
WS_DLL_PUBLIC bool print_bookmark (print_stream_t *self, const char *name, const char *title)
 Print a bookmark in the print stream.
 
WS_DLL_PUBLIC bool new_page (print_stream_t *self)
 Create a new page in the print stream.
 
WS_DLL_PUBLIC bool print_finale (print_stream_t *self)
 Print the finale of the print stream.
 
WS_DLL_PUBLIC bool destroy_print_stream (print_stream_t *self)
 Destroys a print stream.
 

Detailed Description

Definitions for print streams.

Gilbert Ramirez gram@.nosp@m.alum.nosp@m.ni.ri.nosp@m.ce.e.nosp@m.du

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ destroy_print_stream()

WS_DLL_PUBLIC bool destroy_print_stream ( print_stream_t self)

Destroys a print stream.

Parameters
selfPointer to the print_stream_t structure to be destroyed.
Returns
true if successful, false otherwise.

◆ new_page()

WS_DLL_PUBLIC bool new_page ( print_stream_t self)

Create a new page in the print stream.

Parameters
selfPointer to the print_stream_t object.
Returns
true if successful, false otherwise.

◆ print_bookmark()

WS_DLL_PUBLIC bool print_bookmark ( print_stream_t self,
const char *  name,
const char *  title 
)

Print a bookmark in the print stream.

Parameters
selfPointer to the print_stream_t object.
nameThe name of the bookmark.
titleThe title of the bookmark.
Returns
true if successful, false otherwise.

◆ print_finale()

WS_DLL_PUBLIC bool print_finale ( print_stream_t self)

Print the finale of the print stream.

Parameters
selfPointer to the print_stream_t object.
Returns
true if successful, false otherwise.

◆ print_line()

WS_DLL_PUBLIC bool print_line ( print_stream_t self,
int  indent,
const char *  line 
)

Prints a line to the print stream.

Parameters
selfPointer to the print stream object.
indentNumber of spaces for indentation.
lineThe line to be printed.
Returns
true if the line was successfully printed, false otherwise.

◆ print_line_color()

WS_DLL_PUBLIC bool print_line_color ( print_stream_t self,
int  indent,
const char *  line,
const color_t fg,
const color_t bg 
)

Print a colored line to a print stream.

Equivalent to print_line(), but if the stream supports text coloring then the output text will also be colored with the given foreground and background.

Parameters
selfThe print stream.
indentThe indentation level.
lineThe line of text to print.
fgThe foreground color.
bgThe background color.
Returns
true if the print was successful, false otherwise.

◆ print_preamble()

WS_DLL_PUBLIC bool print_preamble ( print_stream_t self,
char *  filename,
const char *  version_string 
)

Print the preamble to a print stream.

Parameters
selfThe print stream.
filenameThe name of the capture file being printed.
version_stringThe Wireshark version string.
Returns
true if the print was successful, false otherwise.

◆ print_stream_ps_new()

WS_DLL_PUBLIC print_stream_t * print_stream_ps_new ( bool  to_file,
const char *  dest 
)

Create a new print stream for PostScript output.

Parameters
to_fileIf true, output will be written to a file; otherwise, it will be written to standard output.
destThe destination file name.
Returns
Pointer to the newly created print stream, or NULL on failure.

◆ print_stream_ps_stdio_new()

WS_DLL_PUBLIC print_stream_t * print_stream_ps_stdio_new ( FILE *  fh)

Create a new print stream for PostScript output using standard I/O.

Parameters
fhFile handle to write to.
Returns
Pointer to the newly created print stream, or NULL on failure.

◆ print_stream_text_new()

WS_DLL_PUBLIC print_stream_t * print_stream_text_new ( bool  to_file,
const char *  dest 
)

Create a new print stream for text output.

Parameters
to_fileIf true, output will be written to a file; otherwise, it will be written to standard output.
destThe destination file name.
Returns
Pointer to the newly created print stream, or NULL on failure.

◆ print_stream_text_stdio_new()

WS_DLL_PUBLIC print_stream_t * print_stream_text_stdio_new ( FILE *  fh)

Create a new print stream for text output using standard I/O.

Parameters
fhFile handle to write to.
Returns
Pointer to the newly created print stream, or NULL on failure.