Mercurial > sci
comparison scid/db.h @ 44:576f4b1ec79f
scid: implement API authentication
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 11 Aug 2022 21:24:07 +0200 |
parents | 00b9af607524 |
children | 71cd8447e3a4 |
comparison
equal
deleted
inserted
replaced
43:6854efe15210 | 44:576f4b1ec79f |
---|---|
37 #include <stdint.h> | 37 #include <stdint.h> |
38 | 38 |
39 #include <jansson.h> | 39 #include <jansson.h> |
40 | 40 |
41 /** | 41 /** |
42 * Maximum property value. | |
43 */ | |
44 #define DB_PROP_VALUE_MAX 256 | |
45 | |
46 /** | |
42 * Open database specified by path. | 47 * Open database specified by path. |
43 * | 48 * |
44 * \pre path != NULL | 49 * \pre path != NULL |
45 * \param path path to the database | 50 * \param path path to the database |
46 */ | 51 */ |
47 int | 52 int |
48 db_open(const char *path); | 53 db_open(const char *path); |
54 | |
55 /** | |
56 * Reinitialize the API key in database and return it. | |
57 * | |
58 * \pre out != NULL | |
59 * \param out the destination key | |
60 * \param outsz the maximum size to write | |
61 * \return 0 on success or -1 on error | |
62 */ | |
63 int | |
64 db_key_init(char *out, size_t outsz); | |
65 | |
66 /** | |
67 * Fetch the key from the database. | |
68 * | |
69 * \pre out != NULL | |
70 * \param out the destination key | |
71 * \param outsz the maximum size to write | |
72 * \return 0 if not found, 1 if found or -1 on error | |
73 */ | |
74 int | |
75 db_key_get(char *out, size_t outsz); | |
49 | 76 |
50 /** | 77 /** |
51 * Add a new job. | 78 * Add a new job. |
52 * | 79 * |
53 * \pre job != NULL | 80 * \pre job != NULL |