| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
column.h File Reference
`#include "ws_symbol_export.h"`
`#include <epan/column-utils.h>`

Go to the source code of this file.

## Classes
struct | _fmt_data
| Describes the configuration of a single column in the packet list. More...

## Macros
#define | COLUMN_DISPLAY_VALUES 'U'
#define | COLUMN_DISPLAY_STRINGS 'R'
#define | COLUMN_DISPLAY_DETAILS 'D'

## Typedefs
typedef struct _fmt_data | fmt_data
| Describes the configuration of a single column in the packet list.

## Functions
WS_DLL_PUBLIC const char * | col_format_to_string (const int fmt)
| Convert a column format number to its corresponding string representation.
WS_DLL_PUBLIC const char * | col_format_desc (const int fmt_num)
| Get the description of a column format.
WS_DLL_PUBLIC const char * | col_format_abbrev (const int fmt_num)
| Get the abbreviation of a column format.
WS_DLL_PUBLIC int | get_column_format (const int col)
| Get the format of a column.
WS_DLL_PUBLIC void | set_column_format (const int col, const int fmt)
| Set the format for a column.
WS_DLL_PUBLIC void | get_column_format_matches (bool *fmt_list, const int format)
| Get column format matches based on a boolean array and an integer value.
WS_DLL_PUBLIC int | get_column_format_from_str (const char *str)
| Get the column format number from a string representation.
WS_DLL_PUBLIC char * | get_column_title (const int col)
| Get the title of a column.
WS_DLL_PUBLIC void | set_column_title (const int col, const char *title)
| Set the title of a column.
WS_DLL_PUBLIC bool | get_column_visible (const int col)
| Get the visibility status of a column.
WS_DLL_PUBLIC void | set_column_visible (const int col, bool visible)
| Set the visibility of a column.
WS_DLL_PUBLIC char | get_column_display_format (const int col)
| Get the current display format for a column.
WS_DLL_PUBLIC void | set_column_display_format (const int col, char display)
| Set the display format for a specific column.
WS_DLL_PUBLIC const char * | get_column_custom_fields (const int col)
| Get custom fields for a specific column.
WS_DLL_PUBLIC void | set_column_custom_fields (const int col, const char *custom_fields)
| Set custom fields for a specific column.
WS_DLL_PUBLIC int | get_column_custom_occurrence (const int col)
| Get the custom occurrence of a column.
WS_DLL_PUBLIC void | set_column_custom_occurrence (const int col, const int custom_occurrence)
| Set a custom occurrence for a specific column.
WS_DLL_PUBLIC const char * | get_column_longest_string (const int format)
| Get the text of a column element.
WS_DLL_PUBLIC const char * | get_column_width_string (const int format, const int col)
| Get a string representing the width of a column.
WS_DLL_PUBLIC int | get_column_char_width (const int format)
| Get the character width of a column format.
WS_DLL_PUBLIC char * | get_column_tooltip (const int col)
| Get the tooltip text of a column element.
WS_DLL_PUBLIC const char * | get_column_text (column_info *cinfo, const int col)
| Get the text of a column element.
WS_DLL_PUBLIC void | col_finalize (column_info *cinfo)
| Finalizes a column by compiling custom filters and splitting fields.
WS_DLL_PUBLIC void | build_column_format_array (column_info *cinfo, const int num_cols, const bool reset_fences)
| Build an array of column formats based on the provided parameters.
WS_DLL_PUBLIC void | column_dump_column_formats (void)
| Dump the available column formats and their descriptions to the console.
WS_DLL_PUBLIC bool | parse_column_format (fmt_data *cfmt, const char *fmt)
| Parse a column format string into a fmt_data struct.
char * | column_fmt_data_to_str (const fmt_data *cfmt)
| Given a fmt_data struct, returns the column format string that should be written to the preferences to generate the fmt_data struct. The inverse of parse_column_format() above.
WS_DLL_PUBLIC void | try_convert_to_custom_column (char **fmt)
| Checks a column format string to see if it is a deprecated column that has been migrated to a custom column, and converts the format to the corresponding custom column format if so, otherwise leaving it unchanged.
WS_DLL_PUBLIC const char * | try_convert_to_column_field (const char *field)
| Checks a column field string to see if it is a name of a filter field created using a default column title (as used in tshark -e), and alias it to the new column type based field.
WS_DLL_PUBLIC void | column_register_fields (void)
| Registers all fields for Wireshark columns.

## Detailed Description

Definitions for column handling routines Column preference and format settings.

For internal Wireshark useonly. Don't include this header in dissectors!

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

## Macro Definition Documentation

## ◆ COLUMN_DISPLAY_VALUES

#define COLUMN_DISPLAY_VALUES 'U'

Defines used in fmt_data.display. The values are legacy from U Unresolved and R Resolved stored in the preferences.

## Function Documentation

## ◆ build_column_format_array()

WS_DLL_PUBLIC void build_column_format_array | ( | column_info * | cinfo,
|  | const int | num_cols,
|  | const bool | reset_fences )

Build an array of column formats based on the provided parameters.

Parameters

  cinfo | Pointer to the column information structure.
  num_cols | Number of columns to be processed.
  reset_fences | Flag indicating whether to reset column fences.

## ◆ col_finalize()

WS_DLL_PUBLIC void col_finalize | ( | column_info * | cinfo | ) |

Finalizes a column by compiling custom filters and splitting fields.

Parameters

  cinfo | Pointer to the column information structure.

## ◆ col_format_abbrev()

WS_DLL_PUBLIC const char * col_format_abbrev | ( | const int | fmt_num | ) |

Get the abbreviation of a column format.

Parameters

  fmt_num | The format number to get the abbreviation for.

Returns
  The abbreviation of the column format, or NULL if invalid.

## ◆ col_format_desc()

WS_DLL_PUBLIC const char * col_format_desc | ( | const int | fmt_num | ) |

Get the description of a column format.

Parameters

  fmt_num | The format number to get the description for.

Returns
  The description of the column format, or NULL if invalid.

## ◆ col_format_to_string()

WS_DLL_PUBLIC const char * col_format_to_string | ( | const int | fmt | ) |

Convert a column format number to its corresponding string representation.

Parameters

  fmt | The column format number.

Returns
  The string representation of the column format, or NULL if invalid.

## ◆ column_fmt_data_to_str()

char * column_fmt_data_to_str | ( | const fmt_data * | cfmt | ) |
| extern

Given a fmt_data struct, returns the column format string that should be written to the preferences to generate the fmt_data struct. The inverse of parse_column_format() above.

Parameters

  [in] | cfmt | The fmt_data struct.

Returns
  A column format string that corresponds to the fmt_data. This string is owned by the caller, and must be freed. Returns NULL if cfmt is NULL.

## ◆ column_register_fields()

WS_DLL_PUBLIC void column_register_fields | ( | void |  | ) |

Registers all fields for Wireshark columns.

This function registers all necessary fields for displaying and managing columns in Wireshark. It ensures that the protocol ID is correctly set and then deregisters any existing column fields. If a list of preferred columns is provided, it processes each format to register unique fields.

## ◆ get_column_char_width()

WS_DLL_PUBLIC int get_column_char_width | ( | const int | format | ) |

Get the character width of a column format.

Parameters

  format | The column format identifier.

Returns
  The character width of the specified column format.

## ◆ get_column_custom_fields()

WS_DLL_PUBLIC const char * get_column_custom_fields | ( | const int | col | ) |

Get custom fields for a specific column.

Parameters

  col | The column index.

Returns
  const char* Custom fields string or NULL if invalid column.

## ◆ get_column_custom_occurrence()

WS_DLL_PUBLIC int get_column_custom_occurrence | ( | const int | col | ) |

Get the custom occurrence of a column.

Parameters

  col | The column index.

Returns
  int The custom occurrence value.

## ◆ get_column_display_format()

WS_DLL_PUBLIC char get_column_display_format | ( | const int | col | ) |

Get the current display format for a column.

Parameters

  col | The index of the column.

Returns
  char The current display format.

## ◆ get_column_format()

WS_DLL_PUBLIC int get_column_format | ( | const int | col | ) |

Get the format of a column.

Parameters

  col | The index of the column.

Returns
  The format of the column, or -1 if the column is invalid.

## ◆ get_column_format_from_str()

WS_DLL_PUBLIC int get_column_format_from_str | ( | const char * | str | ) |

Get the column format number from a string representation.

Parameters

  str | The string representation of the column format.

Returns
  The column format number corresponding to the string, or -1 if invalid.

## ◆ get_column_format_matches()

WS_DLL_PUBLIC void get_column_format_matches | ( | bool * | fmt_list,
|  | const int | format )

Get column format matches based on a boolean array and an integer value.

Parameters

  [out] | fmt_list | Array to store the matches.
  [in] | format | Integer value representing the column format.

## ◆ get_column_longest_string()

WS_DLL_PUBLIC const char * get_column_longest_string | ( | const int | format | ) |

Get the text of a column element.

The string returned may vary depending on the format specified.

Parameters

  format | The format of the column.

Returns
  A string representing the longest possible value for the specified column type.

## ◆ get_column_text()

WS_DLL_PUBLIC const char * get_column_text | ( | column_info * | cinfo,
|  | const int | col )

Get the text of a column element.

The string returned may depend on whether the resolved member variable is set. For internal Wireshark use, not to be called from dissectors. Dissectors use col_get_text() in column-utils.h

Parameters

  cinfo | the column information
  col | the column index to use (not the format)

Returns
  the text string

## ◆ get_column_title()

WS_DLL_PUBLIC char * get_column_title | ( | const int | col | ) |

Get the title of a column.

Parameters

  col | The index of the column.

Returns
  char* The title of the column, or NULL if the column is invalid.

## ◆ get_column_tooltip()

WS_DLL_PUBLIC char * get_column_tooltip | ( | const int | col | ) |

Get the tooltip text of a column element.

The string returned may depend on whether the resolved member variable is set. For internal Wireshark use, not to be called from dissectors. Dissectors use col_get_text() in column-utils.h

Parameters

  col | the column index to use (not the format)

Returns
  The tooltip text of the column element or NULL if invalid column requested

## ◆ get_column_visible()

WS_DLL_PUBLIC bool get_column_visible | ( | const int | col | ) |

Get the visibility status of a column.

Parameters

  col | The index of the column to check.

Returns
  true if the column is visible, false otherwise.

## ◆ get_column_width_string()

WS_DLL_PUBLIC const char * get_column_width_string | ( | const int | format,
|  | const int | col )

Get a string representing the width of a column.

Determines the appropriate width for a column based on its format and content.

Parameters

  format | The format of the column.
  col | The index of the column.

Returns
  A string representing the width of the column.

## ◆ parse_column_format()

WS_DLL_PUBLIC bool parse_column_format | ( | fmt_data * | cfmt,
|  | const char * | fmt )

Parse a column format string into a fmt_data struct.

If the format string possibly can be that of a deprecated column that has been migrated to a custom column (e.g., upon first being read from a preference file), call try_convert_to_custom_column() first.

Parameters

  [out] | cfmt | The parsed cfmt, still owned by the caller. For custom columns, the caller is responsible for freeing the custom_fields member as well.
  [in] | fmt | The column format to parse.

Returns
  true if conversion was successful, false if unsuccessful

## ◆ set_column_custom_fields()

WS_DLL_PUBLIC void set_column_custom_fields | ( | const int | col,
|  | const char * | custom_fields )

Set custom fields for a specific column.

Parameters

  col | The index of the column.
  custom_fields | A string containing the custom fields to set.

## ◆ set_column_custom_occurrence()

WS_DLL_PUBLIC void set_column_custom_occurrence | ( | const int | col,
|  | const int | custom_occurrence )

Set a custom occurrence for a specific column.

Parameters

  col | The column index.
  custom_occurrence | The custom occurrence value to set.

## ◆ set_column_display_format()

WS_DLL_PUBLIC void set_column_display_format | ( | const int | col,
|  | char | display )

Set the display format for a specific column.

Parameters

  col | The index of the column to set the display format for.
  display | The new display format character.

## ◆ set_column_format()

WS_DLL_PUBLIC void set_column_format | ( | const int | col,
|  | const int | fmt )

Set the format for a column.

Parameters

  col | The ID of the column to set the format for.
  fmt | The format number to set.

## ◆ set_column_title()

WS_DLL_PUBLIC void set_column_title | ( | const int | col,
|  | const char * | title )

Set the title of a column.

Parameters

  col | The index of the column.
  title | The new title for the column.

## ◆ set_column_visible()

WS_DLL_PUBLIC void set_column_visible | ( | const int | col,
|  | bool | visible )

Set the visibility of a column.

Parameters

  col | The index of the column to set visibility for.
  visible | Whether the column should be visible (true) or not (false).

## ◆ try_convert_to_column_field()

WS_DLL_PUBLIC const char * try_convert_to_column_field | ( | const char * | field | ) |

Checks a column field string to see if it is a name of a filter field created using a default column title (as used in tshark -e), and alias it to the new column type based field.

Parameters

  [in] | field | The old title based field, e.g. "_ws.col.Info"

Returns
  The new field, e.g. "_ws.col.info", or NULL

## ◆ try_convert_to_custom_column()

WS_DLL_PUBLIC void try_convert_to_custom_column | ( | char ** | fmt | ) |

Checks a column format string to see if it is a deprecated column that has been migrated to a custom column, and converts the format to the corresponding custom column format if so, otherwise leaving it unchanged.

Parameters

  [in,out] | fmt | The column format to check and possibly convert.