Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/libraries/network/WANDiscovery.h @ 7747

Last change on this file since 7747 was 7745, checked in by smerkli, 15 years ago

Removed some things and fixed some bugs

File size: 3.1 KB
RevLine 
[7161]1/*
[7745]2 *   ORXONOX - the hottest 3D action shooter ever to exist > www.orxonox.net <
[7161]3 *
4 *
5 *   License notice:
6 *
[7745]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.
[7161]11 *
[7745]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.
[7161]16 *
[7745]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.
[7161]20 *
[7745]21 *   Author: Fabian 'x3n' Landau (original) Co-authors: Sandro 'smerkli' Merkli
22 *   (copied and adapted to WAN)
[7161]23 *
24 */
25
[7745]26#ifndef WANDISCOVERY_H
[7630]27#define WANDISCOVERY_H
[7161]28
29#include "NetworkPrereqs.h"
30#include "packet/ServerInformation.h"
[7737]31#include "core/ConfigFileManager.h"
[7161]32#include "util/Singleton.h"
[7737]33#include "core/OrxonoxClass.h"
34#include "core/ConfigValueIncludes.h"
35#include "core/CoreIncludes.h"
[7631]36#include "MasterServerComm.h"
[7650]37#include "MasterServerProtocol.h"
[7161]38
39#include <vector>
40
[7692]41#define WANDISC_MAXTRIES 5
[7631]42
[7161]43// tolua_begin
44namespace orxonox
45{
46
[7630]47  class _NetworkExport WANDiscovery
[7161]48// tolua_end
[7737]49    : public Singleton<WANDiscovery>, public OrxonoxClass
[7161]50  { // tolua_export
[7630]51    friend class Singleton<WANDiscovery>;
[7161]52    public:
[7631]53      /** constructor */
[7630]54      WANDiscovery();
[7631]55
56      /** destructor */
[7630]57      ~WANDiscovery();
[7631]58
[7745]59      /** get content of msaddress */
60      std::string getMSAddress()
61      { return this->msaddress; }
62
[7631]63      /** ask server for server list  */
[7161]64      void discover(); // tolua_export
[7631]65
66      /** \param index Index to get the name of
67       * \return The name of the server
68       *
69       * Get the name of the server at index index.
70       */
[7161]71      std::string getServerListItemName( unsigned int index ); // tolua_export
[7631]72
73      /** \param index Index to get the IP of
74       * \return The IP of the server
75       *
76       * Get the IP of the server at index index.
77       */
[7161]78      std::string getServerListItemIP( unsigned int index ); // tolua_export
[7631]79
80      /** \return an instance of WANDiscovery
81       *
82       * Create and return an instance of WANDiscovery.
83       */
84      static WANDiscovery& getInstance() { return Singleton<WANDiscovery>::getInstance(); } // tolua_export
[7651]85   
[7672]86      /* todo: might make this private and use getter/setter methods
87       * at some later time.
88       */
[7657]89      /** game server list */
90      std::vector<packet::ServerInformation> servers_;
[7737]91
92      /** Function used for the configuration file parameter update */
93      void setConfigValues();
[7161]94     
95    private:
[7631]96      /** Singleton pointer */
[7630]97      static WANDiscovery* singletonPtr_s;
[7631]98
99      /** Master server communications object */
100      MasterServerComm msc;
101
[7737]102      /** master server address */
[7739]103      std::string msaddress;
[7737]104
[7161]105  }; // tolua_export
106
107} // tolua_export
108
[7630]109#endif // WANDISCOVERY_H
Note: See TracBrowser for help on using the repository browser.