comparison src/login-common/login-proxy.h @ 10612:6b3dc91ae0c5 HEAD

login: Proxy code API cleanup.
author Timo Sirainen <tss@iki.fi>
date Sun, 31 Jan 2010 16:13:07 +0200
parents 7f0ccd367351
children 23956a9b915b
comparison
equal deleted inserted replaced
10611:c06033a1f147 10612:6b3dc91ae0c5
19 unsigned int connect_timeout_msecs; 19 unsigned int connect_timeout_msecs;
20 enum login_proxy_ssl_flags ssl_flags; 20 enum login_proxy_ssl_flags ssl_flags;
21 }; 21 };
22 22
23 /* Called when new input comes from proxy. */ 23 /* Called when new input comes from proxy. */
24 typedef void proxy_callback_t(void *context); 24 typedef void proxy_callback_t(struct client *client);
25 25
26 /* 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
27 called when new input is available from proxy. */ 27 called when new input is available from proxy. */
28 struct login_proxy * 28 int login_proxy_new(struct client *client,
29 login_proxy_new(struct client *client, const struct login_proxy_settings *set, 29 const struct login_proxy_settings *set,
30 proxy_callback_t *callback, void *context); 30 proxy_callback_t *callback, struct login_proxy **proxy_r);
31 #ifdef CONTEXT_TYPE_SAFETY
32 # define login_proxy_new(client, set, callback, context) \
33 ({(void)(1 ? 0 : callback(context)); \
34 login_proxy_new(client, set, \
35 (proxy_callback_t *)callback, context); })
36 #else
37 # define login_proxy_new(client, set, callback, context) \
38 login_proxy_new(client, set, (proxy_callback_t *)callback, context)
39 #endif
40 /* Free the proxy. This should be called if authentication fails. */ 31 /* Free the proxy. This should be called if authentication fails. */
41 void login_proxy_free(struct login_proxy **proxy); 32 void login_proxy_free(struct login_proxy **proxy);
42 33
43 /* Return TRUE if host/port/destuser combination points to same as current 34 /* Return TRUE if host/port/destuser combination points to same as current
44 connection. */ 35 connection. */