This project is a slightly modified version of Programming Assignment 3 from the textbook. The goal of this assignment is to give you a better understanding of reliable transport protocols by having you actually program one. You are going to write the code for a Go-Back-N protocol (GBN) as described in section 3.4.3 of your textbook. As the original assignment specification describes, you must first implement an Alternating-Bit protocol and then extend it to support the GBN. The original assignment specification can be found at: http://media.pearsoncmg.com/aw/aw_kurose_network_2/labs/lab3.html
Rather than actually modifying the OS on a given machine, your code will run in a simulated environment. The goal of the simulator (written in C) is to mimic an actual Unix environment. You will be provided with a number of routines which you can call, and a number of routines that will simulate sending and receiving of messages and call your routines when appropriate.
In the GBN protocol, the sender has to process three different types of events:
The simulator will generate these types of events, and it is your job to implement the code necessary to process the event. The general structure of the simulator is available here.
You are given two structures which define the data units passed to (and/or from) your routines:
struct msg {
char data[20] ;
};
struct pkt {
int seqnum;
int acknum;
int checksum;
char payload[20];
};
You will implement the following routines:
You may (and should) call the following routines:
I have also provided two additional helper functions which you can use to calculate and check the packet checksum. Those functions and the correct method of calling them can be found in the simulator code skeleton: proj2.c.
Once you have completed your portion of the code and run the simulator, you will be prompted for a number of paramenters. Following is a typical sample run:
----- Network Simulator -------- Enter the number of messages to simulate: 5 Enter packet loss probability [enter 0.0 for no loss]:.2 Enter packet corruption probability [0.0 for no corruption]:.2 Enter average time between messages from sender's layer5 [ > 0.0]:20 Enter TRACE:0
The parameters are as follows:
For this assignment, you may work in teams of two. Download the simulator and skeleton for your code here: proj2.c. You can edit the file with your favorite editor, and compile with your favorite compiler. You may discuss high-level concepts with the other teams, but you are not to copy or even look at another team's code.
There is a bit of an issue with the random number generator. You may need to change the value of the variable mmm in the function jimsrand. If you get an error message asking you to look at the function, you can let me know and we will figure out the solution for the environment you are running in.
Send me your completed code via email by class time on the due dates. Part A must be turned in by Thursday, November 6 and Part B must be turned in by Tuesday, November 11. Make sure you include all files required to compile and run your program and any special instructions with respect to compilation, etc. I will compile it and run it under a number of scenarios. You do not need to turn in the output of your test cases. However, make sure you test your code for all possible cases.
You are not asked to implement the three way handshake for this assignment. You can assume that connection setup has already taken place and you can hard code an initial sequence number.
You may use both ACK and NAK messages if you like, or just ACK messages (as described in the text). It is up to you.