Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/masterserver/src/libraries/network/WANDiscovery.h @ 7633

Last change on this file since 7633 was 7631, checked in by smerkli, 14 years ago

added comments, lua function (to be tested) and various implementation bits

File size: 2.7 KB
RevLine 
[7161]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
[7630]23 *      Fabian 'x3n' Landau (original)
[7161]24 *   Co-authors:
[7630]25 *      Sandro 'smerkli' Merkli (copied and adapted to WAN)
[7161]26 *
27 */
28
[7630]29#ifndef WANDISCOVERY_H
30#define WANDISCOVERY_H
[7161]31
32#include "NetworkPrereqs.h"
33#include "packet/ServerInformation.h"
34#include "util/Singleton.h"
[7631]35#include "MasterServerComm.h"
[7161]36
37#include <vector>
38
[7631]39/* master server address (to be moved elsewhere later) */
40#define MS_ADDRESS "localhost"
41
42/* protocol (to be moved elsewhere later) */
43#define MSPROTO_CLIENT "CL "
44#define MSPROTO_REQ_LIST "REQ:LIST"
45
[7161]46// tolua_begin
47namespace orxonox
48{
49
[7630]50  class _NetworkExport WANDiscovery
[7161]51// tolua_end
[7630]52    : public Singleton<WANDiscovery>
[7161]53  { // tolua_export
[7630]54    friend class Singleton<WANDiscovery>;
[7161]55    public:
[7631]56      /** constructor */
[7630]57      WANDiscovery();
[7631]58
59      /** destructor */
[7630]60      ~WANDiscovery();
[7631]61
62      /** ask server for server list  */
[7161]63      void discover(); // tolua_export
[7631]64
65      /** \param index Index to get the name of
66       * \return The name of the server
67       *
68       * Get the name of the server at index index.
69       */
[7161]70      std::string getServerListItemName( unsigned int index ); // tolua_export
[7631]71
72      /** \param index Index to get the IP of
73       * \return The IP of the server
74       *
75       * Get the IP of the server at index index.
76       */
[7161]77      std::string getServerListItemIP( unsigned int index ); // tolua_export
[7631]78
79      /** \return an instance of WANDiscovery
80       *
81       * Create and return an instance of WANDiscovery.
82       */
83      static WANDiscovery& getInstance() { return Singleton<WANDiscovery>::getInstance(); } // tolua_export
[7161]84     
85    private:
[7631]86      /** Singleton pointer */
[7630]87      static WANDiscovery* singletonPtr_s;
[7631]88
89      /** Master server communications object */
90      MasterServerComm msc;
91
92      /** game server list */
[7161]93      std::vector<packet::ServerInformation> servers_;
[7631]94
[7161]95  }; // tolua_export
96
97} // tolua_export
98
[7630]99#endif // WANDISCOVERY_H
Note: See TracBrowser for help on using the repository browser.