client.h revision ba90e657bc68a72ab3b3021e2f4a874fac9965ba
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa#ifndef __CLIENT_H
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa#define __CLIENT_H
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa
e6d3b53a6ae989ddbb213f916efba58d2170f9eeEugen Kuksa#include "network.h"
e6d3b53a6ae989ddbb213f916efba58d2170f9eeEugen Kuksa#include "master.h"
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa#include "client-common.h"
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksastruct imap_client {
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa struct client common;
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa
ce4376cf83941a8eed6a14acc1d446eec52b2e83Eugen Kuksa time_t created;
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa int refcount;
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa struct io *io;
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa struct istream *input;
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa struct ostream *output;
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa struct imap_parser *parser;
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa time_t last_input;
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa unsigned int bad_counter;
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa
bd63e05633307b60a7216b523b2b7a2bcc7b2823Eugen Kuksa const char *cmd_tag, *cmd_name;
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa unsigned int cmd_finished:1;
8d3aa811c26916ecb2051e97a249f25fb6feeaf4Eugen Kuksa unsigned int skip_line:1;
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa unsigned int input_blocked:1;
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa unsigned int destroyed:1;
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa};
246c94208917051fd0f0d22dce3c80ef60fb94e2Eugen Kuksa
246c94208917051fd0f0d22dce3c80ef60fb94e2Eugen Kuksavoid client_destroy(struct imap_client *client, const char *reason);
246c94208917051fd0f0d22dce3c80ef60fb94e2Eugen Kuksavoid client_destroy_internal_failure(struct imap_client *client);
36ec4872a8ea62879182f57759a24eb1bc708365Eugen Kuksa
36ec4872a8ea62879182f57759a24eb1bc708365Eugen Kuksavoid client_send_line(struct imap_client *client, const char *line);
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksavoid client_send_tagline(struct imap_client *client, const char *line);
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksaint client_read(struct imap_client *client);
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksavoid client_input(void *context);
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksavoid client_ref(struct imap_client *client);
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksaint client_unref(struct imap_client *client);
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa
f334cf84f4f0421d0c5a65eb446516fe9e066b4eEugen Kuksavoid clients_init(void);
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksavoid clients_deinit(void);
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa#endif
bd63e05633307b60a7216b523b2b7a2bcc7b2823Eugen Kuksa