client-common.h revision bdd36cfdba3ff66d25570a9ff568d69e1eb543cf
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen#include "master-login.h" /* for LOGIN_MAX_SESSION_ID_LEN */
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen/* max. size of input buffer. this means:
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainen IMAP: Max. length of command's all parameters. SASL-IR is read into
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen a separate larger buffer.
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainen POP3: Max. length of a command line (spec says 512 would be enough)
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainen (MASTER_AUTH_MAX_DATA_SIZE - LOGIN_MAX_MASTER_PREFIX_LEN - \
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* max. size of output buffer. if it gets full, the client is disconnected.
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen SASL authentication gives the largest output. */
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainen/* Max. length of SASL authentication buffer. */
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen/* Disconnect client after this many milliseconds if it hasn't managed
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen to log in yet. */
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen#define CLIENT_LOGIN_TIMEOUT_MSECS (MASTER_LOGIN_TIMEOUT_SECS*1000)
a0c453a8edaec90fb0d945c874de0b1845bc7d7eTimo Sirainen "Waiting for authentication process to respond.."
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen "Waiting for authentication master process to respond.."
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen /* for proxying */
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen const char *host, *hostip, *destuser, *password;
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen unsigned int port;
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*create)(struct client *client, void **other_sets);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*notify_auth_ready)(struct client *client);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*notify_disconnect)(struct client *client,
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen const char *text);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*notify_starttls)(struct client *client,
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*auth_send_challenge)(struct client *client, const char *data);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*auth_parse_response)(struct client *client);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen const char *text);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen int (*proxy_parse_line)(struct client *client, const char *line);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen void (*proxy_error)(struct client *client, const char *text);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen const struct master_service_ssl_settings *ssl_set;
bc93929cdd9000ca560a5f42a27f50ab307f1efbTimo Sirainen char *proxy_user, *proxy_master_user, *proxy_password;
eef4ba0cc3e78f8c26804c1c9251a76580a41f0cTimo Sirainen const struct master_service_ssl_settings *ssl_set,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen const struct ip_addr *local_ip, const struct ip_addr *remote_ip);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_destroy(struct client *client, const char *reason);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_destroy_success(struct client *client, const char *reason);
88dc563319efecd6e68bad16b0d92672da05584aTimo Sirainenvoid client_destroy_internal_failure(struct client *client);
bc93929cdd9000ca560a5f42a27f50ab307f1efbTimo Sirainenbool client_unref(struct client **client) ATTR_NOWARN_UNUSED_RESULT;
a5e89374cb2fb2cad575fee6c3b33a9487ab9b3aTimo Sirainenvoid client_cmd_starttls(struct client *client);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenunsigned int clients_get_count(void) ATTR_PURE;
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_log(struct client *client, const char *msg);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_log_err(struct client *client, const char *msg);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_log_warn(struct client *client, const char *msg);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenconst char *client_get_extra_disconnect_reason(struct client *client);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_auth_respond(struct client *client, const char *response);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenbool client_is_tls_enabled(struct client *client);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_auth_fail(struct client *client, const char *text);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenconst char *client_get_session_id(struct client *client);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenvoid client_notify_auth_ready(struct client *client);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_notify_status(struct client *client, bool bad, const char *text);
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainenvoid client_notify_disconnect(struct client *client,
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainen const char *text);
88dc563319efecd6e68bad16b0d92672da05584aTimo Sirainenvoid client_send_raw_data(struct client *client, const void *data, size_t size);
88dc563319efecd6e68bad16b0d92672da05584aTimo Sirainenvoid client_send_raw(struct client *client, const char *data);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_set_auth_waiting(struct client *client);
bc93929cdd9000ca560a5f42a27f50ab307f1efbTimo Sirainenvoid client_auth_send_challenge(struct client *client, const char *data);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_auth_parse_response(struct client *client);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenint client_auth_begin(struct client *client, const char *mech_name,
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenbool client_check_plaintext_auth(struct client *client, bool pass_sent);
1b0cfbf3cc77a670b92fff5c30f7b1eb17a63ab1Timo Sirainenint client_auth_read_line(struct client *client);
64b61cd24d630223478ccbe1934b9f60f0881f59Timo Sirainenvoid client_proxy_finish_destroy_client(struct client *client);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenvoid client_proxy_log_failure(struct client *client, const char *line);
d54ab8987e482a8df250615b44f41fa040c38741Timo Sirainenvoid client_proxy_failed(struct client *client, bool send_line);