PfCreateInterface (iphlpapi)
Last changed: Rob Kaczor-153.2.246.30

.
Summary
The PfCreateInterface function creates a new filter interface. Use this interface to control the adding and deleting of filters to and from network adapters.

C# Signature:

[DllImport("Iphlpapi.dll", EntryPoint = "PfCreateInterface")]

static extern Int32 PfCreateInterface(int dwName, PFFORWARD_ACTION inAction, PFFORWARD_ACTION outAction, int bUseLog, int bMustBeUnique, ref IntPtr ppInterface);

VB Signature:

Declare Function PfCreateInterface Lib "iphlpapi.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

//default action for this interface once created

enum PFFORWARD_ACTION : uint

{

     PF_ACTION_FORWARD = 0,
     PF_ACTION_DROP

}

Tips & Tricks:

Please add some!

Sample Code:

// C conversions for Fltdefs.h

internal const int FALSE = 0;

internal const int TRUE = 1;

IntPtr interfaceHandle = new IntPtr();

//create a filter interface in the tcp/ip stack

int result = PfCreateInterface(0, PFFORWARD_ACTION.PF_ACTION_FORWARD, PFFORWARD_ACTION.PF_ACTION_FORWARD, FALSE, TRUE, ref interfaceHandle);

//interfaceHandle can now be used to bind to a local ip address (PfBindInterfaceToIPAddress) which allow protocol specific packet filters to be added (PfAddFiltersToInterface)

Documentation