Last change
on this file since 9284 was
9284,
checked in by patrick, 18 years ago
|
peerinfos are now gettable from outside
|
File size:
1.6 KB
|
Rev | Line | |
---|
[9276] | 1 | /*! |
---|
| 2 | * @file network_node.h |
---|
| 3 | * a class representing a node in the network (this can be a MASTER_SERVER, PROXY_SERVER or a CLIENT |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _NETWORK_NODE_H |
---|
| 7 | #define _NETWORK_NODE_H |
---|
| 8 | |
---|
| 9 | #include "base_object.h" |
---|
| 10 | #include "synchronizeable.h" |
---|
[9284] | 11 | #include "peer_info.h" |
---|
[9276] | 12 | |
---|
| 13 | #include <list> |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | //!< a class representing a node in the network (this can be a MASTER_SERVER, PROXY_SERVER or a CLIENT |
---|
| 17 | class NetworkNode |
---|
| 18 | { |
---|
| 19 | public: |
---|
[9284] | 20 | NetworkNode(PeerInfo* pInfo); |
---|
[9276] | 21 | ~NetworkNode(); |
---|
| 22 | |
---|
| 23 | |
---|
[9277] | 24 | void addClient(PeerInfo* node); |
---|
| 25 | void addProxyServer(PeerInfo* node); |
---|
| 26 | void addMasterServer(PeerInfo* node); |
---|
| 27 | |
---|
| 28 | void removeClient(PeerInfo* node); |
---|
| 29 | void removeProxyServer(PeerInfo* node); |
---|
| 30 | void removeMasterServer(PeerInfo* node); |
---|
| 31 | |
---|
[9279] | 32 | /** @returns the number of players */ |
---|
| 33 | inline int getPlayerNumber() { return this->playerNumber; } |
---|
| 34 | /** @returns the node type of this node */ |
---|
[9284] | 35 | inline int getNodeType() { return this->peerInfo->nodeType; } |
---|
[9277] | 36 | |
---|
| 37 | |
---|
[9276] | 38 | private: |
---|
[9277] | 39 | int playerNumber; //!< localy direct connected player number |
---|
[9284] | 40 | PeerInfo* peerInfo; //!< the peer informationa about this node |
---|
[9276] | 41 | |
---|
[9277] | 42 | /* network nodes directly connected to this node */ |
---|
[9276] | 43 | std::list<PeerInfo*> clientList; //!< list of all clients in the network |
---|
| 44 | std::list<PeerInfo*> proxyServerList; //!< list of all proxy servers in the network |
---|
| 45 | std::list<PeerInfo*> masterServerList; //!< list of all master servers in the network (should be 1!! :D) |
---|
| 46 | |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | #endif /* _NETWORK_NODE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.