Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
capture_ifinfo.h
1 /* capture_ifinfo.h
2  * Definitions for routines to get information about capture interfaces
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef __CAPTURE_IFINFO_H__
12 #define __CAPTURE_IFINFO_H__
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 
18 #include <glib.h>
19 
20 typedef enum {
21  IF_WIRED,
22  IF_AIRPCAP,
23  IF_PIPE,
24  IF_STDIN,
25  IF_BLUETOOTH,
26  IF_WIRELESS,
27  IF_DIALUP,
28  IF_USB,
29  IF_EXTCAP,
30  IF_VIRTUAL
31 } interface_type;
32 
33 /*
34  * The list of interfaces returned by "get_interface_list()" is
35  * a list of these structures.
36  */
37 typedef struct {
38  char *name; /* e.g. "eth0" */
39  char *friendly_name; /* from OS, e.g. "Local Area Connection", or
40  NULL if not available */
41  char *vendor_description;
42  /* vendor description from pcap_findalldevs(),
43  e.g. "Realtek PCIe GBE Family Controller",
44  or NULL if not available */
45  GSList *addrs; /* containing address values of if_addr_t */
46  interface_type type; /* type of interface */
47  gboolean loopback; /* TRUE if loopback, FALSE otherwise */
48  char *extcap; /* extcap arguments, which present the data to call the extcap interface */
49 } if_info_t;
50 
51 /*
52  * An address in the "addrs" list.
53  */
54 typedef enum {
55  IF_AT_IPv4,
56  IF_AT_IPv6
57 } if_address_type;
58 
59 typedef struct {
60  if_address_type ifat_type;
61  union {
62  guint32 ip4_addr; /* 4 byte IP V4 address, or */
63  guint8 ip6_addr[16];/* 16 byte IP V6 address */
64  } addr;
65 } if_addr_t;
66 
70 extern GList *capture_interface_list(int *err, char **err_str, void (*update_cb)(void));
71 
72 /* Error values from "get_interface_list()/capture_interface_list()". */
73 #define CANT_GET_INTERFACE_LIST 1 /* error getting list */
74 #define DONT_HAVE_PCAP 2 /* couldn't load WinPcap */
75 
76 void free_interface_list(GList *if_list);
77 
78 /*
79  * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer
80  * to an allocated instance of this structure. "free_if_capabilities()"
81  * frees the returned instance.
82  */
83 typedef struct {
84  gboolean can_set_rfmon; /* TRUE if can be put into monitor mode */
85  GList *data_link_types; /* GList of data_link_info_t's */
86  GList *timestamp_types; /* GList of timestamp_info_t's */
88 
89 /*
90  * Information about data link types.
91  */
92 typedef struct {
93  int dlt; /* e.g. DLT_EN10MB (which is 1) */
94  char *name; /* e.g. "EN10MB" or "DLT 1" */
95  char *description; /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
97 
98 /*
99  * Information about timestamp types.
100  */
101 typedef struct {
102  char *name; /* e.g. "adapter_unsynced" */
103  char *description; /* description from libpcap e.g. "Adapter, not synced with system time" */
105 
109 extern if_capabilities_t *
110 capture_get_if_capabilities(const gchar *devname, gboolean monitor_mode,
111  const gchar *auth_string,
112  char **err_str, void (*update_cb)(void));
113 
114 void free_if_capabilities(if_capabilities_t *caps);
115 
116 void add_interface_to_remote_list(if_info_t *if_info);
117 
118 #ifdef __cplusplus
119 }
120 #endif /* __cplusplus */
121 
122 #endif /* __CAPTURE_IFINFO_H__ */
Definition: capture_ifinfo.h:83
Definition: capture_ifinfo.h:101
Definition: capture_ifinfo.h:59
Definition: capture_ifinfo.h:37