ml / util / queueManagement.h @ 6575ae37
History | View | Annotate | Download (1.08 KB)
1 |
/*
|
---|---|
2 |
*
|
3 |
*
|
4 |
*
|
5 |
*
|
6 |
* Agnieszka Witczak & Szymon Kuc
|
7 |
*
|
8 |
*/
|
9 |
|
10 |
|
11 |
#include <stdio.h> |
12 |
#include <stdlib.h> |
13 |
|
14 |
#include <unistd.h> |
15 |
|
16 |
#ifndef WIN32
|
17 |
#include <netinet/in.h> |
18 |
#else
|
19 |
#include <winsock2.h> |
20 |
#endif
|
21 |
|
22 |
typedef struct PktContainer { |
23 |
int udpSocket;
|
24 |
struct iovec *iov;
|
25 |
int iovlen;
|
26 |
struct sockaddr_in *socketaddr;
|
27 |
|
28 |
int pktLen; //kB |
29 |
struct timeval timeStamp;
|
30 |
struct PktContainer *next;
|
31 |
unsigned char priority; |
32 |
} PacketContainer; |
33 |
|
34 |
|
35 |
typedef struct PktQueue { |
36 |
PacketContainer *head; |
37 |
PacketContainer *tail; |
38 |
|
39 |
int size; //kB |
40 |
|
41 |
} PacketQueue; |
42 |
|
43 |
|
44 |
PacketContainer* createPacketContainer (const int uSoc,struct iovec *ioVector,int iovlen,struct sockaddr_in *sockAddress, unsigned char prior); |
45 |
|
46 |
int addPacketTXqueue(PacketContainer *packet);
|
47 |
|
48 |
PacketContainer* takePacketToSend(); |
49 |
|
50 |
int removeOldestPacket() ;
|
51 |
|
52 |
int isQueueEmpty();
|
53 |
|
54 |
int getFirstPacketSize();
|
55 |
|
56 |
void setQueuesParams (int TXsize, int RTXsize, double maxTimeToHold); //in bytes, bytes, seconds |
57 |
|
58 |
#ifdef RTX
|
59 |
void addPacketRTXqueue(PacketContainer *packet);
|
60 |
|
61 |
int rtxPacketsFromTo(int connID, int msgSeqNum, int offsetFrom, int offsetTo); |
62 |
#endif
|