client-common.h revision da62041ae41e58c9e3ef91bd46c15484390c8247
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#include "master-login.h" /* for LOGIN_MAX_SESSION_ID_LEN */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* max. size of input buffer. this means:
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen IMAP: Max. length of command's all parameters. SASL-IR is read into
2b9dbb270ad82e58d5f3581436e6f143176d5819Timo Sirainen a separate larger buffer.
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen POP3: Max. length of a command line (spec says 512 would be enough)
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen (MASTER_AUTH_MAX_DATA_SIZE - LOGIN_MAX_MASTER_PREFIX_LEN - \
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* max. size of output buffer. if it gets full, the client is disconnected.
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen SASL authentication gives the largest output. */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* Max. length of SASL authentication buffer. */
cc0a651962a3e54d5a62231ac5847ae7f9f7de7fTimo Sirainen/* Disconnect client after this many milliseconds if it hasn't managed
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen to log in yet. */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#define CLIENT_LOGIN_TIMEOUT_MSECS (MASTER_LOGIN_TIMEOUT_SECS*1000)
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen "Waiting for authentication process to respond.."
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen "Waiting for authentication master process to respond.."
e237ebeb97f42950eef3efd0d3db85590160d5fbTimo Sirainen /* for proxying */
e237ebeb97f42950eef3efd0d3db85590160d5fbTimo Sirainen const char *host, *hostip, *destuser, *password;
e237ebeb97f42950eef3efd0d3db85590160d5fbTimo Sirainen unsigned int port;
e237ebeb97f42950eef3efd0d3db85590160d5fbTimo Sirainen void (*create)(struct client *client, void **other_sets);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen void (*send_line)(struct client *client, enum client_cmd_reply reply,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen const char *text);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen bool (*auth_handle_reply)(struct client *client,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen void (*auth_send_challenge)(struct client *client, const char *data);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen int (*auth_parse_response)(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen int (*proxy_parse_line)(struct client *client, const char *line);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen char *proxy_user, *proxy_master_user, *proxy_password;
0001f76bf725c5cf403bade8556f142dd43144eeTimo Sirainen const struct login_settings *set, void **other_sets,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen const struct ip_addr *local_ip, const struct ip_addr *remote_ip);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_destroy(struct client *client, const char *reason);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_destroy_success(struct client *client, const char *reason);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_destroy_internal_failure(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_cmd_starttls(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenunsigned int clients_get_count(void) ATTR_PURE;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_log(struct client *client, const char *msg);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_log_err(struct client *client, const char *msg);
de62ce819d59a529530da4b57be1b8d6dad13d6bTimo Sirainenvoid client_log_warn(struct client *client, const char *msg);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenconst char *client_get_extra_disconnect_reason(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_auth_failed(struct client *client);
e6440616c02bb1404dc35debf45d9741260c7831Timo Sirainenbool client_is_tls_enabled(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenconst char *client_get_session_id(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_send_line(struct client *client, enum client_cmd_reply reply,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen const char *text);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_send_raw_data(struct client *client, const void *data, size_t size);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_send_raw(struct client *client, const char *data);
e6440616c02bb1404dc35debf45d9741260c7831Timo Sirainenvoid client_set_auth_waiting(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_auth_send_challenge(struct client *client, const char *data);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint client_auth_parse_response(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint client_auth_begin(struct client *client, const char *mech_name,
cc0a651962a3e54d5a62231ac5847ae7f9f7de7fTimo Sirainenbool client_check_plaintext_auth(struct client *client, bool pass_sent);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint client_auth_read_line(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_proxy_finish_destroy_client(struct client *client);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_proxy_log_failure(struct client *client, const char *line);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid client_proxy_failed(struct client *client, bool send_line);