I know it is a very theoretical question, but forgive me as this is not my specialty.
Looking for an example on how to use raw sockets with boost, I found a question in this same website where it is assured that you cannot know the destination of an UDP message with boost asio. Then having a look at the boost examples, there is an icmp example: http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/example/icmp/ping.cpp Where you actually can have both IP and ICMP headers by using async_receive and a icmp endpoint.
(I was curious that I couldn't find the word "raw" anywhere in the code) My question is: why does this work for ICMP and not for UDP or TCP? is it because ICMP is level 3?
How can this example work at all? Is it that ICMP socket is equivalent to a raw socket? but I don't think it should be.