curl-fuzzer C++ reference
Loading...
Searching...
No Matches
http3_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_HTTP3_MOCK_SERVER_H_
11#define PROTO_FUZZER_HTTP3_MOCK_SERVER_H_
12
13#include <cstddef>
14#include <cstdint>
15#include <memory>
16
18
19namespace proto_fuzzer {
20
21class Http3MockServerImpl;
22
34class Http3MockServer final : public MockServerBase {
35 public:
37
38 explicit Http3MockServer(curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain);
39
40 ~Http3MockServer() override;
41
42 void ObserveState() override;
43
44 Http3MockServer(const Http3MockServer&) = delete;
45 Http3MockServer& operator=(const Http3MockServer&) = delete;
46
47 void Install(CURL* easy) override;
48
49 bool handshake_complete() const;
50
51 bool request_headers_received() const;
52
53 std::size_t executed_action_count() const;
54
55 std::uint16_t server_port() const;
56
57 protected:
58 curl_socket_t HandleOpenSocket(curlsocktype purpose, struct curl_sockaddr* address) override;
59
60 SocketSetupDisposition GetSocketSetupDisposition(curl_socket_t curlfd, curlsocktype purpose) const override;
61
62 void RunLoop(CURLM* multi, CURL* easy, const curl::fuzzer::proto::Scenario& scenario) override;
63
64 private:
65 std::unique_ptr<Http3MockServerImpl> impl_;
66};
67
68} // namespace proto_fuzzer
69
70#endif // PROTO_FUZZER_HTTP3_MOCK_SERVER_H_
Http3MockServer()
Construct a peer with the default checked-in EC certificate.
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Alternate nonblocking curl and QUIC server turns under fixed operation and idle budgets.
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
void Install(CURL *easy) override
Install UDP socket callbacks, the local trust anchor, and HTTP/3-only negotiation on an easy handle.
std::size_t executed_action_count() const
curl_socket_t HandleOpenSocket(curlsocktype purpose, struct curl_sockaddr *address) override
Create curl's real UDP descriptor and rewrite its destination to the private loopback QUIC listener.
SocketSetupDisposition GetSocketSetupDisposition(curl_socket_t curlfd, curlsocktype purpose) const override
HTTP/3 returns an unconnected UDP descriptor, so curl must perform its normal socket setup before usi...
MockServerBase — common plumbing shared by every protocol-specific mock server.
SocketSetupDisposition
Tell curl whether an application-provided socket still needs its normal connect/options setup or alre...