3 * Definitions for routines to get information about capture interfaces
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __CAPTURE_IFINFO_H__
13 #define __CAPTURE_IFINFO_H__
19 #endif /* __cplusplus */
22 * Explicitly set the interface_type enum values as these values are exposed
23 * in the preferences gui.interfaces_hidden_types string.
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.
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 */
49 char *primary_msg
; /* If non-NULL, the query failed, and a message explaining why */
50 const char *secondary_msg
; /* An optional supplementary message */
54 * The list of interfaces returned by "get_interface_list()" is
55 * a list of these structures.
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 */
69 if_capabilities_t
*caps
;
73 * An address in the "addrs" list.
81 if_address_type ifat_type
;
83 uint32_t ip4_addr
; /* 4 byte IP V4 address, or */
84 uint8_t ip6_addr
[16];/* 16 byte IP V6 address */
88 extern GList
*deserialize_interface_list(char *data
, int *err
, char **err_str
);
91 * Return the list of interfaces.
93 * Local interfaces are fetched by running dumpcap.
94 * The remote and extcap interfaces are appended to the list after that.
96 extern GList
*capture_interface_list(int *err
, char **err_str
, void (*update_cb
)(void));
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 */
102 void free_interface_list(GList
*if_list
);
105 * Deep copy an interface list
107 GList
* interface_list_copy(GList
*if_list
);
110 * Get an if_info_t for a particular interface.
111 * (May require privilege, so should only be used by dumpcap.)
113 extern if_info_t
*if_info_get(const char *name
);
118 void if_info_free(if_info_t
*if_info
);
121 * Deep copy an if_info_t.
123 if_info_t
*if_info_copy(const if_info_t
*if_info
);
126 * Deep copy an if_addr_t.
128 if_addr_t
*if_addr_copy(const if_addr_t
*if_addr
);
133 const char *auth_username
;
134 const char *auth_password
;
138 * Information about data link types.
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 */
147 * Information about timestamp types.
150 char *name
; /* e.g. "adapter_unsynced" */
151 char *description
; /* description from libpcap e.g. "Adapter, not synced with system time" */
155 * Fetch the linktype list for the specified interface from a child process.
157 extern if_capabilities_t
*
158 capture_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));
164 * Fetch the linktype list for the specified interface from a child process.
167 capture_get_if_list_capabilities(GList
*if_cap_queries
,
168 char **err_primary_msg
, char **err_secondary_msg
,
169 void (*update_cb
)(void));
171 void free_if_capabilities(if_capabilities_t
*caps
);
173 #ifdef HAVE_PCAP_REMOTE
174 void add_interface_to_remote_list(if_info_t
*if_info
);
176 GList
* append_remote_list(GList
*iflist
);
181 #endif /* __cplusplus */
183 #endif /* __CAPTURE_IFINFO_H__ */