blob: b9abf2530f3d7ca2423570e70eb5e3d10f75e611 (
plain)
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
|
#ifndef SAUERBOT_AUTH_H_
#define SAUERBOT_AUTH_H_
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#define AUTHKEY_LEN 5
struct sbot_authkey {
char key[AUTHKEY_LEN + 1];
int ok; /* used for import */
};
#define NR_AUTHKEYS 100
struct sbot_authmap {
uint16_t mapid;
int mapid_ok; /* used for import */
struct sbot_authkey keys[NR_AUTHKEYS];
};
struct auth_context {
unsigned int key;
unsigned int timeout;
#define AUTH_TIMEOUT 60 /* heartbeats */
int tries;
#define MAX_AUTH_TRIES 3
};
void gen_authmap(struct sbot_authmap *map);
int do_export_authmap(const struct sbot_authmap *map, FILE *fd);
int export_authmap(const struct sbot_authmap *map, const char *file);
int do_import_authmap(struct sbot_authmap *map, FILE *fd);
int import_authmap(struct sbot_authmap *map, const char *file);
#endif /* SAUERBOT_AUTH_H_ */
|