Re: Re: high performance filtering

Home Forums Discussions Support Portal high performance filtering Re: Re: high performance filtering

Vadim Smirnov

Yes, filters allow you to reduce the number of packets indicated to user mode for processing thus improving overall performance.

Note, that only unmanaged block of memory can be passed to WinpkFilter driver. To simplify marshalling STATIC_FILTER_TABLE for C# is declared to contain fixed size array of filters (256).

// Static filters table to be passed to WinpkFilter driver
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public uint m_TableSize; // number of STATIC_FILTER entries
[MarshalAs(UnmanagedType.ByValArray,SizeConst=256)] // For convinience (easier marshalling to unmanaged memory) the size of the array is fixed to 256 entries
public STATIC_FILTER[] m_StaticFilters; // Feel free to change this value if you need more filter entries

So in order to fix the marshalling error you have to change your code like this:

pFilters.m_TableSize = 7;

pFilters.m_StaticFilters = new STATIC_FILTER[256];

You pass 256 filters to drivers but only 7 are valid as indicated by pFilters.m_TableSize