Statistics
| Branch: | Revision:

napa-baselibs / ml / util / queueManagement.h @ 612e856d

History | View | Annotate | Download (982 Bytes)

1 612e856d MarcoMellia
/*
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
#include <netinet/in.h>
17
18
19
typedef struct PktContainer {
20
        int udpSocket; 
21
        struct iovec *iov; 
22
        int iovlen; 
23
        struct sockaddr_in *socketaddr;
24
25
        int pktLen;                //kB
26
        struct timeval timeStamp;
27
        struct PktContainer *next;
28
        unsigned char priority;
29
} PacketContainer;
30
31
32
typedef struct PktQueue { 
33
        PacketContainer *head;
34
        PacketContainer *tail;
35
36
        int size;                //kB
37
38
} PacketQueue;
39
40
41
PacketContainer* createPacketContainer (const int uSoc,struct iovec *ioVector,int iovlen,struct sockaddr_in *sockAddress, unsigned char prior);
42
43
int addPacketTXqueue(PacketContainer *packet);
44
45
PacketContainer* takePacketToSend();
46
47
void addPacketRTXqueue(PacketContainer *packet);
48
49
int removeOldestPacket() ;
50
51
void setQueueSizes (int TXsize, int RTXsize);
52
53
int isQueueEmpty();
54
55
int getFirstPacketSize();
56
57
void setQueuesParams (int TXsize, int RTXsize, double maxTimeToHold);