Main Page | Modules | Data Structures | File List | Data Fields | Globals

gamestat.h

Go to the documentation of this file.
00001 /*
00002    Copyright (c) 2004 Cory Nelson
00003 
00004    Permission is hereby granted, free of charge, to any person obtaining
00005    a copy of this software and associated documentation files (the
00006    "Software"), to deal in the Software without restriction, including
00007    without limitation the rights to use, copy, modify, merge, publish,
00008    distribute, sublicense, and/or sell copies of the Software, and to
00009    permit persons to whom the Software is furnished to do so, subject to
00010    the following conditions:
00011 
00012    The above copyright notice and this permission notice shall be included
00013    in all copies or substantial portions of the Software.
00014 
00015    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00016    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00019    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00020    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00021    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022 */
00023 
00028 #ifndef __GAMESTAT_H__
00029 #define __GAMESTAT_H__
00030 
00032 enum GS_BOOLEAN {
00033    GS_FALSE=0,             
00034    GS_TRUE                 
00035 };
00036 
00037 #ifndef __cplusplus
00038 
00039 typedef struct GS_PLAYERINFO GS_PLAYERINFO;
00041 typedef struct GS_PROPERTY GS_PROPERTY;
00043 typedef struct GS_SERVERINFO GS_SERVERINFO;
00045 typedef struct GS_SERVER GS_SERVER;
00046 #endif
00047 
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051 
00054 
00056 enum GS_INITFLAGS {
00057    GS_INIT_NONE=0,         
00058    GS_INIT_WINSOCK=1       
00059 };
00060 
00062 enum GS_CLEANUPFLAGS {
00063    GS_CLEANUP_NONE=0,      
00064    GS_CLEANUP_WINSOCK=1    
00065 };
00066 
00068 
00073 unsigned char GSInit(unsigned char flags);
00074 
00076 
00081 unsigned char GSCleanup(unsigned char flags);
00082 
00084 
00088 unsigned short GSVersion(void);
00089 
00091 
00094 
00096 enum GS_OPTION {
00097    GS_OPTION_TIMEOUT=0,    
00098    GS_OPTION_COLORFILTER   
00099 };
00100 
00102 
00107 void GSSetOptBool(unsigned short option, unsigned char value);
00108 
00110 
00115 void GSSetOptInt(unsigned short option, int value);
00116 
00118 
00123 unsigned char GSGetOptBool(unsigned short option);
00124 
00126 
00131 int GSGetOptInt(unsigned short option);
00132 
00134 
00137 
00139 enum GS_TYPE {
00140    GS_TYPE_QUAKEWORLD=0,   
00141    GS_TYPE_QUAKE2,         
00142    GS_TYPE_QUAKE3,         
00143    GS_TYPE_DOOM3,          
00144    GS_TYPE_HALFLIFE,       
00145    GS_TYPE_UNREAL2,        
00146    GS_TYPE_GAMESPY2,       
00147    GS_TYPE_BFV,            
00148    GS_TYPE_PAINKILLER,     
00149    GS_TYPE_UT2003,         
00150    GS_TYPE_UT2004,         
00151    GS_TYPE_UNREAL2XMP,     
00152    GS_TYPE_SOF2,           
00153    GS_TYPE_RTCW,           
00154    GS_TYPE_WOLFET,         
00155    GS_TYPE_CS,             
00156    GS_TYPE_CSCZ,           
00157    GS_TYPE_CALLOFDUTY,     
00158    GS_TYPE_SWJKJA,         
00159    GS_TYPE_MOHAA,          
00160    GS_TYPE_MOHBT,          
00161    GS_TYPE_MOHSH,          
00162    GS_TYPE_DOD,            
00163    GS_TYPE_SOF,            
00164    GS_TYPE_GAMESPY,        
00165    GS_TYPE_UT,             
00166    GS_TYPE_SWJK2,          
00167    GS_TYPE_DESCENT3,       
00168    GS_TYPE_AMERICASARMY,   
00169    GS_TYPE_BF1942,         
00170    GS_TYPE_HALO,           
00171    GS_TYPE_POSTAL2,        
00172    GS_TYPE_STVEF,          
00173    GS_TYPE_STVEF2,         
00174    GS_TYPE_DEUSEX,         
00175    GS_TYPE_IL2S,           
00176    GS_TYPE_IL2SFB,         
00177    GS_TYPE_SOURCE,         
00178    GS_TYPE_HALFLIFE2,      
00179    GS_TYPE_CSS,            
00180    GS_TYPE_ASE,            
00181    GS_TYPE_MTA,            
00182    GS_TYPE_MTAVC,          
00183    GS_TYPE_HERETIC2,       
00184    GS_TYPE_IGI2,           
00185    GS_TYPE_GORE,           
00186    GS_TYPE_VIETCONG,       
00187    GS_TYPE_NWN,            
00188    GS_TYPE_SERIOUSSAM,     
00189    GS_TYPE_SERIOUSSAM2,    
00190    GS_TYPE_AOE2,           
00191    GS_TYPE_AOE2TC,         
00192    GS_TYPE_AVP2,           
00193    GS_TYPE_CHASER,         
00194    GS_TYPE_CHROME,         
00195    GS_TYPE_NOLF,           
00196    GS_TYPE_NOLF2,          
00197    GS_TYPE_SHOGO,          
00198    GS_TYPE_SOLDAT,         
00199    GS_TYPE_CODENAMEEAGLE,  
00200    GS_TYPE_DEVASTATION,    
00201    GS_TYPE_GIANTSCK,       
00202    GS_TYPE_GLOBALOPS,      
00203    GS_TYPE_NERFAB,         
00204    GS_TYPE_PURGEJIHAD,     
00205    GS_TYPE_RSC,            
00206    GS_TYPE_RALLYMASTERS,   
00207    GS_TYPE_CCRENEGADE,     
00208    GS_TYPE_RUNE,           
00209    GS_TYPE_SIN,            
00210    GS_TYPE_TACTICALOPS,    
00211    GS_TYPE_UCOMBAT,        
00212    GS_TYPE_UNREAL,         
00213    GS_TYPE_WHEELOFTIME,    
00214    GS_TYPE_XPANDRALLY,     
00215    GS_TYPE_DDPT,           
00216    GS_TYPE_DTR2,           
00217    GS_TYPE_DRAKAN,         
00218    GS_TYPE_F12002,         
00219    GS_TYPE_GUNMAN,         
00220    GS_TYPE_IRONSTORM,      
00221    GS_TYPE_JBNF,           
00222    GS_TYPE_KINGPIN,        
00223    GS_TYPE_NFSHP2,         
00224    GS_TYPE_OPFLASHPOINT,   
00225    GS_TYPE_REDLINE,        
00226    GS_TYPE_TERMINUS,       
00227    GS_TYPE_TUROK2,         
00228    GS_TYPE_TRON20,         
00229    GS_TYPE_TRIBES,         
00230    GS_TYPE_TRIBES2,        
00231    GS_TYPE_THPS3,          
00232    GS_TYPE_THPS4,          
00233    GS_TYPE_V8SCC,          
00234    GS_TYPE_TEAMFACTOR,     
00235    GS_TYPE_RAINBOWSIX,     
00236    GS_TYPE_RAINBOWSIXRS,   
00237    GS_TYPE_NITRO,          
00238    GS_TYPE_FARCRY,         
00239    GS_TYPE_RISEOFNATIONS,  
00240    GS_TYPE_CONTRACTJACK,   
00241    GS_TYPE_HOMEWORLD2,     
00242    GS_TYPE_DAIKATANA,      
00243    GS_TYPE_SAVAGE,         
00244    GS_TYPE_GHOSTRECON,     
00245    GS_TYPE_BREED,          
00246    GS_TYPE_MOHPA,          
00247    GS_TYPE_OPFRESISTANCE,  
00248    GS_TYPE_SOAF,           
00249    GS_TYPE_STBC,           
00250    GS_TYPE_CODUO,          
00251    GS_TYPE_SWBF,           
00252    GS_TYPE_TRIBES3         
00253 };
00254 
00256 struct GS_PLAYERINFO {
00257    char *name;             
00258    int score;              
00259    int ping;               
00260    int time;               
00261 
00262    GS_PLAYERINFO *next;    
00263 };
00264 
00266 struct GS_PROPERTY {
00267    char *key;              
00268    char *value;            
00269 
00270    GS_PROPERTY *next;      
00271 };
00272 
00274 struct GS_SERVERINFO {
00275    char *host;                
00276    char *mod;                 
00277    char *map;                 
00278 
00279    int numplayers;            
00280    int maxplayers;            
00281    int timelimit;             
00282    int scorelimit;            
00283 
00284    GS_PROPERTY *properties;   
00285    GS_PLAYERINFO *players;    
00286 
00287    // added in 1.1
00288    int passworded;            
00289    int ping;                  
00290 };
00291 
00293 
00301 GS_SERVERINFO *GSQueryServer(unsigned short type, const char *host, unsigned short port);
00302 
00304 
00307 void GSFreeServerInfo(GS_SERVERINFO *info);
00308 
00310 
00319 char *GSStripColor(unsigned short type, char *out, const char *in);
00320 
00322 
00325 
00327 enum GS_MASTER {
00328    GS_MASTER_DOOM3=0,      
00329    GS_MASTER_QUAKE3,       
00330    GS_MASTER_QUAKE2,       
00331    GS_MASTER_RTCW,         
00332    GS_MASTER_WOLFET,       
00333    GS_MASTER_SWJK2,        
00334    GS_MASTER_HALFLIFE,     
00335    GS_MASTER_CS,           
00336    GS_MASTER_CSCZ,         
00337    GS_MASTER_CSS,          
00338    GS_MASTER_DOD,          
00339    GS_MASTER_SOF2,         
00340    GS_MASTER_SWJKJA,       
00341    GS_MASTER_STVEF,        
00342    GS_MASTER_STVEF2        
00343 };
00344 
00346 enum GS_MASTER_FILTER {
00347    GS_MASTER_FILTER_NONE=0,         
00348    GS_MASTER_FILTER_FULL=1,         
00349    GS_MASTER_FILTER_NOTFULL=2,      
00350    GS_MASTER_FILTER_EMPTY=4,        
00351    GS_MASTER_FILTER_NOTEMPTY=8,     
00352    GS_MASTER_FILTER_PASSWORD=16,    
00353    GS_MASTER_FILTER_NOPASSWORD=32   
00354 };
00355 
00357 struct GS_SERVER {
00358    char *host;             
00359    unsigned short port;    
00360 
00361    GS_SERVER *next;        
00362 };
00363 
00365 
00374 GS_SERVER *GSQueryMaster(unsigned short type, const char *host, unsigned short port, unsigned short filter);
00375 
00377 
00381 void GSFreeServers(GS_SERVER *servers);
00382 
00384 
00387 
00389 enum GS_ERROR {
00390    GS_OK=0,                      
00391    GS_ERROR_WINSOCK,             
00392    GS_ERROR_UNKNOWNTYPE,         
00393    GS_ERROR_UNKNOWNHOST,         
00394    GS_ERROR_CONNECT,             
00395    GS_ERROR_TIMEOUT,             
00396    GS_ERROR_CORRUPT,             
00397    GS_ERROR_UNKNOWNPORT,         
00398    GS_ERROR_NOTIMPLEMENTED,      
00399    GS_ERROR_INVALIDPARAMETER     
00400 };
00401 
00403 
00407 unsigned short GSLastError(void);
00408 
00410 
00414 const char *GSErrorString(unsigned short err);
00415 
00417 
00421 const char *GSLastErrorString(void);
00422 
00424 
00425 #ifdef __cplusplus
00426 }
00427 #endif
00428 
00429 #endif

Generated on Wed Oct 6 01:04:06 2004 for GameStat by  doxygen 1.3.9