Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/merger/src/network/PacketBuffer.h @ 278

Last change on this file since 278 was 278, checked in by nicolasc, 16 years ago

merged network

File size: 925 bytes
Line 
1//
2// C++ Interface: PacketBuffer
3//
4// Description:
5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12
13#ifndef NETWORK_PACKETBUFFER_H
14#define NETWORK_PACKETBUFFER_H
15
16#include <queue>
17#include <string>
18#include <enet/enet.h>
19#include <boost/bind.hpp>
20#include <boost/thread/mutex.hpp>
21
22
23namespace network{
24
25
26struct PacketEnvelope{
27  int length;
28  int data;
29};
30
31struct QueueItem{
32  ENetPacket *packet;
33  ENetAddress address;
34  QueueItem *next;
35};
36
37class PacketBuffer{
38public:
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 
50private:
51  QueueItem *first;
52  QueueItem *last;
53  bool closed;
54 
55};
56
57} //namespace
58#endif /* NETWORK_PACKETBUFFER_H */
Note: See TracBrowser for help on using the repository browser.