Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
capture_ifinfo.h
Go to the documentation of this file.
1
12#ifndef __CAPTURE_IFINFO_H__
13#define __CAPTURE_IFINFO_H__
14
15#include <glib.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/*
22 * Explicitly set the interface_type enum values as these values are exposed
23 * in the preferences gui.interfaces_hidden_types string.
24 */
25typedef enum {
26 IF_WIRED = 0,
27 IF_AIRPCAP = 1,
28 IF_PIPE = 2,
29 IF_STDIN = 3,
30 IF_BLUETOOTH = 4,
31 IF_WIRELESS = 5,
32 IF_DIALUP = 6,
33 IF_USB = 7,
34 IF_EXTCAP = 8,
35 IF_VIRTUAL = 9,
36 IF_LOOPBACK = 10,
37 IF_TUNNEL = 11,
38} interface_type;
39
40/*
41 * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer
42 * to an allocated instance of this structure. "free_if_capabilities()"
43 * frees the returned instance.
44 */
45typedef struct {
46 bool can_set_rfmon; /* true if can be put into monitor mode */
47 GList *data_link_types; /* GList of data_link_info_t's */
48 GList *data_link_types_rfmon; /* GList of data_link_info_t's */
49 GList *timestamp_types; /* GList of timestamp_info_t's */
50 int status;
51 char *primary_msg; /* If non-NULL, the query failed, and a message explaining why */
52 const char *secondary_msg; /* An optional supplementary message */
54
55/*
56 * The list of interfaces returned by "get_interface_list()" is
57 * a list of these structures.
58 */
59typedef struct {
60 char *name; /* e.g. "eth0" */
61 char *friendly_name; /* from OS, e.g. "Local Area Connection", or
62 NULL if not available */
63 char *vendor_description;
64 /* vendor description from pcap_findalldevs()
65 on Windows, e.g. "Realtek PCIe GBE Family Controller",
66 or NULL if not available */
67 GSList *addrs; /* containing address values of if_addr_t */
68 interface_type type; /* type of interface */
69 bool loopback; /* true if loopback, false otherwise */
70 char *extcap; /* extcap arguments, which present the data to call the extcap interface */
72} if_info_t;
73
83
90typedef struct {
92 union {
93 uint32_t ip4_addr;
94 uint8_t ip6_addr[16];
95 } addr;
96} if_addr_t;
97
107extern GList *deserialize_interface_list(char *data, int *err, char **err_str);
108
122extern GList *capture_interface_list(const char* app_name, int *err, char **err_str, void (*update_cb)(void));
123
124/* Error values from "get_interface_list()/capture_interface_list()". */
125#define CANT_GET_INTERFACE_LIST 1 /* error getting list */
126#define DONT_HAVE_PCAP 2 /* couldn't load WinPcap/Npcap */
127
133void free_interface_list(GList *if_list);
134
140GList * interface_list_copy(GList *if_list);
141
148extern if_info_t *if_info_get(const char *name);
149
155
162
169
170typedef struct {
171 const char *name;
172 bool monitor_mode;
173 const char *auth_username;
174 const char *auth_password;
176
177/*
178 * Information about data link types.
179 */
180typedef struct {
181 int dlt; /* e.g. DLT_EN10MB (which is 1) */
182 char *name; /* e.g. "EN10MB" or "DLT 1" */
183 char *description; /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
185
186/*
187 * Information about timestamp types.
188 */
189typedef struct {
190 char *name; /* e.g. "adapter_unsynced" */
191 char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
193
197extern if_capabilities_t *
198capture_get_if_capabilities(const char* app_name, const char *devname, bool monitor_mode,
199 const char *auth_string,
200 char **err_primary_msg, char **err_secondary_msg,
201 void (*update_cb)(void));
202
206extern GHashTable *
207capture_get_if_list_capabilities(const char* app_name, GList *if_cap_queries,
208 char **err_primary_msg, char **err_secondary_msg,
209 void (*update_cb)(void));
210
217
218#ifdef HAVE_PCAP_REMOTE
219void add_interface_to_remote_list(if_info_t *if_info);
220
221GList* append_remote_list(GList *iflist);
222#endif
223
224#ifdef __cplusplus
225}
226#endif /* __cplusplus */
227
228#endif /* __CAPTURE_IFINFO_H__ */
void free_interface_list(GList *if_list)
Free an interface list.
GHashTable * capture_get_if_list_capabilities(const char *app_name, GList *if_cap_queries, char **err_primary_msg, char **err_secondary_msg, void(*update_cb)(void))
if_info_t * if_info_copy(const if_info_t *if_info)
Deep copy an if_info_t.
if_capabilities_t * capture_get_if_capabilities(const char *app_name, const char *devname, bool monitor_mode, const char *auth_string, char **err_primary_msg, char **err_secondary_msg, void(*update_cb)(void))
void free_if_capabilities(if_capabilities_t *caps)
Frees the memory allocated for interface capabilities.
GList * capture_interface_list(const char *app_name, int *err, char **err_str, void(*update_cb)(void))
Get the list of capture interfaces.
if_addr_t * if_addr_copy(const if_addr_t *if_addr)
Deep copy an if_addr_t.
GList * interface_list_copy(GList *if_list)
Deep copy an interface list.
if_address_type
Enumeration of supported interface address types.
Definition capture_ifinfo.h:79
@ IF_AT_IPv6
Definition capture_ifinfo.h:81
@ IF_AT_IPv4
Definition capture_ifinfo.h:80
if_info_t * if_info_get(const char *name)
Get an if_info_t for a particular interface.
void if_info_free(if_info_t *if_info)
Free an if_info_t.
GList * deserialize_interface_list(char *data, int *err, char **err_str)
Deserialize a serialized interface list into a GList.
Represents an IP address in an interface address list.
Definition capture_ifinfo.h:90
if_address_type ifat_type
Definition capture_ifinfo.h:91
uint32_t ip4_addr
Definition capture_ifinfo.h:93
Definition capture_ifinfo.h:170
Definition capture_ifinfo.h:45
Definition capture_ifinfo.h:59
Definition iptrace.c:70
Definition capture_ifinfo.h:189