#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <sys/types.h> #include "pdu.h" #ifndef WINDOW_H #define WINDOW_H typedef struct { bool isValid; int sequenceNum; uint8_t PDU[MAX_BUFFER]; int packetLength; } windowEntry; typedef struct { int windowSize; int lower; int upper; int current; windowEntry *table; } Window; Window createWindow(int winSize); windowEntry createEntry(); windowEntry createValidEntry(bool valid, int seqNum, int pktLen); windowEntry createValidPDUEntry(int seqNum, uint8_t *pkt, int pktLen); void addEntry (Window * win, windowEntry we); void addPDUToWindow (Window *win, uint8_t *pdu, int pktLen); windowEntry getEntry (Window win, int seqNum); windowEntry getLowestEntry(Window win); void copyPDULocal(Window *win, uint8_t *local, int *localSize, int index); void markEntryInvalid(Window *win, int index); void handleRR (Window *win, int rr); windowEntry handleSREJ (Window win, int srej); void printEntry (windowEntry we); bool isWindowOpen (Window win); void printWindowMetaData(Window win); void printWindow(Window win); #endif