INSTALL.TXT 
LibnetNT Copyright 2000 eEye Digital Security team - http://www.eeye.com  
This is a beta release and all information is subject to change without notice
Ryan Permeh, ryan@eeye.com
Marc Maiffret, marc@eeye.com

Installation of the LibnetNT package requires the preinstallation of the Winpcap 
Network Drivers (http://netgroup-serv.polito.it/winpcap/).  We have included the compiled binary versions for windows NT and 2000. These drivers and the accompanying DLL are released as open source under a BSD style licence.  There were no modifications required to the stanard drivers, so getting and compiling the sources of them will work fine.

PREINSTALLING THE DRIVERS
In the archive that LibnetNT is shipped in, there is a  directory called DRIVERS.  Inside this directory are the dirvers and associated DLLs that need to be installed.  pictoral directions can be found for nt at http://netgroup-serv.polito.it/winpcap/install/help/NT.htm and for windows 2000 at http://netgroup-serv.polito.it/winpcap/install/help/2k.htm.  


The actual LibnetNT functionailty is a provided as a DLL.  This will allow windows programmers to implement all of the functions that the unix version of libnet provides, right within the win32 environment.  

To use LibnetNT
There are two ways of implementing LibnetNT in your program.  The first is to link to it at compile time.  This requires you to add the LibnetNT.lib file into your program.  you must aslo include the libnet.h include file(and it includes a few others).  We recommend using a -I compiler directive to add the entire libnet include directory into your project.

The second way to use the libnet DLL is to use the LoadLibrary() and GetProcAddress() functions.  These will allow you to implement the functionality of Libnet without having to link in the .lib file at compile time.  

For more information on how to use DLL's, read any good book on windows programming.

LibnetNT Internals and conventions
Since this is a port of libnet, we attempted to maintain as much compatibility with the original unix version as possible.  Since there is little in common at the low level network side between unix and windows, most of that code has drasticly changed.
The calling functionality has, however, remained  almost the same.  Most of the new functions are now included in the LibnetNTdll.c and the libnet_win32_link.c  There are a few changes to certain functions that were required(libnet_write_ip() due to the lack of pervasive raw sockets (Under NT4), and libnet_random functions because oif the lack of decent general purpose random number generator), but over all, the code has remained basically the same.  Hopefully, this code will be pushed into the core libnet codebase and will be 100% source compatible with the original libnet by using #DEFINE and #IF statements. 


Porting Unix libnet code to LibnetNT

most code will require very few changes to make it work on NT.  The primary change is that there is a new function that will be required before any libnet packet writes can occur.  You must now use libnet_win32_init(int adapternum) to inititalize the adapter that you want to send packets on.

This is mostly due to the fact that it allows a selectable interface to the adapter, and that there is some configuration required.  We will shortly be putting together a few functions to make this a little more pretty, but as of now, we were attempting to make this as libnet compatible as possibe.

There are also issues with the lack of some common unix functiuonality under windows(like getopt).  This may or may not cause your code to not work correctly, and is well beyond the scope of this document.  Go find a good book on porting code from unix to win32.

We will include a sample project(tcpspoof) that implements the functionality of libnet under windows, and in it, you should be able to get a good feel for what needed to be changed around to make a common libnet project work.
Basically, we have just set a #if(WIN32) statement to handle the windows specific code.  This code should compile against all supported platforms that libnet operates with.

One final note:
Most existing libnet projects require a libpcap to be installed.  since the authors of the drivers that we are using have done this, this is now a possibility.  Although we haven't tested many of the more complex projects using libnet and pcap together, they should work pretty much unaltered( note... pretty much:).  This is a fully open source project and is open to extension and expansion by any developer that chooses to do so. So basically if you find any bugs or have any suggestions then make the changes yourself and send them to us. The beauty of open source...
