Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

708 lines
24 KiB

  1. /*
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ipfltdrv.h
  5. Abstract:
  6. Contains the IOCTLs and related data structures needed to interact with the IP
  7. Filter Driver
  8. Author:
  9. Amritansh Raghav
  10. Revision History:
  11. amritanr 30th Nov 1995 Created
  12. --*/
  13. #ifndef __IPFLTDRV_H__
  14. #define __IPFLTDRV_H__
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #define IPHDRLEN 0xf // header length mask in iph_verlen
  19. #define IPHDRSFT 2 // scaling value for the length
  20. //
  21. // Typedefs used in this file
  22. //
  23. #ifndef CTE_TYPEDEFS_DEFINED
  24. #define CTE_TYPEDEFS_DEFINED 1
  25. typedef unsigned long ulong;
  26. typedef unsigned short ushort;
  27. typedef unsigned char uchar;
  28. typedef unsigned int uint;
  29. #endif // CTE_TYPEDEFS_DEFINED
  30. #include <pfhook.h>
  31. //
  32. // if you don't want these definitions, define the manifest in your sources file
  33. //
  34. #include <packon.h>
  35. //
  36. // Structure of an ICMP header.
  37. //
  38. #ifndef IP_H_INCLUDED
  39. //* IP Header format.
  40. struct IPHeader {
  41. uchar iph_verlen; // Version and length.
  42. uchar iph_tos; // Type of service.
  43. ushort iph_length; // Total length of datagram.
  44. ushort iph_id; // Identification.
  45. ushort iph_offset; // Flags and fragment offset.
  46. uchar iph_ttl; // Time to live.
  47. uchar iph_protocol; // Protocol.
  48. ushort iph_xsum; // Header checksum.
  49. IPAddr iph_src; // Source address.
  50. IPAddr iph_dest; // Destination address.
  51. }; /* IPHeader */
  52. typedef struct IPHeader IPHeader;
  53. #endif
  54. #ifndef ICMPHEADER_INCLUDED
  55. typedef struct ICMPHeader {
  56. UCHAR ich_type; // Type of ICMP packet.
  57. UCHAR ich_code; // Subcode of type.
  58. USHORT ich_xsum; // Checksum of packet.
  59. ULONG ich_param; // Type-specific parameter field.
  60. } ICMPHeader , *PICMPHeader;
  61. #endif
  62. #include <packoff.h>
  63. #include <rtinfo.h>
  64. #include <ipinfoid.h>
  65. #include <ipfltinf.h>
  66. #define IP_FILTER_DRIVER_VERSION_1 1
  67. #define IP_FILTER_DRIVER_VERSION_2 1
  68. #define IP_FILTER_DRIVER_VERSION IP_FILTER_DRIVER_VERSION_2
  69. #define MAX_ADDRWORDS 1
  70. //
  71. // common flags
  72. //
  73. #define PF_GLOBAL_FLAGS_LOGON 0x80000000
  74. #define PF_GLOBAL_FLAGS_ABSORB 0x40000000
  75. //
  76. // Log ID
  77. //
  78. typedef UINT_PTR PFLOGGER ;
  79. //////////////////////////////////////////////////////////////////////////////
  80. // //
  81. // Service name - this is what the service is called //
  82. // //
  83. //////////////////////////////////////////////////////////////////////////////
  84. #define IPFLTRDRVR_SERVICE_NAME "IPFilterDriver"
  85. //
  86. // The following definitions come from <pfhook.h> now.
  87. //
  88. //////////////////////////////////////////////////////////////////////////////
  89. // //
  90. // Device Name - this string is the name of the device. It is the name //
  91. // that should be passed to NtOpenFile when accessing the device. //
  92. // //
  93. //////////////////////////////////////////////////////////////////////////////
  94. //#define DD_IPFLTRDRVR_DEVICE_NAME L"\\Device\\IPFILTERDRIVER"
  95. //////////////////////////////////////////////////////////////////////////////
  96. // //
  97. // IOCTL code definitions and related structures //
  98. // All the IOCTLs are synchronous and need administrator privilege //
  99. // //
  100. //////////////////////////////////////////////////////////////////////////////
  101. //#define FSCTL_IPFLTRDRVR_BASE FILE_DEVICE_NETWORK
  102. //#define _IPFLTRDRVR_CTL_CODE(function, method, access) \
  103. // CTL_CODE(FSCTL_IPFLTRDRVR_BASE, function, method, access)
  104. //////////////////////////////////////////////////////////////////////////////
  105. // //
  106. // This IOCTL is used to to create an interface in the filter driver. It //
  107. // takes in an index and an opaque context. It creates an interface, //
  108. // associates the index and context with it and returns a context for this //
  109. // created interface. All future IOCTLS require this context that is passed //
  110. // out //
  111. // //
  112. //////////////////////////////////////////////////////////////////////////////
  113. #define IOCTL_CREATE_INTERFACE \
  114. _IPFLTRDRVR_CTL_CODE(0, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  115. typedef struct _FILTER_DRIVER_CREATE_INTERFACE
  116. {
  117. IN DWORD dwIfIndex;
  118. IN DWORD dwAdapterId;
  119. IN PVOID pvRtrMgrContext;
  120. OUT PVOID pvDriverContext;
  121. }FILTER_DRIVER_CREATE_INTERFACE, *PFILTER_DRIVER_CREATE_INTERFACE;
  122. #define INVALID_FILTER_DRIVER_CONTEXT NULL
  123. //////////////////////////////////////////////////////////////////////////////
  124. // //
  125. // This IOCTL is used to set filters for an interface. //
  126. // The context used to identify the interface is the one that is passed out //
  127. // by the CREATE_INTERFACE IOCTL //
  128. // There can be two TOC entries, one for IP_FILTER_DRIVER_IN_FILTER_INFO //
  129. // and the other for IP_FILTER_DRIVER_OUT_FILTER_INFO. //
  130. // If a (in or out) TOC entry doesnt exist, no change is made to the //
  131. // (in or out) filters. //
  132. // If a (in or out) TOC exists and its size is 0, the (in or out) filters //
  133. // are deleted and the default (in or out) action set to FORWARD. //
  134. // If a TOC exists and its size is not 0 but the number of filters in the //
  135. // FILTER_DESCRIPTOR is 0, the old filters are deleted and the default //
  136. // action set to the one specified in the descriptor. //
  137. // The last case is when the Toc exists, its size is not 0, and the //
  138. // number of filters is also not 0. In this case, the old filters are //
  139. // deleted, the default action set to the one specified in the descriptor //
  140. // and the new filters are added. //
  141. // //
  142. //////////////////////////////////////////////////////////////////////////////
  143. #define IOCTL_SET_INTERFACE_FILTERS \
  144. _IPFLTRDRVR_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  145. //////////////////////////////////////////////////////////////////////////////
  146. // //
  147. // NOTE: These two IDs are reused but since they are used in different //
  148. // namespaces, we can do that safely //
  149. // //
  150. //////////////////////////////////////////////////////////////////////////////
  151. #define IP_FILTER_DRIVER_IN_FILTER_INFO IP_GENERAL_INFO_BASE + 1
  152. #define IP_FILTER_DRIVER_OUT_FILTER_INFO IP_GENERAL_INFO_BASE + 2
  153. typedef struct _FILTER_DRIVER_SET_FILTERS
  154. {
  155. IN PVOID pvDriverContext;
  156. IN RTR_INFO_BLOCK_HEADER ribhInfoBlock;
  157. }FILTER_DRIVER_SET_FILTERS, *PFILTER_DRIVER_SET_FILTERS;
  158. //
  159. //Definitions for logging and for filter defs.
  160. //
  161. typedef enum _pfEtype
  162. {
  163. PFE_FILTER = 1,
  164. PFE_SYNORFRAG,
  165. PFE_SPOOF,
  166. PFE_UNUSEDPORT,
  167. PFE_ALLOWCTL,
  168. PFE_FULLDENY,
  169. PFE_NOFRAG,
  170. PFE_STRONGHOST,
  171. PFE_FRAGCACHE
  172. } PFETYPE, *PPFETYPE;
  173. typedef struct _FILTER_INFO
  174. {
  175. DWORD dwSrcAddr;
  176. DWORD dwSrcMask;
  177. DWORD dwDstAddr;
  178. DWORD dwDstMask;
  179. DWORD dwProtocol;
  180. DWORD fLateBound;
  181. WORD wSrcPort;
  182. WORD wDstPort;
  183. }FILTER_INFO, *PFILTER_INFO;
  184. typedef enum _AddrType
  185. {
  186. IPV4,
  187. IPV6
  188. }ADDRTYPE, *PADDRTYPE;
  189. typedef struct _FILTER_INFO2
  190. {
  191. ADDRTYPE addrType;
  192. DWORD dwaSrcAddr[MAX_ADDRWORDS];
  193. DWORD dwaSrcMask[MAX_ADDRWORDS];
  194. DWORD dwaDstAddr[MAX_ADDRWORDS];
  195. DWORD dwaDstMask[MAX_ADDRWORDS];
  196. DWORD dwProtocol;
  197. DWORD fLateBound;
  198. WORD wSrcPort;
  199. WORD wDstPort;
  200. WORD wSrcPortHigh;
  201. WORD wDstPortHigh;
  202. }FILTER_INFO2, *PFILTER_INFO2;
  203. typedef struct _FILTER_DESCRIPTOR
  204. {
  205. DWORD dwVersion;
  206. DWORD dwNumFilters;
  207. FORWARD_ACTION faDefaultAction;
  208. FILTER_INFO fiFilter[1];
  209. }FILTER_DESCRIPTOR, *PFILTER_DESCRIPTOR;
  210. //
  211. // new filter definition
  212. //
  213. typedef struct _pfFilterInfoEx
  214. {
  215. PFETYPE type;
  216. DWORD dwFlags;
  217. DWORD dwFilterRule;
  218. PVOID pvFilterHandle;
  219. FILTER_INFO2 info;
  220. } FILTER_INFOEX, *PFILTER_INFOEX;
  221. #define FLAGS_INFOEX_NOSYN 0x1 // not implemented.
  222. #define FLAGS_INFOEX_LOGALL 0x2
  223. #define FLAGS_INFOEX_ALLOWDUPS 0x4
  224. #define FLAGS_INFOEX_ALLFLAGS 0x7
  225. #define FLAGS_INFOEX_ALLOWANYREMOTEADDRESS 0x8
  226. #define FLAGS_INFOEX_ALLOWANYLOCALADDRESS 0x10
  227. typedef struct _FILTER_DESCRIPTOR2
  228. {
  229. DWORD dwVersion; // must be 2
  230. DWORD dwNumFilters;
  231. FILTER_INFOEX fiFilter[1];
  232. } FILTER_DESCRIPTOR2, *PFILTER_DESCRIPTOR2;
  233. //////////////////////////////////////////////////////////////////////////////
  234. // //
  235. // The constants that should be used to set up the FILTER_INFO_STRUCTURE //
  236. // //
  237. //////////////////////////////////////////////////////////////////////////////
  238. #define FILTER_PROTO(ProtoId) MAKELONG(MAKEWORD((ProtoId),0x00),0x00000)
  239. #define FILTER_PROTO_ANY FILTER_PROTO(0x00)
  240. #define FILTER_PROTO_ICMP FILTER_PROTO(0x01)
  241. #define FILTER_PROTO_TCP FILTER_PROTO(0x06)
  242. //#define FILTER_PROTO_TCP_ESTAB FILTER_PROTO(0x86)
  243. #define FILTER_PROTO_UDP FILTER_PROTO(0x11)
  244. #define FILTER_TCPUDP_PORT_ANY (WORD)0x0000
  245. #define FILTER_ICMP_TYPE_ANY (BYTE)0xff
  246. #define FILTER_ICMP_CODE_ANY (BYTE)0xff
  247. //////////////////////////////////////////////////////////////////////////////
  248. // //
  249. // For WAN interfaces, the address is unknown at the time the filters are //
  250. // set. Use these two constants two specify "Local Address". The address //
  251. // and mask are set with IOCTL_INTERFACE_BOUND //
  252. // //
  253. //////////////////////////////////////////////////////////////////////////////
  254. #define SRC_ADDR_USE_LOCAL_FLAG 0x00000001
  255. #define SRC_ADDR_USE_REMOTE_FLAG 0x00000002
  256. #define DST_ADDR_USE_LOCAL_FLAG 0x00000004
  257. #define DST_ADDR_USE_REMOTE_FLAG 0x00000008
  258. #define SRC_MASK_LATE_FLAG 0x00000010
  259. #define DST_MASK_LATE_FLAG 0x00000020
  260. #define SetSrcAddrToLocalAddr(pFilter) \
  261. ((pFilter)->fLateBound |= SRC_ADDR_USE_LOCAL_FLAG)
  262. #define SetSrcAddrToRemoteAddr(pFilter) \
  263. ((pFilter)->fLateBound |= SRC_ADDR_USE_REMOTE_FLAG)
  264. #define SetDstAddrToLocalAddr(pFilter) \
  265. ((pFilter)->fLateBound |= DST_ADDR_USE_LOCAL_FLAG)
  266. #define SetDstAddrToRemoteAddr(pFilter) \
  267. ((pFilter)->fLateBound |= DST_ADDR_USE_REMOTE_FLAG)
  268. #define SetSrcMaskLateFlag(pFilter) ((pFilter)->fLateBound |= SRC_MASK_LATE_FLAG)
  269. #define SetDstMaskLateFlag(pFilter) ((pFilter)->fLateBound |= DST_MASK_LATE_FLAG)
  270. #define AreAllFieldsUnchanged(pFilter) \
  271. ((pFilter)->fLateBound == 0x00000000)
  272. #define DoesSrcAddrUseLocalAddr(pFilter) \
  273. ((pFilter)->fLateBound & SRC_ADDR_USE_LOCAL_FLAG)
  274. #define DoesSrcAddrUseRemoteAddr(pFilter) \
  275. ((pFilter)->fLateBound & SRC_ADDR_USE_REMOTE_FLAG)
  276. #define DoesDstAddrUseLocalAddr(pFilter) \
  277. ((pFilter)->fLateBound & DST_ADDR_USE_LOCAL_FLAG)
  278. #define DoesDstAddrUseRemoteAddr(pFilter) \
  279. ((pFilter)->fLateBound & DST_ADDR_USE_REMOTE_FLAG)
  280. #define IsSrcMaskLateBound(pFilter) ((pFilter)->fLateBound & SRC_MASK_LATE_FLAG)
  281. #define IsDstMaskLateBound(pFilter) ((pFilter)->fLateBound & DST_MASK_LATE_FLAG)
  282. //////////////////////////////////////////////////////////////////////////////
  283. // //
  284. // This IOCTL is used to specify address and mask information for WAN //
  285. // interfaces at the time they bind. The driver goes through all the //
  286. // filters for the interface specified by pvDriverContext and if the //
  287. // fLateBind flag was sepecified for the filter, it changes the //
  288. // any FILTER_ADDRESS_UNKNOWN fields in the source with dwSrcAddr and //
  289. // those in the dest with dwDstAddr //
  290. // //
  291. //////////////////////////////////////////////////////////////////////////////
  292. #define IOCTL_SET_LATE_BOUND_FILTERS \
  293. _IPFLTRDRVR_CTL_CODE(2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  294. typedef struct _FILTER_DRIVER_BINDING_INFO
  295. {
  296. IN PVOID pvDriverContext;
  297. IN DWORD dwLocalAddr;
  298. IN DWORD dwRemoteAddr;
  299. IN DWORD dwMask;
  300. }FILTER_DRIVER_BINDING_INFO, *PFILTER_DRIVER_BINDING_INFO;
  301. //////////////////////////////////////////////////////////////////////////////
  302. // //
  303. // This IOCTL deletes an interface. Once this is called, one may not use //
  304. // the context of this interface for either any of the IOCTLs or the //
  305. // MatchFilter() function //
  306. // //
  307. //////////////////////////////////////////////////////////////////////////////
  308. #define IOCTL_DELETE_INTERFACE \
  309. _IPFLTRDRVR_CTL_CODE(3, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  310. #define IOCTL_DELETE_INTERFACEEX \
  311. _IPFLTRDRVR_CTL_CODE(11, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  312. typedef struct _FILTER_DRIVER_DELETE_INTERFACE
  313. {
  314. IN PVOID pvDriverContext;
  315. }FILTER_DRIVER_DELETE_INTERFACE, *PFILTER_DRIVER_DELETE_INTERFACE;
  316. //////////////////////////////////////////////////////////////////////////////
  317. // //
  318. // This IOCTL is exposed so that a user mode test utility can test the //
  319. // correctness of implementation of the driver //
  320. // //
  321. //////////////////////////////////////////////////////////////////////////////
  322. #define IOCTL_TEST_PACKET \
  323. _IPFLTRDRVR_CTL_CODE(4, METHOD_BUFFERED, FILE_READ_ACCESS)
  324. typedef struct _FILTER_DRIVER_TEST_PACKET
  325. {
  326. IN PVOID pvInInterfaceContext;
  327. IN PVOID pvOutInterfaceContext;
  328. OUT FORWARD_ACTION eaResult;
  329. IN BYTE bIpPacket[1];
  330. }FILTER_DRIVER_TEST_PACKET, *PFILTER_DRIVER_TEST_PACKET;
  331. //////////////////////////////////////////////////////////////////////////////
  332. // //
  333. // This IOCTL get the information associated with an interface. This //
  334. // includes the filters set for the interface and statistics related to the //
  335. // filters themselves. If the size of buffer passed to it is less than //
  336. // sizeof(FILTER_DRIVER_GET_FILTERS), it returns STATUS_INSUFFICIENT_BUFFER.//
  337. // If the size is >= sizeof(FILTER_DRIVER_GET_FILTERS) but less than what is//
  338. // needed to fill in all the FILTER_STATS, then only the number of in and //
  339. // out filters is written out (so that the user can figure out how much //
  340. // memory is needed) and it return STATUS_SUCCESS. If the buffer passed is //
  341. // large enough all the information is written out //
  342. // //
  343. //////////////////////////////////////////////////////////////////////////////
  344. #define IOCTL_GET_FILTER_INFO \
  345. _IPFLTRDRVR_CTL_CODE(5, METHOD_BUFFERED, FILE_READ_ACCESS)
  346. typedef struct _FILTER_STATS_EX
  347. {
  348. DWORD dwNumPacketsFiltered;
  349. FILTER_INFOEX info;
  350. }FILTER_STATS_EX, *PFILTER_STATS_EX;
  351. typedef struct _FILTER_STATS
  352. {
  353. DWORD dwNumPacketsFiltered;
  354. FILTER_INFO info;
  355. }FILTER_STATS, *PFILTER_STATS;
  356. typedef struct _FILTER_IF
  357. {
  358. FORWARD_ACTION eaInAction;
  359. FORWARD_ACTION eaOutAction;
  360. DWORD dwNumInFilters;
  361. DWORD dwNumOutFilters;
  362. FILTER_STATS filters[1];
  363. }FILTER_IF, *PFILTER_IF;
  364. typedef struct _FILTER_DRIVER_GET_FILTERS
  365. {
  366. IN PVOID pvDriverContext;
  367. OUT DWORD dwDefaultHitsIn;
  368. OUT DWORD dwDefaultHitsOut;
  369. OUT FILTER_IF interfaces;
  370. }FILTER_DRIVER_GET_FILTERS, *PFILTER_DRIVER_GET_FILTERS;
  371. //////////////////////////////////////////////////////////////////////////////
  372. // //
  373. // This IOCTL gets the performance information associated with the filter //
  374. // driver. This information is only collected if the driver is built with //
  375. // the DRIVER_PERF flag //
  376. // //
  377. //////////////////////////////////////////////////////////////////////////////
  378. #define IOCTL_GET_FILTER_TIMES \
  379. _IPFLTRDRVR_CTL_CODE(6, METHOD_BUFFERED, FILE_READ_ACCESS)
  380. typedef struct _FILTER_DRIVER_GET_TIMES
  381. {
  382. OUT DWORD dwFragments;
  383. OUT DWORD dwNumPackets;
  384. OUT DWORD dwCache1;
  385. OUT DWORD dwCache2;
  386. OUT DWORD dwWalk1;
  387. OUT DWORD dwWalk2;
  388. OUT DWORD dwForw;
  389. OUT DWORD dwWalkCache;
  390. OUT LARGE_INTEGER liTotalTime;
  391. }FILTER_DRIVER_GET_TIMES, *PFILTER_DRIVER_GET_TIMES;
  392. typedef struct _MIB_IFFILTERTABLE
  393. {
  394. DWORD dwIfIndex;
  395. DWORD dwDefaultHitsIn;
  396. DWORD dwDefaultHitsOut;
  397. FILTER_IF table;
  398. }MIB_IFFILTERTABLE, *PMIB_IFFILTERTABLE;
  399. #define SIZEOF_IFFILTERTABLE(X) \
  400. (MAX_MIB_OFFSET + sizeof(MIB_IFFILTERTABLE) - sizeof(FILTER_STATS) + ((X) * sizeof(FILTER_STATS)) + ALIGN_SIZE)
  401. typedef struct _FILTER_DRIVER_GET_TIMES MIB_IFFILTERTIMES, *PMIB_IFFILTERTIMES;
  402. //
  403. // New IOCTLs and definitions for creating interfaces and filters and
  404. // retrieving information
  405. //
  406. #define IOCTL_PF_CREATE_AND_SET_INTERFACE_PARAMETERS \
  407. _IPFLTRDRVR_CTL_CODE(9, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  408. #define IOCTL_PF_GET_INTERFACE_PARAMETERS \
  409. _IPFLTRDRVR_CTL_CODE(14, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  410. typedef enum _PfBindingType
  411. {
  412. PF_BIND_NONE = 0,
  413. PF_BIND_IPV4ADDRESS,
  414. PF_BIND_IPV6ADDRESS,
  415. PF_BIND_NAME,
  416. PF_BIND_INTERFACEINDEX
  417. } PFBINDINGTYPE, *PPFBINDINGTYPE;
  418. typedef struct _pfSetInterfaceParameters
  419. {
  420. PFBINDINGTYPE pfbType;
  421. DWORD dwBindingData;
  422. FORWARD_ACTION eaIn;
  423. FORWARD_ACTION eaOut;
  424. FILTER_DRIVER_CREATE_INTERFACE fdInterface;
  425. DWORD dwInterfaceFlags;
  426. PFLOGGER pfLogId;
  427. } PFINTERFACEPARAMETERS, *PPFINTERFACEPARAMETERS;
  428. //
  429. // flags for dwInterfaceFlags
  430. //
  431. #define PFSET_FLAGS_UNIQUE 0x1
  432. //
  433. // Structure used to fetch the interface parameters
  434. //
  435. typedef struct _pfGetInterfaceParameters
  436. {
  437. DWORD dwReserved;
  438. PVOID pvDriverContext;
  439. DWORD dwFlags;
  440. DWORD dwInDrops;
  441. DWORD dwOutDrops;
  442. FORWARD_ACTION eaInAction;
  443. FORWARD_ACTION eaOutAction;
  444. DWORD dwNumInFilters;
  445. DWORD dwNumOutFilters;
  446. DWORD dwSynOrFrag;
  447. DWORD dwSpoof;
  448. DWORD dwUnused;
  449. DWORD dwTcpCtl;
  450. LARGE_INTEGER liSYN;
  451. LARGE_INTEGER liTotalLogged;
  452. DWORD dwLostLogEntries;
  453. FILTER_STATS_EX FilterInfo[1];
  454. } PFGETINTERFACEPARAMETERS, *PPFGETINTERFACEPARAMETERS;
  455. //
  456. // flags for above
  457. //
  458. #define GET_FLAGS_RESET 0x1 // reset all fetched counters
  459. #define GET_FLAGS_FILTERS 0x2 // fetch filters as well
  460. #define GET_BY_INDEX 0x4 // pvDriverContext is an
  461. // interface index not
  462. // an interface handle
  463. //
  464. // These IOCTL definitions are used to create, modify and delete
  465. // log interfaces
  466. //
  467. #define IOCTL_PF_CREATE_LOG \
  468. _IPFLTRDRVR_CTL_CODE(7, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  469. #define IOCTL_PF_DELETE_LOG \
  470. _IPFLTRDRVR_CTL_CODE(8, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  471. //
  472. // A logged frame.
  473. //
  474. typedef struct _pfLoggedFrame
  475. {
  476. LARGE_INTEGER Timestamp;
  477. PFETYPE pfeTypeOfFrame;
  478. DWORD dwTotalSizeUsed;
  479. DWORD dwFilterRule;
  480. WORD wSizeOfAdditionalData;
  481. WORD wSizeOfIpHeader;
  482. DWORD dwRtrMgrIndex;
  483. DWORD dwIPIndex;
  484. IPHeader IpHeader;
  485. BYTE bData[1];
  486. } PFLOGGEDFRAME, *PPFLOGGEDFRAME;
  487. typedef struct _PfLog
  488. {
  489. PFLOGGER pfLogId;
  490. HANDLE hEvent;
  491. DWORD dwFlags; // see LOG_ flags below
  492. } PFLOG, *PPFLOG;
  493. typedef struct _PfDeleteLog
  494. {
  495. PFLOGGER pfLogId;
  496. } PFDELETELOG, *PPFDELETELOG;
  497. //
  498. // set a new log buffer. Note dwSize is an in/out
  499. //
  500. typedef struct _PfSetBuffer
  501. {
  502. IN PFLOGGER pfLogId;
  503. IN OUT DWORD dwSize;
  504. OUT DWORD dwLostEntries;
  505. OUT DWORD dwLoggedEntries;
  506. OUT PBYTE pbPreviousAddress;
  507. IN DWORD dwSizeThreshold;
  508. IN DWORD dwEntriesThreshold;
  509. IN DWORD dwFlags;
  510. IN PBYTE pbBaseOfLog;
  511. } PFSETBUFFER, *PPFSETBUFFER;
  512. typedef struct _InterfaceBinding
  513. {
  514. PVOID pvDriverContext;
  515. PFBINDINGTYPE pfType;
  516. DWORD dwAdd;
  517. DWORD dwEpoch;
  518. } INTERFACEBINDING, *PINTERFACEBINDING;
  519. typedef struct _InterfaceBinding2
  520. {
  521. PVOID pvDriverContext;
  522. PFBINDINGTYPE pfType;
  523. DWORD dwAdd;
  524. DWORD dwEpoch;
  525. DWORD dwLinkAdd;
  526. } INTERFACEBINDING2, *PINTERFACEBINDING2;
  527. //
  528. // flags for above
  529. //
  530. #define LOG_LOG_ABSORB 0x1 // log is used to absorb frames
  531. typedef struct _FIlterDriverGetSyncCount
  532. {
  533. LARGE_INTEGER liCount;
  534. } FILTER_DRIVER_GET_SYN_COUNT, *PFILTER_DRIVER_GET_SYN_COUNT;
  535. //
  536. // IOCTL_PF_DELETE_BY_HANDLE input structure
  537. //
  538. typedef struct _PfDeleteByHandle
  539. {
  540. PVOID pvDriverContext;
  541. PVOID pvHandles[1];
  542. } PFDELETEBYHANDLE, *PPFDELETEBYHANDLE;
  543. //
  544. // IOCTL to do incremental filter setting and deleting. This IOCTL requires
  545. // using the new filter info definitions. No mix and match matey.
  546. //
  547. #define IOCTL_SET_INTERFACE_FILTERS_EX \
  548. _IPFLTRDRVR_CTL_CODE(10, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  549. #define IOCTL_DELETE_INTERFACE_FILTERS_EX \
  550. _IPFLTRDRVR_CTL_CODE(12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  551. #define IOCTL_SET_LOG_BUFFER \
  552. _IPFLTRDRVR_CTL_CODE(13, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  553. #define IOCTL_SET_INTERFACE_BINDING \
  554. _IPFLTRDRVR_CTL_CODE(15, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  555. #define IOCTL_CLEAR_INTERFACE_BINDING \
  556. _IPFLTRDRVR_CTL_CODE(16, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  557. #define IOCTL_SET_LATE_BOUND_FILTERSEX \
  558. _IPFLTRDRVR_CTL_CODE(17, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  559. #define IOCTL_GET_SYN_COUNTS \
  560. _IPFLTRDRVR_CTL_CODE(18, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  561. #define IOCTL_PF_DELETE_BY_HANDLE \
  562. _IPFLTRDRVR_CTL_CODE(19, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  563. #define IOCTL_PF_IP_ADDRESS_LOOKUP \
  564. _IPFLTRDRVR_CTL_CODE(20, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  565. #define IOCTL_SET_INTERFACE_BINDING2 \
  566. _IPFLTRDRVR_CTL_CODE(21, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  567. #endif //__IPFLTDRV_H__