Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 31, 2007, 7:40:23 PM (16 years ago)
Author:
rgrieder
Message:
  • added dll support to the network library
  • improved header file dependency in network
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/PacketBuffer.h

    r673 r777  
    1414#define _PacketBuffer_H__
    1515
    16 #include <queue>
    17 #include <string>
    1816#include <enet/enet.h>
    19 #include <boost/bind.hpp>
    20 #include <boost/thread/mutex.hpp>
    2117
     18#include "NetworkPrereqs.h"
    2219
    23 namespace network{
     20namespace network
     21{
     22  struct PacketEnvelope{
     23    int length;
     24    int data;
     25  };
    2426
     27  struct QueueItem{
     28    ENetPacket *packet;
     29    ENetAddress address;
     30    QueueItem *next;
     31  };
    2532
    26 struct PacketEnvelope{
    27   int length;
    28   int data;
    29 };
     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);
    3045
    31 struct QueueItem{
    32   ENetPacket *packet;
    33   ENetAddress address;
    34   QueueItem *next;
    35 };
     46  private:
     47    QueueItem *first;
     48    QueueItem *last;
     49    bool closed;
    3650
    37 class PacketBuffer{
    38 public:
    39   PacketBuffer();
    40   bool isEmpty();
    41   bool isClosed();
    42   void setClosed(bool value);
    43   void print();
    44   // pops a packet from the queue
    45   ENetPacket *pop();
    46   ENetPacket *pop(ENetAddress &address);
    47   // pushs a packet to the queue
    48   bool push(ENetEvent *ev);
    49  
    50 private:
    51   QueueItem *first;
    52   QueueItem *last;
    53   bool closed;
    54  
    55 };
     51  };
    5652
    5753} //namespace
Note: See TracChangeset for help on using the changeset viewer.