login-proxy.h revision ddbdc644a15f56f4b43596f1b8c0fc196c101445
#ifndef LOGIN_PROXY_H
#define LOGIN_PROXY_H
/* Max. number of embedded proxying connections until proxying fails.
This is intended to avoid an accidental configuration where two proxies
keep connecting to each others, both thinking the other one is supposed to
handle the user. This only works if both proxies support the Dovecot
TTL extension feature. */
#define LOGIN_PROXY_TTL 5
struct client;
struct login_proxy;
enum login_proxy_ssl_flags {
PROXY_SSL_FLAG_YES = 0x01,
/* Don't do SSL handshake immediately after connected */
PROXY_SSL_FLAG_STARTTLS = 0x02,
/* Don't require that the received certificate is valid */
PROXY_SSL_FLAG_ANY_CERT = 0x04
};
struct login_proxy_settings {
const char *host;
unsigned int port;
unsigned int connect_timeout_msecs;
/* send a notification about proxy connection to proxy-notify pipe
every n seconds */
unsigned int notify_refresh_secs;
};
/* Called when new input comes from proxy. */
/* Create a proxy to given host. Returns NULL if failed. Given callback is
called when new input is available from proxy. */
const struct login_proxy_settings *set,
/* Free the proxy. This should be called if authentication fails. */
connection. */
/* Detach proxy from client. This is done after the authentication is
successful and all that is left is the dummy proxying. */
/* STARTTLS command was issued. */
void login_proxy_kill_idle(void);
void login_proxy_init(const char *proxy_notify_pipe_path);
void login_proxy_deinit(void);
#endif