Changeset 777 for code/branches/FICN/src/network/PacketBuffer.h
- Timestamp:
- Dec 31, 2007, 7:40:23 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/network/PacketBuffer.h
r673 r777 14 14 #define _PacketBuffer_H__ 15 15 16 #include <queue>17 #include <string>18 16 #include <enet/enet.h> 19 #include <boost/bind.hpp>20 #include <boost/thread/mutex.hpp>21 17 18 #include "NetworkPrereqs.h" 22 19 23 namespace network{ 20 namespace network 21 { 22 struct PacketEnvelope{ 23 int length; 24 int data; 25 }; 24 26 27 struct QueueItem{ 28 ENetPacket *packet; 29 ENetAddress address; 30 QueueItem *next; 31 }; 25 32 26 struct PacketEnvelope{ 27 int length; 28 int data; 29 }; 33 class PacketBuffer{ 34 public: 35 PacketBuffer(); 36 bool isEmpty(); 37 bool isClosed(); 38 void setClosed(bool value); 39 void print(); 40 // pops a packet from the queue 41 ENetPacket *pop(); 42 ENetPacket *pop(ENetAddress &address); 43 // pushs a packet to the queue 44 bool push(ENetEvent *ev); 30 45 31 struct QueueItem{ 32 ENetPacket *packet; 33 ENetAddress address; 34 QueueItem *next; 35 }; 46 private: 47 QueueItem *first; 48 QueueItem *last; 49 bool closed; 36 50 37 class PacketBuffer{ 38 public: 39 PacketBuffer(); 40 bool isEmpty(); 41 bool isClosed(); 42 void setClosed(bool value); 43 void print(); 44 // pops a packet from the queue 45 ENetPacket *pop(); 46 ENetPacket *pop(ENetAddress &address); 47 // pushs a packet to the queue 48 bool push(ENetEvent *ev); 49 50 private: 51 QueueItem *first; 52 QueueItem *last; 53 bool closed; 54 55 }; 51 }; 56 52 57 53 } //namespace
Note: See TracChangeset
for help on using the changeset viewer.