comparison src/login-common/login-proxy.h @ 9773:8e099a00f8a9 HEAD

login proxy: Added client_proxy passdb extra field to specify proxy's connect timeout.
author Timo Sirainen <tss@iki.fi>
date Wed, 12 Aug 2009 18:02:20 -0400
parents e30495ae11de
children da0a48b243a2
comparison
equal deleted inserted replaced
9772:1bcd692d6312 9773:8e099a00f8a9
11 PROXY_SSL_FLAG_STARTTLS = 0x02, 11 PROXY_SSL_FLAG_STARTTLS = 0x02,
12 /* Don't require that the received certificate is valid */ 12 /* Don't require that the received certificate is valid */
13 PROXY_SSL_FLAG_ANY_CERT = 0x04 13 PROXY_SSL_FLAG_ANY_CERT = 0x04
14 }; 14 };
15 15
16 struct login_proxy_settings {
17 const char *host;
18 unsigned int port;
19 unsigned int connect_timeout_msecs;
20 enum login_proxy_ssl_flags ssl_flags;
21 };
22
16 /* Called when new input comes from proxy. */ 23 /* Called when new input comes from proxy. */
17 typedef void proxy_callback_t(void *context); 24 typedef void proxy_callback_t(void *context);
18 25
19 /* Create a proxy to given host. Returns NULL if failed. Given callback is 26 /* Create a proxy to given host. Returns NULL if failed. Given callback is
20 called when new input is available from proxy. */ 27 called when new input is available from proxy. */
21 struct login_proxy * 28 struct login_proxy *
22 login_proxy_new(struct client *client, const char *host, unsigned int port, 29 login_proxy_new(struct client *client, const struct login_proxy_settings *set,
23 enum login_proxy_ssl_flags ssl_flags,
24 proxy_callback_t *callback, void *context); 30 proxy_callback_t *callback, void *context);
25 #ifdef CONTEXT_TYPE_SAFETY 31 #ifdef CONTEXT_TYPE_SAFETY
26 # define login_proxy_new(client, host, port, ssl_flags, callback, context) \ 32 # define login_proxy_new(client, set, callback, context) \
27 ({(void)(1 ? 0 : callback(context)); \ 33 ({(void)(1 ? 0 : callback(context)); \
28 login_proxy_new(client, host, port, ssl_flags, \ 34 login_proxy_new(client, set, \
29 (proxy_callback_t *)callback, context); }) 35 (proxy_callback_t *)callback, context); })
30 #else 36 #else
31 # define login_proxy_new(client, host, port, ssl_flags, callback, context) \ 37 # define login_proxy_new(client, set, callback, context) \
32 login_proxy_new(client, host, port, ssl_flags, \ 38 login_proxy_new(client, set, (proxy_callback_t *)callback, context)
33 (proxy_callback_t *)callback, context)
34 #endif 39 #endif
35 /* Free the proxy. This should be called if authentication fails. */ 40 /* Free the proxy. This should be called if authentication fails. */
36 void login_proxy_free(struct login_proxy **proxy); 41 void login_proxy_free(struct login_proxy **proxy);
37 42
38 /* Return TRUE if host/port/destuser combination points to same as current 43 /* Return TRUE if host/port/destuser combination points to same as current