2 * Utility definitions for packet capture
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __PCAP_UTIL_H__
26 #define __PCAP_UTIL_H__
32 #endif /* __cplusplus */
34 #include <epan/address.h>
37 * XXX - this is also the traditional default snapshot size in
38 * tcpdump - but, if IPv6 is enabled, it defaults to 96, to get an
39 * IPv6 header + TCP + 22 extra bytes.
41 * Some libpcap versions for particular capture devices might happen
42 * to impose a minimum, but it's not always 68.
44 #define MIN_PACKET_SIZE 68 /* minimum amount of packet data we can read */
46 #define MAX_WIN_IF_NAME_LEN 511
49 * The list of interfaces returned by "get_interface_list()" is
50 * a list of these structures.
55 GSList *ip_addr; /* containing address values */
60 * An address in the "ip_addr" list.
70 GList *get_interface_list(int *err, char *err_str);
72 /* Error values from "get_interface_list()". */
73 #define CANT_GET_INTERFACE_LIST 0 /* error getting list */
74 #define NO_INTERFACES_FOUND 1 /* list is empty */
76 void free_interface_list(GList *if_list);
79 * Get an error message string for a CANT_GET_INTERFACE_LIST error from
80 * "get_interface_list()".
82 gchar *cant_get_if_list_error_message(const char *err_str);
85 * The list of data link types returned by "get_pcap_linktype_list()" is
86 * a list of these structures.
94 int get_pcap_linktype(pcap_t *pch, char *devname);
95 GList *get_pcap_linktype_list(char *devname, char *err_buf);
96 void free_pcap_linktype_list(GList *linktype_list);
97 const char *set_pcap_linktype(pcap_t *pch, char *devname, int dlt);
101 #endif /* __cplusplus */
103 #endif /* HAVE_LIBPCAP */
106 * Append to a GString an indication of the version of libpcap/WinPcap
107 * with which we were compiled, if we were, or an indication that we
108 * weren't compiled with libpcap/WinPcap, if we weren't.
110 extern void get_compiled_pcap_version(GString *str);
113 * Append to a GString an indication of the version of libpcap/WinPcap
114 * with which we're running, or an indication that we're not running
115 * with libpcap/WinPcap, if we were compiled with libpcap/WinPcap,
116 * or nothing, if we weren't compiled with libpcap/WinPcap.
118 extern void get_runtime_pcap_version(GString *str);
120 #endif /* __PCAP_UTIL_H__ */