curl-fuzzer C++ reference
Loading...
Searching...
No Matches
tls_websocket_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_TLS_WEBSOCKET_MOCK_SERVER_H_
11#define PROTO_FUZZER_TLS_WEBSOCKET_MOCK_SERVER_H_
12
13#include <curl/curl.h>
14
15#include <cstddef>
16#include <memory>
17
18#include "curl_fuzzer.pb.h"
21
22namespace proto_fuzzer {
23
27 public:
28 explicit TlsWebSocketMockServer(curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain =
29 curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC);
30 ~TlsWebSocketMockServer() override;
31
32 void ObserveState() override;
33
35 TlsWebSocketMockServer& operator=(const TlsWebSocketMockServer&) = delete;
36
37 void Install(CURL* easy) override;
38
39 std::size_t completed_handshake_count() const;
40
41 protected:
42 std::unique_ptr<MockConnection> CreateConnection() override;
43 std::size_t DrainHandshakeData() override;
44 void FlushTransport() override;
45
46 private:
47 TlsMockTransport transport_;
48};
49
50} // namespace proto_fuzzer
51
52#endif // PROTO_FUZZER_TLS_WEBSOCKET_MOCK_SERVER_H_
Reusable TLS carrier for protocol-specific mock peers.
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
TlsWebSocketMockServer(curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain=curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC)
Construct a secure WebSocket peer with the selected certificate chain.
std::size_t DrainHandshakeData() override
Advance TLS and expose only decrypted application bytes to the inherited WebSocket observer.
std::unique_ptr< MockConnection > CreateConnection() override
Create one TLS-wrapped socketpair for the WebSocket exchange.
void FlushTransport() override
Turn queued application plaintext into TLS records before curl's next receive call,...
void Install(CURL *easy) override
Install the common WebSocket callbacks, then require verification against the checked-in TLS test cer...
WebSocketMockServer()
Construct an idle WebSocketMockServer with no queued frames.
Reusable TLS transport for structured in-process protocol peers.
WebSocketMockServer — an in-process WebSocket peer that drives a dynamic 101 handshake and then feeds...