Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/output/src/libraries/network/WANDiscovery.h @ 8817

Last change on this file since 8817 was 8817, checked in by landauf, 13 years ago

corrected authors

  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist > www.orxonox.net <
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or modify it
8 *   under the terms of the GNU General Public License as published by the Free
9 *   Software Foundation; either version 2 of the License, or (at your option)
10 *   any later version.
11 *
12 *   This program is distributed in the hope that it will be useful, but
13 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 *   for more details.
16 *
17 *   You should have received a copy of the GNU General Public License along
18 *   with this program; if not, write to the Free Software Foundation, Inc., 51
19 *   Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Sandro 'smerkli' Merkli
23 *   Co-authors:
24 *      Oliver Scheuss (original)
25 *
26 */
27
28#ifndef _WANDiscovery_H__
29#define _WANDiscovery_H__
30
31#include "NetworkPrereqs.h"
32#include "packet/ServerInformation.h"
33#include "core/ConfigFileManager.h"
34#include "util/Singleton.h"
35#include "core/OrxonoxClass.h"
36#include "core/ConfigValueIncludes.h"
37#include "core/CoreIncludes.h"
38#include "MasterServerComm.h"
39#include "MasterServerProtocol.h"
40
41#include <vector>
42
43#define WANDISC_MAXTRIES 5
44
45// tolua_begin
46namespace orxonox
47{
48
49  class _NetworkExport WANDiscovery
50// tolua_end
51    : public Singleton<WANDiscovery>, public OrxonoxClass
52  { // tolua_export
53    friend class Singleton<WANDiscovery>;
54    public:
55      /** constructor */
56      WANDiscovery();
57
58      /** destructor */
59      ~WANDiscovery();
60
61      /** \return Address of the master server
62       *
63       * Get the master server address
64       */
65      std::string getMSAddress()
66      { return this->msaddress; }
67
68      /** ask server for server list  */
69      void discover(); // tolua_export
70
71      /** \param index Index to get the name of
72       * \return The name of the server
73       *
74       * Get the name of the server at index index.
75       */
76      std::string getServerListItemName( unsigned int index ); // tolua_export
77
78      /** \param index Index to get the IP of
79       * \return The IP of the server
80       *
81       * Get the IP of the server at index index.
82       */
83      std::string getServerListItemIP( unsigned int index ); // tolua_export
84
85      /** \return an instance of WANDiscovery
86       *
87       * Create and return an instance of WANDiscovery.
88       */
89      static WANDiscovery& getInstance() { return Singleton<WANDiscovery>::getInstance(); } // tolua_export
90   
91      /* todo: might make this private and use getter/setter methods
92       * at some later time.
93       */
94      /** game server list */
95      std::vector<packet::ServerInformation> servers_;
96
97      /** Function used for the configuration file parameter update */
98      void setConfigValues();
99
100      /** Master server communications object */
101      MasterServerComm msc;
102     
103    private:
104      /** Singleton pointer */
105      static WANDiscovery* singletonPtr_s;
106
107      /** master server address */
108      std::string msaddress;
109
110  }; // tolua_export
111
112} // tolua_export
113
114#endif // _WANDiscovery_H__
Note: See TracBrowser for help on using the repository browser.