|
 |
15a6e0 |
#ifndef UDPRECVQUEUE_H
|
|
 |
15a6e0 |
#define UDPRECVQUEUE_H
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
#include "common.h"
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
class Connection;
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
class UdpRecvQueue {
|
|
 |
15a6e0 |
public:
|
|
 |
15a6e0 |
struct Entry {
|
|
 |
15a6e0 |
bool received;
|
|
 |
15a6e0 |
unsigned short size;
|
|
 |
15a6e0 |
unsigned char data[PACKET_SIZE];
|
|
 |
15a6e0 |
};
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
public:
|
|
 |
15a6e0 |
Connection &connection;
|
|
 |
15a6e0 |
private:
|
|
 |
15a6e0 |
Time nextConfirmSendTime;
|
|
 |
15a6e0 |
bool confirmRequired;
|
|
 |
15a6e0 |
bool finalEntryAdded;
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
Entry entries[PACKETS_COUNT];
|
|
 |
15a6e0 |
int current;
|
|
 |
15a6e0 |
unsigned int currentIndex;
|
|
 |
15a6e0 |
unsigned int endIndex;
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
public:
|
|
 |
15a6e0 |
explicit UdpRecvQueue(Connection &connection);
|
|
 |
15a6e0 |
~UdpRecvQueue();
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
bool recvUdp(unsigned int index, const void *data, int size);
|
|
 |
c47604 |
bool sendUdpConfirm(bool force = false);
|
|
 |
c47604 |
bool canSentToTcp() const;
|
|
 |
15a6e0 |
int sendTcp();
|
|
 |
c47604 |
void whenWriteToUdp(Time &t) const;
|
|
 |
15a6e0 |
};
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
|
|
 |
15a6e0 |
#endif
|