diff options
author | guy <guy> | 2006-10-13 17:46:45 +0000 |
---|---|---|
committer | guy <guy> | 2006-10-13 17:46:45 +0000 |
commit | 455aff8ba9495985ee622ce38d69dd5795d6e2de (patch) | |
tree | 818ac9fc7f32d22bca40e1bc0be4d473e1fcf483 | |
parent | 50ce2663e80dab3e650826fdc391b80a20bda1e7 (diff) |
Move the Linux Bluetooth and USB declarations to a header file.
Clean up some comments.
Protect all references to the USB stuff from the common Linux code with
PCAP_SUPPORT_USB, just as references to the Bluetooth code are protected
with PCAP_SUPPORT_BT.
-rw-r--r-- | FILES | 2 | ||||
-rw-r--r-- | INSTALL.txt | 4 | ||||
-rw-r--r-- | pcap-bt-linux.c | 3 | ||||
-rw-r--r-- | pcap-bt-linux.h | 41 | ||||
-rw-r--r-- | pcap-linux.c | 30 | ||||
-rw-r--r-- | pcap-usb-linux.c | 3 | ||||
-rw-r--r-- | pcap-usb-linux.h | 41 |
7 files changed, 102 insertions, 22 deletions
@@ -82,6 +82,7 @@ pcap/usb.h pcap-bpf.c pcap-bpf.h pcap-bt-linux.c +pcap-bt-linux.h pcap-dag.c pcap-dag.h pcap-dlpi.c @@ -102,6 +103,7 @@ pcap-stdinc.h pcap-snit.c pcap-snoop.c pcap-usb-linux.c +pcap-usb-linux.h pcap-win32.c pcap.3 pcap.c diff --git a/INSTALL.txt b/INSTALL.txt index 5f40c131..020fe081 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,4 +1,4 @@ -@(#) $Header: /tcpdump/master/libpcap/INSTALL.txt,v 1.17 2006-10-13 17:36:41 guy Exp $ (LBL) +@(#) $Header: /tcpdump/master/libpcap/INSTALL.txt,v 1.18 2006-10-13 17:46:45 guy Exp $ (LBL) To build libpcap, run "./configure" (a shell script). The configure script will determine your system attributes and generate an @@ -358,6 +358,7 @@ pcap/usb.h - public definition of DLT_USB headeer pcap-bpf.c - BSD Packet Filter support pcap-bpf.h - header for backwards compatibility pcap-bt-linux.c - Bluetooth capture support for Linux +pcap-bt-linux.h - Bluetooth capture support for Linux pcap-dag.c - Endace DAG device capture support pcap-dag.h - Endace DAG device capture support pcap-dlpi.c - Data Link Provider Interface support @@ -378,6 +379,7 @@ pcap-stdinc.h - includes and #defines for compiling on Win32 systems pcap-snit.c - SunOS 4.x STREAMS-based Network Interface Tap support pcap-snoop.c - IRIX Snoop network monitoring support pcap-usb-linux.c - USB capture support for Linux +pcap-usb-linux.h - USB capture support for Linux pcap-win32.c - WinPcap capture support pcap.3 - manual entry pcap.c - pcap utility routines diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c index d1c07fd1..f9d23079 100644 --- a/pcap-bt-linux.c +++ b/pcap-bt-linux.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * USB sniffig API implementation for linux platform + * Bluetooth sniffing API implementation for Linux platform * By Paolo Abeni <paolo.abeni@email.com> * */ @@ -38,6 +38,7 @@ #endif #include "pcap-int.h" +#include "pcap-bt-linux.h" #ifdef NEED_STRERROR_H #include "strerror.h" diff --git a/pcap-bt-linux.h b/pcap-bt-linux.h new file mode 100644 index 00000000..2c9e2942 --- /dev/null +++ b/pcap-bt-linux.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Bluetooth sniffing API implementation for Linux platform + * By Paolo Abeni <paolo.abeni@email.com> + * + */ + +/* + * Prototypes for Bluetooth-related functions + */ +int bt_platform_finddevs(pcap_if_t **alldevsp, char *err_str); +pcap_t* bt_open_live(const char* bus, int snaplen, int promisc , int to_ms, char* errmsg); diff --git a/pcap-linux.c b/pcap-linux.c index d011358b..9e761f1b 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -27,7 +27,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.127 2006-10-13 17:34:53 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.128 2006-10-13 17:46:46 guy Exp $ (LBL)"; #endif /* @@ -87,6 +87,14 @@ static const char rcsid[] _U_ = #ifdef HAVE_SEPTEL_API #include "pcap-septel.h" #endif /* HAVE_SEPTEL_API */ + +#ifdef PCAP_SUPPORT_USB +#include "pcap-usb-linux.h" +#endif + +#ifdef PCAP_SUPPORT_BT +#include "pcap-bt-linux.h" +#endif #include <errno.h> #include <stdlib.h> @@ -184,23 +192,6 @@ typedef int socklen_t; */ #define BIGGER_THAN_ALL_MTUS (64*1024) -#ifdef PCAP_SUPPORT_USB -/* - * Prototypes for USB-related functions - */ -int usb_platform_finddevs(pcap_if_t **alldevsp, char *err_str); -pcap_t* usb_open_live(const char* bus, int snaplen, int promisc , int to_ms, char* errmsg); -#endif - -#ifdef PCAP_SUPPORT_BT -/* - * Prototypes for Bluetooth-related functions - */ -int bt_platform_finddevs(pcap_if_t **alldevsp, char *err_str); -pcap_t* bt_open_live(const char* bus, int snaplen, int promisc , int to_ms, char* errmsg); -#endif - - /* * Prototypes for internal functions */ @@ -278,10 +269,11 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, } #endif +#ifdef PCAP_SUPPORT_USB if (strstr(device, "usb")) { return usb_open_live(device, snaplen, promisc, to_ms, ebuf); } - +#endif /* Allocate a handle for this session. */ diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 0a4d5816..f01a28b1 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -29,7 +29,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * USB sniffig API implementation for linux platform + * USB sniffing API implementation for Linux platform * By Paolo Abeni <paolo.abeni@email.com> * */ @@ -39,6 +39,7 @@ #endif #include "pcap-int.h" +#include "pcap-usb-linux.h" #include "pcap/usb.h" #ifdef NEED_STRERROR_H diff --git a/pcap-usb-linux.h b/pcap-usb-linux.h new file mode 100644 index 00000000..b79d1ed4 --- /dev/null +++ b/pcap-usb-linux.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * USB sniffing API implementation for Linux platform + * By Paolo Abeni <paolo.abeni@email.com> + * + */ + +/* + * Prototypes for USB-related functions + */ +int usb_platform_finddevs(pcap_if_t **alldevsp, char *err_str); +pcap_t* usb_open_live(const char* bus, int snaplen, int promisc , int to_ms, char* errmsg); |