Crossfire Client, Branches  R11627
metaserver.h
Go to the documentation of this file.
1 /* char *rcsid_common_metaserver_h =
2  * "$Id: metaserver.h 6927 2007-08-15 07:07:19Z mwedel $";
3  */
4 
5 /*
6  Crossfire client, a client program for the crossfire program.
7 
8  Copyright (C) 2005 Mark Wedel & Crossfire Development Team
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 
24  The author can be reached via e-mail to crossfire-devel@real-time.com
25 */
26 
27 
28 /* Arbitrary size. At some point, we would need to cut this off simply
29  * for display/selection reasons.
30  */
31 #define MAX_METASERVER 100
32 
33 /* Various constants we use in the structure */
34 #define MS_SMALL_BUF 60
35 #define MS_LARGE_BUF 512
36 
46 typedef struct Meta_Info {
47  char ip_addr[MS_SMALL_BUF]; /* MS1 */
48  char hostname[MS_LARGE_BUF]; /* MS1 & MS2 */
49  int port; /* MS2 - port server is on */
50  char html_comment[MS_LARGE_BUF]; /* MS2 */
51  char text_comment[MS_LARGE_BUF]; /* MS1 & MS2 - for MS1, presumed */
52  /* all comments are text */
53  char archbase[MS_SMALL_BUF]; /* MS2 */
54  char mapbase[MS_SMALL_BUF]; /* MS2 */
55  char codebase[MS_SMALL_BUF]; /* MS2 */
56  char flags[MS_SMALL_BUF]; /* MS2 */
57  int num_players; /* MS1 & MS2 */
58  uint32 in_bytes; /* MS2 */
59  uint32 out_bytes; /* MS2 */
60  int idle_time; /* MS1 - for MS2, calculated from */
61  /* last_update value */
62  int uptime; /* MS2 */
63  char version[MS_SMALL_BUF]; /* MS1 & MS2 */
64  int sc_version; /* MS2 */
65  int cs_version; /* MS2 */
66 } Meta_Info;
67 
68 extern Meta_Info *meta_servers;
69 
70 /* Before accessing the metaservers structure,
71  * a lock against this is needed
72  */
73 extern pthread_mutex_t ms2_info_mutex;
74 
75 /* Needs to be here because gtk2 client needs to resort for example */
76 static int meta_sort(Meta_Info *m1, Meta_Info *m2) { return strcasecmp(m1->hostname, m2->hostname); }
77 
78 extern int meta_numservers;
79 
80 extern int cached_servers_num;
81 
82 #define CACHED_SERVERS_MAX 10
85 extern const char* cached_server_file;
#define MS_LARGE_BUF
Definition: metaserver.h:35
int sc_version
Definition: metaserver.h:64
const char * cached_server_file
Definition: metaserver.c:107
int meta_numservers
Definition: metaserver.c:57
int port
Definition: metaserver.h:49
int cs_version
Definition: metaserver.h:65
int uptime
Definition: metaserver.h:62
char codebase[MS_SMALL_BUF]
Definition: metaserver.h:55
char hostname[MS_LARGE_BUF]
Definition: metaserver.h:48
#define CACHED_SERVERS_MAX
Definition: metaserver.h:82
char text_comment[MS_LARGE_BUF]
Definition: metaserver.h:51
int cached_servers_num
Definition: metaserver.c:103
char * cached_servers_ip[CACHED_SERVERS_MAX]
Definition: metaserver.c:105
Meta_Info * meta_servers
Definition: metaserver.c:55
char archbase[MS_SMALL_BUF]
Definition: metaserver.h:53
char * cached_servers_name[CACHED_SERVERS_MAX]
Definition: metaserver.c:104
struct Meta_Info Meta_Info
static int meta_sort(Meta_Info *m1, Meta_Info *m2)
Definition: metaserver.h:76
char flags[MS_SMALL_BUF]
Definition: metaserver.h:56
char ip_addr[MS_SMALL_BUF]
Definition: metaserver.h:47
char html_comment[MS_LARGE_BUF]
Definition: metaserver.h:50
int num_players
Definition: metaserver.h:57
uint32 out_bytes
Definition: metaserver.h:59
unsigned int uint32
Definition: client-types.h:77
uint32 in_bytes
Definition: metaserver.h:58
char mapbase[MS_SMALL_BUF]
Definition: metaserver.h:54
#define MS_SMALL_BUF
Definition: metaserver.h:34
int idle_time
Definition: metaserver.h:60
char version[MS_SMALL_BUF]
Definition: metaserver.h:63
pthread_mutex_t ms2_info_mutex
Definition: metaserver.c:171