Deleted Added
sdiff udiff text old ( 162012 ) new ( 172677 )
full compact
1/*
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.
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.
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_ =
36 "@(#) $Header: /tcpdump/master/libpcap/pcap-win32.c,v 1.25.2.7 2007/06/14 22:07:14 gianluca Exp $ (LBL)";
37#endif
38
39#include <pcap-int.h>
40#include <Packet32.h>
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
502 default:
503 p->linktype = DLT_EN10MB; /*an unknown adapter is assumed to be ethernet*/
504 break;
505 }
506
507 /* Set promiscuous mode */
508 if (promisc)
509 {
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
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 ---