views:

705

answers:

1

I am porting a communications library from Linux to Windows. I know what my approach is for the most part. The library uses all raw ethernet level frames for all the communications.

The library I am porting from makes use of the PF_PACKET family and the struct sockaddr_ll. After browsing through the MSDN winsock site, I haven't found an equivalent family/struct. What should my approach be here?

I have a few ideas, but I am not sure if they are good ideas I could use PF_UNSPEC, for unspecified. I could just pass the number PF_PACKET represents (it's an unsigned short) I could also just make my own sockadddr_ll struct in Windows.

None of those ideas seem good to me, they just seem like hacks that aren't really likely to work.

If anyone has any suggestions, I would appreciate it.

+1  A: 

I assume you're referring to Raw Sockets (where you have to write the network layer, transport layer, and application layer information). New Windows versions (XP SP2 and up) have very limited support for raw sockets with many restrictions.

More info (scroll down to "Limitations on Raw Sockets")

The solution, I believe, is to use WinPcap, which allows you to send raw packets on those systems.

Aziz
ok, the limitations on raw sockets do not apply to me. My application only goes up as high as the second layer. That is, I only need to rend/receive ethernet frames, no TCP/UDP/IP is needed.
devin
Actually it does. Look it the example of sending raw packets with WinPcap, and you'll find what you need :)
Aziz
Nothing below layer 3 is allowed in the windows.
Aziz