Debian Codegraph @

src/bnetd/realm.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2000 Ross Combs ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #ifndef INCLUDED_REALM_TYPES
19 #define INCLUDED_REALM_TYPES
20
21 #ifdef JUST_NEED_TYPES
22 # include "connection.h"
23 # include "common/rcm.h"
24 #else
25 #define JUST_NEED_TYPES
26 # include "connection.h"
27 # include "common/rcm.h"
28 #undef JUST_NEED_TYPES
29 #endif
30
31 namespace pvpgn
32 {
33
34 namespace bnetd
35 {
36
37 struct connection;
38
39 typedef struct realm
40 #ifdef REALM_INTERNAL_ACCESS
41 {
42 char const * name;
43 char const * description;
44 unsigned int sessionnum;
45 unsigned int active;
46 unsigned int ip;
47 unsigned short port;
48 unsigned int player_number;
49 unsigned int game_number;
50 int tcp_sock;
51 struct connection * conn;
52 t_rcm rcm;
53 }
54 #endif
55 t_realm;
56
57 }
58
59 }
60
61 #endif
62
63
64 /*****/
65 #ifndef JUST_NEED_TYPES
66 #ifndef INCLUDED_REALM_PROTOS
67 #define INCLUDED_REALM_PROTOS
68
69 #define JUST_NEED_TYPES
70 # include "common/list.h"
71 # include "connection.h"
72 # include "common/rcm.h"
73 #undef JUST_NEED_TYPES
74
75 namespace pvpgn
76 {
77
78 namespace bnetd
79 {
80
81 extern char const * realm_get_name(t_realm const * realm);
82 extern char const * realm_get_description(t_realm const * realm);
83 extern unsigned short realm_get_port(t_realm const * realm);
84 extern unsigned int realm_get_ip(t_realm const * realm);
85 extern int realm_set_name(t_realm * realm, char const * name);
86 extern unsigned int realm_get_active(t_realm const * realm);
87 extern unsigned int realm_get_player_number(t_realm const * realm);
88 extern int realm_add_player_number(t_realm * realm, int number);
89 extern unsigned int realm_get_game_number(t_realm const * realm);
90 extern int realm_add_game_number(t_realm * realm, int number);
91 extern int realm_set_active(t_realm * realm, unsigned int active);
92 extern int realm_active(t_realm * realm, struct connection * c);
93 extern int realm_deactive(t_realm * realm);
94
95 extern int realmlist_create(char const * filename);
96 extern int realmlist_destroy(void);
97 extern int realmlist_reload(char const * filename);
98 extern t_realm * realmlist_find_realm(char const * realmname);
99 extern t_realm * realmlist_find_realm_by_ip(unsigned long ip); /* ??? */
100 extern t_list * realmlist(void);
101
102 extern struct connection * realm_get_conn(t_realm * realm);
103
104 extern t_realm * realm_get(t_realm * realm, t_rcm_regref * regref);
105 extern void realm_put(t_realm * realm, t_rcm_regref * regref);
106
107 }
108
109 }
110
111 #endif
112 #endif