mirror of https://github.com/PCSX2/pcsx2.git
Added WinPcap to the library of 3rd party includes and made DEV9ghzdrk use them.
WinPcap version is 4.1.2 and only the /include and /lib folders of their developer pack are included. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5599 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
7a00d19b55
commit
e32a18dac4
|
@ -1,359 +1,359 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
|
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
|
||||||
* Copyright (c) 2005 - 2007 CACE Technologies, Davis (California)
|
* Copyright (c) 2005 - 2007 CACE Technologies, Davis (California)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
|
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
|
||||||
* nor the names of its contributors may be used to endorse or promote
|
* nor the names of its contributors may be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @ingroup packetapi
|
/** @ingroup packetapi
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup packet32h Packet.dll definitions and data structures
|
/** @defgroup packet32h Packet.dll definitions and data structures
|
||||||
* Packet32.h contains the data structures and the definitions used by packet.dll.
|
* Packet32.h contains the data structures and the definitions used by packet.dll.
|
||||||
* The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included
|
* The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included
|
||||||
* by the applications that use the functions of this library
|
* by the applications that use the functions of this library
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PACKET32
|
#ifndef __PACKET32
|
||||||
#define __PACKET32
|
#define __PACKET32
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
|
||||||
#ifdef HAVE_AIRPCAP_API
|
#ifdef HAVE_AIRPCAP_API
|
||||||
#include <airpcap.h>
|
#include <airpcap.h>
|
||||||
#else
|
#else
|
||||||
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
|
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
|
||||||
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
|
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
|
||||||
typedef struct _AirpcapHandle *PAirpcapHandle;
|
typedef struct _AirpcapHandle *PAirpcapHandle;
|
||||||
#endif /* AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ */
|
#endif /* AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ */
|
||||||
#endif /* HAVE_AIRPCAP_API */
|
#endif /* HAVE_AIRPCAP_API */
|
||||||
|
|
||||||
#ifdef HAVE_DAG_API
|
#ifdef HAVE_DAG_API
|
||||||
#include <dagc.h>
|
#include <dagc.h>
|
||||||
#endif /* HAVE_DAG_API */
|
#endif /* HAVE_DAG_API */
|
||||||
|
|
||||||
// Working modes
|
// Working modes
|
||||||
#define PACKET_MODE_CAPT 0x0 ///< Capture mode
|
#define PACKET_MODE_CAPT 0x0 ///< Capture mode
|
||||||
#define PACKET_MODE_STAT 0x1 ///< Statistical mode
|
#define PACKET_MODE_STAT 0x1 ///< Statistical mode
|
||||||
#define PACKET_MODE_MON 0x2 ///< Monitoring mode
|
#define PACKET_MODE_MON 0x2 ///< Monitoring mode
|
||||||
#define PACKET_MODE_DUMP 0x10 ///< Dump mode
|
#define PACKET_MODE_DUMP 0x10 ///< Dump mode
|
||||||
#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode
|
#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode
|
||||||
|
|
||||||
|
|
||||||
/// Alignment macro. Defines the alignment size.
|
/// Alignment macro. Defines the alignment size.
|
||||||
#define Packet_ALIGNMENT sizeof(int)
|
#define Packet_ALIGNMENT sizeof(int)
|
||||||
/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT.
|
/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT.
|
||||||
#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1))
|
#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1))
|
||||||
|
|
||||||
#define NdisMediumNull -1 ///< Custom linktype: NDIS doesn't provide an equivalent
|
#define NdisMediumNull -1 ///< Custom linktype: NDIS doesn't provide an equivalent
|
||||||
#define NdisMediumCHDLC -2 ///< Custom linktype: NDIS doesn't provide an equivalent
|
#define NdisMediumCHDLC -2 ///< Custom linktype: NDIS doesn't provide an equivalent
|
||||||
#define NdisMediumPPPSerial -3 ///< Custom linktype: NDIS doesn't provide an equivalent
|
#define NdisMediumPPPSerial -3 ///< Custom linktype: NDIS doesn't provide an equivalent
|
||||||
#define NdisMediumBare80211 -4 ///< Custom linktype: NDIS doesn't provide an equivalent
|
#define NdisMediumBare80211 -4 ///< Custom linktype: NDIS doesn't provide an equivalent
|
||||||
#define NdisMediumRadio80211 -5 ///< Custom linktype: NDIS doesn't provide an equivalent
|
#define NdisMediumRadio80211 -5 ///< Custom linktype: NDIS doesn't provide an equivalent
|
||||||
#define NdisMediumPpi -6 ///< Custom linktype: NDIS doesn't provide an equivalent
|
#define NdisMediumPpi -6 ///< Custom linktype: NDIS doesn't provide an equivalent
|
||||||
|
|
||||||
// Loopback behaviour definitions
|
// Loopback behaviour definitions
|
||||||
#define NPF_DISABLE_LOOPBACK 1 ///< Drop the packets sent by the NPF driver
|
#define NPF_DISABLE_LOOPBACK 1 ///< Drop the packets sent by the NPF driver
|
||||||
#define NPF_ENABLE_LOOPBACK 2 ///< Capture the packets sent by the NPF driver
|
#define NPF_ENABLE_LOOPBACK 2 ///< Capture the packets sent by the NPF driver
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Network type structure.
|
\brief Network type structure.
|
||||||
|
|
||||||
This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed.
|
This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed.
|
||||||
*/
|
*/
|
||||||
typedef struct NetType
|
typedef struct NetType
|
||||||
{
|
{
|
||||||
UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information)
|
UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information)
|
||||||
ULONGLONG LinkSpeed; ///< The speed of the network in bits per second
|
ULONGLONG LinkSpeed; ///< The speed of the network in bits per second
|
||||||
}NetType;
|
}NetType;
|
||||||
|
|
||||||
|
|
||||||
//some definitions stolen from libpcap
|
//some definitions stolen from libpcap
|
||||||
|
|
||||||
#ifndef BPF_MAJOR_VERSION
|
#ifndef BPF_MAJOR_VERSION
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief A BPF pseudo-assembly program.
|
\brief A BPF pseudo-assembly program.
|
||||||
|
|
||||||
The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet.
|
The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet.
|
||||||
*/
|
*/
|
||||||
struct bpf_program
|
struct bpf_program
|
||||||
{
|
{
|
||||||
UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow.
|
UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow.
|
||||||
struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program.
|
struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program.
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief A single BPF pseudo-instruction.
|
\brief A single BPF pseudo-instruction.
|
||||||
|
|
||||||
bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver.
|
bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver.
|
||||||
*/
|
*/
|
||||||
struct bpf_insn
|
struct bpf_insn
|
||||||
{
|
{
|
||||||
USHORT code; ///< Instruction type and addressing mode.
|
USHORT code; ///< Instruction type and addressing mode.
|
||||||
UCHAR jt; ///< Jump if true
|
UCHAR jt; ///< Jump if true
|
||||||
UCHAR jf; ///< Jump if false
|
UCHAR jf; ///< Jump if false
|
||||||
int k; ///< Generic field used for various purposes.
|
int k; ///< Generic field used for various purposes.
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Structure that contains a couple of statistics values on the current capture.
|
\brief Structure that contains a couple of statistics values on the current capture.
|
||||||
|
|
||||||
It is used by packet.dll to return statistics about a capture session.
|
It is used by packet.dll to return statistics about a capture session.
|
||||||
*/
|
*/
|
||||||
struct bpf_stat
|
struct bpf_stat
|
||||||
{
|
{
|
||||||
UINT bs_recv; ///< Number of packets that the driver received from the network adapter
|
UINT bs_recv; ///< Number of packets that the driver received from the network adapter
|
||||||
///< from the beginning of the current capture. This value includes the packets
|
///< from the beginning of the current capture. This value includes the packets
|
||||||
///< lost by the driver.
|
///< lost by the driver.
|
||||||
UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture.
|
UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture.
|
||||||
///< Basically, a packet is lost when the the buffer of the driver is full.
|
///< Basically, a packet is lost when the the buffer of the driver is full.
|
||||||
///< In this situation the packet cannot be stored and the driver rejects it.
|
///< In this situation the packet cannot be stored and the driver rejects it.
|
||||||
UINT ps_ifdrop; ///< drops by interface. XXX not yet supported
|
UINT ps_ifdrop; ///< drops by interface. XXX not yet supported
|
||||||
UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and
|
UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and
|
||||||
///< thus reach the application.
|
///< thus reach the application.
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Packet header.
|
\brief Packet header.
|
||||||
|
|
||||||
This structure defines the header associated with every packet delivered to the application.
|
This structure defines the header associated with every packet delivered to the application.
|
||||||
*/
|
*/
|
||||||
struct bpf_hdr
|
struct bpf_hdr
|
||||||
{
|
{
|
||||||
struct timeval bh_tstamp; ///< The timestamp associated with the captured packet.
|
struct timeval bh_tstamp; ///< The timestamp associated with the captured packet.
|
||||||
///< It is stored in a TimeVal structure.
|
///< It is stored in a TimeVal structure.
|
||||||
UINT bh_caplen; ///< Length of captured portion. The captured portion <b>can be different</b>
|
UINT bh_caplen; ///< Length of captured portion. The captured portion <b>can be different</b>
|
||||||
///< from the original packet, because it is possible (with a proper filter)
|
///< from the original packet, because it is possible (with a proper filter)
|
||||||
///< to instruct the driver to capture only a portion of the packets.
|
///< to instruct the driver to capture only a portion of the packets.
|
||||||
UINT bh_datalen; ///< Original length of packet
|
UINT bh_datalen; ///< Original length of packet
|
||||||
USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases,
|
USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases,
|
||||||
///< a padding could be added between the end of this structure and the packet
|
///< a padding could be added between the end of this structure and the packet
|
||||||
///< data for performance reasons. This filed can be used to retrieve the actual data
|
///< data for performance reasons. This filed can be used to retrieve the actual data
|
||||||
///< of the packet.
|
///< of the packet.
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Dump packet header.
|
\brief Dump packet header.
|
||||||
|
|
||||||
This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets().
|
This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets().
|
||||||
It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a
|
It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a
|
||||||
packet in a dump file. This makes straightforward sending WinPcap dump files to the network.
|
packet in a dump file. This makes straightforward sending WinPcap dump files to the network.
|
||||||
*/
|
*/
|
||||||
struct dump_bpf_hdr{
|
struct dump_bpf_hdr{
|
||||||
struct timeval ts; ///< Time stamp of the packet
|
struct timeval ts; ///< Time stamp of the packet
|
||||||
UINT caplen; ///< Length of captured portion. The captured portion can smaller than the
|
UINT caplen; ///< Length of captured portion. The captured portion can smaller than the
|
||||||
///< the original packet, because it is possible (with a proper filter) to
|
///< the original packet, because it is possible (with a proper filter) to
|
||||||
///< instruct the driver to capture only a portion of the packets.
|
///< instruct the driver to capture only a portion of the packets.
|
||||||
UINT len; ///< Length of the original packet (off wire).
|
UINT len; ///< Length of the original packet (off wire).
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct bpf_stat;
|
struct bpf_stat;
|
||||||
|
|
||||||
#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices
|
#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices
|
||||||
#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links
|
#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links
|
||||||
#define NMAX_PACKET 65535
|
#define NMAX_PACKET 65535
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Addresses of a network adapter.
|
\brief Addresses of a network adapter.
|
||||||
|
|
||||||
This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with
|
This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with
|
||||||
an adapter.
|
an adapter.
|
||||||
*/
|
*/
|
||||||
typedef struct npf_if_addr {
|
typedef struct npf_if_addr {
|
||||||
struct sockaddr_storage IPAddress; ///< IP address.
|
struct sockaddr_storage IPAddress; ///< IP address.
|
||||||
struct sockaddr_storage SubnetMask; ///< Netmask for that address.
|
struct sockaddr_storage SubnetMask; ///< Netmask for that address.
|
||||||
struct sockaddr_storage Broadcast; ///< Broadcast address.
|
struct sockaddr_storage Broadcast; ///< Broadcast address.
|
||||||
}npf_if_addr;
|
}npf_if_addr;
|
||||||
|
|
||||||
|
|
||||||
#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API.
|
#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API.
|
||||||
#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API.
|
#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API.
|
||||||
#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API.
|
#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API.
|
||||||
#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API.
|
#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API.
|
||||||
|
|
||||||
|
|
||||||
typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API
|
typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API
|
||||||
typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API
|
typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API
|
||||||
|
|
||||||
#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter
|
#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter
|
||||||
#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET
|
#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET
|
||||||
#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card
|
#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card
|
||||||
#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file
|
#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file
|
||||||
#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones.
|
#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones.
|
||||||
#define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card
|
#define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card
|
||||||
#define INFO_FLAG_NPFIM_DEVICE 32
|
#define INFO_FLAG_NPFIM_DEVICE 32
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Describes an opened network adapter.
|
\brief Describes an opened network adapter.
|
||||||
|
|
||||||
This structure is the most important for the functioning of packet.dll, but the great part of its fields
|
This structure is the most important for the functioning of packet.dll, but the great part of its fields
|
||||||
should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters
|
should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters
|
||||||
*/
|
*/
|
||||||
typedef struct _ADAPTER {
|
typedef struct _ADAPTER {
|
||||||
HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver.
|
HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver.
|
||||||
CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened.
|
CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened.
|
||||||
int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated
|
int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated
|
||||||
///< on the wire.
|
///< on the wire.
|
||||||
HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter.
|
HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter.
|
||||||
///< It can be passed to standard Win32 functions (like WaitForSingleObject
|
///< It can be passed to standard Win32 functions (like WaitForSingleObject
|
||||||
///< or WaitForMultipleObjects) to wait until the driver's buffer contains some
|
///< or WaitForMultipleObjects) to wait until the driver's buffer contains some
|
||||||
///< data. It is particularly useful in GUI applications that need to wait
|
///< data. It is particularly useful in GUI applications that need to wait
|
||||||
///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy()
|
///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy()
|
||||||
///< function can be used to define the minimum amount of data in the kernel buffer
|
///< function can be used to define the minimum amount of data in the kernel buffer
|
||||||
///< that will cause the event to be signalled.
|
///< that will cause the event to be signalled.
|
||||||
|
|
||||||
UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and
|
UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and
|
||||||
///< ReadEvent will be signaled, also if no packets were captured
|
///< ReadEvent will be signaled, also if no packets were captured
|
||||||
CHAR Name[ADAPTER_NAME_LENGTH];
|
CHAR Name[ADAPTER_NAME_LENGTH];
|
||||||
PWAN_ADAPTER pWanAdapter;
|
PWAN_ADAPTER pWanAdapter;
|
||||||
UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API.
|
UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API.
|
||||||
|
|
||||||
#ifdef HAVE_AIRPCAP_API
|
#ifdef HAVE_AIRPCAP_API
|
||||||
PAirpcapHandle AirpcapAd;
|
PAirpcapHandle AirpcapAd;
|
||||||
#endif // HAVE_AIRPCAP_API
|
#endif // HAVE_AIRPCAP_API
|
||||||
|
|
||||||
#ifdef HAVE_NPFIM_API
|
#ifdef HAVE_NPFIM_API
|
||||||
void* NpfImHandle;
|
void* NpfImHandle;
|
||||||
#endif // HAVE_NPFIM_API
|
#endif // HAVE_NPFIM_API
|
||||||
|
|
||||||
#ifdef HAVE_DAG_API
|
#ifdef HAVE_DAG_API
|
||||||
dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter
|
dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter
|
||||||
PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card
|
PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card
|
||||||
struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure
|
struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure
|
||||||
unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry
|
unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry
|
||||||
DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps).
|
DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps).
|
||||||
#endif // HAVE_DAG_API
|
#endif // HAVE_DAG_API
|
||||||
} ADAPTER, *LPADAPTER;
|
} ADAPTER, *LPADAPTER;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Structure that contains a group of packets coming from the driver.
|
\brief Structure that contains a group of packets coming from the driver.
|
||||||
|
|
||||||
This structure defines the header associated with every packet delivered to the application.
|
This structure defines the header associated with every packet delivered to the application.
|
||||||
*/
|
*/
|
||||||
typedef struct _PACKET {
|
typedef struct _PACKET {
|
||||||
HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications.
|
HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications.
|
||||||
OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications.
|
OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications.
|
||||||
PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for
|
PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for
|
||||||
///< details about the organization of the data in this buffer
|
///< details about the organization of the data in this buffer
|
||||||
UINT Length; ///< Length of the buffer
|
UINT Length; ///< Length of the buffer
|
||||||
DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data
|
DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data
|
||||||
///< received by the last call to PacketReceivePacket()
|
///< received by the last call to PacketReceivePacket()
|
||||||
BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications.
|
BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications.
|
||||||
} PACKET, *LPPACKET;
|
} PACKET, *LPPACKET;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Structure containing an OID request.
|
\brief Structure containing an OID request.
|
||||||
|
|
||||||
It is used by the PacketRequest() function to send an OID to the interface card driver.
|
It is used by the PacketRequest() function to send an OID to the interface card driver.
|
||||||
It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address,
|
It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address,
|
||||||
the list of the multicast groups defined on it, and so on.
|
the list of the multicast groups defined on it, and so on.
|
||||||
*/
|
*/
|
||||||
struct _PACKET_OID_DATA {
|
struct _PACKET_OID_DATA {
|
||||||
ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h
|
ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h
|
||||||
///< for a complete list of valid codes.
|
///< for a complete list of valid codes.
|
||||||
ULONG Length; ///< Length of the data field
|
ULONG Length; ///< Length of the data field
|
||||||
UCHAR Data[1]; ///< variable-lenght field that contains the information passed to or received
|
UCHAR Data[1]; ///< variable-lenght field that contains the information passed to or received
|
||||||
///< from the adapter.
|
///< from the adapter.
|
||||||
};
|
};
|
||||||
typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA;
|
typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName,
|
BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName,
|
||||||
CHAR *Value,
|
CHAR *Value,
|
||||||
UINT *pValueLen,
|
UINT *pValueLen,
|
||||||
CHAR *DefaultVal);
|
CHAR *DefaultVal);
|
||||||
|
|
||||||
BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName,
|
BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName,
|
||||||
WCHAR *Value,
|
WCHAR *Value,
|
||||||
UINT *pValueLen,
|
UINT *pValueLen,
|
||||||
WCHAR *DefaultVal);
|
WCHAR *DefaultVal);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// EXPORTED FUNCTIONS
|
// EXPORTED FUNCTIONS
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
PCHAR PacketGetVersion();
|
PCHAR PacketGetVersion();
|
||||||
PCHAR PacketGetDriverVersion();
|
PCHAR PacketGetDriverVersion();
|
||||||
BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes);
|
BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes);
|
||||||
BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites);
|
BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites);
|
||||||
BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode);
|
BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode);
|
||||||
BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout);
|
BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout);
|
||||||
BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp);
|
BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp);
|
||||||
BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior);
|
BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior);
|
||||||
INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen);
|
INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen);
|
||||||
BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s);
|
BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||||
BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s);
|
BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s);
|
||||||
BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim);
|
BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim);
|
||||||
BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type);
|
BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type);
|
||||||
LPADAPTER PacketOpenAdapter(PCHAR AdapterName);
|
LPADAPTER PacketOpenAdapter(PCHAR AdapterName);
|
||||||
BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync);
|
BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync);
|
||||||
INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync);
|
INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync);
|
||||||
LPPACKET PacketAllocatePacket(void);
|
LPPACKET PacketAllocatePacket(void);
|
||||||
VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length);
|
VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length);
|
||||||
VOID PacketFreePacket(LPPACKET lpPacket);
|
VOID PacketFreePacket(LPPACKET lpPacket);
|
||||||
BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync);
|
BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync);
|
||||||
BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter);
|
BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter);
|
||||||
BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize);
|
BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize);
|
||||||
BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries);
|
BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries);
|
||||||
BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData);
|
BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData);
|
||||||
HANDLE PacketGetReadEvent(LPADAPTER AdapterObject);
|
HANDLE PacketGetReadEvent(LPADAPTER AdapterObject);
|
||||||
BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len);
|
BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len);
|
||||||
BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks);
|
BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks);
|
||||||
BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync);
|
BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync);
|
||||||
BOOL PacketStopDriver();
|
BOOL PacketStopDriver();
|
||||||
VOID PacketCloseAdapter(LPADAPTER lpAdapter);
|
VOID PacketCloseAdapter(LPADAPTER lpAdapter);
|
||||||
BOOLEAN PacketStartOem(PCHAR errorString, UINT errorStringLength);
|
BOOLEAN PacketStartOem(PCHAR errorString, UINT errorStringLength);
|
||||||
BOOLEAN PacketStartOemEx(PCHAR errorString, UINT errorStringLength, ULONG flags);
|
BOOLEAN PacketStartOemEx(PCHAR errorString, UINT errorStringLength, ULONG flags);
|
||||||
PAirpcapHandle PacketGetAirPcapHandle(LPADAPTER AdapterObject);
|
PAirpcapHandle PacketGetAirPcapHandle(LPADAPTER AdapterObject);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Used by PacketStartOemEx
|
// Used by PacketStartOemEx
|
||||||
//
|
//
|
||||||
#define PACKET_START_OEM_NO_NETMON 0x00000001
|
#define PACKET_START_OEM_NO_NETMON 0x00000001
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //__PACKET32
|
#endif //__PACKET32
|
|
@ -1,113 +1,113 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
|
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
|
||||||
* Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
|
* Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
|
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
|
||||||
* nor the names of its contributors may be used to endorse or promote
|
* nor the names of its contributors may be used to endorse or promote
|
||||||
* products derived from this software without specific prior written
|
* products derived from this software without specific prior written
|
||||||
* permission.
|
* permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __WIN32_EXTENSIONS_H__
|
#ifndef __WIN32_EXTENSIONS_H__
|
||||||
#define __WIN32_EXTENSIONS_H__
|
#define __WIN32_EXTENSIONS_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Definitions */
|
/* Definitions */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit().
|
\brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit().
|
||||||
*/
|
*/
|
||||||
struct pcap_send_queue
|
struct pcap_send_queue
|
||||||
{
|
{
|
||||||
u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field.
|
u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field.
|
||||||
u_int len; ///< Current size of the queue, in bytes.
|
u_int len; ///< Current size of the queue, in bytes.
|
||||||
char *buffer; ///< Buffer containing the packets to be sent.
|
char *buffer; ///< Buffer containing the packets to be sent.
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct pcap_send_queue pcap_send_queue;
|
typedef struct pcap_send_queue pcap_send_queue;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief This typedef is a support for the pcap_get_airpcap_handle() function
|
\brief This typedef is a support for the pcap_get_airpcap_handle() function
|
||||||
*/
|
*/
|
||||||
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
|
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
|
||||||
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
|
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
|
||||||
typedef struct _AirpcapHandle *PAirpcapHandle;
|
typedef struct _AirpcapHandle *PAirpcapHandle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BPF_MEM_EX_IMM 0xc0
|
#define BPF_MEM_EX_IMM 0xc0
|
||||||
#define BPF_MEM_EX_IND 0xe0
|
#define BPF_MEM_EX_IND 0xe0
|
||||||
|
|
||||||
/*used for ST*/
|
/*used for ST*/
|
||||||
#define BPF_MEM_EX 0xc0
|
#define BPF_MEM_EX 0xc0
|
||||||
#define BPF_TME 0x08
|
#define BPF_TME 0x08
|
||||||
|
|
||||||
#define BPF_LOOKUP 0x90
|
#define BPF_LOOKUP 0x90
|
||||||
#define BPF_EXECUTE 0xa0
|
#define BPF_EXECUTE 0xa0
|
||||||
#define BPF_INIT 0xb0
|
#define BPF_INIT 0xb0
|
||||||
#define BPF_VALIDATE 0xc0
|
#define BPF_VALIDATE 0xc0
|
||||||
#define BPF_SET_ACTIVE 0xd0
|
#define BPF_SET_ACTIVE 0xd0
|
||||||
#define BPF_RESET 0xe0
|
#define BPF_RESET 0xe0
|
||||||
#define BPF_SET_MEMORY 0x80
|
#define BPF_SET_MEMORY 0x80
|
||||||
#define BPF_GET_REGISTER_VALUE 0x70
|
#define BPF_GET_REGISTER_VALUE 0x70
|
||||||
#define BPF_SET_REGISTER_VALUE 0x60
|
#define BPF_SET_REGISTER_VALUE 0x60
|
||||||
#define BPF_SET_WORKING 0x50
|
#define BPF_SET_WORKING 0x50
|
||||||
#define BPF_SET_ACTIVE_READ 0x40
|
#define BPF_SET_ACTIVE_READ 0x40
|
||||||
#define BPF_SET_AUTODELETION 0x30
|
#define BPF_SET_AUTODELETION 0x30
|
||||||
#define BPF_SEPARATION 0xff
|
#define BPF_SEPARATION 0xff
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
|
pcap_send_queue* pcap_sendqueue_alloc(u_int memsize);
|
||||||
|
|
||||||
void pcap_sendqueue_destroy(pcap_send_queue* queue);
|
void pcap_sendqueue_destroy(pcap_send_queue* queue);
|
||||||
|
|
||||||
int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
|
int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data);
|
||||||
|
|
||||||
u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
|
u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync);
|
||||||
|
|
||||||
HANDLE pcap_getevent(pcap_t *p);
|
HANDLE pcap_getevent(pcap_t *p);
|
||||||
|
|
||||||
struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
|
struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size);
|
||||||
|
|
||||||
int pcap_setuserbuffer(pcap_t *p, int size);
|
int pcap_setuserbuffer(pcap_t *p, int size);
|
||||||
|
|
||||||
int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
|
int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks);
|
||||||
|
|
||||||
int pcap_live_dump_ended(pcap_t *p, int sync);
|
int pcap_live_dump_ended(pcap_t *p, int sync);
|
||||||
|
|
||||||
int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data);
|
int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data);
|
||||||
|
|
||||||
int pcap_start_oem(char* err_str, int flags);
|
int pcap_start_oem(char* err_str, int flags);
|
||||||
|
|
||||||
PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
|
PAirpcapHandle pcap_get_airpcap_handle(pcap_t *p);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //__WIN32_EXTENSIONS_H__
|
#endif //__WIN32_EXTENSIONS_H__
|
|
@ -1,444 +1,444 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 - 2003
|
* Copyright (c) 2002 - 2003
|
||||||
* NetGroup, Politecnico di Torino (Italy)
|
* NetGroup, Politecnico di Torino (Italy)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of the Politecnico di Torino nor the names of its
|
* 3. Neither the name of the Politecnico di Torino nor the names of its
|
||||||
* contributors may be used to endorse or promote products derived from
|
* contributors may be used to endorse or promote products derived from
|
||||||
* this software without specific prior written permission.
|
* this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __REMOTE_EXT_H__
|
#ifndef __REMOTE_EXT_H__
|
||||||
#define __REMOTE_EXT_H__
|
#define __REMOTE_EXT_H__
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_REMOTE
|
#ifndef HAVE_REMOTE
|
||||||
#error Please do not include this file directly. Just define HAVE_REMOTE and then include pcap.h
|
#error Please do not include this file directly. Just define HAVE_REMOTE and then include pcap.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Definition for Microsoft Visual Studio
|
// Definition for Microsoft Visual Studio
|
||||||
#if _MSC_VER > 1000
|
#if _MSC_VER > 1000
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file remote-ext.h
|
\file remote-ext.h
|
||||||
|
|
||||||
The goal of this file it to include most of the new definitions that should be
|
The goal of this file it to include most of the new definitions that should be
|
||||||
placed into the pcap.h file.
|
placed into the pcap.h file.
|
||||||
|
|
||||||
It includes all new definitions (structures and functions like pcap_open().
|
It includes all new definitions (structures and functions like pcap_open().
|
||||||
Some of the functions are not really a remote feature, but, right now,
|
Some of the functions are not really a remote feature, but, right now,
|
||||||
they are placed here.
|
they are placed here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// All this stuff is public
|
// All this stuff is public
|
||||||
/*! \addtogroup remote_struct
|
/*! \addtogroup remote_struct
|
||||||
\{
|
\{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Defines the maximum buffer size in which address, port, interface names are kept.
|
\brief Defines the maximum buffer size in which address, port, interface names are kept.
|
||||||
|
|
||||||
In case the adapter name or such is larger than this value, it is truncated.
|
In case the adapter name or such is larger than this value, it is truncated.
|
||||||
This is not used by the user; however it must be aware that an hostname / interface
|
This is not used by the user; however it must be aware that an hostname / interface
|
||||||
name longer than this value will be truncated.
|
name longer than this value will be truncated.
|
||||||
*/
|
*/
|
||||||
#define PCAP_BUF_SIZE 1024
|
#define PCAP_BUF_SIZE 1024
|
||||||
|
|
||||||
|
|
||||||
/*! \addtogroup remote_source_ID
|
/*! \addtogroup remote_source_ID
|
||||||
\{
|
\{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Internal representation of the type of source in use (file,
|
\brief Internal representation of the type of source in use (file,
|
||||||
remote/local interface).
|
remote/local interface).
|
||||||
|
|
||||||
This indicates a file, i.e. the user want to open a capture from a local file.
|
This indicates a file, i.e. the user want to open a capture from a local file.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SRC_FILE 2
|
#define PCAP_SRC_FILE 2
|
||||||
/*!
|
/*!
|
||||||
\brief Internal representation of the type of source in use (file,
|
\brief Internal representation of the type of source in use (file,
|
||||||
remote/local interface).
|
remote/local interface).
|
||||||
|
|
||||||
This indicates a local interface, i.e. the user want to open a capture from
|
This indicates a local interface, i.e. the user want to open a capture from
|
||||||
a local interface. This does not involve the RPCAP protocol.
|
a local interface. This does not involve the RPCAP protocol.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SRC_IFLOCAL 3
|
#define PCAP_SRC_IFLOCAL 3
|
||||||
/*!
|
/*!
|
||||||
\brief Internal representation of the type of source in use (file,
|
\brief Internal representation of the type of source in use (file,
|
||||||
remote/local interface).
|
remote/local interface).
|
||||||
|
|
||||||
This indicates a remote interface, i.e. the user want to open a capture from
|
This indicates a remote interface, i.e. the user want to open a capture from
|
||||||
an interface on a remote host. This does involve the RPCAP protocol.
|
an interface on a remote host. This does involve the RPCAP protocol.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SRC_IFREMOTE 4
|
#define PCAP_SRC_IFREMOTE 4
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\}
|
\}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \addtogroup remote_source_string
|
/*! \addtogroup remote_source_string
|
||||||
|
|
||||||
The formats allowed by the pcap_open() are the following:
|
The formats allowed by the pcap_open() are the following:
|
||||||
- file://path_and_filename [opens a local file]
|
- file://path_and_filename [opens a local file]
|
||||||
- rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol]
|
- rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol]
|
||||||
- rpcap://host/devicename [opens the selected device available on a remote host]
|
- rpcap://host/devicename [opens the selected device available on a remote host]
|
||||||
- rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP]
|
- rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP]
|
||||||
- adaptername [to open a local adapter; kept for compability, but it is strongly discouraged]
|
- adaptername [to open a local adapter; kept for compability, but it is strongly discouraged]
|
||||||
- (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged]
|
- (NULL) [to open the first local adapter; kept for compability, but it is strongly discouraged]
|
||||||
|
|
||||||
The formats allowed by the pcap_findalldevs_ex() are the following:
|
The formats allowed by the pcap_findalldevs_ex() are the following:
|
||||||
- file://folder/ [lists all the files in the given folder]
|
- file://folder/ [lists all the files in the given folder]
|
||||||
- rpcap:// [lists all local adapters]
|
- rpcap:// [lists all local adapters]
|
||||||
- rpcap://host:port/ [lists the devices available on a remote host]
|
- rpcap://host:port/ [lists the devices available on a remote host]
|
||||||
|
|
||||||
Referring to the 'host' and 'port' paramters, they can be either numeric or literal. Since
|
Referring to the 'host' and 'port' paramters, they can be either numeric or literal. Since
|
||||||
IPv6 is fully supported, these are the allowed formats:
|
IPv6 is fully supported, these are the allowed formats:
|
||||||
|
|
||||||
- host (literal): e.g. host.foo.bar
|
- host (literal): e.g. host.foo.bar
|
||||||
- host (numeric IPv4): e.g. 10.11.12.13
|
- host (numeric IPv4): e.g. 10.11.12.13
|
||||||
- host (numeric IPv4, IPv6 style): e.g. [10.11.12.13]
|
- host (numeric IPv4, IPv6 style): e.g. [10.11.12.13]
|
||||||
- host (numeric IPv6): e.g. [1:2:3::4]
|
- host (numeric IPv6): e.g. [1:2:3::4]
|
||||||
- port: can be either numeric (e.g. '80') or literal (e.g. 'http')
|
- port: can be either numeric (e.g. '80') or literal (e.g. 'http')
|
||||||
|
|
||||||
Here you find some allowed examples:
|
Here you find some allowed examples:
|
||||||
- rpcap://host.foo.bar/devicename [everything literal, no port number]
|
- rpcap://host.foo.bar/devicename [everything literal, no port number]
|
||||||
- rpcap://host.foo.bar:1234/devicename [everything literal, with port number]
|
- rpcap://host.foo.bar:1234/devicename [everything literal, with port number]
|
||||||
- rpcap://10.11.12.13/devicename [IPv4 numeric, no port number]
|
- rpcap://10.11.12.13/devicename [IPv4 numeric, no port number]
|
||||||
- rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number]
|
- rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number]
|
||||||
- rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number]
|
- rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number]
|
||||||
- rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number]
|
- rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number]
|
||||||
- rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number]
|
- rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number]
|
||||||
- rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number]
|
- rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number]
|
||||||
|
|
||||||
\{
|
\{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief String that will be used to determine the type of source in use (file,
|
\brief String that will be used to determine the type of source in use (file,
|
||||||
remote/local interface).
|
remote/local interface).
|
||||||
|
|
||||||
This string will be prepended to the interface name in order to create a string
|
This string will be prepended to the interface name in order to create a string
|
||||||
that contains all the information required to open the source.
|
that contains all the information required to open the source.
|
||||||
|
|
||||||
This string indicates that the user wants to open a capture from a local file.
|
This string indicates that the user wants to open a capture from a local file.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SRC_FILE_STRING "file://"
|
#define PCAP_SRC_FILE_STRING "file://"
|
||||||
/*!
|
/*!
|
||||||
\brief String that will be used to determine the type of source in use (file,
|
\brief String that will be used to determine the type of source in use (file,
|
||||||
remote/local interface).
|
remote/local interface).
|
||||||
|
|
||||||
This string will be prepended to the interface name in order to create a string
|
This string will be prepended to the interface name in order to create a string
|
||||||
that contains all the information required to open the source.
|
that contains all the information required to open the source.
|
||||||
|
|
||||||
This string indicates that the user wants to open a capture from a network interface.
|
This string indicates that the user wants to open a capture from a network interface.
|
||||||
This string does not necessarily involve the use of the RPCAP protocol. If the
|
This string does not necessarily involve the use of the RPCAP protocol. If the
|
||||||
interface required resides on the local host, the RPCAP protocol is not involved
|
interface required resides on the local host, the RPCAP protocol is not involved
|
||||||
and the local functions are used.
|
and the local functions are used.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SRC_IF_STRING "rpcap://"
|
#define PCAP_SRC_IF_STRING "rpcap://"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\}
|
\}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\addtogroup remote_open_flags
|
\addtogroup remote_open_flags
|
||||||
\{
|
\{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Defines if the adapter has to go in promiscuous mode.
|
\brief Defines if the adapter has to go in promiscuous mode.
|
||||||
|
|
||||||
It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise.
|
It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise.
|
||||||
Note that even if this parameter is false, the interface could well be in promiscuous
|
Note that even if this parameter is false, the interface could well be in promiscuous
|
||||||
mode for some other reason (for example because another capture process with
|
mode for some other reason (for example because another capture process with
|
||||||
promiscuous mode enabled is currently using that interface).
|
promiscuous mode enabled is currently using that interface).
|
||||||
On on Linux systems with 2.2 or later kernels (that have the "any" device), this
|
On on Linux systems with 2.2 or later kernels (that have the "any" device), this
|
||||||
flag does not work on the "any" device; if an argument of "any" is supplied,
|
flag does not work on the "any" device; if an argument of "any" is supplied,
|
||||||
the 'promisc' flag is ignored.
|
the 'promisc' flag is ignored.
|
||||||
*/
|
*/
|
||||||
#define PCAP_OPENFLAG_PROMISCUOUS 1
|
#define PCAP_OPENFLAG_PROMISCUOUS 1
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Defines if the data trasfer (in case of a remote
|
\brief Defines if the data trasfer (in case of a remote
|
||||||
capture) has to be done with UDP protocol.
|
capture) has to be done with UDP protocol.
|
||||||
|
|
||||||
If it is '1' if you want a UDP data connection, '0' if you want
|
If it is '1' if you want a UDP data connection, '0' if you want
|
||||||
a TCP data connection; control connection is always TCP-based.
|
a TCP data connection; control connection is always TCP-based.
|
||||||
A UDP connection is much lighter, but it does not guarantee that all
|
A UDP connection is much lighter, but it does not guarantee that all
|
||||||
the captured packets arrive to the client workstation. Moreover,
|
the captured packets arrive to the client workstation. Moreover,
|
||||||
it could be harmful in case of network congestion.
|
it could be harmful in case of network congestion.
|
||||||
This flag is meaningless if the source is not a remote interface.
|
This flag is meaningless if the source is not a remote interface.
|
||||||
In that case, it is simply ignored.
|
In that case, it is simply ignored.
|
||||||
*/
|
*/
|
||||||
#define PCAP_OPENFLAG_DATATX_UDP 2
|
#define PCAP_OPENFLAG_DATATX_UDP 2
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Defines if the remote probe will capture its own generated traffic.
|
\brief Defines if the remote probe will capture its own generated traffic.
|
||||||
|
|
||||||
In case the remote probe uses the same interface to capture traffic and to send
|
In case the remote probe uses the same interface to capture traffic and to send
|
||||||
data back to the caller, the captured traffic includes the RPCAP traffic as well.
|
data back to the caller, the captured traffic includes the RPCAP traffic as well.
|
||||||
If this flag is turned on, the RPCAP traffic is excluded from the capture, so that
|
If this flag is turned on, the RPCAP traffic is excluded from the capture, so that
|
||||||
the trace returned back to the collector is does not include this traffic.
|
the trace returned back to the collector is does not include this traffic.
|
||||||
*/
|
*/
|
||||||
#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4
|
#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Defines if the local adapter will capture its own generated traffic.
|
\brief Defines if the local adapter will capture its own generated traffic.
|
||||||
|
|
||||||
This flag tells the underlying capture driver to drop the packets that were sent by itself.
|
This flag tells the underlying capture driver to drop the packets that were sent by itself.
|
||||||
This is usefult when building applications like bridges, that should ignore the traffic
|
This is usefult when building applications like bridges, that should ignore the traffic
|
||||||
they just sent.
|
they just sent.
|
||||||
*/
|
*/
|
||||||
#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8
|
#define PCAP_OPENFLAG_NOCAPTURE_LOCAL 8
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief This flag configures the adapter for maximum responsiveness.
|
\brief This flag configures the adapter for maximum responsiveness.
|
||||||
|
|
||||||
In presence of a large value for nbytes, WinPcap waits for the arrival of several packets before
|
In presence of a large value for nbytes, WinPcap waits for the arrival of several packets before
|
||||||
copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage,
|
copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage,
|
||||||
i.e. better performance, which is good for applications like sniffers. If the user sets the
|
i.e. better performance, which is good for applications like sniffers. If the user sets the
|
||||||
PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will copy the packets as soon as the application
|
PCAP_OPENFLAG_MAX_RESPONSIVENESS flag, the capture driver will copy the packets as soon as the application
|
||||||
is ready to receive them. This is suggested for real time applications (like, for example, a bridge)
|
is ready to receive them. This is suggested for real time applications (like, for example, a bridge)
|
||||||
that need the best responsiveness.*/
|
that need the best responsiveness.*/
|
||||||
#define PCAP_OPENFLAG_MAX_RESPONSIVENESS 16
|
#define PCAP_OPENFLAG_MAX_RESPONSIVENESS 16
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\}
|
\}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\addtogroup remote_samp_methods
|
\addtogroup remote_samp_methods
|
||||||
\{
|
\{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief No sampling has to be done on the current capture.
|
\brief No sampling has to be done on the current capture.
|
||||||
|
|
||||||
In this case, no sampling algorithms are applied to the current capture.
|
In this case, no sampling algorithms are applied to the current capture.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SAMP_NOSAMP 0
|
#define PCAP_SAMP_NOSAMP 0
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief It defines that only 1 out of N packets must be returned to the user.
|
\brief It defines that only 1 out of N packets must be returned to the user.
|
||||||
|
|
||||||
In this case, the 'value' field of the 'pcap_samp' structure indicates the
|
In this case, the 'value' field of the 'pcap_samp' structure indicates the
|
||||||
number of packets (minus 1) that must be discarded before one packet got accepted.
|
number of packets (minus 1) that must be discarded before one packet got accepted.
|
||||||
In other words, if 'value = 10', the first packet is returned to the caller, while
|
In other words, if 'value = 10', the first packet is returned to the caller, while
|
||||||
the following 9 are discarded.
|
the following 9 are discarded.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SAMP_1_EVERY_N 1
|
#define PCAP_SAMP_1_EVERY_N 1
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief It defines that we have to return 1 packet every N milliseconds.
|
\brief It defines that we have to return 1 packet every N milliseconds.
|
||||||
|
|
||||||
In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting
|
In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting
|
||||||
time' in milliseconds before one packet got accepted.
|
time' in milliseconds before one packet got accepted.
|
||||||
In other words, if 'value = 10', the first packet is returned to the caller; the next
|
In other words, if 'value = 10', the first packet is returned to the caller; the next
|
||||||
returned one will be the first packet that arrives when 10ms have elapsed.
|
returned one will be the first packet that arrives when 10ms have elapsed.
|
||||||
*/
|
*/
|
||||||
#define PCAP_SAMP_FIRST_AFTER_N_MS 2
|
#define PCAP_SAMP_FIRST_AFTER_N_MS 2
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\}
|
\}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\addtogroup remote_auth_methods
|
\addtogroup remote_auth_methods
|
||||||
\{
|
\{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief It defines the NULL authentication.
|
\brief It defines the NULL authentication.
|
||||||
|
|
||||||
This value has to be used within the 'type' member of the pcap_rmtauth structure.
|
This value has to be used within the 'type' member of the pcap_rmtauth structure.
|
||||||
The 'NULL' authentication has to be equal to 'zero', so that old applications
|
The 'NULL' authentication has to be equal to 'zero', so that old applications
|
||||||
can just put every field of struct pcap_rmtauth to zero, and it does work.
|
can just put every field of struct pcap_rmtauth to zero, and it does work.
|
||||||
*/
|
*/
|
||||||
#define RPCAP_RMTAUTH_NULL 0
|
#define RPCAP_RMTAUTH_NULL 0
|
||||||
/*!
|
/*!
|
||||||
\brief It defines the username/password authentication.
|
\brief It defines the username/password authentication.
|
||||||
|
|
||||||
With this type of authentication, the RPCAP protocol will use the username/
|
With this type of authentication, the RPCAP protocol will use the username/
|
||||||
password provided to authenticate the user on the remote machine. If the
|
password provided to authenticate the user on the remote machine. If the
|
||||||
authentication is successful (and the user has the right to open network devices)
|
authentication is successful (and the user has the right to open network devices)
|
||||||
the RPCAP connection will continue; otherwise it will be dropped.
|
the RPCAP connection will continue; otherwise it will be dropped.
|
||||||
|
|
||||||
This value has to be used within the 'type' member of the pcap_rmtauth structure.
|
This value has to be used within the 'type' member of the pcap_rmtauth structure.
|
||||||
*/
|
*/
|
||||||
#define RPCAP_RMTAUTH_PWD 1
|
#define RPCAP_RMTAUTH_PWD 1
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\}
|
\}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
\brief This structure keeps the information needed to autheticate
|
\brief This structure keeps the information needed to autheticate
|
||||||
the user on a remote machine.
|
the user on a remote machine.
|
||||||
|
|
||||||
The remote machine can either grant or refuse the access according
|
The remote machine can either grant or refuse the access according
|
||||||
to the information provided.
|
to the information provided.
|
||||||
In case the NULL authentication is required, both 'username' and
|
In case the NULL authentication is required, both 'username' and
|
||||||
'password' can be NULL pointers.
|
'password' can be NULL pointers.
|
||||||
|
|
||||||
This structure is meaningless if the source is not a remote interface;
|
This structure is meaningless if the source is not a remote interface;
|
||||||
in that case, the functions which requires such a structure can accept
|
in that case, the functions which requires such a structure can accept
|
||||||
a NULL pointer as well.
|
a NULL pointer as well.
|
||||||
*/
|
*/
|
||||||
struct pcap_rmtauth
|
struct pcap_rmtauth
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
\brief Type of the authentication required.
|
\brief Type of the authentication required.
|
||||||
|
|
||||||
In order to provide maximum flexibility, we can support different types
|
In order to provide maximum flexibility, we can support different types
|
||||||
of authentication based on the value of this 'type' variable. The currently
|
of authentication based on the value of this 'type' variable. The currently
|
||||||
supported authentication methods are defined into the
|
supported authentication methods are defined into the
|
||||||
\link remote_auth_methods Remote Authentication Methods Section\endlink.
|
\link remote_auth_methods Remote Authentication Methods Section\endlink.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int type;
|
int type;
|
||||||
/*!
|
/*!
|
||||||
\brief Zero-terminated string containing the username that has to be
|
\brief Zero-terminated string containing the username that has to be
|
||||||
used on the remote machine for authentication.
|
used on the remote machine for authentication.
|
||||||
|
|
||||||
This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication
|
This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication
|
||||||
and it can be NULL.
|
and it can be NULL.
|
||||||
*/
|
*/
|
||||||
char *username;
|
char *username;
|
||||||
/*!
|
/*!
|
||||||
\brief Zero-terminated string containing the password that has to be
|
\brief Zero-terminated string containing the password that has to be
|
||||||
used on the remote machine for authentication.
|
used on the remote machine for authentication.
|
||||||
|
|
||||||
This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication
|
This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication
|
||||||
and it can be NULL.
|
and it can be NULL.
|
||||||
*/
|
*/
|
||||||
char *password;
|
char *password;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief This structure defines the information related to sampling.
|
\brief This structure defines the information related to sampling.
|
||||||
|
|
||||||
In case the sampling is requested, the capturing device should read
|
In case the sampling is requested, the capturing device should read
|
||||||
only a subset of the packets coming from the source. The returned packets depend
|
only a subset of the packets coming from the source. The returned packets depend
|
||||||
on the sampling parameters.
|
on the sampling parameters.
|
||||||
|
|
||||||
\warning The sampling process is applied <strong>after</strong> the filtering process.
|
\warning The sampling process is applied <strong>after</strong> the filtering process.
|
||||||
In other words, packets are filtered first, then the sampling process selects a
|
In other words, packets are filtered first, then the sampling process selects a
|
||||||
subset of the 'filtered' packets and it returns them to the caller.
|
subset of the 'filtered' packets and it returns them to the caller.
|
||||||
*/
|
*/
|
||||||
struct pcap_samp
|
struct pcap_samp
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
Method used for sampling. Currently, the supported methods are listed in the
|
Method used for sampling. Currently, the supported methods are listed in the
|
||||||
\link remote_samp_methods Sampling Methods Section\endlink.
|
\link remote_samp_methods Sampling Methods Section\endlink.
|
||||||
*/
|
*/
|
||||||
int method;
|
int method;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
This value depends on the sampling method defined. For its meaning, please check
|
This value depends on the sampling method defined. For its meaning, please check
|
||||||
at the \link remote_samp_methods Sampling Methods Section\endlink.
|
at the \link remote_samp_methods Sampling Methods Section\endlink.
|
||||||
*/
|
*/
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Maximum lenght of an host name (needed for the RPCAP active mode)
|
//! Maximum lenght of an host name (needed for the RPCAP active mode)
|
||||||
#define RPCAP_HOSTLIST_SIZE 1024
|
#define RPCAP_HOSTLIST_SIZE 1024
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\}
|
\}
|
||||||
*/ // end of public documentation
|
*/ // end of public documentation
|
||||||
|
|
||||||
|
|
||||||
// Exported functions
|
// Exported functions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** \name New WinPcap functions
|
/** \name New WinPcap functions
|
||||||
|
|
||||||
This section lists the new functions that are able to help considerably in writing
|
This section lists the new functions that are able to help considerably in writing
|
||||||
WinPcap programs because of their easiness of use.
|
WinPcap programs because of their easiness of use.
|
||||||
*/
|
*/
|
||||||
//\{
|
//\{
|
||||||
pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
|
pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf);
|
||||||
int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf);
|
int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf);
|
||||||
int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf);
|
int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf);
|
||||||
int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
|
int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf);
|
||||||
struct pcap_samp *pcap_setsampling(pcap_t *p);
|
struct pcap_samp *pcap_setsampling(pcap_t *p);
|
||||||
|
|
||||||
//\}
|
//\}
|
||||||
// End of new winpcap functions
|
// End of new winpcap functions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** \name Remote Capture functions
|
/** \name Remote Capture functions
|
||||||
*/
|
*/
|
||||||
//\{
|
//\{
|
||||||
SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf);
|
SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf);
|
||||||
int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf);
|
int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf);
|
||||||
int pcap_remoteact_close(const char *host, char *errbuf);
|
int pcap_remoteact_close(const char *host, char *errbuf);
|
||||||
void pcap_remoteact_cleanup();
|
void pcap_remoteact_cleanup();
|
||||||
//\}
|
//\}
|
||||||
// End of remote capture functions
|
// End of remote capture functions
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Winpcap is version 4.1.2 downloaded from
|
||||||
|
https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip
|
||||||
|
Just the /include and /lib directories are included to keep the size small.
|
|
@ -2,7 +2,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include "DEV9.h"
|
#include "..\DEV9.h"
|
||||||
|
|
||||||
#define GetKeyV(name, var, s, t) \
|
#define GetKeyV(name, var, s, t) \
|
||||||
size = s; type = t; \
|
size = s; type = t; \
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SvnRootDir)\common\include;$(SvnRootDir)\3rdparty\winpcap\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -74,14 +74,14 @@
|
||||||
</DataExecutionPrevention>
|
</DataExecutionPrevention>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;wpcap.lib;packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;wpcap.lib;packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(ProjectDir)../pcap/wpcap_32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)3rdparty\winpcap\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SvnRootDir)\common\include;$(SvnRootDir)\3rdparty\winpcap\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
<DataExecutionPrevention>
|
<DataExecutionPrevention>
|
||||||
</DataExecutionPrevention>
|
</DataExecutionPrevention>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
<AdditionalLibraryDirectories>$(ProjectDir)../pcap/wpcap_32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)3rdparty\winpcap\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;wpcap.lib;packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;wpcap.lib;packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "DEV9.h"
|
#include "..\DEV9.h"
|
||||||
#include "pcap.h"
|
#include "pcap.h"
|
||||||
#include "pcap_io.h"
|
#include "pcap_io.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "Dev9.h"
|
#include "..\Dev9.h"
|
||||||
|
|
||||||
//mtfifo<NetPacket*> rx_fifo;
|
//mtfifo<NetPacket*> rx_fifo;
|
||||||
//mtfifo<NetPacket*> tx_fifo;
|
//mtfifo<NetPacket*> tx_fifo;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "dev9.h"
|
#include "..\dev9.h"
|
||||||
|
|
||||||
u8 CALLBACK smap_read8(u32 addr);
|
u8 CALLBACK smap_read8(u32 addr);
|
||||||
u16 CALLBACK smap_read16(u32 addr);
|
u16 CALLBACK smap_read16(u32 addr);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "tap.h"
|
#include "tap.h"
|
||||||
#include "dev9.h"
|
#include "..\dev9.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
//=============
|
//=============
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue