亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? packet.h

?? Windows XP下的抓包程序實現
?? H
?? 第 1 頁 / 共 3 頁
字號:
/*
 * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
 * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Politecnico di Torino, CACE Technologies 
 * nor the names of its contributors may be used to endorse or promote 
 * products derived from this software without specific prior written 
 * permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

/** @addtogroup NPF 
 *  @{
 */

/** @defgroup NPF_include NPF structures and definitions 
 *  @{
 */

#ifndef __PACKET_INCLUDE______
#define __PACKET_INCLUDE______

#ifdef __NPF_x86__
#define NTKERNEL	///< Forces the compilation of the jitter with kernel calls 
#include "jitter.h"
#endif

//
// Needed to disable a warning due to the #pragma prefast directives,
// that are ignored by the normal DDK compiler
//
#ifndef _PREFAST_
#pragma warning(disable:4068)
#endif

#include "win_bpf.h"

#define  MAX_REQUESTS   32 ///< Maximum number of simultaneous IOCTL requests.

#define Packet_ALIGNMENT sizeof(int) ///< Alignment macro. Defines the alignment size.
#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1))	///< Alignment macro. Rounds up to the next 
																				///< even multiple of Packet_ALIGNMENT. 

#define KERNEL_EVENT_NAMESPACE L"\\BaseNamedObjects\\"

/***************************/
/*         IOCTLs          */
/***************************/

/*!
  \brief IOCTL code: set kernel buffer size.

  This IOCTL is used to set a new size of the circular buffer associated with an instance of NPF.
  When a BIOCSETBUFFERSIZE command is received, the driver frees the old buffer, allocates the new one 
  and resets all the parameters associated with the buffer in the OPEN_INSTANCE structure. The currently 
  buffered packets are lost.
*/
#define	 BIOCSETBUFFERSIZE 9592

/*!
  \brief IOCTL code: set packet filtering program.

  This IOCTL sets a new packet filter in the driver. Before allocating any memory for the new filter, the 
  bpf_validate() function is called to check the correctness of the filter. If this function returns TRUE, 
  the filter is copied to the driver's memory, its address is stored in the bpfprogram field of the 
  OPEN_INSTANCE structure associated with current instance of the driver, and the filter will be applied to 
  every incoming packet. This command also empties the circular buffer used by current instance 
  to store packets. This is done to avoid the presence in the buffer of packets that do not match the filter.
*/
#define	 BIOCSETF 9030

/*!
  \brief IOCTL code: get the capture stats

  This command returns to the application the number of packets received and the number of packets dropped by 
  an instance of the driver.
*/
#define  BIOCGSTATS 9031

/*!
  \brief IOCTL code: set the read timeout

  This command sets the maximum timeout after which a read is released, also if no data packets were received.
*/
#define	 BIOCSRTIMEOUT 7416

/*!
  \brief IOCTL code: set working mode

  This IOCTL can be used to set the working mode of a NPF instance. The new mode, received by the driver in the
  buffer associated with the IOCTL command, can be #MODE_CAPT for capture mode (the default), #MODE_STAT for
  statistical mode or #MODE_DUMP for dump mode.
*/
#define	 BIOCSMODE 7412

/*!
  \brief IOCTL code: set number of physical repetions of every packet written by the app

  Sets the number of times a single write call must be repeated. This command sets the OPEN_INSTANCE::Nwrites 
  member, and is used to implement the 'multiple write' feature of the driver.
*/
#define	 BIOCSWRITEREP 7413

/*!
  \brief IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call

  This command sets the OPEN_INSTANCE::MinToCopy member.
*/
#define	 BIOCSMINTOCOPY 7414

/*!
  \brief IOCTL code: set an OID value

  This IOCTL is used to perform an OID set operation on the NIC driver. 
*/
#define	 BIOCSETOID 2147483648

/*!
  \brief IOCTL code: get an OID value

  This IOCTL is used to perform an OID get operation on the NIC driver. 
*/
#define	 BIOCQUERYOID 2147483652

/*!
  \brief IOCTL code: set the name of a the file used by kernel dump mode

  This command opens a file whose name is contained in the IOCTL buffer and associates it with current NPf instance.
  The dump thread uses it to copy the content of the circular buffer to file.
  If a file was already opened, the driver closes it before opening the new one.
*/
#define  BIOCSETDUMPFILENAME 9029

/*!
  \brief IOCTL code: get the name of the event that the driver signals when some data is present in the buffer

  Command used by the application to retrieve the name of the global event associated with a NPF instance.
  The event is signaled by the driver when the kernel buffer contains enough data for a transfer.
*/
#define  BIOCGEVNAME 7415

/*!
  \brief IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps.

  Command used to send a buffer of packets in a single system call. Every packet in the buffer is preceded by
  a sf_pkthdr structure. The timestamps of the packets are ignored, i.e. the packets are sent as fast as 
  possible. The NPF_BufferedWrite() function is invoked to send the packets.
*/
#define  BIOCSENDPACKETSNOSYNC 9032

/*!
  \brief IOCTL code: Send a buffer containing multiple packets to the network, considering the timestamps.

  Command used to send a buffer of packets in a single system call. Every packet in the buffer is preceded by
  a sf_pkthdr structure. The timestamps of the packets are used to synchronize the write, i.e. the packets 
  are sent to the network respecting the intervals specified in the sf_pkthdr structure assiciated with each
  packet. NPF_BufferedWrite() function is invoked to send the packets. 
*/
#define  BIOCSENDPACKETSSYNC 9033

/*!
  \brief IOCTL code: Set the dump file limits.

  This IOCTL sets the limits (maximum size and maximum number of packets) of the dump file created when the
  driver works in dump mode.
*/
#define  BIOCSETDUMPLIMITS 9034

/*!
  \brief IOCTL code: Get the status of the kernel dump process.

  This command returns TRUE if the kernel dump is ended, i.e if one of the limits set with BIOCSETDUMPLIMITS
  (amount of bytes or number of packets) has been reached.
*/
#define BIOCISDUMPENDED 7411

/*!
  \brief IOCTL code: set the loopback behavior.

  This IOCTL sets the loopback behavior of the driver with packets sent by itself: capture or drop.
*/
#define  BIOCISETLOBBEH 7410			

/*!
	\brief This IOCTL passes the read event HANDLE allocated by the user (packet.dll) to kernel level

	Parameter: HANDLE
	Parameter size: sizeof(HANDLE). If the caller is 32 bit, the parameter size is 4 bytes, even if sizeof(HANDLE) at kernel level
		is 8 bytes. That's why in this IOCTL code handler we detect a 32bit calling process and do the necessary thunking.

	TODO GV:I will go to hell for this ugly IOCTL definition. We should use CTL_CODE!!
*/
#define BIOCSETEVENTHANDLE 7920

// Working modes
#define MODE_CAPT 0x0		///< Capture working mode
#define MODE_STAT 0x1		///< Statistical working mode
#define MODE_MON  0x2		///< Kernel monitoring mode
#define MODE_DUMP 0x10		///< Kernel dump working mode


#define IMMEDIATE 1			///< Immediate timeout. Forces a read call to return immediately.

#define NDIS_FLAGS_SKIP_LOOPBACK_W2K    0x400 ///< This is an undocumented flag for NdisSetPacketFlags() that allows to disable loopback reception.

// The following definitions are used to provide compatibility 
// of the dump files with the ones of libpcap
#define TCPDUMP_MAGIC 0xa1b2c3d4	///< Libpcap magic number. Used by programs like tcpdump to recognize a driver's generated dump file.
#define PCAP_VERSION_MAJOR 2		///< Major libpcap version of the dump file. Used by programs like tcpdump to recognize a driver's generated dump file.
#define PCAP_VERSION_MINOR 4		///< Minor libpcap version of the dump file. Used by programs like tcpdump to recognize a driver's generated dump file.

// Loopback behaviour definitions
#define NPF_DISABLE_LOOPBACK	1	///< Tells the driver to drop the packets sent by itself. This is usefult when building applications like bridges.
#define NPF_ENABLE_LOOPBACK		2	///< Tells the driver to capture the packets sent by itself.

/*!
  \brief Header of a libpcap dump file.

  Used when a driver instance is set in dump mode to create a libpcap-compatible file.
*/
struct packet_file_header 
{
	UINT magic;				///< Libpcap magic number
	USHORT version_major;	///< Libpcap major version
	USHORT version_minor;	///< Libpcap minor version
	UINT thiszone;			///< Gmt to local correction
	UINT sigfigs;			///< Accuracy of timestamps
	UINT snaplen;			///< Length of the max saved portion of each packet
	UINT linktype;			///< Data link type (DLT_*). See win_bpf.h for details.
};

/*!
  \brief Header associated to a packet in the driver's buffer when the driver is in dump mode.
  Similar to the bpf_hdr structure, but simpler.
*/
struct sf_pkthdr {
    struct timeval	ts;			///< time stamp
    UINT			caplen;		///< Length of captured portion. The captured portion can be different from 
								///< the original packet, because it is possible (with a proper filter) to 
								///< instruct the driver to capture only a portion of the packets. 
    UINT			len;		///< Length of the original packet (off wire).
};

/*!
  \brief Stores an OID request.
  
  This structure is used by the driver to perform OID query or set operations on the underlying NIC driver. 
  The OID operations be performed usually only by network drivers, but NPF exports this mechanism to user-level 
  applications through an IOCTL interface. The driver uses this structure to wrap a NDIS_REQUEST structure.
  This allows to handle correctly the callback structure of NdisRequest(), handling multiple requests and
  maintaining information about the IRPs to complete.
*/
typedef struct _INTERNAL_REQUEST {
    LIST_ENTRY		ListElement;		///< Used to handle lists of requests.
//    PIRP			Irp;				///< Irp that performed the request
//	BOOLEAN			Internal;			///< True if the request is for internal use of npf.sys. False if the request is performed by the user through an IOCTL.
	NDIS_EVENT		InternalRequestCompletedEvent;
    NDIS_REQUEST	Request;			///< The structure with the actual request, that will be passed to NdisRequest().
	NDIS_STATUS		RequestStatus;

} INTERNAL_REQUEST, *PINTERNAL_REQUEST;

/*!
  \brief Contains a NDIS packet.
  
  The driver uses this structure to wrap a NDIS_PACKET  structure.
  This allows to handle correctly the callback structure of NdisTransferData(), handling multiple requests and
  maintaining information about the IRPs to complete.
*/
typedef struct _PACKET_RESERVED {
    LIST_ENTRY		ListElement;		///< Used to handle lists of packets.
    PIRP			Irp;				///< Irp that performed the request
    PMDL			pMdl;				///< MDL mapping the buffer of the packet.
	BOOLEAN			FreeBufAfterWrite;	///< True if the memory buffer associated with the packet must be freed 
										///< after a call to NdisSend().
	ULONG			Cpu;				///< The CPU on which the packet was pulled out of the linked list of free packets
}  PACKET_RESERVED, *PPACKET_RESERVED;

#define RESERVED(_p) ((PPACKET_RESERVED)((_p)->ProtocolReserved)) ///< Macro to obtain a NDIS_PACKET from a PACKET_RESERVED

/*!
  \brief Port device extension.
  
  Structure containing some data relative to every adapter on which NPF is bound.
*/
typedef struct _DEVICE_EXTENSION {
    NDIS_HANDLE    NdisProtocolHandle;	///< NDIS handle of NPF.
    NDIS_STRING    AdapterName;			///< Name of the adapter.
	PWSTR		   ExportString;		///< Name of the exported device, i.e. name that the applications will use 
										///< to open this adapter through WinPcap.
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;

/*!
  \brief Kernel buffer of each CPU.

  Structure containing the kernel buffer (and other CPU related fields) used to capture packets.
*/
typedef struct __CPU_Private_Data
{
	ULONG	P;					///< Zero-based index of the producer in the buffer. It indicates the first free byte to be written.
	ULONG	C;					///< Zero-based index of the consumer in the buffer. It indicates the first free byte to be read.
	ULONG	Free;				///< Number of the free bytes in the buffer
	PUCHAR	Buffer;				///< Pointer to the kernel buffer used to capture packets.
	ULONG	Accepted;			///< Number of packet that current capture instance acepted, from its opening. A packet 
								///< is accepted if it passes the filter and fits in the buffer. Accepted packets are the
								///< ones that reach the application. 
								///< This number is related to the particular CPU this structure is referring to.
	ULONG	Received;			///< Number of packets received by current instance from its opening, i.e. number of 
								///< packet received by the network adapter since the beginning of the 
								///< capture/monitoring/dump session. 
								///< This number is related to the particular CPU this structure is referring to.
	ULONG	Dropped;			///< Number of packet that current instance had to drop, from its opening. A packet 
								///< is dropped if there is no more space to store it in the circular buffer that the 
								///< driver associates to current instance. 
								///< This number is related to the particular CPU this structure is referring to.
	NDIS_SPIN_LOCK BufferLock;	///< It protects the buffer associated with this CPU.
	PMDL    TransferMdl1;		///< MDL used to map the portion of the buffer that will contain an incoming packet. 
	PMDL    TransferMdl2;		///< Second MDL used to map the portion of the buffer that will contain an incoming packet. 
	ULONG	NewP;				///< Used by NdisTransferData() (when we call NdisTransferData, p index must be updated only in the TransferDataComplete.
}
	CpuPrivateData;


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色免费短视频| 欧美不卡在线视频| 日韩精品中文字幕在线一区| 国产亚洲精品aa午夜观看| 亚洲自拍另类综合| 懂色一区二区三区免费观看| 欧美日韩1234| 国产精品福利av| 国内精品第一页| 欧美日韩一区二区在线观看 | 91国产福利在线| 久久综合九色综合久久久精品综合| 一区二区三区日韩欧美精品| 亚洲免费成人av| 精品91自产拍在线观看一区| 亚洲一区av在线| 99久久精品久久久久久清纯| 久久久五月婷婷| 蜜桃视频免费观看一区| 91福利精品视频| 亚洲男女一区二区三区| 国产精品2024| 精品精品国产高清a毛片牛牛| 日日夜夜精品视频天天综合网| 99精品欧美一区二区三区小说| 久久久高清一区二区三区| 久久精品久久99精品久久| 欧美久久一二区| 午夜精品久久久久久久99水蜜桃| 在线国产电影不卡| 亚洲与欧洲av电影| 欧美优质美女网站| 亚洲国产日产av| 欧美日韩精品高清| 日韩国产精品大片| 日韩一区二区三区电影| 久久国产人妖系列| 久久久噜噜噜久噜久久综合| 国产一区不卡在线| 国产精品欧美经典| 99久久婷婷国产| 一区二区国产盗摄色噜噜| 色天使色偷偷av一区二区| 亚洲精品欧美在线| 欧美久久高跟鞋激| 丝袜美腿亚洲一区二区图片| 在线免费一区三区| 亚洲综合在线电影| 欧美亚洲自拍偷拍| 日本成人在线网站| 久久久综合精品| 成人国产在线观看| 亚洲综合丝袜美腿| 欧美刺激午夜性久久久久久久| 精品亚洲aⅴ乱码一区二区三区| 欧美精品一区二区久久久| 国产 欧美在线| 亚洲精品欧美专区| 精品三级在线看| av亚洲精华国产精华精| 亚洲国产日日夜夜| 国产亚洲污的网站| 色婷婷综合中文久久一本| 蜜臀久久久久久久| 国产精品久久久久aaaa樱花 | 亚洲一二三区在线观看| 欧美丰满少妇xxxbbb| 国产麻豆9l精品三级站| 亚洲最大色网站| 久久久国产精华| 欧美日产在线观看| www.激情成人| 日本大胆欧美人术艺术动态| 国产精品久久精品日日| 91麻豆精品国产91久久久使用方法| 国产乱子轮精品视频| 亚洲一级二级在线| 国产清纯白嫩初高生在线观看91| 欧美视频第二页| 国产电影一区在线| 青青草91视频| 亚洲一二三四区不卡| 国产精品―色哟哟| 日韩一卡二卡三卡四卡| 欧美在线观看你懂的| 国产乱码精品一品二品| 午夜精品久久久久久久99水蜜桃| 国产精品久久久一区麻豆最新章节| 欧美精品在线一区二区三区| av色综合久久天堂av综合| 国产在线视频一区二区三区| 亚洲成av人在线观看| 中文字幕一区不卡| 国产无人区一区二区三区| 欧美一区二区免费| 欧美三级视频在线播放| 99久久精品国产一区| 国产v综合v亚洲欧| 国产制服丝袜一区| 蜜桃久久精品一区二区| 天天影视网天天综合色在线播放| 亚洲人成电影网站色mp4| 欧美高清一级片在线观看| 欧美成人三级在线| 日韩欧美一区在线| 日韩一区二区三区在线视频| 91精品国产欧美一区二区| 欧美性生活影院| 欧美午夜宅男影院| 欧美性极品少妇| 欧洲av一区二区嗯嗯嗯啊| 91亚洲男人天堂| 91国产视频在线观看| 99国产欧美另类久久久精品| 国产成人精品免费在线| 国产91精品在线观看| 久久99久国产精品黄毛片色诱| 日本aⅴ亚洲精品中文乱码| 天天操天天色综合| 六月丁香婷婷色狠狠久久| 蜜臀精品久久久久久蜜臀| 激情综合色综合久久综合| 国产尤物一区二区| 国产精品18久久久久久久久| 国产高清无密码一区二区三区| 国产精一品亚洲二区在线视频| 国产综合一区二区| 国产91精品精华液一区二区三区| 成人h动漫精品一区二区| 色婷婷激情一区二区三区| 91福利区一区二区三区| 91精品国产乱码久久蜜臀| 337p粉嫩大胆色噜噜噜噜亚洲| 2019国产精品| ...xxx性欧美| 亚洲国产va精品久久久不卡综合| 免费成人美女在线观看| 国产精品一区二区三区乱码| 91伊人久久大香线蕉| 6080午夜不卡| 久久久高清一区二区三区| 亚洲嫩草精品久久| 日本欧美大码aⅴ在线播放| 国产一区二区免费视频| 91捆绑美女网站| 欧美一区2区视频在线观看| 久久久久久久久久久久久久久99 | 天天色 色综合| 成人午夜激情在线| 欧美最猛黑人xxxxx猛交| 欧美大片一区二区| 亚洲欧洲美洲综合色网| 性久久久久久久久| 国产电影一区二区三区| 91极品视觉盛宴| 久久久夜色精品亚洲| 亚洲精品成人a在线观看| 麻豆成人久久精品二区三区小说| 成人免费av网站| 91麻豆精品国产91久久久久久久久| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美色图在线观看| 久久精品视频一区| 日韩精品视频网站| 日韩精品电影一区亚洲| 日韩 欧美一区二区三区| 国产成人在线观看免费网站| 在线一区二区三区| 久久午夜国产精品| 日本不卡一区二区三区| 91免费精品国自产拍在线不卡| 日韩一区二区三区av| 亚洲精品免费在线观看| 国产米奇在线777精品观看| 91麻豆精品国产| 亚洲精品大片www| 99精品在线免费| 欧美精品一区二区三区四区 | 亚洲精品美腿丝袜| 国产伦精品一区二区三区免费迷| 7777精品伊人久久久大香线蕉的 | 岛国一区二区三区| 欧美一卡2卡3卡4卡| 亚洲国产精品视频| 色婷婷激情一区二区三区| 日韩一区在线播放| 国产成人精品在线看| 久久五月婷婷丁香社区| 日韩高清不卡在线| 欧美日韩综合色| 亚洲一区二区偷拍精品| 一本色道久久综合亚洲91| 国产精品区一区二区三| 国产在线日韩欧美| 日韩欧美的一区| 精品中文字幕一区二区小辣椒| 欧美一区午夜精品| 日韩成人av影视| 日韩视频免费直播| 蜜桃视频一区二区三区在线观看 |