/usr/include/atheme/database_backend.h is in atheme-services 7.2.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | /*
* Copyright (c) 2010 William Pitcock <nenolod@atheme.org>
* Rights to this code are as documented in doc/LICENSE.
*
* Platform-agnostic database backend layer.
*/
#ifndef DATABASE_BACKEND_H
#define DATABASE_BACKEND_H
#include "common.h"
E bool strict_mode;
struct database_handle_;
typedef struct database_handle_ database_handle_t;
typedef struct {
const char *name;
/* Reading stuff. */
bool (*read_next_row)(database_handle_t *hdl);
const char *(*read_word)(database_handle_t *hdl);
const char *(*read_str)(database_handle_t *hdl);
bool (*read_int)(database_handle_t *hdl, int *res);
bool (*read_uint)(database_handle_t *hdl, unsigned int *res);
bool (*read_time)(database_handle_t *hdl, time_t *res);
/* Writing stuff. */
bool (*start_row)(database_handle_t *hdl, const char *type);
bool (*write_word)(database_handle_t *hdl, const char *word);
bool (*write_str)(database_handle_t *hdl, const char *str);
bool (*write_int)(database_handle_t *hdl, int num);
bool (*write_uint)(database_handle_t *hdl, unsigned int num);
bool (*write_time)(database_handle_t *hdl, time_t time);
bool (*commit_row)(database_handle_t *hdl);
} database_vtable_t;
typedef enum {
DB_READ,
DB_WRITE
} database_transaction_t;
struct database_handle_ {
void *priv;
database_vtable_t *vt;
database_transaction_t txn;
char *file;
unsigned int line;
unsigned int token;
};
typedef struct {
database_handle_t *(*db_open)(const char *filename, database_transaction_t txn);
void (*db_close)(database_handle_t *db);
void (*db_parse)(database_handle_t *db);
} database_module_t;
E database_handle_t *db_open(const char *filename, database_transaction_t txn);
E void db_close(database_handle_t *db);
E void db_parse(database_handle_t *db);
E bool db_read_next_row(database_handle_t *db);
E const char *db_read_word(database_handle_t *db);
E const char *db_read_str(database_handle_t *db);
E bool db_read_int(database_handle_t *db, int *r);
E bool db_read_uint(database_handle_t *db, unsigned int *r);
E bool db_read_time(database_handle_t *db, time_t *t);
E const char *db_sread_word(database_handle_t *db);
E const char *db_sread_str(database_handle_t *db);
E int db_sread_int(database_handle_t *db);
E unsigned int db_sread_uint(database_handle_t *db);
E time_t db_sread_time(database_handle_t *db);
E bool db_start_row(database_handle_t *db, const char *type);
E bool db_write_word(database_handle_t *db, const char *word);
E bool db_write_str(database_handle_t *db, const char *str);
E bool db_write_int(database_handle_t *db, int num);
E bool db_write_uint(database_handle_t *db, unsigned int num);
E bool db_write_time(database_handle_t *db, time_t time);
E bool db_write_format(database_handle_t *db, const char *str, ...);
E bool db_commit_row(database_handle_t *db);
typedef void (*database_handler_f)(database_handle_t *db, const char *type);
E void db_register_type_handler(const char *type, database_handler_f fun);
E void db_unregister_type_handler(const char *type);
E void db_process(database_handle_t *db, const char *type);
E void db_init(void);
E database_module_t *db_mod;
#endif
|