The purpose of this project is to create a full networking stack for an operating system that I call "inet_os", consisting of a C++ implementation of a full TCP/IP stack for educational purposes.
The network stack includes OSI model layers:
- Layer 1, Physical layer (NIC)
- Layer 2, Ethernet and ARP (L2, L2_ARP_impl)
- Layer 3, IP (L3)
- Layer 4, TCP (L4_TCP)
- Layer 5, sockets (L5_socket)
The implementation is based on the 4.4BSD-Lite2 distribution, a UNIX based operating system, which is implemented in C. Using C++ instead of C was a huge step, however necessary in order to better implement the code, and provide a cleaner implementation.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Project was built using Visual Studio 2013, so its best to use it during the build process.
- Install Visual Studio 2013.
- Download the NetlabTAU project.
- Install latest version of Boost.
- Go to pthreads-win32 and install latest version of pthread (For example, pthreads-w32-2-9-1-release).
- Install latest version of WinPcap Developer's Pack (
WpdPack
).
Configure Sniffer project build (debug and release):
For both debug and release configurations:
- Go to
Sniffer -> Project properties -> VC++ Directories -> General -> Include Directories
and add path to:WpdPack
library root (in my caseC:\Projects\WpdPack_4_1_2\Include
).
- Go to
Sniffer -> Project properties -> C/C++ -> Preprocessor Definitions
and make sure that you have defined:_SCL_SECURE_NO_WARNINGS
,_CRT_SECURE_NO_WARNINGS
,WIN32
,_LIB
, and_DEBUG
(for debug build) orNDEBUG
(for release build). - Build Sniffer project in debug and release and make sure it works (don't run it, just build).
Configure NetlabTAU project build (debug and release):
- Go to
NetlabTAU -> Project properties -> VC++ Directories -> General -> Include Directories
and add path to:WpdPack
library root (in my caseC:\Projects\WpdPack_4_1_2\Include
).boost
library root (in my caseC:\Projects\Boost_1_66_0
).pthreads-win32
library root (in my caseC:\Projects\pthreads-w32-2-9-1-release\Pre-built.2\include
).
- Go to
NetlabTAU -> Project properties -> C/C++ -> Preprocessor Definitions
and make sure that you have defined:- For release:
_SCL_SECURE_NO_WARNINGS
,_CRT_SECURE_NO_WARNINGS
,WIN32
,_LIB
,_CONSOLE
,BOOST_CB_DISABLE_DEBUG
and_WINSOCK_DEPRECATED_NO_WARNINGS
. - For debug, add the release definitions and add:
HAVE_REMOTE
,_DEBUG
,_WINDOWS
,NOMINMAX
andCMAKE_INTDIR="Debug"
.
- For release:
- Go to
NetlabTAU -> Project properties -> Linker -> Input -> Additional Dependencies
and add:- The
Sniffer.lib
fromDebug\Sniffer.lib
(for debug) or fromRelease\Sniffer.lib
(for release). - The
wpcap.lib
from yourWpdPack
library (in my caseC:\Projects\WpdPack_4_1_2\Lib\wpcap.lib
). - The
pthreadVC2.lib
from yourpthreads-win32
library (in my caseC:\Projects\pthreads-w32-2-9-1-release\Pre-built.2\lib\x86\pthreadVC2.lib
). Iphlpapi.lib
ws2_32.lib
- The
- Copy and paste
pthreadVC2.dll
from thepthreads-win32
library (in my caseC:\Projects\pthreads-w32-2-9-1-release\Pre-built.2\dll\x86
) into theNetlabTAU\Debug
andNetlabTAU\Release
folders. - Build Netlab project in debug and release and make sure it works.
The main program includes several tests:
- Resolving an IP address Using ARP
- Opening a TCP Connection Using the TCP 3-way Handshake
- Sending a Small Packet Using TCP
- Sending a Large Packet Using TCP
- Closing a TCP Connection
- Shutting Down a TCP Connection
- Combined Test: Unreliable and Delayed Channel
- Application Use Case
- Application Use Case (with drop)
- Cwnd Fall Test
More information will be added later
If you want to contribute, please ask email the author. Further instructions will be posted, if needed.
- Tom Mahler - tommahler email address from Gmail.com.
This project is licensed under the MIT License - see the LICENSE.md file for details