1 #ifndef IMAP_URLAUTH_CLIENT_H 2 #define IMAP_URLAUTH_CLIENT_H 3 4 struct client; 5 struct mail_storage; 6 7 enum imap_urlauth_worker_state { 8 IMAP_URLAUTH_WORKER_STATE_INACTIVE = 0, 9 IMAP_URLAUTH_WORKER_STATE_CONNECTED, 10 IMAP_URLAUTH_WORKER_STATE_ACTIVE, 11 }; 12 13 struct client { 14 struct client *prev, *next; 15 16 int fd_in, fd_out, fd_ctrl; 17 struct io *ctrl_io; 18 struct ostream *output, *ctrl_output; 19 struct istream *ctrl_input; 20 struct timeout *to_idle; 21 struct event *event; 22 23 char *username, *service; 24 ARRAY_TYPE(const_string) access_apps; 25 26 /* settings: */ 27 const struct imap_urlauth_settings *set; 28 29 enum imap_urlauth_worker_state worker_state; 30 31 bool disconnected:1; 32 }; 33 34 extern struct client *imap_urlauth_clients; 35 extern unsigned int imap_urlauth_client_count; 36 37 int client_create(const char *service, const char *username, 38 int fd_in, int fd_out, const struct imap_urlauth_settings *set, 39 struct client **client_r); 40 void client_destroy(struct client *client, const char *reason); 41 42 void client_send_line(struct client *client, const char *fmt, ...) 43 ATTR_FORMAT(2, 3); 44 45 void client_disconnect(struct client *client, const char *reason); 46 47 void clients_destroy_all(void); 48 49 #endif 50