Leaked source code of windows server 2003
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.

276 lines
6.5 KiB

  1. #ifndef __PROTO__
  2. #define __PROTO__
  3. NTSTATUS
  4. DriverEntry(
  5. IN PDRIVER_OBJECT DriverObject,
  6. IN PUNICODE_STRING RegistryPath
  7. );
  8. NTSTATUS
  9. FilterDriverDispatch(
  10. IN PDEVICE_OBJECT DeviceObject,
  11. IN PIRP Irp
  12. );
  13. VOID
  14. FilterDriverUnload(
  15. IN PDRIVER_OBJECT DriverObject
  16. );
  17. VOID
  18. SetupExternalNaming(
  19. IN PUNICODE_STRING ntname
  20. );
  21. VOID
  22. TearDownExternalNaming();
  23. BOOL
  24. InitFilterDriver();
  25. BOOL
  26. CloseFilterDriver();
  27. BOOL
  28. MatchLocalLook(DWORD Addr, DWORD dwIndex);
  29. NTSTATUS
  30. SetForwarderEntryPoint(
  31. IPPacketFilterPtr pfnMatch
  32. );
  33. BOOL
  34. AllocateCacheStructures();
  35. VOID
  36. FreeExistingCache();
  37. //FORWARD_ACTION __fastcall
  38. FORWARD_ACTION
  39. MatchFilter(
  40. IPHeader UNALIGNED *pIpHeader,
  41. PBYTE pbRestOfPacketPacket,
  42. UINT uiPacketLength,
  43. UINT RecvInterfaceIndex,
  44. UINT SendInterfaceIndex,
  45. IPAddr RecvLinkNextHop,
  46. IPAddr SendLinkNextHop
  47. );
  48. FORWARD_ACTION
  49. MatchFilterp(
  50. UNALIGNED IPHeader *pIpHeader,
  51. BYTE *pbRestOfPacket,
  52. UINT uiPacketLength,
  53. UINT RecvInterfaceIndex,
  54. UINT SendInterfaceIndex,
  55. IPAddr RecvLinkNextHop,
  56. IPAddr SendLinkNextHop,
  57. INTERFACE_CONTEXT RecvInterfaceContext,
  58. INTERFACE_CONTEXT SendInterfaceContext,
  59. BOOL fInnerCall,
  60. BOOL fIoctlCall
  61. );
  62. NTSTATUS
  63. AddInterface(
  64. IN PVOID pvRtrMgrCtxt,
  65. IN DWORD dwRtrMgrIndex,
  66. IN DWORD dwAdapterId,
  67. IN PPFFCB Fcb,
  68. OUT PVOID *ppvFltrDrvrCtxt
  69. );
  70. NTSTATUS
  71. DeleteInterface(
  72. IN PVOID pvIfContext
  73. );
  74. NTSTATUS
  75. UnSetFiltersEx(
  76. IN PPFFCB Fcb,
  77. IN PPAGED_FILTER_INTERFACE pPage,
  78. DWORD dwLength,
  79. IN PFILTER_DRIVER_SET_FILTERS pRtrMgrInfo
  80. );
  81. NTSTATUS
  82. SetFiltersEx(
  83. IN PPFFCB Fcb,
  84. IN PPAGED_FILTER_INTERFACE pPage,
  85. DWORD dwLength,
  86. IN PFILTER_DRIVER_SET_FILTERS pRtrMgrInfo
  87. );
  88. NTSTATUS
  89. SetFilters(
  90. IN PFILTER_DRIVER_SET_FILTERS pRtrMgrInfo
  91. );
  92. NTSTATUS
  93. UpdateBindingInformation(
  94. PFILTER_DRIVER_BINDING_INFO pBindInfo,
  95. PVOID pvContext
  96. );
  97. NTSTATUS
  98. GetFilters(
  99. IN PVOID pvIfContext,
  100. IN BOOL fClear,
  101. OUT PFILTER_IF pInfo
  102. );
  103. PFILTER_INTERFACE
  104. NewInterface(
  105. IN PVOID pvContext,
  106. IN DWORD dwIndex,
  107. IN FORWARD_ACTION inAction,
  108. IN FORWARD_ACTION outAction,
  109. IN PVOID pvOldContext,
  110. IN DWORD dwIpIndex,
  111. IN DWORD dwName
  112. );
  113. VOID
  114. DeleteFilters(
  115. IN PFILTER_INTERFACE pIf,
  116. IN DWORD dwInOrOut
  117. );
  118. VOID
  119. ClearCache();
  120. NTSTATUS
  121. MakeNewFilters(
  122. IN DWORD dwNumFilters,
  123. IN PFILTER_INFO pFilterInfo,
  124. IN BOOL fInFilter,
  125. OUT PLIST_ENTRY pList
  126. );
  127. PRTR_TOC_ENTRY
  128. GetPointerToTocEntry(
  129. DWORD dwType,
  130. PRTR_INFO_BLOCK_HEADER pInfoHdr
  131. );
  132. NTSTATUS
  133. DoIpIoctl(
  134. IN PWCHAR DriverName,
  135. IN DWORD Ioctl,
  136. IN PVOID pvInArg,
  137. IN DWORD dwInSize,
  138. IN PVOID pvOutArg,
  139. IN DWORD dwOutSize,
  140. OUT PDWORD pdwFinalSize OPTIONAL);
  141. NTSTATUS
  142. AddNewInterface(PPFINTERFACEPARAMETERS pInfo,
  143. PPFFCB Fcb);
  144. VOID
  145. DereferenceLog(PPFLOGINTERFACE pLog);
  146. VOID
  147. AddRefToLog(PPFLOGINTERFACE pLog);
  148. NTSTATUS
  149. ReferenceLogByHandleId(PFLOGGER LogId,
  150. PPFFCB Fcb,
  151. PPFLOGINTERFACE * ppLog);
  152. BOOL
  153. DereferenceFilter(PFILTER pFilt, PFILTER_INTERFACE pIf);
  154. NTSTATUS
  155. DeletePagedInterface(PPFFCB Fcb, PPAGED_FILTER_INTERFACE pPage);
  156. VOID
  157. InitLogs();
  158. NTSTATUS
  159. PfLogCreateLog(PPFLOG pLog,
  160. PPFFCB Fcb,
  161. PIRP Irp);
  162. NTSTATUS
  163. PfDeleteLog(PPFDELETELOG pfDel,
  164. PPFFCB Fcb);
  165. NTSTATUS
  166. PfLogSetBuffer( PPFSETBUFFER pSet, PPFFCB Fcb, PIRP Irp );
  167. NTSTATUS
  168. GetInterfaceParameters(PPAGED_FILTER_INTERFACE pPage,
  169. PPFGETINTERFACEPARAMETERS pp,
  170. PDWORD pdwSize);
  171. VOID
  172. AdvanceLog(PPFLOGINTERFACE pLog);
  173. DWORD
  174. GetIpStackIndex(IPAddr Addr, BOOL fNew);
  175. KIRQL
  176. LockLog(PPFLOGINTERFACE pLog);
  177. NTSTATUS
  178. SetInterfaceBinding(PINTERFACEBINDING pBind,
  179. PPAGED_FILTER_INTERFACE pPage);
  180. NTSTATUS
  181. SetInterfaceBinding2(PINTERFACEBINDING2 pBind,
  182. PPAGED_FILTER_INTERFACE pPage);
  183. NTSTATUS
  184. ClearInterfaceBinding(PPAGED_FILTER_INTERFACE pPage, PINTERFACEBINDING pBind);
  185. VOID
  186. ClearCacheEntry(PFILTER pFilt, PFILTER_INTERFACE pIf);
  187. VOID
  188. ClearAnyCacheEntry(PFILTER pFilt, PFILTER_INTERFACE pIf);
  189. NTSTATUS
  190. UpdateBindingInformationEx(
  191. PFILTER_DRIVER_BINDING_INFO pBindInfo,
  192. PPAGED_FILTER_INTERFACE pPage
  193. );
  194. NTSTATUS
  195. SetExtensionPointer(
  196. PPF_SET_EXTENSION_HOOK_INFO Info,
  197. PFILE_OBJECT FileObject
  198. );
  199. PFILTER_INTERFACE
  200. FilterDriverLookupInterface(
  201. IN ULONG Index,
  202. IN IPAddr LinkNextHop
  203. );
  204. BOOL
  205. WildFilter(PFILTER pf);
  206. __inline
  207. BMAddress(DWORD dwAddr)
  208. /*++
  209. Routine Description:
  210. Check if the given address is the broadcast address or
  211. a multicast address.
  212. --*/
  213. {
  214. UCHAR cPtr = (UCHAR)dwAddr;
  215. if((dwAddr == BCASTADDR)
  216. ||
  217. ((cPtr >= MCASTSTART) && (cPtr <= MCASTEND) )
  218. )
  219. {
  220. return(TRUE);
  221. }
  222. return(FALSE);
  223. }
  224. #endif