client.h revision 6ef7e31619edfaa17ed044b45861d106a86191ef
183bea41fa640dc8117f3eb45ff935cd81377a84Timo Sirainen#ifndef __CLIENT_H
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen#define __CLIENT_H
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen
47e0598840ecffa364ebed523e06939e22738f06Timo Sirainen#include "network.h"
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen#include "master.h"
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen#include "client-common.h"
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenstruct imap_client {
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen struct client common;
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen time_t created;
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen int refcount;
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen struct io *io;
1d738cce754bc64bbc66d3355ebdaf3f6eac55f1Timo Sirainen struct istream *input;
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen struct ostream *output;
bdd7a96c363346f7c38f389791be1487ca08775bTimo Sirainen struct imap_parser *parser;
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen
63e2edd14ae7b1dc4a08e2e659501dbf519462f9Timo Sirainen struct login_proxy *proxy;
63e2edd14ae7b1dc4a08e2e659501dbf519462f9Timo Sirainen char *proxy_user, *proxy_password;
63e2edd14ae7b1dc4a08e2e659501dbf519462f9Timo Sirainen
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen time_t last_input;
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen unsigned int bad_counter;
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen const char *cmd_tag, *cmd_name;
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen unsigned int cmd_finished:1;
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen unsigned int proxy_login_sent:1;
029cfcdce65b284d5230adf1c920a5f526b03b5cTimo Sirainen unsigned int skip_line:1;
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen unsigned int input_blocked:1;
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen unsigned int destroyed:1;
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen unsigned int greeting_sent:1;
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen};
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenvoid client_destroy(struct imap_client *client, const char *reason);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenvoid client_destroy_internal_failure(struct imap_client *client);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenvoid client_send_line(struct imap_client *client, const char *line);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenvoid client_send_tagline(struct imap_client *client, const char *line);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenbool client_read(struct imap_client *client);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenbool client_skip_line(struct imap_client *client);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenvoid client_input(void *context);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenvoid client_ref(struct imap_client *client);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainenbool client_unref(struct imap_client *client);
90c23747727c85f80e4e8eed7968f0edbeac7ac5Timo Sirainen
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenvoid clients_init(void);
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenvoid clients_deinit(void);
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen#endif
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen