Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6141 was 6141, checked in by patrick, 18 years ago

network: created branche network again

File size: 1.7 KB
RevLine 
[5566]1/*!
2 * @file network_stream.h
3 *  implementation of a network pipe
4 */
[5587]5
[5566]6#ifndef _NETWORK_STREAM
7#define _NETWORK_STREAM
8
[6139]9#include <vector>
10#include <list>
11
[5582]12#include "data_stream.h"
[5809]13#include "network_protocol.h"
[6139]14#include "server_socket.h"
15#include "handshake.h"
[5566]16
[5647]17class Synchronizeable;
18class NetworkSocket;
[6139]19class ServerSocket;
[5647]20class ConnectionMonitor;
[5741]21class NetworkProtocol;
[5589]22
[6139]23typedef std::list<Synchronizeable*>  SynchronizeableList;
24typedef std::vector<NetworkSocket*>  NetworkSocketVector;
25typedef std::vector<Handshake*>      HandshakeVector;
[5809]26
27
[5649]28class NetworkStream : public DataStream
[5566]29{
30
[5996]31  public:
32    NetworkStream();
[6139]33    NetworkStream(IPaddress& address);
34    NetworkStream(unsigned int port);
[5804]35
[5996]36    ~NetworkStream();
37    void init();
[5804]38
[5996]39    void connectSynchronizeable(Synchronizeable& sync);
[6139]40    void disconnectSynchronizeable(Synchronizeable& sync);
[5566]41
[5996]42    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
43    inline bool isActive() const { return this->bActive; }
44
[6139]45    inline int getMaxConnections(){ return maxConnections; }
46    void setMaxConnections( int n );
47
[5996]48    virtual void processData();
49
50  private:
51    NetworkProtocol*       networkProtocol;
52    ConnectionMonitor*     connectionMonitor;
[6139]53    SynchronizeableList    synchronizeables;
54    NetworkSocketVector    networkSockets;
55    HandshakeVector        handshakes;
56    ServerSocket*          serverSocket;
[5996]57    int                    type;
58    Header                 packetHeader;
59    bool                   bActive;
[6139]60    std::list<int>         freeSocketSlots;
61
62    int                    myHostId;
63    int                    maxConnections;
64
65    void updateConnectionList();
[5587]66};
[5566]67#endif /* _NETWORK_STREAM */
Note: See TracBrowser for help on using the repository browser.