curl-fuzzer C++ reference
Loading...
Searching...
No Matches
smtps_mock_server.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al.
3 *
4 * SPDX-License-Identifier: curl
5 */
6
9
11
12#include <cstddef>
13#include <memory>
14#include <string>
15
17
18namespace proto_fuzzer {
19
24
28
34void SmtpsMockServer::Install(CURL* easy) {
36 transport_.Install(easy);
37}
38
42std::unique_ptr<MockConnection> SmtpsMockServer::CreateConnection() { return transport_.CreateConnection(); }
43
45int SmtpsMockServer::negotiated_tls_version() const { return transport_.negotiated_tls_version(); }
46
48std::size_t SmtpsMockServer::completed_handshake_count() const { return transport_.completed_handshake_count(); }
49
51std::string SmtpsMockServer::negotiated_alpn() const { return transport_.negotiated_alpn(); }
52
55#if defined(PROTO_FUZZER_OBSERVE_STATE)
57 const volatile std::size_t smtps_observation[] = {
58 completed_handshake_count(), static_cast<std::size_t>(negotiated_tls_version()), negotiated_alpn().size()};
59 (void)smtps_observation;
60#endif
61}
62
63} // namespace proto_fuzzer
virtual void Install(CURL *easy)
Install the common OPENSOCKETFUNCTION / OPENSOCKETDATA / SOCKOPTFUNCTION callbacks on 'easy'.
std::unique_ptr< MockConnection > connection_
The per-scenario MockConnection, lazily created by HandleOpenSocket().
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
std::size_t completed_handshake_count() const
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
void Install(CURL *easy) override
Install the shared socket callbacks and a stable local trust anchor.
~SmtpsMockServer() override
Release the TLS connection before the carrier-owned server context.
std::unique_ptr< MockConnection > CreateConnection() override
Wrap one socketpair endpoint in an OpenSSL acceptor.
SmtpsMockServer()
Construct the OpenSSL server carrier used by every SMTPS scenario.
std::string negotiated_alpn() const
MockConnection and MockServer — the in-process peer that feeds canned response bytes to libcurl over ...
Implicit-TLS in-process peer for curl's SMTPS state machine.
TlsApplicationProtocol
Application protocol selected by the in-process TLS peer.
@ kHttp11
Ordinary HTTPS scripts contain HTTP/1.1 response bytes.