30.5 TCP Concurrent Server, One Child per Client


29.6 libnet : Packet Creation and Injection Library

libnet provides an interface to craft and inject arbitrary packets into the network. It provides both raw socket and datalink access modes in an implementation-independent manner.

The library hides many of the details of crafting the IP and UDP or TCP headers, and provides simple and portable access to writing datalink and raw packets. As with libpcap , the library is made up of quite a number of functions. We will show how to use a small group of the functions for accessing raw sockets in the example in the following section, as well as the code required to use raw sockets directly for comparison. All the library functions begin with the libnet_ prefix; the libnet man page and online manual describe these functions in more detail.

The library is publicly available from http://www.packetfactory.net/libnet/. The online manual is http://www.packetfactory.net/libnet/manual/. As of this writing, the only manual available is for the deprecated version 1.0; the supported version 1.1 has a significantly different API. This example uses the 1.1 API.



UNIX Network Programming Volume 1, Third Edition
Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition)
ISBN: 0131411551
EAN: 2147483647
Year: 2003
Pages: 441

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net