Crossfire Client, Branch  R11627
metaserver.h
Go to the documentation of this file.
00001 /* char *rcsid_common_metaserver_h =
00002  *   "$Id: metaserver.h 6927 2007-08-15 07:07:19Z mwedel $";
00003  */
00004 
00005 /*
00006     Crossfire client, a client program for the crossfire program.
00007 
00008     Copyright (C) 2005 Mark Wedel & Crossfire Development Team
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019 
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023 
00024     The author can be reached via e-mail to crossfire-devel@real-time.com
00025 */
00026 
00027 
00028 /* Arbitrary size.  At some point, we would need to cut this off simply
00029  * for display/selection reasons.
00030  */
00031 #define MAX_METASERVER 100
00032 
00033 /* Various constants we use in the structure */
00034 #define MS_SMALL_BUF    60
00035 #define MS_LARGE_BUF    512
00036 
00046 typedef struct Meta_Info {
00047     char    ip_addr[MS_SMALL_BUF];      /* MS1 */
00048     char    hostname[MS_LARGE_BUF];     /* MS1 & MS2 */
00049     int     port;                       /* MS2 - port server is on */
00050     char    html_comment[MS_LARGE_BUF]; /* MS2 */
00051     char    text_comment[MS_LARGE_BUF]; /* MS1 & MS2 - for MS1, presumed */
00052                                         /* all comments are text */
00053     char    archbase[MS_SMALL_BUF];     /* MS2 */
00054     char    mapbase[MS_SMALL_BUF];      /* MS2 */
00055     char    codebase[MS_SMALL_BUF];     /* MS2 */
00056     char    flags[MS_SMALL_BUF];        /* MS2 */
00057     int     num_players;                /* MS1 & MS2 */
00058     uint32  in_bytes;                   /* MS2 */
00059     uint32  out_bytes;                  /* MS2 */
00060     int     idle_time;                  /* MS1 - for MS2, calculated from */
00061                                         /* last_update value */
00062     int     uptime;                     /* MS2 */
00063     char    version[MS_SMALL_BUF];      /* MS1 & MS2 */
00064     int     sc_version;                 /* MS2 */
00065     int     cs_version;                 /* MS2 */
00066 } Meta_Info;
00067 
00068 extern Meta_Info *meta_servers;
00069 
00070 /* Before accessing the metaservers structure,
00071  * a lock against this is needed
00072  */
00073 extern pthread_mutex_t ms2_info_mutex;
00074 
00075 /* Needs to be here because gtk2 client needs to resort for example */
00076 static int meta_sort(Meta_Info *m1, Meta_Info *m2) { return strcasecmp(m1->hostname, m2->hostname); }
00077 
00078 extern int meta_numservers;
00079 
00080 extern int cached_servers_num;
00081 
00082 #define CACHED_SERVERS_MAX  10
00083 extern char* cached_servers_name[ CACHED_SERVERS_MAX ];
00084 extern char* cached_servers_ip[ CACHED_SERVERS_MAX ];
00085 extern const char* cached_server_file;