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.

151 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. private\inc\ipxfltif.h
  5. Abstract:
  6. IPX Filter driver interface with forwarder
  7. Author:
  8. Vadim Eydelman
  9. Revision History:
  10. --*/
  11. #ifndef _IPXFLTIF_
  12. #define _IPXFLTIF_
  13. // No filter context means that packets should not
  14. // be passed for filtering
  15. #define NO_FILTER_CONTEXT ((PVOID)0)
  16. // Forwarder Driver Entry Points:
  17. // ==============================
  18. /*++
  19. S E T _ I F _ I N _ C O N T E X T _ H A N D L E R
  20. Routine Description:
  21. Associates filter driver context with
  22. the packets received on the interface
  23. Arguments:
  24. InterfaceIndex - index of the interface
  25. ifInContext - filter driver context
  26. Return Value:
  27. STATUS_SUCCESS - context associated ok
  28. STATUS_UNSUCCESSFUL - interface does not exist
  29. --*/
  30. typedef
  31. NTSTATUS
  32. (*PSET_IF_IN_CONTEXT_HANDLER) (
  33. IN ULONG InterfaceIndex,
  34. IN PVOID ifInContext
  35. );
  36. /*++
  37. S E T _ I F _ O U T _ C O N T E X T _ H A N D L E R
  38. Routine Description:
  39. Associates filter driver context with
  40. the packets sent on the interface
  41. Arguments:
  42. InterfaceIndex - index of the interface
  43. ifOutContext - filter driver context
  44. Return Value:
  45. STATUS_SUCCESS - context associated ok
  46. STATUS_UNSUCCESSFUL - interface does not exist
  47. --*/
  48. typedef
  49. NTSTATUS
  50. (*PSET_IF_OUT_CONTEXT_HANDLER) (
  51. IN ULONG InterfaceIndex,
  52. IN PVOID ifOutContext
  53. );
  54. typedef enum {
  55. FILTER_DENY_IN = -2,
  56. FILTER_DENY_OUT = -1,
  57. FILTER_DENY = 1,
  58. FILTER_PERMIT = 0
  59. } FILTER_ACTION;
  60. #define NOT_FILTER_ACTION(action) (!action)
  61. #define IS_FILTERED(action) (action!=FILTER_PERMIT)
  62. // Forwarder Driver Entry Points:
  63. // ==============================
  64. /*++
  65. F i l t e r H a n d l e r
  66. Routine Description:
  67. Filters the packet supplied by the forwarder
  68. Arguments:
  69. ipxHdr - pointer to packet header
  70. ipxHdrLength - size of the header buffer (must be at least 30)
  71. ifInContext - context associated with interface on which packet
  72. was received
  73. ifOutContext - context associated with interface on which packet
  74. will be sent
  75. Return Value:
  76. FILTER_PERMIT - packet should be passed on by the forwarder
  77. FILTER_DENY_IN - packet should be dropped because of input filter
  78. FILTER_DENY_OUT - packet should be dropped because of output filter
  79. --*/
  80. typedef
  81. FILTER_ACTION
  82. (*PFILTER_HANDLER) (
  83. IN PUCHAR ipxHdr,
  84. IN ULONG ipxHdrLength,
  85. IN PVOID ifInContext,
  86. IN PVOID ifOutContex
  87. );
  88. /*++
  89. I n t e r f a c e D e l e t e d H a n d l e r
  90. Routine Description:
  91. Frees interface filters blocks when forwarder indicates that
  92. interface is deleted
  93. Arguments:
  94. ifInContext - context associated with input filters block
  95. ifOutContext - context associated with output filters block
  96. Return Value:
  97. None
  98. --*/
  99. typedef
  100. VOID
  101. (*PINTERFACE_DELETED_HANDLER) (
  102. IN PVOID ifInContext,
  103. IN PVOID ifOutContext
  104. );
  105. // Binds filter driver to forwarder
  106. // IPX_FLT_BIND_INPUT should be passed in the input buffer and
  107. // IPX_FLT_BINF_OUTPUT will be returned in the output buffer
  108. #define IOCTL_FWD_INTERNAL_BIND_FILTER \
  109. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+16,METHOD_BUFFERED,FILE_ANY_ACCESS)
  110. typedef struct _IPX_FLT_BIND_INPUT {
  111. PFILTER_HANDLER FilterHandler;
  112. PINTERFACE_DELETED_HANDLER InterfaceDeletedHandler;
  113. } IPX_FLT_BIND_INPUT, *PIPX_FLT_BIND_INPUT;
  114. typedef struct _IPX_FLT_BIND_OUTPUT {
  115. ULONG Size;
  116. PSET_IF_IN_CONTEXT_HANDLER SetIfInContextHandler;
  117. PSET_IF_OUT_CONTEXT_HANDLER SetIfOutContextHandler;
  118. } IPX_FLT_BIND_OUTPUT, *PIPX_FLT_BIND_OUTPUT;
  119. #endif