aboutsummaryrefslogtreecommitdiff
path: root/common/mysql.h
blob: ac9a360e0fbc0dd91b1d2f842fe9b1175a6fe3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef COMMON_MYSQL_H_
#define COMMON_MYSQL_H_

struct db_host_info {
    char * privkeytxt;
    char * address;
    char * username;
    char * hostkeyhash;
};

char db_init(void);
void db_clean(void);
char * // returns NULL if no user found, this char * is to be freed from the calling code
db_get_username_from_pubkey(ssh_key pubkey);
struct db_host_info * // returns NULL if no key found, this char * is to be freed from the calling code
db_get_host_info(const char * hostname);
void db_set_host_publickey_hash(const char * hostname, const char * hash);
unsigned long long // returns 0 on error, or the session_id
db_init_session_and_get_id(const char * hostname, const char * username);
void db_free_host_info(struct db_host_info * info);

#endif