pcap-win32.c (162012) | pcap-win32.c (172677) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1999 - 2003 3 * NetGroup, Politecnico di Torino (Italy) | 2 * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) 3 * Copyright (c) 2005 - 2007 CACE Technologies, Davis (California) |
4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. | 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. |
15 * 3. Neither the name of the Politecnico di Torino nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. | 15 * 3. Neither the name of the Politecnico di Torino, CACE Technologies 16 * nor the names of its contributors may be used to endorse or promote 17 * products derived from this software without specific prior written 18 * permission. |
18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 33#ifndef lint 34static const char rcsid[] _U_ = | 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 */ 33 34#ifndef lint 35static const char rcsid[] _U_ = |
35 "@(#) $Header: /tcpdump/master/libpcap/pcap-win32.c,v 1.25.2.3 2005/07/10 17:52:54 risso Exp $ (LBL)"; | 36 "@(#) $Header: /tcpdump/master/libpcap/pcap-win32.c,v 1.25.2.7 2007/06/14 22:07:14 gianluca Exp $ (LBL)"; |
36#endif 37 38#include <pcap-int.h> | 37#endif 38 39#include <pcap-int.h> |
39#include <packet32.h> | 40#include <Packet32.h> |
40#include <Ntddndis.h> 41#ifdef HAVE_DAG_API 42#include <dagnew.h> 43#include <dagapi.h> 44#endif /* HAVE_DAG_API */ 45#ifdef __MINGW32__ 46int* _errno(); 47#define errno (*_errno()) --- 433 unchanged lines hidden (view full) --- 481 case NdisMediumPPPSerial: 482 p->linktype = DLT_PPP_SERIAL; 483 break; 484 485 case NdisMediumNull: 486 p->linktype = DLT_NULL; 487 break; 488 | 41#include <Ntddndis.h> 42#ifdef HAVE_DAG_API 43#include <dagnew.h> 44#include <dagapi.h> 45#endif /* HAVE_DAG_API */ 46#ifdef __MINGW32__ 47int* _errno(); 48#define errno (*_errno()) --- 433 unchanged lines hidden (view full) --- 482 case NdisMediumPPPSerial: 483 p->linktype = DLT_PPP_SERIAL; 484 break; 485 486 case NdisMediumNull: 487 p->linktype = DLT_NULL; 488 break; 489 |
490 case NdisMediumBare80211: 491 p->linktype = DLT_IEEE802_11; 492 break; 493 494 case NdisMediumRadio80211: 495 p->linktype = DLT_IEEE802_11_RADIO; 496 break; 497 498 case NdisMediumPpi: 499 p->linktype = DLT_PPI; 500 break; 501 |
|
489 default: 490 p->linktype = DLT_EN10MB; /*an unknown adapter is assumed to be ethernet*/ 491 break; 492 } 493 | 502 default: 503 p->linktype = DLT_EN10MB; /*an unknown adapter is assumed to be ethernet*/ 504 break; 505 } 506 |
494 /* Set promisquous mode */ 495 if (promisc) PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_PROMISCUOUS); 496 else PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_ALL_LOCAL); | 507 /* Set promiscuous mode */ 508 if (promisc) 509 { |
497 | 510 |
511 if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_PROMISCUOUS) == FALSE) 512 { 513 snprintf(ebuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to promiscuous mode"); 514 goto bad; 515 } 516 } 517 else 518 { 519 if (PacketSetHwFilter(p->adapter,NDIS_PACKET_TYPE_ALL_LOCAL) == FALSE) 520 { 521 snprintf(ebuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to non-promiscuous mode"); 522 goto bad; 523 } 524 } 525 |
|
498 /* Set the buffer size */ 499 p->bufsize = PcapBufSize; 500 501 /* Store the timeout. Used by pcap_setnonblock() */ 502 p->timeout= to_ms; 503 504 /* allocate Packet structure used during the capture */ 505 if((p->Packet = PacketAllocatePacket())==NULL) --- 270 unchanged lines hidden --- | 526 /* Set the buffer size */ 527 p->bufsize = PcapBufSize; 528 529 /* Store the timeout. Used by pcap_setnonblock() */ 530 p->timeout= to_ms; 531 532 /* allocate Packet structure used during the capture */ 533 if((p->Packet = PacketAllocatePacket())==NULL) --- 270 unchanged lines hidden --- |