1 #ifndef PROXY_TLS_H
2 #define PROXY_TLS_H
3 
4 // Attempt to reduce ifdef soup within the larger code files by blanking out
5 // or swapping these specialized functions.
6 // I'm not being super smart about this: if usage of a function leads to a
7 // compile error just adjust this as necessary. This is a bit less typing than
8 // leaving the header empty and redefining everything in the .c file, but if
9 // the balance changes we should switch to always doing that.
10 
11 enum mcp_tls_ret {
12     MCP_TLS_OK = 1,
13     MCP_TLS_NEEDIO = -1,
14     MCP_TLS_ERR = -2,
15 };
16 
17 #ifdef PROXY_TLS
18 int mcp_tls_init(proxy_ctx_t *ctx);
19 int mcp_tls_backend_init(proxy_ctx_t *ctx, struct mcp_backendconn_s *be);
20 int mcp_tls_shutdown(struct mcp_backendconn_s *be);
21 int mcp_tls_cleanup(struct mcp_backendconn_s *be);
22 int mcp_tls_connect(struct mcp_backendconn_s *be);
23 int mcp_tls_handshake(struct mcp_backendconn_s *be);
24 int mcp_tls_send_validate(struct mcp_backendconn_s *be);
25 int mcp_tls_read(struct mcp_backendconn_s *be);
26 int mcp_tls_writev(struct mcp_backendconn_s *be, int iovcnt);
27 #else
28 #define mcp_tls_init(ctx)
29 #define mcp_tls_backend_init(ctx, be)
30 #define mcp_tls_shutdown(be);
31 #define mcp_tls_cleanup(be);
32 #define mcp_tls_connect(be)
33 #define mcp_tls_handshake(be) 0
34 #define mcp_tls_send_validate(be) 0
35 #define mcp_tls_read(be) 0
36 int mcp_tls_writev(struct mcp_backendconn_s *be, int iovcnt);
37 #endif // PROXY_TLS
38 
39 #endif
40