Statistics
| Branch: | Revision:

ml / util / queueManagement.h @ b71dda24

History | View | Annotate | Download (1.1 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

    
23
typedef struct PktContainer {
24
        int udpSocket; 
25
        struct iovec *iov; 
26
        int iovlen; 
27
        struct sockaddr_in *socketaddr;
28

    
29
        int pktLen;                //kB
30
        struct timeval timeStamp;
31
        struct PktContainer *next;
32
        unsigned char priority;
33
} PacketContainer;
34

    
35

    
36
typedef struct PktQueue { 
37
        PacketContainer *head;
38
        PacketContainer *tail;
39

    
40
        int size;                //kB
41

    
42
} PacketQueue;
43

    
44

    
45
PacketContainer* createPacketContainer (const int uSoc,struct iovec *ioVector,int iovlen,struct sockaddr_in *sockAddress, unsigned char prior);
46

    
47
int addPacketTXqueue(PacketContainer *packet);
48

    
49
PacketContainer* takePacketToSend();
50

    
51
int removeOldestPacket() ;
52

    
53
void setQueueSizes (int TXsize, int RTXsize);
54

    
55
int isQueueEmpty();
56

    
57
int getFirstPacketSize();
58

    
59
void setQueuesParams (int TXsize, int RTXsize, double maxTimeToHold);
60

    
61
#ifdef RTX
62
void addPacketRTXqueue(PacketContainer *packet);
63

    
64
int rtxPacketsFromTo(int connID, int msgSeqNum, int offsetFrom, int offsetTo);
65
#endif