Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/network/PacketBuffer.h @ 698

Last change on this file since 698 was 673, checked in by rgrieder, 17 years ago
  • deleted obsolete classes: BaseEntity, Entity, Light and SceneNode (please complain if not agreed)
  • improved include guard naming consistency
File size: 910 bytes
RevLine 
[173]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
[673]13#ifndef _PacketBuffer_H__
14#define _PacketBuffer_H__
[173]15
16#include <queue>
17#include <string>
[188]18#include <enet/enet.h>
[174]19#include <boost/bind.hpp>
20#include <boost/thread/mutex.hpp>
[173]21
[174]22
[173]23namespace network{
24
[196]25
[173]26struct PacketEnvelope{
27  int length;
28  int data;
29};
30
31struct QueueItem{
[188]32  ENetPacket *packet;
[204]33  ENetAddress address;
[173]34  QueueItem *next;
35};
36
37class PacketBuffer{
38public:
39  PacketBuffer();
40  bool isEmpty();
[174]41  bool isClosed();
42  void setClosed(bool value);
43  void print();
[173]44  // pops a packet from the queue
[188]45  ENetPacket *pop();
[204]46  ENetPacket *pop(ENetAddress &address);
[173]47  // pushs a packet to the queue
[204]48  bool push(ENetEvent *ev);
[196]49 
[173]50private:
51  QueueItem *first;
52  QueueItem *last;
[174]53  bool closed;
54 
[173]55};
56
57} //namespace
[673]58#endif /* _PacketBuffer_H__ */
Note: See TracBrowser for help on using the repository browser.