Wireshark 4.5.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
72/*
73 * An address in the "addrs" list.
74 */
75typedef enum {
76 IF_AT_IPv4,
77 IF_AT_IPv6
78} if_address_type;
79
80typedef struct {
81 if_address_type ifat_type;
82 union {
83 uint32_t ip4_addr; /* 4 byte IP V4 address, or */
84 uint8_t ip6_addr[16];/* 16 byte IP V6 address */
85 } addr;
86} if_addr_t;
87
88extern GList *deserialize_interface_list(char *data, int *err, char **err_str);
89
96extern GList *capture_interface_list(int *err, char **err_str, void (*update_cb)(void));
97
98/* Error values from "get_interface_list()/capture_interface_list()". */
99#define CANT_GET_INTERFACE_LIST 1 /* error getting list */
100#define DONT_HAVE_PCAP 2 /* couldn't load WinPcap/Npcap */
101
102void free_interface_list(GList *if_list);
103
107GList * interface_list_copy(GList *if_list);
108
113extern if_info_t *if_info_get(const char *name);
114
119
124
129
130typedef struct {
131 const char *name;
132 bool monitor_mode;
133 const char *auth_username;
134 const char *auth_password;
136
137/*
138 * Information about data link types.
139 */
140typedef struct {
141 int dlt; /* e.g. DLT_EN10MB (which is 1) */
142 char *name; /* e.g. "EN10MB" or "DLT 1" */
143 char *description; /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
145
146/*
147 * Information about timestamp types.
148 */
149typedef struct {
150 char *name; /* e.g. "adapter_unsynced" */
151 char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
153
157extern if_capabilities_t *
158capture_get_if_capabilities(const char *devname, bool monitor_mode,
159 const char *auth_string,
160 char **err_primary_msg, char **err_secondary_msg,
161 void (*update_cb)(void));
162
166extern GHashTable *
168 char **err_primary_msg, char **err_secondary_msg,
169 void (*update_cb)(void));
170
171void free_if_capabilities(if_capabilities_t *caps);
172
173#ifdef HAVE_PCAP_REMOTE
174void add_interface_to_remote_list(if_info_t *if_info);
175
176GList* append_remote_list(GList *iflist);
177#endif
178
179#ifdef __cplusplus
180}
181#endif /* __cplusplus */
182
183#endif /* __CAPTURE_IFINFO_H__ */
if_info_t * if_info_copy(const if_info_t *if_info)
GList * capture_interface_list(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_info_t * if_info_get(const char *name)
void if_info_free(if_info_t *if_info)
if_capabilities_t * capture_get_if_capabilities(const char *devname, bool monitor_mode, const char *auth_string, char **err_primary_msg, char **err_secondary_msg, void(*update_cb)(void))
GHashTable * capture_get_if_list_capabilities(GList *if_cap_queries, char **err_primary_msg, char **err_secondary_msg, void(*update_cb)(void))
Definition capture_ifinfo.h:80
Definition capture_ifinfo.h:130
Definition capture_ifinfo.h:43
Definition capture_ifinfo.h:57
Definition iptrace.c:58
Definition capture_ifinfo.h:149