client.h revision ab1236617440e654d5c5a043b677512714b788dd
89a126810703c666309310d0f3189e9834d70b5bTimo Sirainen#ifndef __CLIENT_H
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen#define __CLIENT_H
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen#include "network.h"
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen#include "master.h"
687d1dee0e92229232aa8be416897b640df67d07Timo Sirainen#include "client-common.h"
65988f5a8abed57e9894fec77105941e046d3490Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenstruct imap_client {
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct client common;
687d1dee0e92229232aa8be416897b640df67d07Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen time_t created;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen int refcount;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct io *io;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct istream *input;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct ostream *output;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct imap_parser *parser;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct login_proxy *proxy;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen char *proxy_user, *proxy_password;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
64510d2cc23a79d2142030bf5bade44baa490db3Timo Sirainen time_t last_input;
64510d2cc23a79d2142030bf5bade44baa490db3Timo Sirainen unsigned int bad_counter;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen const char *cmd_tag, *cmd_name;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen unsigned int cmd_finished:1;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen unsigned int proxy_login_sent:1;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen unsigned int skip_line:1;
f335accff54f408a8bbb328f8098ad458f2ff58eTimo Sirainen unsigned int input_blocked:1;
f335accff54f408a8bbb328f8098ad458f2ff58eTimo Sirainen unsigned int destroyed:1;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen};
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid client_destroy(struct imap_client *client, const char *reason);
2e03303e721a293d796c0287829396f5caea76eaTimo Sirainenvoid client_destroy_internal_failure(struct imap_client *client);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid client_send_line(struct imap_client *client, const char *line);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid client_send_tagline(struct imap_client *client, const char *line);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenint client_read(struct imap_client *client);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenint client_skip_line(struct imap_client *client);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid client_input(void *context);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid client_ref(struct imap_client *client);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenint client_unref(struct imap_client *client);
345253fb28498b2e0a60f4a2a8644c65feee7e75Timo Sirainen
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid clients_init(void);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenvoid clients_deinit(void);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen
345253fb28498b2e0a60f4a2a8644c65feee7e75Timo Sirainen#endif
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen