Remove ADDRESS macros and just have their lower-case equivalents.
[metze/wireshark/wip.git] / caputils / 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 #include <glib.h>
31
32 typedef enum {
33         IF_WIRED,
34         IF_AIRPCAP,
35         IF_PIPE,
36         IF_STDIN,
37         IF_BLUETOOTH,
38         IF_WIRELESS,
39         IF_DIALUP,
40         IF_USB,
41 #ifdef HAVE_EXTCAP
42         IF_EXTCAP,
43 #endif
44         IF_VIRTUAL
45 } interface_type;
46
47 /*
48  * The list of interfaces returned by "get_interface_list()" is
49  * a list of these structures.
50  */
51 typedef struct {
52         char    *name;          /* e.g. "eth0" */
53         char    *friendly_name; /* from OS, e.g. "Local Area Connection", or
54                                    NULL if not available */
55         char    *vendor_description;
56                                 /* vendor description from pcap_findalldevs(),
57                                    e.g. "Realtek PCIe GBE Family Controller",
58                                    or NULL if not available */
59         GSList  *addrs;         /* containing address values of if_addr_t */
60         interface_type type;    /* type of interface */
61         gboolean loopback;      /* TRUE if loopback, FALSE otherwise */
62 #ifdef HAVE_EXTCAP
63         char    *extcap;                /* extcap arguments, which present the data to call the extcap interface */
64 #endif
65 } if_info_t;
66
67 /*
68  * An address in the "addrs" list.
69  */
70 typedef enum {
71         IF_AT_IPv4,
72         IF_AT_IPv6
73 } if_address_type;
74
75 typedef struct {
76         if_address_type ifat_type;
77         union {
78                 guint32 ip4_addr;   /*  4 byte IP V4 address, or */
79                 guint8 ip6_addr[16];/* 16 byte IP V6 address */
80         } addr;
81 } if_addr_t;
82
83 /**
84  * Fetch the interface list from a child process.
85  */
86 extern GList *capture_interface_list(int *err, char **err_str, void (*update_cb)(void));
87
88 /* Error values from "get_interface_list()/capture_interface_list()". */
89 #define CANT_GET_INTERFACE_LIST 1       /* error getting list */
90 #define DONT_HAVE_PCAP          2       /* couldn't load WinPcap */
91
92 void free_interface_list(GList *if_list);
93
94 /*
95  * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer
96  * to an allocated instance of this structure.  "free_if_capabilities()"
97  * frees the returned instance.
98  */
99 typedef struct {
100         gboolean        can_set_rfmon;  /* TRUE if can be put into monitor mode */
101         GList           *data_link_types;       /* GList of data_link_info_t's */
102 } if_capabilities_t;
103
104 /*
105  * Information about data link types.
106  */
107 typedef struct {
108         int     dlt;            /* e.g. DLT_EN10MB (which is 1) */
109         char    *name;          /* e.g. "EN10MB" or "DLT 1" */
110         char    *description;   /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
111 } data_link_info_t;
112
113 /**
114  * Fetch the linktype list for the specified interface from a child process.
115  */
116 extern if_capabilities_t *
117 capture_get_if_capabilities(const gchar *devname, gboolean monitor_mode,
118                             const gchar *auth_string,
119                             char **err_str, void (*update_cb)(void));
120
121 void free_if_capabilities(if_capabilities_t *caps);
122
123 void add_interface_to_remote_list(if_info_t *if_info);
124
125 #ifdef __cplusplus
126 }
127 #endif /* __cplusplus */
128
129 #endif /* __CAPTURE_IFINFO_H__ */