Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9449 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 25, 2006, 10:15:18 AM (18 years ago)
Author:
patrick
Message:

making the node id system as consistant as possible

Location:
branches/proxy/src/lib/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/README.NETWORK

    r9406 r9449  
    99UserId:
    1010containing the id of a user (==client). This id must be unique within a orxonox network its used especialy in the NetworkStream for node identification and also in the Synchronizeable base class for permissions checking (PERMISSION_OWNER)
    11 WARNING:
    12 There is some correlation between userids and the maxplayer, do not touch this.
     11
     12the connections belonging tu toe userId's are stored in the NetworkStream::peers std::map. As a keyvalue the userId's are used. Therefore the usage of this peers map is very delicate. Don't ever try to add anything you are not sure about the id stuff.
     13
     14There are some reserved id's, don't mess with them:
     150 :                  Master Server
     161 :                  First Proxy Server
     172 :                  Second Proxy Server
     183 :                  Third Proxy Server
     194 :                  Fourth Proxy Server
     20.
     21.
     22.
     23NET_MAX_PROXY        The maximal number of proxy servers
     24NET_MAX... + 1       First Client
     25NET_MAX... + 2       Second Client
     26.
     27.
     28.
     29NET_MAX_CONNECTION   Last client
     30
    1331
    1432
  • branches/proxy/src/lib/network/netdefs.h

    r9406 r9449  
    4343
    4444
     45
     46
    4547//!< enum indicating the type of the node
    4648typedef enum {
     
    6769} UidType;
    6870
     71
     72//!< the id of the node
     73typedef enum nodeId {
     74  NET_ID_UNASSIGNED       =-1,
     75
     76  NET_ID_MASTER_SERVER    = 0,
     77
     78  NET_ID_PROXY_SERVER_01  = 1,
     79  NET_ID_PROXY_SERVER_02,
     80  NET_ID_PROXY_SERVER_03,
     81  NET_ID_PROXY_SERVER_04,
     82  NET_ID_PROXY_SERVER_05,
     83  NET_ID_PROXY_SERVER_06,
     84  NET_ID_PROXY_SERVER_07,
     85  NET_ID_PROXY_SERVER_08  = 8,
     86
     87  NET_ID_PROXY_MAX        = 8,
     88
     89  NET_ID_CLIENT_01        = 9,
     90  NET_ID_CLIENT_02,
     91  NET_ID_CLIENT_03,
     92  NET_ID_CLIENT_04,
     93  NET_ID_CLIENT_05,
     94  NET_ID_CLIENT_06,
     95  NET_ID_CLIENT_07,
     96  NET_ID_CLIENT_08,
     97  NET_ID_CLIENT_09,
     98  NET_ID_CLIENT_10,
     99  NET_ID_CLIENT_11,
     100  NET_ID_CLIENT_12,
     101  NET_ID_CLIENT_13,
     102  NET_ID_CLIENT_14,
     103  NET_ID_CLIENT_15,
     104  NET_ID_CLIENT_16,
     105  NET_ID_CLIENT_17,
     106  NET_ID_CLIENT_18,
     107  NET_ID_CLIENT_19,
     108  NET_ID_CLIENT_20,
     109  NET_ID_CLIENT_21,
     110  NET_ID_CLIENT_22,
     111  NET_ID_CLIENT_23,
     112  NET_ID_CLIENT_24,
     113  NET_ID_CLIENT_25,
     114  NET_ID_CLIENT_26,
     115  NET_ID_CLIENT_27,
     116  NET_ID_CLIENT_28,
     117  NET_ID_CLIENT_29,
     118  NET_ID_CLIENT_30,
     119  NET_ID_CLIENT_31,
     120  NET_ID_CLIENT_32,
     121  NET_ID_CLIENT_33,
     122  NET_ID_CLIENT_34,
     123  NET_ID_CLIENT_35,
     124  NET_ID_CLIENT_36,
     125  NET_ID_CLIENT_37,
     126  NET_ID_CLIENT_38,
     127  NET_ID_CLIENT_39,
     128  NET_ID_CLIENT_40,
     129
     130  NET_ID_CLIENT_MAX        = 40
     131
     132};
    69133#endif /* _NETDEFS_H */
  • branches/proxy/src/lib/network/network_manager.cc

    r9448 r9449  
    133133  this->networkStream->createServer( port);
    134134  // and connect to the master server for synchronization
    135   this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);
     135  int userId = this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);
    136136  // and to the other proxy servers also, this would be very nice if its works
    137137
  • branches/proxy/src/lib/network/network_stream.cc

    r9447 r9449  
    182182 * @param port: the port number
    183183 */
    184 void NetworkStream::connectToMasterServer(std::string host, int port)
     184int NetworkStream::connectToMasterServer(std::string host, int port)
    185185{
    186186  int node = this->peers.size();
     
    192192  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
    193193  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
     194
     195  return node;
    194196}
    195197
     
    200202 * @param port: the port number
    201203 */
    202 void NetworkStream::connectToProxyServer(std::string host, int port)
     204int NetworkStream::connectToProxyServer(std::string host, int port)
    203205{
    204206  int node = this->peers.size();
     
    212214  this->peers[node].connectionMonitor = new ConnectionMonitor( 0 );
    213215  this->peers[node].ip = this->peers[node].socket->getRemoteAddress();
     216
     217  return node;
    214218}
    215219
  • branches/proxy/src/lib/network/network_stream.h

    r9433 r9449  
    4141    void init();
    4242
    43     void connectToMasterServer(std::string host, int port);
    44     void connectToProxyServer(std::string host, int port);
     43    int connectToMasterServer(std::string host, int port);
     44    int connectToProxyServer(std::string host, int port);
    4545    void createServer(int port);
    4646
Note: See TracChangeset for help on using the changeset viewer.