"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:n7********************************@4ax.com...
Paul:
Are you trying to control the traffic to and or from just your
application, or the entire machine?
If for the entire machine, your best bet might be to look at the
Routing and Remote Access Service APIs in the Platform SDK. You'll
have to PInvoke functions like PfCreateInterface,
PfAddFiltersToInterface, and so on:
http://msdn.microsoft.com/library/de..._reference.asp
I'm sure you could get some help if you google for some of the API names.
I've found the information on the various packet filtering functions and
they seem relatively straightforward to use. However, I'm not entirely clear
how to set up access to the functions in C#. By PInvoke I presume you mean
dllimport, so for a function like this:
DWORD PfCreateInterface(
DWORD dwName,
PFFORWARD_ACTION inAction,
PFFORWARD_ACTION outAction,
BOOL bUseLog,
BOOL bMustBeUnique,
INTERFACE_HANDLE* ppInterface
);
I presume the set up to dllimport would be something like this (and this is
a big guess):
[dllimport ("iphlpapi.dll")]
public static extern int pfCreateInterface(int dwName, int inAction, int
OutAction, bool bUseLog, bool bMustBeUnique, intptr ppInterface);
The actual information on the MSDN sites for these packet filtering
functions is pretty sparse, but I think if I can find enough code samples I
can figure it out. Any pointers would be appreciated.