diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-07-04 00:24:02 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-07-04 07:25:26 +0000 |
commit | 9e6487f24751d1c1a047ee82e158077ac67c9c68 (patch) | |
tree | 3cc4a8524062948f4951914dc9af489e0d7c4572 /caputils/capture-pcap-util.h | |
parent | c5643a3d257909ed3e8752cd729b9192ae719683 (diff) |
Move utility routines for capturing into a libcaputils static library.
Some of those routines are used only in dumpcap; others are used in
TShark and Wireshark as well.
Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7
Reviewed-on: https://code.wireshark.org/review/2841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'caputils/capture-pcap-util.h')
-rw-r--r-- | caputils/capture-pcap-util.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/caputils/capture-pcap-util.h b/caputils/capture-pcap-util.h new file mode 100644 index 0000000000..617bcc82e5 --- /dev/null +++ b/caputils/capture-pcap-util.h @@ -0,0 +1,74 @@ +/* capture-pcap-util.h + * Utility definitions for packet capture + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __CAPTURE_PCAP_UTIL_H__ +#define __CAPTURE_PCAP_UTIL_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef HAVE_LIBPCAP + +#include <pcap.h> + +/* + * A snapshot length of 0 is useless - and libpcap/WinPcap don't guarantee + * that a snapshot length of 0 will work, and, on some platforms, it won't + * (with BPF, for example, the kernel is told the snapshot length via the + * return value of the BPF program, and a return value of 0 means "drop + * the packet"), so the minimum packet size is 1 byte. + */ +#define MIN_PACKET_SIZE 1 /* minimum amount of packet data we can read */ + +GList *get_interface_list(int *err, char **err_str); +#ifdef HAVE_PCAP_REMOTE +GList *get_remote_interface_list(const char *hostname, const char *port, + int auth_type, const char *username, + const char *passwd, int *err, char **err_str); +#endif + +const char *linktype_val_to_name(int dlt); +int linktype_name_to_val(const char *linktype); + +#endif /* HAVE_LIBPCAP */ + +/* + * Get the versions of capture libraries with which we were compiled, + * and append them to a GString. + */ +extern void get_compiled_caplibs_version(GString *str); + +/* + * Append to a GString an indication of the version of capture libraries + * with which we're running, or an indication that we're not running + * with capture libraries, if we were compiled with WinPcap but + * WinPcap wasn't loaded, or nothing, if we weren't compiled with + * libpcap/WinPcap. + */ +extern void get_runtime_caplibs_version(GString *str); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CAPTURE_PCAP_UTIL_H__ */ |