Reputation: 1659
Taking Windows 7 as an example platform, I would like to understand how I would write an application program at the layer 3 (IP) layer. Take as a simple illustrative example the case where I'd like to implement ping myself in C/C++. How would I go about doing this?
The problem, of course, is that when operating at the IP layer, instead of the TCP/UDP layer, there is no port number identifying the process (my process) for the IP layer to hand the packet off to. So, this obisouly can't be a traditional application layer program.
Instead, I think what I need to is write a level 3 hdnler that does what I want and register it with the OS to displace the existing IP layer implmentatio.
Is my thought correcy? If so, how would I implement it? If not, what is the corret approach?
Finally, I'd like to ask the exact same questions about layer 2 (Ethernet). How may I directly send amd receive Ethernet frames?
Upvotes: 1
Views: 1974
Reputation: 181
winpcap is best for your neeeds. you can send / receive raw packet by windpcap api. have a good luck.
Upvotes: 1