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
|
#ifndef HYBBX_STORAGE_PRIVATE_H
#define HYBBX_STORAGE_PRIVATE_H
#include "hybbx/auth.h"
#include "hybbx/storage.h"
#include <stddef.h>
struct hybbx_storage {
hybbx_storage_backend_kind_t backend;
char *path;
char guest_prefix[HYBBX_AUTH_GUEST_PREFIX_MAX];
hybbx_storage_sql_config_t sql_cfg;
void *backend_data;
};
hybbx_result_t hybbx_storage_flatfile_open(hybbx_storage_t *storage);
void hybbx_storage_flatfile_close(hybbx_storage_t *storage);
hybbx_result_t hybbx_storage_flatfile_session_begin(hybbx_storage_t *storage,
const hybbx_user_record_t *user,
const char *transport,
hybbx_session_record_t *out);
hybbx_result_t hybbx_storage_flatfile_session_end(hybbx_storage_t *storage,
uint64_t session_id);
hybbx_result_t hybbx_storage_flatfile_find_user(hybbx_storage_t *storage,
const char *username,
hybbx_user_record_t *out);
hybbx_result_t hybbx_storage_flatfile_resolve_user(hybbx_storage_t *storage,
const char *name,
hybbx_user_record_t *out);
hybbx_result_t hybbx_storage_flatfile_count_level(hybbx_storage_t *storage,
hybbx_user_level_t level,
size_t *count);
hybbx_result_t hybbx_storage_flatfile_foreach_user(
hybbx_storage_t *storage,
hybbx_storage_user_fn fn,
void *ctx);
hybbx_result_t hybbx_storage_flatfile_register_user(hybbx_storage_t *storage,
const hybbx_user_registration_t *reg,
hybbx_user_record_t *out);
hybbx_result_t hybbx_storage_flatfile_update_user(hybbx_storage_t *storage,
const hybbx_user_record_t *user);
hybbx_result_t hybbx_storage_flatfile_delete_user(hybbx_storage_t *storage,
uint64_t user_id);
hybbx_result_t hybbx_storage_sql_open(hybbx_storage_t *storage);
void hybbx_storage_sql_close(hybbx_storage_t *storage);
hybbx_result_t hybbx_storage_sql_register_user(hybbx_storage_t *storage,
const hybbx_user_registration_t *reg,
hybbx_user_record_t *out);
hybbx_result_t hybbx_storage_sql_find_user(hybbx_storage_t *storage,
const char *username,
hybbx_user_record_t *out);
hybbx_result_t hybbx_storage_sql_resolve_user(hybbx_storage_t *storage,
const char *name,
hybbx_user_record_t *out);
hybbx_result_t hybbx_storage_sql_count_level(hybbx_storage_t *storage,
hybbx_user_level_t level,
size_t *count);
hybbx_result_t hybbx_storage_sql_foreach_user(hybbx_storage_t *storage,
hybbx_storage_user_fn fn,
void *ctx);
hybbx_result_t hybbx_storage_sql_update_user(hybbx_storage_t *storage,
const hybbx_user_record_t *user);
hybbx_result_t hybbx_storage_sql_delete_user(hybbx_storage_t *storage,
uint64_t user_id);
hybbx_result_t hybbx_storage_sql_session_begin(hybbx_storage_t *storage,
const hybbx_user_record_t *user,
const char *transport,
hybbx_session_record_t *out);
hybbx_result_t hybbx_storage_sql_session_end(hybbx_storage_t *storage,
uint64_t session_id);
void hybbx_storage_sql_backup_files(const hybbx_storage_t *storage);
void hybbx_storage_sql_backup_tick(hybbx_storage_t *storage);
#ifdef HYBBX_HAVE_SQLITE
struct sqlite3;
struct sqlite3 *hybbx_storage_sql_mail_db(hybbx_storage_t *storage);
#endif
#endif /* HYBBX_STORAGE_PRIVATE_H */
|