2 * Sub-authentication Daemon
4 * (c) 2017 Martin Mares <mj@ucw.cz>
11 #include <ucw/clists.h>
12 #include <ucw/mainloop.h>
13 #include <ucw-json/json.h>
15 #define SOCKET_TIMEOUT 60000 // in ms
16 #define MAX_PACKET_SIZE 16384
17 #define MAX_OOB_DATA_SIZE 4096
20 struct main_file socket;
21 struct main_timer timer;
23 struct json_context *json;
24 struct json_node *request;
25 struct json_node *reply;
28 extern clist zone_list; // of struct auth_zone
29 extern char *database_name;
33 void cmd_error(struct client *c, const char *err);
34 void cmd_dispatch(struct client *c);
36 const char *get_string(struct json_node *n, const char *key);
37 bool get_uint(struct json_node *n, const char *key, uint *dest);
38 struct json_node **get_array(struct json_node *n, const char *key);
39 struct json_node *get_object(struct json_node *n, const char *key);
46 uint auto_create_acct;
52 clist accounts; // of struct auth_acct
58 struct auth_zone *zone;
59 clist tokens; // of struct auth_token