Debian Codegraph @

src/bnetd/storage.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002,2003 Dizzy
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
19 #ifndef INCLUDED_STORAGE_TYPES
20 #define INCLUDED_STORAGE_TYPES
21
22 #include "common/elist.h"
23 #include "attr.h"
24
25 /* flags to tell if calling codes really want all accounts loading */
26 #define ST_NONE 0
27 #define ST_FORCE 1
28
29 namespace pvpgn
30 {
31
32 namespace bnetd
33 {
34
35 typedef const void t_storage_info;
36 typedef int(*t_read_attr_func)(const char *, const char *, void *);
37 typedef int(*t_read_accounts_func)(t_storage_info *, void*);
38 typedef int(*t_load_clans_func)(void*);
39 typedef int(*t_load_teams_func)(void*);
40
41 typedef struct {
42 int(*init)(const char *);
43 int(*close)(void);
44 unsigned(*read_maxuserid)(void);
45 t_storage_info * (*create_account)(char const *);
46 t_storage_info * (*get_defacct)(void);
47 int(*free_info)(t_storage_info *);
48 int(*read_attrs)(t_storage_info *, t_read_attr_func, void *, const char *);
49 int(*write_attrs)(t_storage_info *, const t_hlist *);
50 t_attr * (*read_attr)(t_storage_info *, const char *);
51 int(*read_accounts)(int, t_read_accounts_func, void *);
52 t_storage_info * (*read_account)(const char *, unsigned);
53 int(*cmp_info)(t_storage_info *, t_storage_info *);
54 const char * (*escape_key)(const char *);
55 int(*load_clans)(t_load_clans_func);
56 int(*write_clan)(void *);
57 int(*remove_clan)(int);
58 int(*remove_clanmember)(int);
59 int(*load_teams)(t_load_teams_func);
60 int(*write_team)(void *);
61 int(*remove_team)(unsigned int);
62 } t_storage;
63
64 }
65
66 }
67
68 #endif /* INCLUDED_STORAGE_TYPES */
69
70 #ifndef JUST_NEED_TYPES
71 #ifndef INCLUDED_STORAGE_PROTOS
72 #define INCLUDED_STORAGE_PROTOS
73
74 namespace pvpgn
75 {
76
77 namespace bnetd
78 {
79
80 extern t_storage *storage;
81
82 extern int storage_init(const char *);
83 extern void storage_close(void);
84
85 }
86
87 }
88
89 #endif /* INCLUDED_STORAGE_PROTOS */
90 #endif /* JUST_NEED_TYPES */