## Readme for stop_and_wait protocol
The “`stop_and_wait.c“` program provides a network emulation, and mimics a communication between two hosts through a lossy and erroneous network.
## Submission requirements
* Source code
* Readme file, Readme_lastname.md or txt file (i.e. Readme_tepe.md or txt). Use this readme as template.
### Objective:
Implement a reliable data transfer protocol using the following 8 functions. You may not have to implement all, you only need to implement which are essential to transfer packets from A to B.
*Comments provided below are information only, you may implement more steps than what is given.
“`C
void A_output(struct msg message)
{
//called when the application layer of A generates a message
//generate packet from message
//send to layer 3
//start timer
//return
}
“`
“`C
void A_input(struct pkt packet)
{
//called when layer 3 of A has a packet.
//stop the timer
//check if ack# is the expected one
//if not re-tx the correct packet
//if yes, move to next packet
}
“`
“`C
void A_timerinterrupt()
{
// when A’s timer is off then this function is callled.
// re-tx
//start timer again
}
“`
“`C
void A_init()
{
//called once when you start the emulator.
//you may implement any initialization
}
“`
“`C
void B_output(struct msg message)
{
//called when the application layer of B generates a message.
//you donot need to implement this for unidirectional network.
}
“`
“`C
void B_input(struct pkt packet)
{
//called when there is a packet for layer 3
//1 checks if the packet is expected one
//2 check if it is corrupted using checksum
//if 1 && 2 send ack
//pass to app layer of B
//if not do nothing
}
“`
“`C
void B_timerinterrupt()
{
//called when the B’s timer expires
}
“`
“`C
void B_init()
{
//entity B routines are called. You can use it to do any initialization
}
“`