diff --git a/wiretap/Makefile.common b/wiretap/Makefile.common index f1fe817d3a..8ef34201c6 100644 --- a/wiretap/Makefile.common +++ b/wiretap/Makefile.common @@ -110,7 +110,6 @@ NONGENERATED_HEADER_FILES = \ visual.h \ vms.h \ wtap.h \ - wtap-capture.h \ wtap-int.h # Files that generate compileable files diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 29adc69308..04cedf9029 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -34,17 +34,6 @@ #include "erf.h" #include "libpcap.h" -#ifdef HAVE_LIBPCAP -#include -#endif - -#ifdef HAVE_LIBPCAP -# ifdef HAVE_SYS_TYPES_H -# include -# endif -#include "wtap-capture.h" -#endif - /* * Various pseudo-headers that appear at the beginning of packet data. * @@ -2265,206 +2254,6 @@ static int wtap_wtap_encap_to_pcap_encap(int encap) return -1; } -#ifdef HAVE_LIBPCAP -/* - * Given a Wiretap encapsulation type, and raw packet data and the packet - * header from libpcap, process any pseudo-header in the packet, - * fill in the Wiretap packet header, and return a pointer to the - * beginning of the non-pseudo-header data in the packet. - */ -const guchar * -wtap_process_pcap_packet(gint linktype, const struct pcap_pkthdr *phdr, - const guchar *pd, union wtap_pseudo_header *pseudo_header, - struct wtap_pkthdr *whdr, int *err) -{ - guint size; - - /* "phdr->ts" may not necessarily be a "struct timeval" - it may - be a "struct bpf_timeval", with member sizes wired to 32 - bits - and we may go that way ourselves in the future, so - copy the members individually. */ - whdr->ts.secs = phdr->ts.tv_sec; - whdr->ts.nsecs = phdr->ts.tv_usec * 1000; - whdr->caplen = phdr->caplen; - whdr->len = phdr->len; - whdr->pkt_encap = linktype; - - /* - * If this is an ATM packet, the first four bytes are the - * direction of the packet (transmit/receive), the VPI, and - * the VCI; read them and generate the pseudo-header from - * them. - */ - switch (linktype) { - - case WTAP_ENCAP_ATM_PDUS: - if (whdr->caplen < SUNATM_LEN) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: SunATM capture has a %u-byte packet, too small to have even an ATM pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - libpcap_get_sunatm_pseudoheader(pd, pseudo_header); - - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= SUNATM_LEN; - whdr->caplen -= SUNATM_LEN; - pd += SUNATM_LEN; - - /* - * If this is ATM LANE traffic, try to guess what type of - * LANE traffic it is based on the packet contents. - */ - if (pseudo_header->atm.type == TRAF_LANE) - atm_guess_lane_type(pd, whdr->caplen, pseudo_header); - break; - - case WTAP_ENCAP_IRDA: - if (whdr->caplen < IRDA_SLL_LEN) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: IrDA capture has a %u-byte packet, too small to have even an IrDA pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - if (!libpcap_get_irda_pseudoheader(pd, pseudo_header, err, NULL)) - return NULL; - - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= IRDA_SLL_LEN; - whdr->caplen -= IRDA_SLL_LEN; - pd += IRDA_SLL_LEN; - break; - - case WTAP_ENCAP_MTP2_WITH_PHDR: - if (whdr->caplen < MTP2_HDR_LEN) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: MTP2 capture has a %u-byte packet, too small to have even an MTP2 pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - if (!libpcap_get_mtp2_pseudoheader(pd, pseudo_header)) - return NULL; - - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= MTP2_HDR_LEN; - whdr->caplen -= MTP2_HDR_LEN; - pd += MTP2_HDR_LEN; - break; - - case WTAP_ENCAP_LINUX_LAPD: - if (whdr->caplen < LAPD_SLL_LEN) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: LAPD capture has a %u-byte packet, too small to have even an LAPD pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - if (!libpcap_get_lapd_pseudoheader(pd, pseudo_header, err, NULL)) - return NULL; - - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= LAPD_SLL_LEN; - whdr->caplen -= LAPD_SLL_LEN; - pd += LAPD_SLL_LEN; - break; - - case WTAP_ENCAP_USB_LINUX: - if (whdr->caplen < sizeof (struct linux_usb_phdr)) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: Linux USB file has a %u-byte packet, too small to have even a LAPD pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= sizeof (struct linux_usb_phdr); - whdr->caplen -= sizeof (struct linux_usb_phdr); - pd += sizeof (struct linux_usb_phdr); - break; - - case WTAP_ENCAP_ERF: - if (whdr->caplen < sizeof(struct erf_phdr) ) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: ERF capture has a %u-byte packet, too small to have even an ERF pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - if (!libpcap_get_erf_pseudoheader(pd, whdr, pseudo_header)) - return NULL; - - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= sizeof(struct erf_phdr); - whdr->caplen -= sizeof(struct erf_phdr); - pd += sizeof(struct erf_phdr); - - if (!libpcap_get_erf_subheader(pd, pseudo_header, &size)) - return NULL; - - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= size; - whdr->caplen -= size; - pd += size; - break; - - case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR: - if (whdr->caplen < sizeof (struct libpcap_bt_phdr)) { - /* - * Uh-oh, the packet isn't big enough to even - * have a pseudo-header. - */ - g_message("libpcap: bluetooth file has a %u-byte packet, too small to have even a pseudo-header\n", - whdr->caplen); - *err = WTAP_ERR_BAD_RECORD; - return NULL; - } - /* - * Don't count the pseudo-header as part of the packet. - */ - whdr->len -= sizeof (struct libpcap_bt_phdr); - whdr->caplen -= sizeof (struct libpcap_bt_phdr); - pd += sizeof (struct libpcap_bt_phdr); - break; - } - return pd; -} -#endif - /* Returns 0 if we could write the specified encapsulation type, an error indication otherwise. */ int libpcap_dump_can_write_encap(int encap) diff --git a/wiretap/libwiretap.vcproj b/wiretap/libwiretap.vcproj index c8713cdbca..3e45910cfe 100644 --- a/wiretap/libwiretap.vcproj +++ b/wiretap/libwiretap.vcproj @@ -253,10 +253,6 @@ RelativePath=".\catapult_dct2000.h" > - - @@ -377,10 +373,6 @@ RelativePath=".\vms.h" > - - diff --git a/wiretap/wtap-capture.h b/wiretap/wtap-capture.h deleted file mode 100644 index 9b69799882..0000000000 --- a/wiretap/wtap-capture.h +++ /dev/null @@ -1,32 +0,0 @@ -/* wtap_capture.h - * - * $Id$ - * - * Wiretap Library - * Copyright (c) 1998 by Gilbert Ramirez - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __WTAP_CAPTURE_H__ -#define __WTAP_CAPTURE_H__ - -/* XXX - needed until "wiretap" can do live packet captures */ -const guchar *wtap_process_pcap_packet(gint linktype, - const struct pcap_pkthdr *phdr, const guchar *pd, - union wtap_pseudo_header *pseudo_header, struct wtap_pkthdr *whdr, - int *err); - -#endif /* __WTAP_CAPTURE_H__ */