Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

merged FICN back into trunk
awaiting release.

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