#ifndef SAUERBOT_AUTH_H_ #define SAUERBOT_AUTH_H_ #include #include #include #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_ */