Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/network/PacketBuffer.h @ 196

Last change on this file since 196 was 196, checked in by scheusso, 16 years ago

created a dummyserver and dummyclient in order to test ConnectionManager and PacketBuffer with enet and boost_thread\n Makefile is used to build server and client

File size: 863 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  QueueItem *next;
34};
35
36class PacketBuffer{
37public:
38  PacketBuffer();
39  bool isEmpty();
40  bool isClosed();
41  void setClosed(bool value);
42  void print();
43  // pops a packet from the queue
44  ENetPacket *pop();
45  // pushs a packet to the queue
46  bool push(ENetPacket *pck);
47 
48private:
49  QueueItem *first;
50  QueueItem *last;
51  bool closed;
52 
53};
54
55} //namespace
56#endif /* NETWORK_PACKETBUFFER_H */
Note: See TracBrowser for help on using the repository browser.