PfTestPacket
[PfTestPacketis available for use in the operating systems listed in the Requirements section. In Windows Server "Longhorn", this function returns ERROR_CALL_NOT_SUPPORTED. The MprConfigInterfaceTransportSetInfo function and the Windows Filtering Platform API Management Functions provide similar functionality.]
The PfTestPacket function tests the specified packet and returns the action that would be performed given the specified interface.
DWORD PfTestPacket(
INTERFACE_HANDLE pInInterface,
INTERFACE_HANDLE pOutInterface,
DWORD cBytes,
PBYTE pbPacket,
PPFFORWARD_ACTION ppAction
);
Parameters
- pInInterface
[in, optional] Handle to an interface to use as an input interface for the packet. This parameter is optional and may be NULL. - pOutInterface
[in, optional] Handle to an interface to use as an output interface for the packet. This parameter is optional and may be NULL. - cBytes
[in] Specifies the size, in bytes, of the test packet specified by the pbPacket parameter. - pbPacket
[in] Pointer to a network packet to test with the specified interface (or interfaces). - ppAction
[out] Pointer to a variable of type PFFORWARD_ACTION. This variable receives the action that would have been taken given the specified interface(s) and packet.
Return Value
If the function succeeds, the return value is NO_ERROR.
If the function fails, use FormatMessage to obtain the message string for the returned error.
Remarks
Specifying only an input interface simulates a packet destined for the local computer. Specifying only an output interface simulates sending a packet from the local computer. Specifying both an input and an output interface simulates routing a network packet.
If the caller does not specify any interfaces, the PfTestPacket returns PF_ACTION_FORWARD in the ppAction parameter.
Requirements
Server | Requires Windows Server 2003 or Windows 2000 Server. |
Header | Declared in Fltdefs.h. |
Library | Use Iphlpapi.lib. |
DLL | Requires Iphlpapi.dll. |