Add dissection of Class Based Flow Control Pause frames.
[obnox/wireshark/wip.git] / capture-pcap-util.h
1 /* capture-pcap-util.h
2  * Utility definitions for packet capture
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
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.
14  *
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.
19  *
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.
23  */
24
25 #ifndef __CAPTURE_PCAP_UTIL_H__
26 #define __CAPTURE_PCAP_UTIL_H__
27
28 #ifdef HAVE_LIBPCAP
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 #include <pcap.h>
35
36 /*
37  * A snapshot length of 0 is useless - and libpcap/WinPcap don't guarantee
38  * that a snapshot length of 0 will work, and, on some platforms, it won't
39  * (with BPF, for example, the kernel is told the snapshot length via the
40  * return value of the BPF program, and a return value of 0 means "drop
41  * the packet"), so the minimum packet size is 1 byte.
42  */
43 #define MIN_PACKET_SIZE 1       /* minimum amount of packet data we can read */
44
45 GList *get_interface_list(int *err, char **err_str);
46 #ifdef HAVE_PCAP_REMOTE
47 GList *get_remote_interface_list(const char *hostname, const char *port,
48                                  int auth_type, const char *username,
49                                  const char *passwd, int *err, char **err_str);
50 #endif
51
52 GList *get_pcap_linktype_list(const char *devname, char **err_str);
53
54 /* get/set the link type of an interface */
55 /* (only used in capture_loop.c / capture-pcap-util.c) */
56 int get_pcap_linktype(pcap_t *pch, const char *devname);
57
58
59 const char *linktype_val_to_name(int dlt);
60 int linktype_name_to_val(const char *linktype);
61
62 #ifdef __cplusplus
63 }
64 #endif /* __cplusplus */
65
66 #endif /* HAVE_LIBPCAP */
67
68 /*
69  * Append to a GString an indication of the version of libpcap/WinPcap
70  * with which we were compiled, if we were, or an indication that we
71  * weren't compiled with libpcap/WinPcap, if we weren't.
72  */
73 extern void get_compiled_pcap_version(GString *str);
74
75 /*
76  * Append to a GString an indication of the version of libpcap/WinPcap
77  * with which we're running, or an indication that we're not running
78  * with libpcap/WinPcap, if we were compiled with libpcap/WinPcap,
79  * or nothing, if we weren't compiled with libpcap/WinPcap.
80  */
81 extern void get_runtime_pcap_version(GString *str);
82
83 #endif /* __CAPTURE_PCAP_UTIL_H__ */