I use a bit modified PassThru sample to process every packet.
(it is marked with comment “HERE GOES THE PROCESSING OF PACKET” where i perform some actions with the packet)
But I need to process packets when a certain amount of time passes or if the
adapter packet queue reaches its limit.
I think the best solution is to create my own queue in C# code, but i can’t realize how to store packets in it.
So how can I do that?
The call above injects the packet into the network flow and processing does not make any sense after this point.
If I understand you right then you are working over bandwidth limiter solution for outgoing traffic. So, instead of SendPacketToAdapter you should put packet into the queue (List<INTERMEDIATE_BUFFER> an example). A different thread can pop packets from the queue and call SendPacketToAdapter for them when time passes or queue reaches some predefined limit.