[9263] | 1 | /*! |
---|
[9264] | 2 | * @file network_monitor.h |
---|
| 3 | * a class to monitor the network: throughput, network nodes |
---|
[9263] | 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _NETWORK_MONITOR_H |
---|
| 7 | #define _NETWORK_MONITOR_H |
---|
| 8 | |
---|
| 9 | #include "base_object.h" |
---|
| 10 | #include "synchronizeable.h" |
---|
| 11 | |
---|
[9278] | 12 | #include "network_node.h" |
---|
| 13 | |
---|
[9264] | 14 | #include <list> |
---|
| 15 | |
---|
[9263] | 16 | class NetworkStream; |
---|
[9264] | 17 | class PeerInfo; |
---|
[9263] | 18 | |
---|
[9278] | 19 | |
---|
[9269] | 20 | namespace OrxGui { class GLGuiBox; }; |
---|
[9264] | 21 | |
---|
[9273] | 22 | |
---|
| 23 | |
---|
| 24 | //!< a class that monitors the whole network. it tries to gather all informations its able to from the network |
---|
[9263] | 25 | class NetworkMonitor : public Synchronizeable |
---|
| 26 | { |
---|
| 27 | |
---|
| 28 | public: |
---|
| 29 | NetworkMonitor(NetworkStream* networkStream); |
---|
[9264] | 30 | virtual ~NetworkMonitor(); |
---|
| 31 | |
---|
[9277] | 32 | /* client/masterserver/proxyserver addition/removal interface */ |
---|
| 33 | void addNetworkNode(NetworkNode* node); |
---|
| 34 | void removeNetworkNode(NetworkNode* node); |
---|
[9264] | 35 | |
---|
[9278] | 36 | inline void addClient(NetworkNode* node, PeerInfo* pInfo) { node->addClient(pInfo); } |
---|
| 37 | inline void addProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addProxyServer(pInfo); } |
---|
| 38 | inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); } |
---|
[9264] | 39 | |
---|
[9278] | 40 | inline void removeClient(NetworkNode* node, PeerInfo* pInfo) { node->removeClient(pInfo); } |
---|
| 41 | inline void removeProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeProxyServer(pInfo); } |
---|
| 42 | inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); } |
---|
[9264] | 43 | |
---|
[9277] | 44 | |
---|
[9265] | 45 | void showGUI(); |
---|
[9266] | 46 | void hideGUI(); |
---|
[9264] | 47 | |
---|
| 48 | void process(); |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | private: |
---|
[9279] | 52 | NetworkStream* networkStream; //!< reference to the one networkstream of the network |
---|
[9277] | 53 | std::list<NetworkNode*> nodeList; //!< list of all network nodes |
---|
[9265] | 54 | |
---|
| 55 | OrxGui::GLGuiBox* box; |
---|
[9272] | 56 | |
---|
| 57 | int playerNumber; //!< total number of players in the game |
---|
[9263] | 58 | }; |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | #endif |
---|