| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
decode_as.h File Reference
`#include "ws_symbol_export.h"`
`#include "ftypes/ftypes.h"`
`#include "packet_info.h"`

Go to the source code of this file.

## Classes
struct | decode_as_value_s
struct | decode_as_s

## Macros
#define | MAX_DECODE_AS_PROMPT_LEN 200
#define | DECODE_AS_ENTRY "decode_as_entry"
#define | DECODE_AS_NONE "(none)"
#define | DECODE_AS_ENTRIES_FILE_NAME "decode_as_entries"

## Typedefs
typedef void(* | build_label_func) (packet_info *pinfo, char *result)
typedef void *(* | build_valid_func) (packet_info *pinfo)
typedef void(* | decode_as_add_to_list_func) (const char *table_name, const char *proto_name, void *value, void *user_data)
typedef void(* | decode_as_populate_list_func) (const char *table_name, decode_as_add_to_list_func add_to_list, void *ui_element)
typedef void(* | decode_as_free_func) (void *value)
typedef void(* | decode_as_add_changed_list_func) (void *data, void *user_data)
typedef bool(* | decode_as_reset_func) (const char *name, const void *pattern)
typedef bool(* | decode_as_change_func) (const char *name, const void *pattern, const void *handle, const char *list_name)
typedef void(* | decode_as_reset_all_func) (void)
typedef void(* | decode_as_build_changed_list_func) (decode_as_add_changed_list_func func, void *user_data)
typedef struct decode_as_value_s | decode_as_value_t
typedef struct decode_as_s | decode_as_t

## Functions
WS_DLL_PUBLIC void | register_decode_as (decode_as_t *reg)
| Register a "Decode As". A copy of the decode_as_t will be maintained by the decode_as module.
WS_DLL_PUBLIC struct dissector_table * | register_decode_as_next_proto (int proto, const char *table_name, const char *ui_name, build_label_func label_func)
WS_DLL_PUBLIC void | decode_as_default_populate_list (const char *table_name, decode_as_add_to_list_func add_to_list, void *ui_element)
| Populate a list with default decode-as values.
WS_DLL_PUBLIC bool | decode_as_default_reset (const char *name, const void *pattern)
| Reset the decode-as settings for a given dissector.
WS_DLL_PUBLIC bool | decode_as_default_change (const char *name, const void *pattern, const void *handle, const char *list_name)
| Add a FT_UINT32 value to dissector table list.
void | load_decode_as_entries (const char *app_env_var_prefix)
| Load "decode as" entries from the current profile.
WS_DLL_PUBLIC int | save_decode_as_entries (const char *app_name, const char *app_env_var_prefix, char **err)
| Write out the "decode as" entries of the current profile.
WS_DLL_PUBLIC void | decode_clear_all (void)
| Clear all "decode as" settings.
WS_DLL_PUBLIC void | decode_cleanup (void)
| Frees memory used by "decode as" routines.
WS_DLL_PUBLIC void | decode_build_reset_list (const char *table_name, ftenum_t selector_type, void *key, void *value, void *user_data)
| Build a list of dissectors to be reset.

## Variables
WS_DLL_PUBLIC GList * | decode_as_list

## Typedef Documentation

## ◆ build_label_func

typedef void(* build_label_func) (packet_info *pinfo, char *result)

callback function definition: return formatted label string

## ◆ build_valid_func

typedef void *(* build_valid_func) (packet_info *pinfo)

callback function definition: return value used to pass to dissector table

## ◆ decode_as_build_changed_list_func

typedef void(* decode_as_build_changed_list_func) (decode_as_add_changed_list_func func, void *user_data)

callback function definition: Special building of a decode as dissector list

## ◆ decode_as_change_func

typedef bool(* decode_as_change_func) (const char *name, const void *pattern, const void *handle, const char *list_name)

callback function definition: Apply value to dissector table

## ◆ decode_as_reset_all_func

typedef void(* decode_as_reset_all_func) (void)

callback function definition: Remove all protocol specific bindings

## ◆ decode_as_reset_func

typedef bool(* decode_as_reset_func) (const char *name, const void *pattern)

callback function definition: Clear value from dissector table

## ◆ decode_as_t

typedef struct decode_as_s decode_as_t

Pulls everything together including the dissector (protocol) name, the "layer type" of the dissector, the dissector table name, the function pointer values as well as handlers for populating, applying and resetting the changes to the dissector table through Decode As GUI functionality. For dissector tables that are an integer or string type, the provided "default" handling functions should suffice.

## ◆ decode_as_value_t

typedef struct decode_as_value_s decode_as_value_t

Contains all of the function pointers (typically just 1) that provide the text explaining the name and use of the value field that will be passed to the dissector table to change the dissection output.

## Function Documentation

## ◆ decode_as_default_change()

WS_DLL_PUBLIC bool decode_as_default_change | ( | const char * | name,
|  | const void * | pattern,
|  | const void * | handle,
|  | const char * | list_name )

Add a FT_UINT32 value to dissector table list.

Parameters

  name | The name of the dissector.
  pattern | The pattern to use for changing the value.
  handle | The handle for the dissector.
  list_name | The name of the list to add the value to.

Returns
  true if the change was successful, false otherwise.

## ◆ decode_as_default_populate_list()

WS_DLL_PUBLIC void decode_as_default_populate_list | ( | const char * | table_name,
|  | decode_as_add_to_list_func | add_to_list,
|  | void * | ui_element )

Populate a list with default decode-as values.

Parameters

  table_name | The name of the dissector table to populate.
  add_to_list | Function pointer to add items to the list.
  ui_element | User interface element for display purposes.

## ◆ decode_as_default_reset()

WS_DLL_PUBLIC bool decode_as_default_reset | ( | const char * | name,
|  | const void * | pattern )

Reset the decode-as settings for a given dissector.

Parameters

  name | The name of the dissector to reset.
  pattern | The pattern to use for resetting.

Returns
  true if the reset was successful, false otherwise.

## ◆ decode_build_reset_list()

WS_DLL_PUBLIC void decode_build_reset_list | ( | const char * | table_name,
|  | ftenum_t | selector_type,
|  | void * | key,
|  | void * | value,
|  | void * | user_data )

Build a list of dissectors to be reset.

This routine creates one entry in the list of protocol dissector that need to be reset. It is called by the g_hash_table_foreach routine once for each changed entry in a dissector table. Unfortunately it cannot delete the entry immediately as this screws up the foreach function, so it builds a list of dissectors to be reset once the foreach routine finishes.

Parameters

  table_name | The table name in which this dissector is found.
  selector_type | The type of the selector in that dissector table
  key | A pointer to the key for this entry in the dissector hash table. This is generally the numeric selector of the protocol, i.e. the ethernet type code, IP port number, TCP port number, etc.
  value | A pointer to the value for this entry in the dissector hash table. This is an opaque pointer that can only be handed back to routine in the file packet.c - but it's unused.
  user_data | Unused.

## ◆ decode_cleanup()

WS_DLL_PUBLIC void decode_cleanup | ( | void |  | ) |

Frees memory used by "decode as" routines.

Frees memory used by "decode as" routines. Called at program shutdown.

## ◆ decode_clear_all()

WS_DLL_PUBLIC void decode_clear_all | ( | void |  | ) |

Clear all "decode as" settings.

Clear all "decode as" settings.

## ◆ load_decode_as_entries()

void load_decode_as_entries | ( | const char * | app_env_var_prefix | ) |
| extern

Load "decode as" entries from the current profile.

Parameters

  app_env_var_prefix | The environment variable prefix for the application.

## ◆ register_decode_as()

WS_DLL_PUBLIC void register_decode_as | ( | decode_as_t * | reg | ) |

Register a "Decode As". A copy of the decode_as_t will be maintained by the decode_as module.

Parameters

  reg | Pointer to the decode_as_t structure containing the protocol registration information.

## ◆ register_decode_as_next_proto()

WS_DLL_PUBLIC struct dissector_table * register_decode_as_next_proto | ( | int | proto,
|  | const char * | table_name,
|  | const char * | ui_name,
|  | build_label_func | label_func )

Register a "Decode As" entry for the special case where there is no indication for the next protocol (such as port number etc.). For now, this will use a uint32 dissector table internally and assign all registered protocols to 0. The framework to do this can be kept internal to epan.

Parameters

  proto | The protocol ID to create the dissector table.
  table_name | The table name in which this dissector is found.
  ui_name | UI name for created dissector table.
  label_func | Pointer to optional function to generate prompt text for dissector. If NULL, "Next level protocol as" is used.

Returns
  Created dissector table with Decode As support

## ◆ save_decode_as_entries()

WS_DLL_PUBLIC int save_decode_as_entries | ( | const char * | app_name,
|  | const char * | app_env_var_prefix,
|  | char ** | err )

Write out the "decode as" entries of the current profile.

Parameters

  app_name | The name of the application.
  app_env_var_prefix | The environment variable prefix.
  err | Pointer to a string where error messages will be stored.

Returns
  The number of entries written, or a negative value on error.

## Variable Documentation

## ◆ decode_as_list

WS_DLL_PUBLIC GList* decode_as_list

List of registered decode_as_t structs. For UI code only. Should not be directly accessed by dissectors.