Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/network/proxy/proxy_settings.cc @ 9308

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

proxy server ip synchronizeing bug, nodes get registered

File size: 1.7 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Patrick Boenzli
13*/
14
15
16#define DEBUG_MODULE_NETWORK
17
18#include "proxy_settings.h"
19#include "netdefs.h"
20
21#include "loading/load_param.h"
22
23
24using namespace std;
25
26
27ProxySettings* ProxySettings::singletonRef = NULL;
28
29/**
30 * Standard constructor
31 */
32ProxySettings::ProxySettings()
33{
34  /* set the class id for the base object */
35  this->setClassID(CL_PROXY_SETTINGS, "ProxySettings");
36}
37
38
39/**
40 * Standard destructor
41 */
42ProxySettings::~ProxySettings()
43{
44  ProxySettings::singletonRef = NULL;
45
46  // remove all unused proxy data again
47  for( int i = 0; i < this->proxies.size(); i++)
48  {
49    IPaddress* ip = this->proxies.back();
50    this->proxies.pop_back();
51    delete ip;
52  }
53}
54
55
56
57/**
58 * load the proxy settings
59 * @param root: the root element of the xml elemnts
60 */
61void ProxySettings::loadProxySettings(const TiXmlElement* root)
62{
63
64  LoadParam(root, "max-player", this, ProxySettings, setMaxPlayer);
65
66  LOAD_PARAM_START_CYCLE(root, element);
67  {
68    element->ToText();
69    // PER-PARTICLE-ATTRIBUTES:
70    LoadParam(root, "proxy-addr", this, ProxySettings, setProxyAddr);
71  }
72  LOAD_PARAM_END_CYCLE(element);
73
74}
75
76
77/**
78 * sets the proxy address to
79 *  @param proxyAddr: the proxy address
80 */
81void ProxySettings::setProxyAddr(const std::string& proxyAddr)
82{
83  IPaddress *ip = new IPaddress;
84
85  SDLNet_ResolveHost( ip, proxyAddr.c_str(), 9999 );
86
87  this->proxies.push_back(ip);
88}
89
90
91
92
93
94
95
Note: See TracBrowser for help on using the repository browser.