Wireshark  4.3.0
The Wireshark network protocol analyzer
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
18 extern "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  */
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;
37 
38 /*
39  * The list of interfaces returned by "get_interface_list()" is
40  * a list of these structures.
41  */
42 typedef struct {
43  char *name; /* e.g. "eth0" */
44  char *friendly_name; /* from OS, e.g. "Local Area Connection", or
45  NULL if not available */
46  char *vendor_description;
47  /* vendor description from pcap_findalldevs(),
48  e.g. "Realtek PCIe GBE Family Controller",
49  or NULL if not available */
50  GSList *addrs; /* containing address values of if_addr_t */
51  interface_type type; /* type of interface */
52  bool loopback; /* true if loopback, false otherwise */
53  char *extcap; /* extcap arguments, which present the data to call the extcap interface */
54 } if_info_t;
55 
56 /*
57  * An address in the "addrs" list.
58  */
59 typedef enum {
60  IF_AT_IPv4,
61  IF_AT_IPv6
62 } if_address_type;
63 
64 typedef struct {
65  if_address_type ifat_type;
66  union {
67  uint32_t ip4_addr; /* 4 byte IP V4 address, or */
68  uint8_t ip6_addr[16];/* 16 byte IP V6 address */
69  } addr;
70 } if_addr_t;
71 
78 extern GList *capture_interface_list(int *err, char **err_str, void (*update_cb)(void));
79 
80 /* Error values from "get_interface_list()/capture_interface_list()". */
81 #define CANT_GET_INTERFACE_LIST 1 /* error getting list */
82 #define DONT_HAVE_PCAP 2 /* couldn't load WinPcap/Npcap */
83 
84 void free_interface_list(GList *if_list);
85 
90 extern if_info_t *if_info_get(const char *name);
91 
96 
97 /*
98  * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer
99  * to an allocated instance of this structure. "free_if_capabilities()"
100  * frees the returned instance.
101  */
102 typedef struct {
103  bool can_set_rfmon; /* true if can be put into monitor mode */
104  GList *data_link_types; /* GList of data_link_info_t's */
105  GList *timestamp_types; /* GList of timestamp_info_t's */
107 
108 /*
109  * Information about data link types.
110  */
111 typedef struct {
112  int dlt; /* e.g. DLT_EN10MB (which is 1) */
113  char *name; /* e.g. "EN10MB" or "DLT 1" */
114  char *description; /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
116 
117 /*
118  * Information about timestamp types.
119  */
120 typedef struct {
121  char *name; /* e.g. "adapter_unsynced" */
122  char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
124 
128 extern if_capabilities_t *
129 capture_get_if_capabilities(const char *devname, bool monitor_mode,
130  const char *auth_string,
131  char **err_primary_msg, char **err_secondary_msg,
132  void (*update_cb)(void));
133 
134 void free_if_capabilities(if_capabilities_t *caps);
135 
136 void add_interface_to_remote_list(if_info_t *if_info);
137 
138 #ifdef __cplusplus
139 }
140 #endif /* __cplusplus */
141 
142 #endif /* __CAPTURE_IFINFO_H__ */
GList * capture_interface_list(int *err, char **err_str, void(*update_cb)(void))
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))
Definition: capture_ifinfo.h:64
Definition: capture_ifinfo.h:102
Definition: capture_ifinfo.h:42
Definition: iptrace.c:57
Definition: capture_ifinfo.h:120