Changeset 6139 in orxonox.OLD for trunk/src/lib/network/network_stream.h
- Timestamp:
- Dec 16, 2005, 6:45:32 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_stream.h
r5996 r6139 7 7 #define _NETWORK_STREAM 8 8 9 #include <vector> 10 #include <list> 11 9 12 #include "data_stream.h" 10 13 #include "network_protocol.h" 14 #include "server_socket.h" 15 #include "handshake.h" 11 16 12 17 class Synchronizeable; 13 18 class NetworkSocket; 19 class ServerSocket; 14 20 class ConnectionMonitor; 15 21 class NetworkProtocol; 16 22 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 }; 23 typedef std::list<Synchronizeable*> SynchronizeableList; 24 typedef std::vector<NetworkSocket*> NetworkSocketVector; 25 typedef std::vector<Handshake*> HandshakeVector; 25 26 26 27 … … 30 31 public: 31 32 NetworkStream(); 32 NetworkStream(IPaddress& address , NodeType type);33 NetworkStream(unsigned int port , NodeType type);33 NetworkStream(IPaddress& address); 34 NetworkStream(unsigned int port); 34 35 35 NetworkStream(IPaddress& address, Synchronizeable& sync, NodeType type);36 NetworkStream(unsigned int port, Synchronizeable& sync, NodeType type);37 36 ~NetworkStream(); 38 37 void init(); 39 38 40 39 void connectSynchronizeable(Synchronizeable& sync); 40 void disconnectSynchronizeable(Synchronizeable& sync); 41 41 42 42 inline bool isServer() const { return (this->type == NET_SERVER)? true:false; } 43 43 inline bool isActive() const { return this->bActive; } 44 45 inline int getMaxConnections(){ return maxConnections; } 46 void setMaxConnections( int n ); 44 47 45 48 virtual void processData(); … … 48 51 NetworkProtocol* networkProtocol; 49 52 ConnectionMonitor* connectionMonitor; 50 Synchronizeable* synchronizeables; 51 NetworkSocket* networkSocket; 53 SynchronizeableList synchronizeables; 54 NetworkSocketVector networkSockets; 55 HandshakeVector handshakes; 56 ServerSocket* serverSocket; 52 57 int type; 53 int state;54 58 Header packetHeader; 55 59 bool bActive; 60 std::list<int> freeSocketSlots; 61 62 int myHostId; 63 int maxConnections; 64 65 void updateConnectionList(); 56 66 }; 57 67 #endif /* _NETWORK_STREAM */
Note: See TracChangeset
for help on using the changeset viewer.