Friday, March 2, 2012

Packet Generator 3/2/12

Packet Generator

First and foremost, I apologize for taking so long to develop a packet generator.

For this part, the first thing I wanted to do was investigate the pcap library which tcpdump uses. This library allows the program to investigate the IP and link layer packets coming in. This may or may not be necessary but I wanted the program to, in the future, be able to investigate all the packets coming through similar to tcpdump. There is a similar library for Windows called WinPcap which also provides a send function. At first, I thought the Pcap library had it's own specified send function so that it could read in packets. Unfortunately, I was wrong and eventually realized that only a simple send command was necessary. The packet generator is split into two parts, a host and a client:

Host: This host will first be called with the port number and the choice between TCP or UDP packets to send out. (Host <port number> <TCP/UDP>). It will wait for a connection. When it receives a connection, it will spawn a thread and the thread will send a defined set of bits to the client.

Client: The client file will be called with an IP address, port number, and choice between TCP or UDP packets (Client <IP> <port> <TCP/UDP>). It will first establish a connection with the router (depending on TCP or UDP) and then prepare to receive packets. The first packet received will be marked with a time. The client should know how much is being sent over so that the last packet received will also be marked with a time. It will then calculate how many bits it has received and the time passed to calculate speed.


Note: This post will be edited upon completion. At this moment, the calculation of the speed is not working correctly and the way the host and the client interact may need to be changed. Also, as much as I researched the libpcap library, it is not being utilized yet. I plan on perhaps saving all traces to a file. Otherwise, I plan on sending an endless stream of packets from the host to the client to get a constant reading on speed from the interfaces.

No comments:

Post a Comment