Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
address_types.h
Go to the documentation of this file.
1
10#pragma once
11#include "address.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif /* __cplusplus */
16
17typedef int (*AddrValueToString)(const address* addr, char *buf, int buf_len);
18typedef int (*AddrValueToStringLen)(const address* addr);
19typedef unsigned (*AddrValueToByte)(const address* addr, uint8_t *buf, unsigned buf_len);
20typedef int (*AddrFixedLen)(void);
21typedef const char* (*AddrColFilterString)(const address* addr, bool src);
22typedef int (*AddrNameResolutionLen)(void);
23typedef const char* (*AddrNameResolutionToString)(const address* addr);
24
25struct _address_type_t;
26typedef struct _address_type_t address_type_t;
27
42WS_DLL_PUBLIC int address_type_dissector_register(const char* name, const char* pretty_name,
43 AddrValueToString to_str_func, AddrValueToStringLen str_len_func,
44 AddrValueToByte to_bytes_func, AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func,
45 AddrNameResolutionToString name_res_str_func, AddrNameResolutionLen name_res_len_func);
46
53WS_DLL_PUBLIC int address_type_get_by_name(const char* name);
54
63int ipv4_to_str(const address* addr, char *buf, int buf_len);
64
71
72/* Address type functions used by multiple (dissector) address types */
73
82int none_addr_to_str(const address* addr, char *buf, int buf_len);
83
90int none_addr_str_len(const address* addr);
91
99int none_addr_len(void);
100
109WS_DLL_PUBLIC int ether_to_str(const address* addr, char *buf, int buf_len);
110
116int ether_str_len(const address* addr);
117
123int ether_len(void);
124
132const char* ether_name_resolution_str(const address* addr);
133
140
141/* XXX - Temporary? Here at least until all of the address type handling is finalized
142 * Otherwise should be folded into address_types.c or just be handled with function pointers
143 */
155const char* address_type_column_filter_string(const address* addr, bool src);
156
157
158#ifdef __cplusplus
159}
160#endif /* __cplusplus */
161
162/*
163 * Editor modelines - https://www.wireshark.org/tools/modelines.html
164 *
165 * Local variables:
166 * c-basic-offset: 4
167 * tab-width: 8
168 * indent-tabs-mode: nil
169 * End:
170 *
171 * vi: set shiftwidth=4 tabstop=8 expandtab:
172 * :indentSize=4:tabSize=8:noTabs=true:
173 */
int ether_len(void)
Get the length of an Ethernet address.
Definition address_types.c:210
int ipv4_to_str(const address *addr, char *buf, int buf_len)
Convert an IPv4 address to a string.
Definition address_types.c:228
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.
Definition address_types.c:103
const char * ether_name_resolution_str(const address *addr)
Get a string representation of an Ethernet address for name resolution.
Definition address_types.c:215
const char * address_type_column_filter_string(const address *addr, bool src)
Return a display‑filter string for the given address and direction.
Definition address_types.c:1181
WS_DLL_PUBLIC int ether_to_str(const address *addr, char *buf, int buf_len)
Convert an Ethernet address to a string representation.
Definition address_types.c:188
int none_addr_str_len(const address *addr)
Calculates the length of a string representation for an address with no type.
WS_DLL_PUBLIC int address_type_get_by_name(const char *name)
Retrieves the address type by its name.
Definition address_types.c:141
int none_addr_len(void)
Returns the length of a none address.
Definition address_types.c:170
int ether_name_resolution_len(void)
Returns the length of the Ethernet name resolution.
Definition address_types.c:220
void address_types_initialize(void)
Initialize the address types system.
Definition address_types.c:694
int none_addr_to_str(const address *addr, char *buf, int buf_len)
Converts a none address to a string.
int ether_str_len(const address *addr)
Calculates the length of a string representation for an Ethernet address.
Definition address_types.c:26
Definition address.h:55