| 24 | namespace openssl { |
| 25 | |
| 26 | struct TLSClientConfig { |
| 27 | // Callback that will be called before the TLS handshake is started. |
| 28 | typedef Try<Nothing> (*ConfigureSocketCallback)( |
| 29 | SSL* ssl, |
| 30 | const Address& peer, |
| 31 | const Option<std::string>& servername); |
| 32 | |
| 33 | // Callback that will be called after the TLS handshake has been |
| 34 | // completed successfully. |
| 35 | typedef Try<Nothing> (*VerifyCallback)( |
| 36 | const SSL* const ssl, |
| 37 | const Option<std::string>& servername, |
| 38 | const Option<net::IP>& ip); |
| 39 | |
| 40 | // The `ConfigureSocketCallback` and `VerifyCallback` arguments can be set |
| 41 | // to nullptr, in that case they will not be called. |
| 42 | TLSClientConfig( |
| 43 | const Option<std::string>& servername, |
| 44 | SSL_CTX *ctx, |
| 45 | ConfigureSocketCallback, |
| 46 | VerifyCallback); |
| 47 | |
| 48 | // Context from which the `SSL` object for this connection is created. |
| 49 | SSL_CTX *ctx; |
| 50 | |
| 51 | // Server hostname to be used for hostname validation, if any. |
| 52 | // This will be passed as the `servername` argument to both |
| 53 | // callbacks. |
| 54 | // |
| 55 | // TODO(bevers): Use this for SNI as well when the linked OpenSSL |
| 56 | // supports it. |
| 57 | Option<std::string> servername; |
| 58 | |
| 59 | // User-specified callbacks. |
| 60 | VerifyCallback verify; |
| 61 | ConfigureSocketCallback configure_socket; |
| 62 | }; |
| 63 | |
| 64 | |
| 65 | // Returns a `TLSClientConfig` object that is configured with the |
no outgoing calls
no test coverage detected