Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/network/proxy/network_settings.h @ 9409

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

saturation level for auto proxy server activation

File size: 2.1 KB
Line 
1/*!
2 * @file proxy_settings.h
3 *  some shared data from the proxy settings
4 */
5
6#ifndef _NETWORK_SETTINGS_H
7#define _NETWORK_SETTINGS_H
8
9#include "base_object.h"
10#include "netdefs.h"
11
12#include "debug.h"
13#include "ip.h"
14
15#include <vector>
16
17
18class NetworkStream;
19class Synchronizeable;
20class TiXmlElement;
21
22
23/* and here is the class itsself*/
24class NetworkSettings : public BaseObject
25{
26
27  public:
28    inline static NetworkSettings* getInstance() { if (!NetworkSettings::singletonRef) NetworkSettings::singletonRef = new NetworkSettings();
29      return NetworkSettings::singletonRef; }
30    virtual ~NetworkSettings();
31
32    void loadData();
33
34    void loadNetworkSettings(const TiXmlElement* root);
35
36    /** @param number: sets the max number of players */
37    inline void setMaxPlayer(int number) { this->maxPlayer = number; }
38    /** sets the @param saturation: a threshold in percente when the proxy servers should be activated to be able to redirect the clients */
39    inline void setMaxPlayerSaturation(float saturation) { this->maxPlayerSaturation = saturation; }
40    /** @returns teh max number of players */
41    int getMaxPlayer() { return this->maxPlayer; }
42
43    void setMasterAddr(const std::string& masterAddr);
44    /** @returns the address of the master server read from the network config file */
45    inline IP getMasterAddr() { return this->masterServer; }
46
47    void setProxyAddr(const std::string& proxyAddr);
48    /** @returns the list of proxy servers from the init file */
49    inline std::vector<IPaddress*>* getProxyList() { return &this->proxies; }
50
51
52  private:
53    NetworkSettings();
54
55
56  private:
57    static NetworkSettings*      singletonRef;            //!< Pointer to the only instance of this Class
58
59    int                          maxPlayer;               //!< maximal number of players
60    float                        maxPlayerSaturation;     //!< the saturation level from where on the proxy server should be activated
61
62    std::vector<IPaddress*>      proxies;                 //!< all registered proxies
63    IP                           masterServer;            //!< master server ip address
64
65};
66
67
68
69#endif /* _NETWORK_SETTINGS_H */
Note: See TracBrowser for help on using the repository browser.