Blob Blame Raw
#ifndef UDPRECVQUEUE_H
#define UDPRECVQUEUE_H


#include "common.h"



class Connection;


class UdpRecvQueue {
public:
	struct Entry {
		bool received;
		unsigned short size;
		unsigned char data[PACKET_SIZE];
	};
	
public:
	Connection &connection;
private:
	Time nextConfirmSendTime;
	bool confirmRequired;
	bool finalEntryAdded;
	
	Entry entries[PACKETS_COUNT];
	int current;
	unsigned int currentIndex;
	unsigned int endIndex;
	
public:
	explicit UdpRecvQueue(Connection &connection);
	~UdpRecvQueue();
	
	bool recvUdp(unsigned int index, const void *data, int size);
	bool sendUdpConfirm();
	int sendTcp();
};


#endif