Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/network_stream.h @ 6018

Last change on this file since 6018 was 6018, checked in by rennerc, 18 years ago

NetworkStream should now accept net connections

File size: 1.3 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 <vector>
10#include <list>
11
12#include "data_stream.h"
13#include "network_protocol.h"
14#include "server_socket.h"
15
16class Synchronizeable;
17class NetworkSocket;
18class ServerSocket;
19class ConnectionMonitor;
20class NetworkProtocol;
21
22typedef std::list<Synchronizeable*>  SynchronizeableList;
23typedef std::vector<NetworkSocket*> NetworkSocketVector;
24
25
26class NetworkStream : public DataStream
27{
28
29  public:
30    NetworkStream();
31    NetworkStream(IPaddress& address);
32    NetworkStream(unsigned int port);
33
34    ~NetworkStream();
35    void init();
36
37    void connectSynchronizeable(Synchronizeable& sync);
38
39    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
40    inline bool isActive() const { return this->bActive; }
41
42    virtual void processData();
43
44  private:
45    NetworkProtocol*       networkProtocol;
46    ConnectionMonitor*     connectionMonitor;
47    SynchronizeableList    synchronizeables;
48    NetworkSocketVector    networkSockets;
49    ServerSocket*          serverSocket;
50    int                    type;
51    Header                 packetHeader;
52    bool                   bActive;
53    std::list<int>         freeSocketSlots;
54
55    void updateConnectionList();
56};
57#endif /* _NETWORK_STREAM */
Note: See TracBrowser for help on using the repository browser.