Orxonox  0.0.5 Codename: Arcturus
ServerList.h
Go to the documentation of this file.
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  * Sandro 'smerkli' Merkli
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 #ifndef _ServerList_
30 #define _ServerList_
31 
32 #include <list>
33 #include <string>
35 
36 /* methods necessary */
37 namespace orxonox
38 {
39  /* HELPER STRUCTURES */
41  {
42  /* server information (name, IP, etc) */
44 
45  /* peer pointer */
47  };
48 
50  {
51  /* list element found */
53 
54  /* successful search */
55  bool success;
56  };
57 
58 
59 
60 
61 
65  class ServerList
66  { public:
68  ServerList();
69 
71  ~ServerList();
72 
73 
74  /* BASIC MANIPULATION */
80  int addServer( packet::ServerInformation toadd,
81  ENetPeer *peer );
82 
87  bool delServerByName( std::string name );
88 
93  bool delServerByAddress( std::string address );
94 
95  bool setNameByAddress( std::string address, std::string name );
96 
97  bool setClientsByAddress( std::string address, int clientNumber );
98 
99  /* SEARCHING */
100  /* \param address The address of the server that is to be
101  * found
102  * \return A struct containing a result of the search and a boolean
103  * that is only true if the search was successful
104  *
105  * Find and return the list handle of a given address.
106  */
108  findServerByAddress( std::string address );
109 
110 
111  /* \param name The name of the server that is to be
112  * found
113  * \return The struct containing the list entry of the server
114  *
115  * Find and return the list handle of a given name.
116  */
118  findServerByName( std::string name );
119 
120 
121  /* SORTING */
123  void sortByName();
124 
126  void sortByPing();
127 
129  std::list<ServerListElem> serverlist;
130  private:
131  };
132 }
133 
134 #endif /*_ServerList_*/
std::list< ServerListElem > serverlist
the list of servers for internal storage
Definition: ServerList.h:129
ENetPeer * peer
Definition: ServerList.h:46
::std::string string
Definition: gtest-port.h:756
bool success
Definition: ServerList.h:55
ServerListElem result
Definition: ServerList.h:52
Definition: ServerInformation.h:43
packet::ServerInformation ServerInfo
Definition: ServerList.h:43
An ENet peer which data packets may be sent or received from.
Definition: enet.h:253
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Definition: ServerList.h:40
Definition: ServerList.h:49
This class is keeps a list of game servers and some info about them.
Definition: ServerList.h:65