Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6139 in orxonox.OLD for trunk/src/lib/network/network_stream.h


Ignore:
Timestamp:
Dec 16, 2005, 6:45:32 PM (18 years ago)
Author:
patrick
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/network_stream.h

    r5996 r6139  
    77#define _NETWORK_STREAM
    88
     9#include <vector>
     10#include <list>
     11
    912#include "data_stream.h"
    1013#include "network_protocol.h"
     14#include "server_socket.h"
     15#include "handshake.h"
    1116
    1217class Synchronizeable;
    1318class NetworkSocket;
     19class ServerSocket;
    1420class ConnectionMonitor;
    1521class NetworkProtocol;
    1622
    17 
    18 //<! The state of the NetworkStream
    19 typedef 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 };
     23typedef std::list<Synchronizeable*>  SynchronizeableList;
     24typedef std::vector<NetworkSocket*>  NetworkSocketVector;
     25typedef std::vector<Handshake*>      HandshakeVector;
    2526
    2627
     
    3031  public:
    3132    NetworkStream();
    32     NetworkStream(IPaddress& address, NodeType type);
    33     NetworkStream(unsigned int port, NodeType type);
     33    NetworkStream(IPaddress& address);
     34    NetworkStream(unsigned int port);
    3435
    35     NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type);
    36     NetworkStream(unsigned int port, Synchronizeable& sync, NodeType type);
    3736    ~NetworkStream();
    3837    void init();
    3938
    4039    void connectSynchronizeable(Synchronizeable& sync);
     40    void disconnectSynchronizeable(Synchronizeable& sync);
    4141
    4242    inline bool isServer() const { return (this->type == NET_SERVER)? true:false; }
    4343    inline bool isActive() const { return this->bActive; }
     44
     45    inline int getMaxConnections(){ return maxConnections; }
     46    void setMaxConnections( int n );
    4447
    4548    virtual void processData();
     
    4851    NetworkProtocol*       networkProtocol;
    4952    ConnectionMonitor*     connectionMonitor;
    50     Synchronizeable*       synchronizeables;
    51     NetworkSocket*         networkSocket;
     53    SynchronizeableList    synchronizeables;
     54    NetworkSocketVector    networkSockets;
     55    HandshakeVector        handshakes;
     56    ServerSocket*          serverSocket;
    5257    int                    type;
    53     int                    state;
    5458    Header                 packetHeader;
    5559    bool                   bActive;
     60    std::list<int>         freeSocketSlots;
     61
     62    int                    myHostId;
     63    int                    maxConnections;
     64
     65    void updateConnectionList();
    5666};
    5767#endif /* _NETWORK_STREAM */
Note: See TracChangeset for help on using the changeset viewer.