epan/dissectors/pidl/drsuapi/drsuapi.cnf unicodePwd, ntPasswdHistory, Newer-Keys
[wireshark-sm.git] / capture / capture_ifinfo.h
blob021e19132296cdc7ab5727e0b2376862d46d2097
1 /** @file
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__
15 #include <glib.h>
17 #ifdef __cplusplus
18 extern "C" {
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.
25 typedef 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;
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.
43 typedef 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 */
51 } if_capabilities_t;
54 * The list of interfaces returned by "get_interface_list()" is
55 * a list of these structures.
57 typedef 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 */
69 if_capabilities_t *caps;
70 } if_info_t;
73 * An address in the "addrs" list.
75 typedef enum {
76 IF_AT_IPv4,
77 IF_AT_IPv6
78 } if_address_type;
80 typedef 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;
88 extern GList *deserialize_interface_list(char *data, int *err, char **err_str);
90 /**
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);
116 * Free an if_info_t.
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);
130 typedef struct {
131 const char *name;
132 bool monitor_mode;
133 const char *auth_username;
134 const char *auth_password;
135 } if_cap_query_t;
138 * Information about data link types.
140 typedef 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 */
144 } data_link_info_t;
147 * Information about timestamp types.
149 typedef struct {
150 char *name; /* e.g. "adapter_unsynced" */
151 char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
152 } timestamp_info_t;
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.
166 extern GHashTable *
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);
177 #endif
179 #ifdef __cplusplus
181 #endif /* __cplusplus */
183 #endif /* __CAPTURE_IFINFO_H__ */