home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / pfhook.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  2KB  |  77 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. #include "ntddk.h"
  35.  
  36. #define DD_IPFLTRDRVR_DEVICE_NAME         L"\\Device\\IPFILTERDRIVER"
  37.  
  38. #define INVALID_PF_IF_INDEX               0xffffffff
  39. #define ZERO_PF_IP_ADDR                   0
  40.  
  41. typedef ULONG IPAddr;
  42.  
  43. typedef enum _PF_FORWARD_ACTION {
  44.     PF_FORWARD = 0,
  45.     PF_DROP = 1,
  46.     PF_PASS = 2,
  47.     PF_ICMP_ON_DROP = 3
  48. } PF_FORWARD_ACTION;
  49.  
  50. typedef PF_FORWARD_ACTION STDCALL
  51. (*PacketFilterExtensionPtr)(
  52.   IN unsigned char  *PacketHeader,
  53.   IN unsigned char  *Packet, 
  54.   IN unsigned int  PacketLength, 
  55.   IN unsigned int  RecvInterfaceIndex, 
  56.   IN unsigned int  SendInterfaceIndex, 
  57.   IN IPAddr  RecvLinkNextHop, 
  58.   IN IPAddr  SendLinkNextHop); 
  59.  
  60. typedef struct _PF_SET_EXTENSION_HOOK_INFO {
  61.   PacketFilterExtensionPtr  ExtensionPointer; 
  62. } PF_SET_EXTENSION_HOOK_INFO, *PPF_SET_EXTENSION_HOOK_INFO;
  63.  
  64. #define FSCTL_IPFLTRDRVR_BASE             FILE_DEVICE_NETWORK
  65.  
  66. #define _IPFLTRDRVR_CTL_CODE(function, method, access) \
  67.   CTL_CODE(FSCTL_IPFLTRDRVR_BASE, function, method, access)
  68.  
  69. #define IOCTL_PF_SET_EXTENSION_POINTER \
  70.   _IPFLTRDRVR_CTL_CODE(22, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  71.  
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75.  
  76. #endif /* __PFHOOK_H */
  77.