Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

handshake: several clients can connect at the same time now

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
[6007]9#include <vector>
10#include <list>
11
[5582]12#include "data_stream.h"
[5809]13#include "network_protocol.h"
[6007]14#include "server_socket.h"
[6043]15#include "handshake.h"
[5566]16
[5647]17class Synchronizeable;
18class NetworkSocket;
[6007]19class ServerSocket;
[5647]20class ConnectionMonitor;
[5741]21class NetworkProtocol;
[5589]22
[6007]23typedef std::list<Synchronizeable*>  SynchronizeableList;
[6043]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();
[6007]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);
[6060]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
[6090]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;
[6007]53    SynchronizeableList    synchronizeables;
54    NetworkSocketVector    networkSockets;
[6043]55    HandshakeVector        handshakes;
[6007]56    ServerSocket*          serverSocket;
[5996]57    int                    type;
58    Header                 packetHeader;
59    bool                   bActive;
[6018]60    std::list<int>         freeSocketSlots;
61
[6043]62    int                    myHostId;
[6090]63    int                    maxConnections;
[6043]64
[6018]65    void updateConnectionList();
[5587]66};
[5566]67#endif /* _NETWORK_STREAM */
Note: See TracBrowser for help on using the repository browser.