home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / cwin / c.exe / $INSTDIR / include / ddk / pfhook.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-12-15  |  1.9 KB  |  82 lines

  1. /*
  2.  * pfhook.h
  3.  *
  4.  * Packet filter API
  5.  *
  6.  * This file is part of the w32api package.
  7.  *
  8.  * Contributors:
  9.  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
  10.  *
  11.  * THIS SOFTWARE IS NOT COPYRIGHTED
  12.  *
  13.  * This source code is offered for use in the public domain. You may
  14.  * use, modify or distribute it freely.
  15.  *
  16.  * This code is distributed in the hope that it will be useful but
  17.  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  18.  * DISCLAIMED. This includes but is not limited to warranties of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  */
  22.  
  23. #ifndef __PFHOOK_H
  24. #define __PFHOOK_H
  25.  
  26. #if __GNUC__ >=3
  27. #pragma GCC system_header
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #pragma pack(push,4)
  35.  
  36. #include "ntddk.h"
  37.  
  38.  
  39. #define DD_IPFLTRDRVR_DEVICE_NAME         L"\\Device\\IPFILTERDRIVER"
  40.  
  41. #define INVALID_PF_IF_INDEX               0xffffffff
  42. #define ZERO_PF_IP_ADDR                   0
  43.  
  44. typedef ULONG IPAddr;
  45.  
  46. typedef enum _PF_FORWARD_ACTION {
  47.     PF_FORWARD = 0,
  48.     PF_DROP = 1,
  49.     PF_PASS = 2,
  50.     PF_ICMP_ON_DROP = 3
  51. } PF_FORWARD_ACTION;
  52.  
  53. typedef PF_FORWARD_ACTION STDCALL
  54. (*PacketFilterExtensionPtr)(
  55.   IN unsigned char  *PacketHeader,
  56.   IN unsigned char  *Packet, 
  57.   IN unsigned int  PacketLength, 
  58.   IN unsigned int  RecvInterfaceIndex, 
  59.   IN unsigned int  SendInterfaceIndex, 
  60.   IN IPAddr  RecvLinkNextHop, 
  61.   IN IPAddr  SendLinkNextHop); 
  62.  
  63. typedef struct _PF_SET_EXTENSION_HOOK_INFO {
  64.   PacketFilterExtensionPtr  ExtensionPointer; 
  65. } PF_SET_EXTENSION_HOOK_INFO, *PPF_SET_EXTENSION_HOOK_INFO;
  66.  
  67. #define FSCTL_IPFLTRDRVR_BASE             FILE_DEVICE_NETWORK
  68.  
  69. #define _IPFLTRDRVR_CTL_CODE(function, method, access) \
  70.   CTL_CODE(FSCTL_IPFLTRDRVR_BASE, function, method, access)
  71.  
  72. #define IOCTL_PF_SET_EXTENSION_POINTER \
  73.   _IPFLTRDRVR_CTL_CODE(22, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  74.  
  75. #pragma pack(pop)
  76.  
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80.  
  81. #endif /* __PFHOOK_H */
  82.