| 1 |
/*
|
| 2 |
* Copyright (C) 2002,2003 Mihai RUSU (dizzy@roedu.net)
|
| 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 |
/* flags to tell if calling codes really want all accounts loading */
|
| 23 |
#define ST_NONE 0
|
| 24 |
#define ST_FORCE 1
|
| 25 |
|
| 26 |
#define t_storage_info void
|
| 27 |
|
| 28 |
typedef int (*t_read_attr_func)(const char *, const char *, void *);
|
| 29 |
typedef int (*t_read_accounts_func)(t_storage_info *, void*);
|
| 30 |
typedef int (*t_load_clans_func)(void*);
|
| 31 |
typedef int (*t_load_teams_func)(void*);
|
| 32 |
|
| 33 |
typedef struct {
|
| 34 |
int (*init)(const char *);
|
| 35 |
int (*close)(void);
|
| 36 |
unsigned (*read_maxuserid)(void);
|
| 37 |
t_storage_info * (*create_account)(char const * );
|
| 38 |
t_storage_info * (*get_defacct)(void);
|
| 39 |
int (*free_info)(t_storage_info *);
|
| 40 |
int (*read_attrs)(t_storage_info *, t_read_attr_func, void *);
|
| 41 |
int (*write_attrs)(t_storage_info *, void *);
|
| 42 |
void * (*read_attr)(t_storage_info *, const char *);
|
| 43 |
int (*read_accounts)(int,t_read_accounts_func, void *);
|
| 44 |
t_storage_info * (*read_account)(const char *,unsigned);
|
| 45 |
int (*cmp_info)(t_storage_info *, t_storage_info *);
|
| 46 |
const char * (*escape_key)(const char *);
|
| 47 |
int (*load_clans)(t_load_clans_func);
|
| 48 |
int (*write_clan)(void *);
|
| 49 |
int (*remove_clan)(int);
|
| 50 |
int (*remove_clanmember)(int);
|
| 51 |
int (*load_teams)(t_load_teams_func);
|
| 52 |
int (*write_team)(void *);
|
| 53 |
int (*remove_team)(unsigned int);
|
| 54 |
} t_storage;
|
| 55 |
|
| 56 |
#endif /* INCLUDED_STORAGE_TYPES */
|
| 57 |
|
| 58 |
#ifndef JUST_NEED_TYPES
|
| 59 |
#ifndef INCLUDED_STORAGE_PROTOS
|
| 60 |
#define INCLUDED_STORAGE_PROTOS
|
| 61 |
|
| 62 |
extern t_storage *storage;
|
| 63 |
|
| 64 |
extern int storage_init(const char *);
|
| 65 |
extern void storage_close(void);
|
| 66 |
|
| 67 |
#endif /* INCLUDED_STORAGE_PROTOS */
|
| 68 |
#endif /* JUST_NEED_TYPES */
|