Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/network/monitor/network_node.h @ 9625

Last change on this file since 9625 was 9625, checked in by patrick, 18 years ago

yet another weekend commit, quite much work done:

  • introduced a new PERMISSION layer: PERMISSION_SERVER: the nearest server hast authority
  • tightening up permissions: brand new implementation to prevent sending unused variables in the network (less smog in the net:D_
  • removed some compiler warnings from some central modules
  • networkmonitor interface changed to work with networknodes mainly
  • better debug output for the network monitor
  • networnode inteface standardisation
  • force reconnection commands integration
File size: 3.0 KB
Line 
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"
11#include "peer_info.h"
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
17class NetworkNode
18{
19  public:
20    NetworkNode(PeerInfo* pInfo);
21    ~NetworkNode();
22
23
24    void addClient(NetworkNode* node);
25    void addActiveProxyServer(NetworkNode* node);
26    void addPassiveProxyServer(NetworkNode* node);
27    void addMasterServer(NetworkNode* node);
28
29    void removeClient(NetworkNode* node);
30    void removeActiveProxyServer(NetworkNode* node);
31    void removePassiveProxyServer(NetworkNode* node);
32    void removeMasterServer(NetworkNode* node);
33
34    void removeClient(int userId);
35    void removeActiveProxyServer(int userId);
36    void removePassiveProxyServer(int userId);
37    void removeMasterServer(int userId);
38
39
40    PeerInfo* getClient(int index) const;
41    PeerInfo* getActiveProxyServer(int index) const;
42    PeerInfo* getPassiveProxyServer(int index) const;
43    PeerInfo* getMasterServer(int index) const;
44
45    /** @returns the master server list */
46    inline std::list<NetworkNode*> getMasterServer() const { return this->masterServerList; }
47    /** @returns the active proxy server list */
48    inline std::list<NetworkNode*> getActiveProxyServer() const { return this->activeProxyServerList; }
49    /** @returns the passive proxy server list */
50    inline std::list<NetworkNode*> getPassiveProxyServer() const { return this->passiveProxyServerList; }
51    /** @returns the client list */
52    inline std::list<NetworkNode*> getClient() const { return this->clientList; }
53
54    PeerInfo* getPeerByUserId( int userId);
55
56    /** @returns the number of players */
57    inline int getPlayerNumber() const { return this->playerNumber; }
58    /** @returns the node type of this node */
59    inline int getNodeType() const { return this->peerInfo->nodeType; }
60    /** @returns the peer info of this node */
61    inline PeerInfo* getPeerInfo() const { return this->peerInfo; }
62
63    void debug(int depth) const;
64
65
66  private:
67    int                          playerNumber;                 //!< localy direct connected player number
68    int                          connectionNumber;             //!< number of connections ( can but musn't be equal players)
69    PeerInfo*                    peerInfo;                     //!< the peer information about this node
70
71    /* network nodes directly connected to this node */
72    std::list<NetworkNode*>         clientList;                   //!< list of all clients in the network
73    std::list<NetworkNode*>         activeProxyServerList;        //!< list of all proxy servers in the network
74    std::list<NetworkNode*>         passiveProxyServerList;       //!< list of all proxy servers in the network
75    std::list<NetworkNode*>         masterServerList;             //!< list of all master servers in the network (should be 1!! :D)
76
77};
78
79#endif /* _NETWORK_NODE_H */
Note: See TracBrowser for help on using the repository browser.