| 1 |
michael |
1620 |
/* |
| 2 |
michael |
2865 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
michael |
1620 |
* |
| 4 |
michael |
2865 |
* Copyright (c) 1996-2009 by Andrew Church <achurch@achurch.org> |
| 5 |
michael |
9102 |
* Copyright (c) 2012-2020 ircd-hybrid development team |
| 6 |
michael |
1620 |
* |
| 7 |
|
|
* This program is free software; you can redistribute it and/or modify |
| 8 |
|
|
* it under the terms of the GNU General Public License as published by |
| 9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
|
|
* (at your option) any later version. |
| 11 |
|
|
* |
| 12 |
|
|
* This program is distributed in the hope that it will be useful, |
| 13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
|
* GNU General Public License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU General Public License |
| 18 |
|
|
* along with this program; if not, write to the Free Software |
| 19 |
michael |
4564 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
| 20 |
michael |
1620 |
* USA |
| 21 |
|
|
*/ |
| 22 |
|
|
|
| 23 |
|
|
/*! \file conf_db.h |
| 24 |
|
|
* \brief Includes file utilities for database handling |
| 25 |
michael |
1635 |
* \version $Id$ |
| 26 |
michael |
1620 |
*/ |
| 27 |
|
|
|
| 28 |
michael |
6358 |
#ifndef INCLUDED_conf_db_h |
| 29 |
|
|
#define INCLUDED_conf_db_h |
| 30 |
michael |
1620 |
|
| 31 |
michael |
9368 |
enum { DATABASE_UPDATE_TIMEOUT = 300 }; |
| 32 |
|
|
enum { KLINE_DB_VERSION = 1 }; |
| 33 |
|
|
|
| 34 |
michael |
1620 |
struct dbFILE |
| 35 |
|
|
{ |
| 36 |
michael |
2865 |
char mode; /**< 'r' for reading, 'w' for writing */ |
| 37 |
|
|
FILE *fp; /**< The file pointer itself */ |
| 38 |
michael |
1737 |
char filename[HYB_PATH_MAX + 1]; /**< Name of the database file */ |
| 39 |
|
|
char tempname[HYB_PATH_MAX + 1]; /**< Name of the temporary file (for writing) */ |
| 40 |
michael |
1620 |
}; |
| 41 |
|
|
|
| 42 |
michael |
8657 |
extern bool read_uint16(uint16_t *, struct dbFILE *); |
| 43 |
|
|
extern bool write_uint16(uint16_t, struct dbFILE *); |
| 44 |
|
|
extern bool read_uint32(uint32_t *, struct dbFILE *); |
| 45 |
|
|
extern bool write_uint32(uint32_t, struct dbFILE *); |
| 46 |
|
|
extern bool read_uint64(uint64_t *, struct dbFILE *); |
| 47 |
|
|
extern bool write_uint64(uint64_t, struct dbFILE *); |
| 48 |
|
|
extern bool read_string(char **, struct dbFILE *); |
| 49 |
|
|
extern bool write_string(const char *, struct dbFILE *); |
| 50 |
michael |
1620 |
|
| 51 |
michael |
6927 |
extern void load_kline_database(const char *); |
| 52 |
|
|
extern void save_kline_database(const char *); |
| 53 |
|
|
extern void load_dline_database(const char *); |
| 54 |
|
|
extern void save_dline_database(const char *); |
| 55 |
|
|
extern void load_xline_database(const char *); |
| 56 |
|
|
extern void save_xline_database(const char *); |
| 57 |
|
|
extern void load_resv_database(const char *); |
| 58 |
|
|
extern void save_resv_database(const char *); |
| 59 |
michael |
1625 |
extern void save_all_databases(void *); |
| 60 |
michael |
1620 |
#endif |