|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include <stdio.h>#include <epan/epan.h>#include <epan/packet.h>#include <epan/print_stream.h>#include <wsutil/json_dumper.h>#include "ws_symbol_export.h"Go to the source code of this file.
Typedefs | |
| typedef struct _output_fields | output_fields_t |
| typedef GSList *(* | proto_node_children_grouper_func) (proto_node *node) |
Enumerations | |
| enum | print_format_e { PR_FMT_TEXT , PR_FMT_PS } |
| Output format for printed packet data. More... | |
| enum | print_dissections_e { print_dissections_none , print_dissections_collapsed , print_dissections_as_displayed , print_dissections_expanded } |
| Controls the level of protocol dissection detail included in printed output. More... | |
| enum | fields_format { FORMAT_CSV , FORMAT_JSON , FORMAT_EK , FORMAT_XML } |
| Output serialization format for field export (e.g., via tshark -T). More... | |
| enum | pf_flags { PF_NONE = 0x00 , PF_INCLUDE_CHILDREN = 0x01 } |
| Bitmask flags controlling protocol field printing behavior. More... | |
Functions | |
| WS_DLL_PUBLIC output_fields_t * | output_fields_new (void) |
| Create a new instance of output_fields_t. | |
| WS_DLL_PUBLIC void | output_fields_free (output_fields_t *info) |
| Free the memory allocated for an output_fields_t structure. | |
| WS_DLL_PUBLIC void | output_fields_add (output_fields_t *info, const char *field) |
| Adds a field to the output fields list. | |
| WS_DLL_PUBLIC GSList * | output_fields_valid (output_fields_t *info) |
| Retrieves the list of valid output fields. | |
| WS_DLL_PUBLIC size_t | output_fields_num_fields (output_fields_t *info) |
| Gets the number of fields in the output fields list. | |
| WS_DLL_PUBLIC bool | output_fields_set_option (output_fields_t *info, char *option) |
| Sets an option for the output fields. | |
| WS_DLL_PUBLIC void | output_fields_list_options (FILE *fh) |
| Outputs the list of available fields to a file handle. | |
| WS_DLL_PUBLIC bool | output_fields_add_protocolfilter (output_fields_t *info, const char *field, pf_flags filter_flags) |
| Adds a protocol filter to the output fields. | |
| WS_DLL_PUBLIC bool | output_fields_has_cols (output_fields_t *info) |
| Checks if the output fields have columns. | |
| WS_DLL_PUBLIC void | output_fields_prime_edt (struct epan_dissect *edt, output_fields_t *info) |
| Outputs fields in a prime EDT format. | |
| WS_DLL_PUBLIC bool | proto_tree_print (print_dissections_e print_dissections, bool print_hex_data, epan_dissect_t *edt, GHashTable *output_only_tables, print_stream_t *stream) |
| Prints the protocol tree. | |
| WS_DLL_PUBLIC bool | print_hex_data (print_stream_t *stream, epan_dissect_t *edt, unsigned hexdump_options) |
| Prints hexadecimal data to a stream. | |
| WS_DLL_PUBLIC void | write_pdml_preamble (FILE *fh, const char *filename, const char *doc_dir) |
| Writes the preamble for a PDML (Packet Data Markup Language) file. | |
| WS_DLL_PUBLIC void | write_pdml_proto_tree (output_fields_t *fields, epan_dissect_t *edt, column_info *cinfo, FILE *fh, bool use_color) |
| Writes a protocol tree in PDML format to a file. | |
| WS_DLL_PUBLIC void | write_pdml_finale (FILE *fh) |
| Writes the final PDML tag to the file. | |
| WS_DLL_PUBLIC GSList * | proto_node_group_children_by_unique (proto_node *node) |
| WS_DLL_PUBLIC GSList * | proto_node_group_children_by_json_key (proto_node *node) |
| WS_DLL_PUBLIC json_dumper | write_json_preamble (FILE *fh) |
| Writes the JSON preamble to the specified file handle. | |
| WS_DLL_PUBLIC void | write_json_proto_tree (output_fields_t *fields, print_dissections_e print_dissections, bool print_hex_data, epan_dissect_t *edt, column_info *cinfo, proto_node_children_grouper_func node_children_grouper, json_dumper *dumper) |
| Writes a protocol tree to JSON format. | |
| WS_DLL_PUBLIC void | write_json_finale (json_dumper *dumper) |
| Ends JSON output. | |
| WS_DLL_PUBLIC void | write_ek_proto_tree (output_fields_t *fields, bool print_summary, bool print_hex_data, epan_dissect_t *edt, column_info *cinfo, FILE *fh) |
| Writes protocol tree data in a specific format to a file. | |
| WS_DLL_PUBLIC void | write_psml_preamble (column_info *cinfo, FILE *fh) |
| Writes the PSML preamble to the specified file. | |
| WS_DLL_PUBLIC void | write_psml_columns (epan_dissect_t *edt, FILE *fh, bool use_color) |
| Writes PSML columns to a file. | |
| WS_DLL_PUBLIC void | write_psml_finale (FILE *fh) |
| Writes the final PSML tag to the file. | |
| WS_DLL_PUBLIC void | write_csv_column_titles (column_info *cinfo, FILE *fh) |
| Writes CSV column titles to a file. | |
| WS_DLL_PUBLIC void | write_csv_columns (epan_dissect_t *edt, FILE *fh) |
| Writes CSV columns to a file. | |
| WS_DLL_PUBLIC void | write_carrays_hex_data (uint32_t num, FILE *fh, epan_dissect_t *edt) |
| Writes hexadecimal data from a list of data sources to a file. | |
| WS_DLL_PUBLIC void | write_fields_preamble (output_fields_t *fields, FILE *fh) |
| Writes the preamble for fields output. | |
| WS_DLL_PUBLIC void | write_fields_proto_tree (output_fields_t *fields, epan_dissect_t *edt, column_info *cinfo, FILE *fh) |
| Writes specified fields to a protocol tree. | |
| WS_DLL_PUBLIC void | write_fields_finale (output_fields_t *fields, FILE *fh) |
| Writes the finale for fields output. | |
| WS_DLL_PUBLIC char * | get_node_field_value (field_info *fi, epan_dissect_t *edt) |
| Retrieves the value of a node field. | |
| void | print_cache_field_handles (void) |
| Prints cache field handles. | |
Definitions for printing packet analysis trees.
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
| enum fields_format |
| enum pf_flags |
| enum print_dissections_e |
Controls the level of protocol dissection detail included in printed output.
| enum print_format_e |
| WS_DLL_PUBLIC char * get_node_field_value | ( | field_info * | fi, |
| epan_dissect_t * | edt | ||
| ) |
Retrieves the value of a node field.
| fi | Pointer to the field_info structure containing the field information. |
| edt | Pointer to the epan_dissect_t structure containing the dissection context. |
| WS_DLL_PUBLIC void output_fields_add | ( | output_fields_t * | info, |
| const char * | field | ||
| ) |
Adds a field to the output fields list.
| info | Pointer to the output_fields_t structure. |
| field | The field to be added. |
| WS_DLL_PUBLIC bool output_fields_add_protocolfilter | ( | output_fields_t * | info, |
| const char * | field, | ||
| pf_flags | filter_flags | ||
| ) |
Adds a protocol filter to the output fields.
| info | Pointer to the output_fields_t structure. |
| field | The name of the field to be added as a protocol filter. |
| filter_flags | Flags to specify how the protocol filter should be applied (e.g., whether to include child fields). |
| WS_DLL_PUBLIC void output_fields_free | ( | output_fields_t * | info | ) |
Free the memory allocated for an output_fields_t structure.
| info | Pointer to the output_fields_t structure to be freed. |
| WS_DLL_PUBLIC bool output_fields_has_cols | ( | output_fields_t * | info | ) |
Checks if the output fields have columns.
| info | Pointer to the output_fields_t structure. |
| WS_DLL_PUBLIC void output_fields_list_options | ( | FILE * | fh | ) |
Outputs the list of available fields to a file handle.
| fh | File handle where the list of fields will be printed. |
| WS_DLL_PUBLIC output_fields_t * output_fields_new | ( | void | ) |
Create a new instance of output_fields_t.
| WS_DLL_PUBLIC size_t output_fields_num_fields | ( | output_fields_t * | info | ) |
Gets the number of fields in the output fields list.
| info | Pointer to the output_fields_t structure. |
| WS_DLL_PUBLIC void output_fields_prime_edt | ( | struct epan_dissect * | edt, |
| output_fields_t * | info | ||
| ) |
Outputs fields in a prime EDT format.
| edt | The epan_dissect structure containing packet information. |
| info | The output_fields_t structure containing field information. |
| WS_DLL_PUBLIC bool output_fields_set_option | ( | output_fields_t * | info, |
| char * | option | ||
| ) |
Sets an option for the output fields.
| info | Pointer to the output_fields_t structure. |
| option | The option to set. |
| WS_DLL_PUBLIC GSList * output_fields_valid | ( | output_fields_t * | info | ) |
Retrieves the list of valid output fields.
| info | Pointer to the output_fields_t structure. |
|
extern |
Prints cache field handles.
This function retrieves and prints the IDs of the "Data" and "Frame" protocol fields.
| WS_DLL_PUBLIC bool print_hex_data | ( | print_stream_t * | stream, |
| epan_dissect_t * | edt, | ||
| unsigned | hexdump_options | ||
| ) |
Prints hexadecimal data to a stream.
| stream | The output stream where the hex data will be printed. |
| edt | The epan dissector context containing the packet information. |
| hexdump_options | Options for how the hex data should be displayed. |
| WS_DLL_PUBLIC GSList * proto_node_group_children_by_json_key | ( | proto_node * | node | ) |
Groups the children of a node by their json key. Children are put in the same group if they have the same json key.
For each different json key we store a linked list of values corresponding to that json key. These lists are kept in both a linked list and a hashmap. The hashmap is used to quickly retrieve the values of a json key. The linked list is used to preserve the ordering of keys as they are encountered which is not guaranteed when only using a hashmap.
For each child of the node get the key and get the list of values already associated with that key from the hashmap. If no list exist yet for that key create a new one and add it to both the linked list and hashmap. If a list already exists add the node to that list.
| WS_DLL_PUBLIC GSList * proto_node_group_children_by_unique | ( | proto_node * | node | ) |
Groups each child of the node separately.
| WS_DLL_PUBLIC bool proto_tree_print | ( | print_dissections_e | print_dissections, |
| bool | print_hex_data, | ||
| epan_dissect_t * | edt, | ||
| GHashTable * | output_only_tables, | ||
| print_stream_t * | stream | ||
| ) |
Prints the protocol tree.
| print_dissections | The level of dissection details to print. |
| print_hex_data | Whether to print hexadecimal data. |
| edt | The epan_dissect structure containing packet information. |
| output_only_tables | A hash table of tables to print, or NULL to print all tables. |
| stream | The print stream to which the output will be written. |
| WS_DLL_PUBLIC void write_carrays_hex_data | ( | uint32_t | num, |
| FILE * | fh, | ||
| epan_dissect_t * | edt | ||
| ) |
Writes hexadecimal data from a list of data sources to a file.
| num | Number of data sources to process. |
| fh | File handle where the data will be written. |
| edt | Pointer to the epan_dissect_t structure containing the data sources. |
| WS_DLL_PUBLIC void write_csv_column_titles | ( | column_info * | cinfo, |
| FILE * | fh | ||
| ) |
Writes CSV column titles to a file.
| cinfo | Pointer to the column information structure. |
| fh | File handle where the column titles will be written. |
| WS_DLL_PUBLIC void write_csv_columns | ( | epan_dissect_t * | edt, |
| FILE * | fh | ||
| ) |
Writes CSV columns to a file.
| edt | Pointer to the epan_dissect_t structure containing dissection data. |
| fh | File handle where the CSV columns will be written. |
| WS_DLL_PUBLIC void write_ek_proto_tree | ( | output_fields_t * | fields, |
| bool | print_summary, | ||
| bool | print_hex_data, | ||
| epan_dissect_t * | edt, | ||
| column_info * | cinfo, | ||
| FILE * | fh | ||
| ) |
Writes protocol tree data in a specific format to a file.
| fields | Output fields structure containing relevant information. |
| print_summary | Flag indicating whether to print summary information. |
| print_hex_data | Flag indicating whether to print hexadecimal data. |
| edt | Pointer to the epan_dissect_t structure containing dissection data. |
| cinfo | Pointer to the column_info structure for column formatting. |
| fh | File handle where the output will be written. |
| WS_DLL_PUBLIC void write_fields_finale | ( | output_fields_t * | fields, |
| FILE * | fh | ||
| ) |
Writes the finale for fields output.
| fields | Pointer to the output_fields_t structure containing field information. |
| fh | File handle where the finale will be written. |
| WS_DLL_PUBLIC void write_fields_preamble | ( | output_fields_t * | fields, |
| FILE * | fh | ||
| ) |
Writes the preamble for fields output.
| fields | Pointer to the output_fields_t structure containing field information. |
| fh | File handle where the preamble will be written. |
| WS_DLL_PUBLIC void write_fields_proto_tree | ( | output_fields_t * | fields, |
| epan_dissect_t * | edt, | ||
| column_info * | cinfo, | ||
| FILE * | fh | ||
| ) |
Writes specified fields to a protocol tree.
| fields | The output fields to be written. |
| edt | The dissector information. |
| cinfo | Column information. |
| fh | File handle for output. |
| WS_DLL_PUBLIC void write_json_finale | ( | json_dumper * | dumper | ) |
Ends JSON output.
| dumper | Pointer to the json_dumper structure. |
| WS_DLL_PUBLIC json_dumper write_json_preamble | ( | FILE * | fh | ) |
Writes the JSON preamble to the specified file handle.
| fh | File handle where the JSON output will be written. |
| WS_DLL_PUBLIC void write_json_proto_tree | ( | output_fields_t * | fields, |
| print_dissections_e | print_dissections, | ||
| bool | print_hex_data, | ||
| epan_dissect_t * | edt, | ||
| column_info * | cinfo, | ||
| proto_node_children_grouper_func | node_children_grouper, | ||
| json_dumper * | dumper | ||
| ) |
Writes a protocol tree to JSON format.
| fields | Output fields configuration. |
| print_dissections | Type of dissection to print. |
| print_hex_data | Whether to include hexadecimal data in the output. |
| edt | The epan dissector context. |
| cinfo | Column information. |
| node_children_grouper | Function to group proto node children. |
| dumper | JSON dumper for output. |
| WS_DLL_PUBLIC void write_pdml_finale | ( | FILE * | fh | ) |
Writes the final PDML tag to the file.
| fh | File handle where the PDML finale should be written. |
| WS_DLL_PUBLIC void write_pdml_preamble | ( | FILE * | fh, |
| const char * | filename, | ||
| const char * | doc_dir | ||
| ) |
Writes the preamble for a PDML (Packet Data Markup Language) file.
| fh | File handle to write the preamble to. |
| filename | Name of the capture file, or NULL if not applicable. |
| doc_dir | Directory containing the XML stylesheet. |
| WS_DLL_PUBLIC void write_pdml_proto_tree | ( | output_fields_t * | fields, |
| epan_dissect_t * | edt, | ||
| column_info * | cinfo, | ||
| FILE * | fh, | ||
| bool | use_color | ||
| ) |
Writes a protocol tree in PDML format to a file.
| fields | Output fields structure containing the fields to be printed. |
| edt | Epan dissector information. |
| cinfo | Column information. |
| fh | File handle where the PDML data will be written. |
| use_color | Whether to use color in the output. |
| WS_DLL_PUBLIC void write_psml_columns | ( | epan_dissect_t * | edt, |
| FILE * | fh, | ||
| bool | use_color | ||
| ) |
Writes PSML columns to a file.
| edt | Pointer to epan_dissect_t structure containing dissection data. |
| fh | File handle where the PSML columns will be written. |
| use_color | Boolean indicating whether to use color filtering. |
| WS_DLL_PUBLIC void write_psml_finale | ( | FILE * | fh | ) |
Writes the final PSML tag to the file.
| fh | File handle where the PSML finale will be written. |
| WS_DLL_PUBLIC void write_psml_preamble | ( | column_info * | cinfo, |
| FILE * | fh | ||
| ) |
Writes the PSML preamble to the specified file.
| cinfo | Pointer to column information structure. |
| fh | File handle where the PSML preamble will be written. |