Check-in Lasker-2.2.3 tar ball from samba.org
[capablanca.git] / lasker-2.2.3 / src / globals.h
1 /* 
2    Copyright 2002 Andrew Tridgell <tridge@samba.org>
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8    
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13    
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   
17 */
18
19 /*
20    all global variiables in chessd have been moved here so that they can
21    be maintained over a code reload. As long as the code reload does not change the
22    shape or meaning of any of the following globals then the reload should work
23 */
24
25
26 /* the EXTERN macro is used to allow ficsmain.c to declare real variables while
27    other modules declare them as extern */
28 #ifndef EXTERN
29 #define EXTERN extern
30 #endif
31
32 /* from network.c */
33 GENSTRUCT struct net_globals {
34         int sockfd; /* main listening socket */
35         int numConnections; /* number of active connections */
36         int no_file;   /* number of connections allocated */
37         struct connection_t **con; _LEN(no_file)
38 };
39 EXTERN struct net_globals net_globals;
40
41 /* from gamedb.c */
42
43 GENSTRUCT struct game_globals {
44         int g_num;
45         struct game *garray; _LEN(g_num)
46 };
47 EXTERN struct game_globals game_globals;
48
49 /* from playerdb.c */
50 GENSTRUCT struct player_globals {
51         int p_num;
52         unsigned parray_size;
53         struct player *parray; _LEN(parray_size)
54 };
55 EXTERN struct player_globals player_globals;
56
57 /* from command.c */
58 GENSTRUCT struct command_globals {
59         time_t startuptime;
60         int player_high;
61         int game_high;
62         int commanding_player;
63 };
64 EXTERN struct command_globals command_globals;
65
66 /* from gics.c */
67 GENSTRUCT struct gics_globals {
68         struct userstat_type userstat;
69 };
70 EXTERN struct gics_globals gics_globals;
71
72 /* from seekproc.c */
73 GENSTRUCT struct seek_globals {
74         int quota_time;
75         struct pending *pendlist;
76         unsigned max_ads;
77         struct pending *ads; _LEN(max_ads)
78 };
79 EXTERN struct seek_globals seek_globals;
80
81 /* from timeseal.c */
82 GENSTRUCT struct timeseal_globals {
83         int decoder_conn;
84 };
85 EXTERN struct timeseal_globals timeseal_globals;
86
87 /* a structure containing all globals, to make it easy to save
88    globals for a reload
89 */
90 GENSTRUCT struct all_globals {
91         struct net_globals *net_globals;
92         struct game_globals *game_globals;
93         struct player_globals *player_globals;
94         struct command_globals *command_globals;
95         struct gics_globals *gics_globals;
96         struct seek_globals *seek_globals;
97         struct timeseal_globals *timeseal_globals;
98 };