Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/network_stream.h @ 6026

Last change on this file since 6026 was 5996, checked in by patrick, 19 years ago

orxonox/trunk: merged network branche into trunk with command svn merge -r 5824:HEAD

File size: 1.5 KB
Line 
1/*!
2 * @file network_stream.h
3 *  implementation of a network pipe
4 */
5
6#ifndef _NETWORK_STREAM
7#define _NETWORK_STREAM
8
9#include "data_stream.h"
10#include "network_protocol.h"
11
12class Synchronizeable;
13class NetworkSocket;
14class ConnectionMonitor;
15class NetworkProtocol;
16
17
18//<! The state of the NetworkStream
19typedef enum NetStat {
20  NET_REC_HEADER = 0,                          //!< Waiting for header
21  NET_REC_DATA,                                //!< Waiting for data
22
23  NUM_STATES                                   //!< Number of states
24};
25
26
27class NetworkStream : public DataStream
28{
29
30  public:
31    NetworkStream();
32    NetworkStream(IPaddress& address, NodeType type);
33    NetworkStream(unsigned int port, NodeType type);
34
35    NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type);
36    NetworkStream(unsigned int port, Synchronizeable& sync, NodeType type);
37    ~NetworkStream();
38    void init();
39
40    void connectSynchronizeable(Synchronizeable& sync);
41
42    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
43    inline bool isActive() const { return this->bActive; }
44
45    virtual void processData();
46
47  private:
48    NetworkProtocol*       networkProtocol;
49    ConnectionMonitor*     connectionMonitor;
50    Synchronizeable*       synchronizeables;
51    NetworkSocket*         networkSocket;
52    int                    type;
53    int                    state;
54    Header                 packetHeader;
55    bool                   bActive;
56};
57#endif /* _NETWORK_STREAM */
Note: See TracBrowser for help on using the repository browser.