ssl-proxy.h revision cec3230c9b2a96bac1ea42c69475e8aea4b91eab
45312f52ff3a3d4c137447be4c7556500c2f8bf2Timo Sirainen#ifndef SSL_PROXY_H
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen#define SSL_PROXY_H
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenstruct ip_addr;
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenstruct ssl_proxy;
e28fa207d1a097fa6e4a867f74ee0761472ef1ceTimo Sirainenstruct login_settings;
adb6413686e52e00dded4932babcc08ff041876bTimo Sirainenstruct client;
b039dabf4c53f72454e795930e7643b6e0e625f9Timo Sirainen
ef50336eefcb9ba99f73c6af37420eaf8857a39bTimo Sirainenextern bool ssl_initialized;
e28fa207d1a097fa6e4a867f74ee0761472ef1ceTimo Sirainen
ef50336eefcb9ba99f73c6af37420eaf8857a39bTimo Sirainentypedef int ssl_handshake_callback_t(void *context);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen/* establish SSL connection with the given fd, returns a new fd which you
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen must use from now on, or -1 if error occurred. Unless -1 is returned,
5694eeb99b69dea8033ca77ad69743c6b4871370Timo Sirainen the given fd must be simply forgotten. */
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenint ssl_proxy_alloc(int fd, const struct ip_addr *ip,
5694eeb99b69dea8033ca77ad69743c6b4871370Timo Sirainen const struct login_settings *set,
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen struct ssl_proxy **proxy_r);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenint ssl_proxy_client_alloc(int fd, struct ip_addr *ip,
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen const struct login_settings *set,
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen ssl_handshake_callback_t *callback, void *context,
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen struct ssl_proxy **proxy_r);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenvoid ssl_proxy_start(struct ssl_proxy *proxy);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenvoid ssl_proxy_set_client(struct ssl_proxy *proxy, struct client *client);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenbool ssl_proxy_has_valid_client_cert(const struct ssl_proxy *proxy) ATTR_PURE;
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenbool ssl_proxy_has_broken_client_cert(struct ssl_proxy *proxy);
de486b59018016977015ef42e6071155b60e82e1Timo Sirainenconst char *ssl_proxy_get_peer_name(struct ssl_proxy *proxy);
de486b59018016977015ef42e6071155b60e82e1Timo Sirainenbool ssl_proxy_is_handshaked(const struct ssl_proxy *proxy) ATTR_PURE;
de486b59018016977015ef42e6071155b60e82e1Timo Sirainenconst char *ssl_proxy_get_last_error(const struct ssl_proxy *proxy) ATTR_PURE;
de486b59018016977015ef42e6071155b60e82e1Timo Sirainenconst char *ssl_proxy_get_security_string(struct ssl_proxy *proxy);
de486b59018016977015ef42e6071155b60e82e1Timo Sirainenvoid ssl_proxy_free(struct ssl_proxy **proxy);
de486b59018016977015ef42e6071155b60e82e1Timo Sirainen
de486b59018016977015ef42e6071155b60e82e1Timo Sirainen/* Return number of active SSL proxies */
de486b59018016977015ef42e6071155b60e82e1Timo Sirainenunsigned int ssl_proxy_get_count(void) ATTR_PURE;
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen
220e21750948941dc6e33b8f11b552fa21d7f81eTimo Sirainenvoid ssl_proxy_init(void);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainenvoid ssl_proxy_deinit(void);
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen#endif
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen