Fix compilation of packet-aruba-erm.c
[metze/wireshark/wip.git] / 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  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __CAPTURE_IFINFO_H__
24 #define __CAPTURE_IFINFO_H__
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 typedef enum {
31         IF_WIRED,
32         IF_AIRPCAP,
33         IF_PIPE,
34         IF_STDIN,
35         IF_BLUETOOTH,
36         IF_WIRELESS,
37         IF_DIALUP,
38         IF_USB,
39         IF_VIRTUAL
40 } interface_type;
41
42 /*
43  * The list of interfaces returned by "get_interface_list()" is
44  * a list of these structures.
45  */
46 typedef struct {
47         char    *name;          /* e.g. "eth0" */
48         char    *friendly_name; /* from OS, e.g. "Local Area Connection", or
49                                    NULL if not available */
50         char    *vendor_description;
51                                 /* vendor description from pcap_findalldevs(),
52                                    e.g. "Realtek PCIe GBE Family Controller",
53                                    or NULL if not available */
54         GSList  *addrs;         /* containing address values of if_addr_t */
55         interface_type type;    /* type of interface */
56         gboolean loopback;      /* TRUE if loopback, FALSE otherwise */
57 } if_info_t;
58
59 /*
60  * An address in the "addrs" list.
61  */
62 typedef enum {
63         IF_AT_IPv4,
64         IF_AT_IPv6
65 } if_address_type;
66
67 typedef struct {
68         if_address_type ifat_type;
69         union {
70                 guint32 ip4_addr;   /*  4 byte IP V4 address, or */
71                 guint8 ip6_addr[16];/* 16 byte IP V6 address */
72         } addr;
73 } if_addr_t;
74
75 /**
76  * Fetch the interface list from a child process.
77  */
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 NO_INTERFACES_FOUND     2       /* list is empty */
83 #define DONT_HAVE_PCAP          3       /* couldn't load WinPcap */
84
85 void free_interface_list(GList *if_list);
86
87 /*
88  * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer
89  * to an allocated instance of this structure.  "free_if_capabilities()"
90  * frees the returned instance.
91  */
92 typedef struct {
93         gboolean        can_set_rfmon;  /* TRUE if can be put into monitor mode */
94         GList           *data_link_types;       /* GList of data_link_info_t's */
95 } if_capabilities_t;
96
97 /*
98  * Information about data link types.
99  */
100 typedef struct {
101         int     dlt;            /* e.g. DLT_EN10MB (which is 1) */
102         char    *name;          /* e.g. "EN10MB" or "DLT 1" */
103         char    *description;   /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
104 } data_link_info_t;
105
106 /**
107  * Fetch the linktype list for the specified interface from a child process.
108  */
109 extern if_capabilities_t *
110 capture_get_if_capabilities(const char *devname, gboolean monitor_mode,
111                             char **err_str, void (*update_cb)(void));
112
113 void free_if_capabilities(if_capabilities_t *caps);
114
115 void add_interface_to_remote_list(if_info_t *if_info);
116
117 #ifdef __cplusplus
118 }
119 #endif /* __cplusplus */
120
121 #endif /* __CAPTURE_IFINFO_H__ */