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: |
---|
23 | * Fabian 'x3n' Landau (original) |
---|
24 | * Co-authors: |
---|
25 | * Sandro 'smerkli' Merkli (copied and adapted to WAN) |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef WANDISCOVERY_H |
---|
30 | #define WANDISCOVERY_H |
---|
31 | |
---|
32 | #include "NetworkPrereqs.h" |
---|
33 | #include "packet/ServerInformation.h" |
---|
34 | #include "util/Singleton.h" |
---|
35 | #include "MasterServerComm.h" |
---|
36 | #include "MasterServerProtocol.h" |
---|
37 | |
---|
38 | #include <vector> |
---|
39 | |
---|
40 | |
---|
41 | // tolua_begin |
---|
42 | namespace orxonox |
---|
43 | { |
---|
44 | |
---|
45 | class _NetworkExport WANDiscovery |
---|
46 | // tolua_end |
---|
47 | : public Singleton<WANDiscovery> |
---|
48 | { // tolua_export |
---|
49 | friend class Singleton<WANDiscovery>; |
---|
50 | public: |
---|
51 | /** constructor */ |
---|
52 | WANDiscovery(); |
---|
53 | |
---|
54 | /** destructor */ |
---|
55 | ~WANDiscovery(); |
---|
56 | |
---|
57 | /** ask server for server list */ |
---|
58 | void discover(); // tolua_export |
---|
59 | |
---|
60 | /** \param index Index to get the name of |
---|
61 | * \return The name of the server |
---|
62 | * |
---|
63 | * Get the name of the server at index index. |
---|
64 | */ |
---|
65 | std::string getServerListItemName( unsigned int index ); // tolua_export |
---|
66 | |
---|
67 | /** \param index Index to get the IP of |
---|
68 | * \return The IP of the server |
---|
69 | * |
---|
70 | * Get the IP of the server at index index. |
---|
71 | */ |
---|
72 | std::string getServerListItemIP( unsigned int index ); // tolua_export |
---|
73 | |
---|
74 | /** \return an instance of WANDiscovery |
---|
75 | * |
---|
76 | * Create and return an instance of WANDiscovery. |
---|
77 | */ |
---|
78 | static WANDiscovery& getInstance() { return Singleton<WANDiscovery>::getInstance(); } // tolua_export |
---|
79 | |
---|
80 | /** game server list */ |
---|
81 | std::vector<packet::ServerInformation> servers_; |
---|
82 | |
---|
83 | private: |
---|
84 | /** Singleton pointer */ |
---|
85 | static WANDiscovery* singletonPtr_s; |
---|
86 | |
---|
87 | /** Master server communications object */ |
---|
88 | MasterServerComm msc; |
---|
89 | |
---|
90 | }; // tolua_export |
---|
91 | |
---|
92 | } // tolua_export |
---|
93 | |
---|
94 | #endif // WANDISCOVERY_H |
---|