Last change
on this file since 706 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
|
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 <queue> |
---|
17 | #include <string> |
---|
18 | #include <enet/enet.h> |
---|
19 | #include <boost/bind.hpp> |
---|
20 | #include <boost/thread/mutex.hpp> |
---|
21 | |
---|
22 | |
---|
23 | namespace network{ |
---|
24 | |
---|
25 | |
---|
26 | struct PacketEnvelope{ |
---|
27 | int length; |
---|
28 | int data; |
---|
29 | }; |
---|
30 | |
---|
31 | struct QueueItem{ |
---|
32 | ENetPacket *packet; |
---|
33 | ENetAddress address; |
---|
34 | QueueItem *next; |
---|
35 | }; |
---|
36 | |
---|
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 | }; |
---|
56 | |
---|
57 | } //namespace |
---|
58 | #endif /* _PacketBuffer_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.