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} interface_type;
37
38/*
39 * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer
40 * to an allocated instance of this structure. "free_if_capabilities()"
41 * frees the returned instance.
42 */
43typedef struct {
44 bool can_set_rfmon; /* true if can be put into monitor mode */
45 GList *data_link_types; /* GList of data_link_info_t's */
46 GList *data_link_types_rfmon; /* GList of data_link_info_t's */
47 GList *timestamp_types; /* GList of timestamp_info_t's */
48 int status;
49 char *primary_msg; /* If non-NULL, the query failed, and a message explaining why */
50 const char *secondary_msg; /* An optional supplementary message */
52
53/*
54 * The list of interfaces returned by "get_interface_list()" is
55 * a list of these structures.
56 */
57typedef struct {
58 char *name; /* e.g. "eth0" */
59 char *friendly_name; /* from OS, e.g. "Local Area Connection", or
60 NULL if not available */
61 char *vendor_description;
62 /* vendor description from pcap_findalldevs(),
63 e.g. "Realtek PCIe GBE Family Controller",
64 or NULL if not available */
65 GSList *addrs; /* containing address values of if_addr_t */
66 interface_type type; /* type of interface */
67 bool loopback; /* true if loopback, false otherwise */
68 char *extcap; /* extcap arguments, which present the data to call the extcap interface */
70} if_info_t;
71
81
88typedef struct {
90 union {
91 uint32_t ip4_addr;
92 uint8_t ip6_addr[16];
93 } addr;
94} if_addr_t;
95
96extern GList *deserialize_interface_list(char *data, int *err, char **err_str);
97
104extern GList *capture_interface_list(const char* app_name, int *err, char **err_str, void (*update_cb)(void));
105
106/* Error values from "get_interface_list()/capture_interface_list()". */
107#define CANT_GET_INTERFACE_LIST 1 /* error getting list */
108#define DONT_HAVE_PCAP 2 /* couldn't load WinPcap/Npcap */
109
110void free_interface_list(GList *if_list);
111
115GList * interface_list_copy(GList *if_list);
116
121extern if_info_t *if_info_get(const char *name);
122
127
132
137
138typedef struct {
139 const char *name;
140 bool monitor_mode;
141 const char *auth_username;
142 const char *auth_password;
144
145/*
146 * Information about data link types.
147 */
148typedef struct {
149 int dlt; /* e.g. DLT_EN10MB (which is 1) */
150 char *name; /* e.g. "EN10MB" or "DLT 1" */
151 char *description; /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
153
154/*
155 * Information about timestamp types.
156 */
157typedef struct {
158 char *name; /* e.g. "adapter_unsynced" */
159 char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
161
165extern if_capabilities_t *
166capture_get_if_capabilities(const char* app_name, const char *devname, bool monitor_mode,
167 const char *auth_string,
168 char **err_primary_msg, char **err_secondary_msg,
169 void (*update_cb)(void));
170
174extern GHashTable *
175capture_get_if_list_capabilities(const char* app_name, GList *if_cap_queries,
176 char **err_primary_msg, char **err_secondary_msg,
177 void (*update_cb)(void));
178
179void free_if_capabilities(if_capabilities_t *caps);
180
181#ifdef HAVE_PCAP_REMOTE
182void add_interface_to_remote_list(if_info_t *if_info);
183
184GList* append_remote_list(GList *iflist);
185#endif
186
187#ifdef __cplusplus
188}
189#endif /* __cplusplus */
190
191#endif /* __CAPTURE_IFINFO_H__ */
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)
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))
GList * capture_interface_list(const char *app_name, int *err, char **err_str, void(*update_cb)(void))
if_addr_t * if_addr_copy(const if_addr_t *if_addr)
GList * interface_list_copy(GList *if_list)
if_address_type
Enumeration of supported interface address types.
Definition capture_ifinfo.h:77
@ IF_AT_IPv6
Definition capture_ifinfo.h:79
@ IF_AT_IPv4
Definition capture_ifinfo.h:78
if_info_t * if_info_get(const char *name)
void if_info_free(if_info_t *if_info)
Represents an IP address in an interface address list.
Definition capture_ifinfo.h:88
if_address_type ifat_type
Definition capture_ifinfo.h:89
uint32_t ip4_addr
Definition capture_ifinfo.h:91
Definition capture_ifinfo.h:138
Definition capture_ifinfo.h:43
Definition capture_ifinfo.h:57
Definition iptrace.c:70
Definition capture_ifinfo.h:157