Want to develop a firewall in C#

Hey,
I’ new to the forum. Bt i am a user of Comodo Firewall. I’m a BTech final year student and i chose Firewall as my final year project. Bt i chose to do it in C#.
Can you guys help me to do the coding ?
How can we capture and make the packet allow or drop the packet using our application ?
U guys have any idea ?

Sorry if i posted this in the wrong section…

You can’t use C#. You need to write a driver in C.

Here is a similar thread
http://social.msdn.microsoft.com/Forums/en/wfp/thread/0bfede94-3ec8-4eb0-835d-8729066491e3

Some info on the call-out driver

And the WFP intro.
http://www.microsoft.com/whdc/device/network/WFP.mspx

Can’t i use a C written code or a dll in C#?

I heard it is possible to use the dll file of packet capturing and analysing fuction and do it in C# itself. So it is not possible ?

Hi sinoop_joy,

I think that wj32 is as close to the topic as you can get

At the same time, this message is sorta ambiguous:

meaning… what is a correlation between using DLL and “packet capturing” as a main goal of what you want to achieve? That is not clear

My regards

p.s. “fuction” does not sound good ;), therefore I took courage and edited the quote… if that’s what you mean. Cheers!

I didnt get it.
Any way what i want to achieve is to make a software that can cpture,analyse and drop packets accoring to the content present in it.
I want to allow or deny a application from sending or receiving packets.
All thes have to be done using C# + a driver.
I think only a driver can help my application to capture a packet.

Sorry… !!. My mistake. ;D

Also i got a doubt. Which type of driver should i develop ? WDM or kernal mode driver ?
Will WDM be enough for my needs ? ???

Also when should i capture the packet ? Should i capture the packet as soon as a application sends that to OS or after OS sends it to the destination ?
Which one is possible ?

I’ll give you some more hints:

  1. Follow the links already posted on the Windows Filtering Platform, and start reading.
  2. Think about how your driver is going to communicate with the user-mode C# program: LPC, named pipes, filter communication ports, etc.
Also i got a doubt. Which type of driver should i develop ? WDM or kernal mode driver ? Will WDM be enough for my needs ? ???

WDM drivers are kernel-mode drivers.

Also when should i capture the packet ? Should i capture the packet as soon as a application sends that to OS or after OS sends it to the destination ? Which one is possible ?

The latter doesn’t sound like a firewall to me.