client-common.h revision 9f627b360ed38fdc54cb02ec5e67246c3f0d5b0f
eb5ea3f4513ff2999892b8d904551f58b74f65f9Timo Sirainen/* max. size of input buffer. this means:
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen IMAP: Max. length of command's all parameters. SASL-IR is read into
eb5ea3f4513ff2999892b8d904551f58b74f65f9Timo Sirainen a separate larger buffer.
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen POP3: Max. length of a command line (spec says 512 would be enough)
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen (MASTER_AUTH_MAX_DATA_SIZE - LOGIN_MAX_MASTER_PREFIX_LEN)
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen/* max. size of output buffer. if it gets full, the client is disconnected.
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen SASL authentication gives the largest output. */
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen/* Max. length of SASL authentication buffer. */
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen/* Disconnect client after this many milliseconds if it hasn't managed
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen to log in yet. */
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen#define CLIENT_LOGIN_TIMEOUT_MSECS (MASTER_LOGIN_TIMEOUT_SECS*1000)
355fe8b5d02904df39e793f66da5432d86649d4aTimo Sirainen "Waiting for authentication process to respond.."
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen "Waiting for authentication master process to respond.."
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen /* for proxying */
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen unsigned int port;
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen void (*create)(struct client *client, void **other_sets);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen void (*notify_auth_ready)(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen void (*notify_disconnect)(struct client *client,
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen const char *text);
355fe8b5d02904df39e793f66da5432d86649d4aTimo Sirainen void (*notify_starttls)(struct client *client,
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen void (*auth_send_challenge)(struct client *client, const char *data);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen void (*auth_parse_response)(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen const char *text);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen int (*proxy_parse_line)(struct client *client, const char *line);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen void (*proxy_error)(struct client *client, const char *text);
355fe8b5d02904df39e793f66da5432d86649d4aTimo Sirainen char *proxy_user, *proxy_master_user, *proxy_password;
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen const struct login_settings *set, void **other_sets,
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen const struct ip_addr *local_ip, const struct ip_addr *remote_ip);
1d3f7c1278168d5b1cbfa9a2cc9929a0909056b4Timo Sirainenvoid client_destroy(struct client *client, const char *reason);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_destroy_success(struct client *client, const char *reason);
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainenvoid client_destroy_internal_failure(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_cmd_starttls(struct client *client);
1d3f7c1278168d5b1cbfa9a2cc9929a0909056b4Timo Sirainenunsigned int clients_get_count(void) ATTR_PURE;
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_log(struct client *client, const char *msg);
e262f3aa3429dbc74f668bc8bd501cf08b955778Timo Sirainenvoid client_log_err(struct client *client, const char *msg);
e262f3aa3429dbc74f668bc8bd501cf08b955778Timo Sirainenvoid client_log_warn(struct client *client, const char *msg);
e262f3aa3429dbc74f668bc8bd501cf08b955778Timo Sirainenconst char *client_get_extra_disconnect_reason(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_auth_respond(struct client *client, const char *response);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_auth_fail(struct client *client, const char *text);
1d3f7c1278168d5b1cbfa9a2cc9929a0909056b4Timo Sirainenvoid client_notify_auth_ready(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_notify_status(struct client *client, bool bad, const char *text);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_notify_disconnect(struct client *client,
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen const char *text);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_send_raw_data(struct client *client, const void *data, size_t size);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_send_raw(struct client *client, const char *data);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_set_auth_waiting(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_auth_send_challenge(struct client *client, const char *data);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_auth_parse_response(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenint client_auth_begin(struct client *client, const char *mech_name,
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenbool client_check_plaintext_auth(struct client *client, bool pass_sent);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenint client_auth_read_line(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_proxy_finish_destroy_client(struct client *client);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_proxy_log_failure(struct client *client, const char *line);
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenvoid client_proxy_failed(struct client *client, bool send_line);