Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/proxy/network_settings.h @ 9570

Last change on this file since 9570 was 9494, checked in by bensch, 18 years ago

merged the proxy back

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    /** @returns teh max number of players */
39    int getMaxPlayer() const { return this->maxPlayer; }
40    /** sets the @param saturation: a threshold in percente when the proxy servers should be activated to be able to redirect the clients */
41    inline void setMaxPlayerSaturation(float saturation) { this->maxPlayerSaturation = saturation; }
42
43
44    void setMasterAddr(const std::string& masterAddr);
45    /** @returns the address of the master server read from the network config file */
46    inline const IP& getMasterAddr() const { return this->masterServer; }
47
48    void setProxyAddr(const std::string& proxyAddr);
49    /** @returns the list of proxy servers from the init file */
50    inline std::vector<IP>* getProxyList() { return &this->proxies; }
51
52
53  private:
54    NetworkSettings();
55
56
57  private:
58    static NetworkSettings*      singletonRef;            //!< Pointer to the only instance of this Class
59
60    int                          maxPlayer;               //!< maximal number of players
61    float                        maxPlayerSaturation;     //!< the saturation level from where on the proxy server should be activated
62
63    std::vector<IP>              proxies;                 //!< all registered proxies
64    IP                           masterServer;            //!< master server ip address
65
66};
67
68
69
70#endif /* _NETWORK_SETTINGS_H */
Note: See TracBrowser for help on using the repository browser.