curl-fuzzer C++ reference
Loading...
Searching...
No Matches
mqtts_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 MqttsMockServer::Install(CURL* easy) {
36 transport_.Install(easy);
37}
38
42std::unique_ptr<MockConnection> MqttsMockServer::CreateConnection() { return transport_.CreateConnection(); }
43
45int MqttsMockServer::negotiated_tls_version() const { return transport_.negotiated_tls_version(); }
46
48std::size_t MqttsMockServer::completed_handshake_count() const { return transport_.completed_handshake_count(); }
49
51std::string MqttsMockServer::negotiated_alpn() const { return transport_.negotiated_alpn(); }
52
55#if defined(PROTO_FUZZER_OBSERVE_STATE)
57 const volatile std::size_t mqtts_observation[] = {completed_handshake_count(),
58 static_cast<std::size_t>(negotiated_tls_version()),
59 negotiated_alpn().size(), packet_count()};
60 (void)mqtts_observation;
61#endif
62}
63
64} // 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().
std::size_t packet_count() const
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
std::unique_ptr< MockConnection > CreateConnection() override
Wrap one socketpair endpoint in an OpenSSL acceptor.
std::size_t completed_handshake_count() const
void Install(CURL *easy) override
Install the shared socket callbacks and a stable local trust anchor.
~MqttsMockServer() override
Release the TLS connection before the carrier-owned server context.
std::string negotiated_alpn() const
MqttsMockServer()
Construct the OpenSSL server carrier used by every MQTTS scenario.
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
MockConnection and MockServer — the in-process peer that feeds canned response bytes to libcurl over ...
Implicit-TLS in-process peer for curl's MQTTS state machine.
TlsApplicationProtocol
Application protocol selected by the in-process TLS peer.
@ kHttp11
Ordinary HTTPS scripts contain HTTP/1.1 response bytes.