curl-fuzzer C++ reference
Loading...
Searching...
No Matches
h2_origin_mock_server.h
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
10#ifndef PROTO_FUZZER_H2_ORIGIN_MOCK_SERVER_H_
11#define PROTO_FUZZER_H2_ORIGIN_MOCK_SERVER_H_
12
13#include <curl/curl.h>
14
15#include <cstddef>
16#include <memory>
17
20
21namespace proto_fuzzer {
22
28 public:
29 explicit H2OriginMockServer(
30 curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain =
31 curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC,
32 curl::fuzzer::proto::TlsGroupProfile group_profile = curl::fuzzer::proto::TLS_GROUP_X25519);
33 ~H2OriginMockServer() override;
34
35 void Install(CURL* easy) override;
36
37 const H2Runtime& runtime() const;
38 std::size_t cleaned_push_count() const;
39
40 protected:
41 std::unique_ptr<MockConnection> CreateConnection() override;
42
43 void RunLoop(CURLM* multi, CURL* easy, const curl::fuzzer::proto::Scenario& scenario) override;
44
45 void HandleDetachedMulti(CurlMultiPtr multi) override;
46
47 private:
48 H2Runtime runtime_;
49 CurlMultiPtr retained_multi_;
50};
51
52} // namespace proto_fuzzer
53
54#endif // PROTO_FUZZER_H2_ORIGIN_MOCK_SERVER_H_
H2OriginMockServer(curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain=curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC, curl::fuzzer::proto::TlsGroupProfile group_profile=curl::fuzzer::proto::TLS_GROUP_X25519)
Construct an HTTP/2 TLS peer with the selected certificate chain.
const H2Runtime & runtime() const
Expose shared protocol observations without allowing carrier state changes.
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Run the raw HTTP/2 response driver and probe server push and upkeep APIs.
void HandleDetachedMulti(CurlMultiPtr multi) override
Keep the connection cache alive until this mock is destroyed, after the caller has cleaned the detach...
void Install(CURL *easy) override
Keep transport selection out of the mutation grammar.
std::unique_ptr< MockConnection > CreateConnection() override
Attach the reusable H2 client-frame tracker after TLS decryption.
Protocol state shared by TLS and plaintext HTTP/2 origin peers.
Definition h2_runtime.h:33
TlsMockServer()
Build one reusable in-process server context per fuzz iteration.
std::unique_ptr< CURLM, CurlMultiDeleter > CurlMultiPtr
Unique ownership of a CURL multi handle.
Definition curl_raii.h:58
Shared HTTP/2 plan, push, and upkeep behavior for origin peers.
Reusable TLS transport for structured in-process protocol peers.