| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Typedefs | Functions
address_types.h File Reference
`#include "address.h"`

Go to the source code of this file.

## Typedefs
typedef int(* | AddrValueToString) (const address *addr, char *buf, int buf_len)
typedef int(* | AddrValueToStringLen) (const address *addr)
typedef unsigned(* | AddrValueToByte) (const address *addr, uint8_t *buf, unsigned buf_len)
typedef int(* | AddrFixedLen) (void)
typedef const char *(* | AddrColFilterString) (const address *addr, bool src)
typedef int(* | AddrNameResolutionLen) (void)
typedef const char *(* | AddrNameResolutionToString) (const address *addr)
typedef struct _address_type_t | address_type_t

## Functions
WS_DLL_PUBLIC int | address_type_dissector_register (const char *name, const char *pretty_name, AddrValueToString to_str_func, AddrValueToStringLen str_len_func, AddrValueToByte to_bytes_func, AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func, AddrNameResolutionToString name_res_str_func, AddrNameResolutionLen name_res_len_func)
| Registers a new address type with various associated functions.
WS_DLL_PUBLIC int | address_type_get_by_name (const char *name)
| Retrieves the address type by its name.
int | ipv4_to_str (const address *addr, char *buf, int buf_len)
| Convert an IPv4 address to a string.
void | address_types_initialize (void)
| Initialize the address types system.
int | none_addr_to_str (const address *addr, char *buf, int buf_len)
| Converts a none address to a string.
int | none_addr_str_len (const address *addr)
| Calculates the length of a string representation for an address with no type.
int | none_addr_len (void)
| Returns the length of a none address.
WS_DLL_PUBLIC int | ether_to_str (const address *addr, char *buf, int buf_len)
| Convert an Ethernet address to a string representation.
int | ether_str_len (const address *addr)
| Calculates the length of a string representation for an Ethernet address.
int | ether_len (void)
| Get the length of an Ethernet address.
const char * | ether_name_resolution_str (const address *addr)
| Get a string representation of an Ethernet address for name resolution.
int | ether_name_resolution_len (void)
| Returns the length of the Ethernet name resolution.
const char * | address_type_column_filter_string (const address *addr, bool src)
| Return a display‑filter string for the given address and direction.

## Detailed Description

Definitions for address types

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

## ◆ address_type_column_filter_string()

const char * address_type_column_filter_string | ( | const address * | addr,
|  | bool | src )

Return a display‑filter string for the given address and direction.

Produces a column‑filter expression appropriate for the specified address, indicating either a source or destination field depending on `src`.

Parameters

  addr | The address to convert into a filter string.
  src | true for a source‑address filter, false for destination.

Returns
  The column filter string, or an empty string if not found.

## ◆ address_type_dissector_register()

WS_DLL_PUBLIC int address_type_dissector_register | ( | const char * | name,
|  | const char * | pretty_name,
|  | AddrValueToString | to_str_func,
|  | AddrValueToStringLen | str_len_func,
|  | AddrValueToByte | to_bytes_func,
|  | AddrColFilterString | col_filter_str_func,
|  | AddrFixedLen | fixed_len_func,
|  | AddrNameResolutionToString | name_res_str_func,
|  | AddrNameResolutionLen | name_res_len_func )

Registers a new address type with various associated functions.

Parameters

  name | The unique identifier for the address type.
  pretty_name | A human-readable name for the address type.
  to_str_func | Function to convert an address value to a string.
  str_len_func | Function to get the length of the string representation of an address value.
  to_bytes_func | Function to convert an address value to bytes.
  col_filter_str_func | Function to generate a column filter string for the address type.
  fixed_len_func | Function to get the fixed length of the address value.
  name_res_str_func | Function to resolve the name of an address value to a string.
  name_res_len_func | Function to get the length of the resolved name string.

Returns
  The registered address type identifier.

## ◆ address_type_get_by_name()

WS_DLL_PUBLIC int address_type_get_by_name | ( | const char * | name | ) |

Retrieves the address type by its name.

Parameters

  name | The name of the address type to retrieve.

Returns
  The address type if found, otherwise -1.

## ◆ address_types_initialize()

void address_types_initialize | ( | void |  | ) |

Initialize the address types system.

Initializes the address types system by registering predefined address types such as AT_NONE and AT_ETHER.

## ◆ ether_len()

int ether_len | ( | void |  | ) |

Get the length of an Ethernet address.

Returns
  The length of an Ethernet address in bytes, which is always 6.

## ◆ ether_name_resolution_len()

int ether_name_resolution_len | ( | void |  | ) |

Returns the length of the Ethernet name resolution.

Returns
  The maximum address string length.

## ◆ ether_name_resolution_str()

const char * ether_name_resolution_str | ( | const address * | addr | ) |

Get a string representation of an Ethernet address for name resolution.

Parameters

  addr | The address structure containing the Ethernet address.

Returns
  A logical name if found in ethers files, or a vendor-prefixed string if the vendor is known, or a full MAC address string otherwise.

## ◆ ether_str_len()

int ether_str_len | ( | const address * | addr | ) |

Calculates the length of a string representation for an Ethernet address.

Returns
  int Length of the string representation, which is always 18.

## ◆ ether_to_str()

WS_DLL_PUBLIC int ether_to_str | ( | const address * | addr,
|  | char * | buf,
|  | int | buf_len )

Convert an Ethernet address to a string representation.

Parameters

  addr | Pointer to the address structure containing the Ethernet address.
  buf | Buffer to store the resulting string.
  buf_len | Length of the buffer.

Returns
  Length of the formatted string, which is always 18

## ◆ ipv4_to_str()

int ipv4_to_str | ( | const address * | addr,
|  | char * | buf,
|  | int | buf_len )

Convert an IPv4 address to a string.

Parameters

  addr | Pointer to the address structure containing the IPv4 address.
  buf | Buffer to store the resulting string.
  buf_len | Length of the buffer.

Returns
  Number of characters written to the buffer, including the null terminator.

## ◆ none_addr_len()

int none_addr_len | ( | void |  | ) |

Returns the length of a none address.

This function calculates and returns the length of a none address.

Returns
  The length of the none address, which is always 0.

## ◆ none_addr_str_len()

int none_addr_str_len | ( | const address * | addr | ) |

Calculates the length of a string representation for an address with no type.

Parameters

  addr | Pointer to the address structure.

Returns
  Length of the string representation, including the null terminator, which is always 1.

## ◆ none_addr_to_str()

int none_addr_to_str | ( | const address * | addr,
|  | char * | buf,
|  | int | buf_len )

Converts a none address to a string.

Parameters

  addr | The address to convert.
  buf | Buffer to store the resulting string.
  buf_len | Length of the buffer.

Returns
  Number of characters written to the buffer, which is always 1 (null byte).