Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/network/PacketBuffer.h @ 934

Last change on this file since 934 was 790, checked in by nicolasc, 17 years ago

merged FICN back into trunk
awaiting release.

File size: 890 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 _PacketBuffer_H__
14#define _PacketBuffer_H__
15
16#include <enet/enet.h>
17
18#include "NetworkPrereqs.h"
19
20namespace network
21{
22  struct PacketEnvelope{
23    int length;
24    int data;
25  };
26
27  struct QueueItem{
28    ENetPacket *packet;
29    ENetAddress address;
30    QueueItem *next;
31  };
32
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);
45
46  private:
47    QueueItem *first;
48    QueueItem *last;
49    bool closed;
50
51  };
52
53} //namespace
54#endif /* _PacketBuffer_H__ */
Note: See TracBrowser for help on using the repository browser.