Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 413 was 337, checked in by bknecht, 17 years ago

merged merger to FICN branch

File size: 925 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
13#ifndef NETWORK_PACKETBUFFER_H
14#define NETWORK_PACKETBUFFER_H
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
58#endif /* NETWORK_PACKETBUFFER_H */
Note: See TracBrowser for help on using the repository browser.