Skip to content

Instantly share code, notes, and snippets.

@AjayKrP
Created September 23, 2017 05:46
Show Gist options
  • Save AjayKrP/863ba9c3f57665a6caa95ce12f28848f to your computer and use it in GitHub Desktop.
Save AjayKrP/863ba9c3f57665a6caa95ce12f28848f to your computer and use it in GitHub Desktop.
/*
* Data structure for packet in our GBN implementation
* Type indicates what kind of packet it is
* 0 - request
* 1 - ACK
* 2 - data
* 3 - teardown
* If type == data, then seq_no denotes the current packet's sequence number
* Length is the length of the data field
* Data carries the request or actual data; empty if type == ACK
*/
#define DATA_SIZE 128
struct packet
{
int type;
int seq_no;
int length;
char data[DATA_SIZE];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment