Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6327 was 6139, checked in by patrick, 19 years ago

trunk: merged branche network with trunk using command: svn merge -r5999:HEAD, conflicts resolved in favor of the trunk bla

File size: 1.7 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#include "handshake.h"
16
17class Synchronizeable;
18class NetworkSocket;
19class ServerSocket;
20class ConnectionMonitor;
21class NetworkProtocol;
22
23typedef std::list<Synchronizeable*>  SynchronizeableList;
24typedef std::vector<NetworkSocket*>  NetworkSocketVector;
25typedef std::vector<Handshake*>      HandshakeVector;
26
27
28class NetworkStream : public DataStream
29{
30
31  public:
32    NetworkStream();
33    NetworkStream(IPaddress& address);
34    NetworkStream(unsigned int port);
35
36    ~NetworkStream();
37    void init();
38
39    void connectSynchronizeable(Synchronizeable& sync);
40    void disconnectSynchronizeable(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    inline int getMaxConnections(){ return maxConnections; }
46    void setMaxConnections( int n );
47
48    virtual void processData();
49
50  private:
51    NetworkProtocol*       networkProtocol;
52    ConnectionMonitor*     connectionMonitor;
53    SynchronizeableList    synchronizeables;
54    NetworkSocketVector    networkSockets;
55    HandshakeVector        handshakes;
56    ServerSocket*          serverSocket;
57    int                    type;
58    Header                 packetHeader;
59    bool                   bActive;
60    std::list<int>         freeSocketSlots;
61
62    int                    myHostId;
63    int                    maxConnections;
64
65    void updateConnectionList();
66};
67#endif /* _NETWORK_STREAM */
Note: See TracBrowser for help on using the repository browser.