-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindow.h
More file actions
31 lines (26 loc) · 679 Bytes
/
window.h
File metadata and controls
31 lines (26 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef __WINDOW_H__
#define __WINDOW_H__
#include <stdlib.h>
#include <stdint.h>
#include "srej.h"
typedef struct {
uint32_t seqNum;
int32_t segSize;
uint8_t buf[MAX_LEN];
int32_t hasData;
} Segment;
typedef struct {
Segment *segment;
int32_t winSize;
int32_t curSize;
int32_t start; // start Idx
uint32_t startSeq;
uint32_t endSeq;
} Window;
void *CreateWindow(int32_t winSize, uint32_t seqNum);
int isValidSeqNum(void *window, uint32_t seqNum);
int isClosed(void *window);
void AddSegment(void *window, uint8_t *buf, uint32_t bufLen, uint32_t seqNum);
void MoveWindow(void *window, uint32_t seqNum);
void FreeWindow(void *window);
#endif