curl-fuzzer C++ reference
Loading...
Searching...
No Matches
dict_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_DICT_MOCK_SERVER_H_
11#define PROTO_FUZZER_DICT_MOCK_SERVER_H_
12
13#include <string_view>
14
16
17namespace proto_fuzzer {
18
33class DictMockServer : public PingpongMockServer {
34 public:
36
37 ~DictMockServer() override;
38
39 void ObserveState() override;
40
41 DictMockServer(const DictMockServer&) = delete;
42 DictMockServer& operator=(const DictMockServer&) = delete;
43
44 void Install(CURL* easy) override;
45
46 protected:
47 std::unique_ptr<MockConnection> CreateConnection() override;
48
49 void RunLoop(CURLM* multi, CURL* easy, const curl::fuzzer::proto::Scenario& scenario) override;
50
51 void HandleLine(std::string_view line) override;
52
53 void ResetProtocolState() override;
54
55 private:
56 void FinishResponse();
57
60 bool reply_sent_;
62 bool write_closed_;
63};
64
65} // namespace proto_fuzzer
66
67#endif // PROTO_FUZZER_DICT_MOCK_SERVER_H_
void Install(CURL *easy) override
Remove the operation deadline so a partial DICT request write exercises sendf()'s explicit no-timeout...
std::unique_ptr< MockConnection > CreateConnection() override
Construct the ordinary plaintext transport only when its client endpoint can queue the complete bound...
void HandleLine(std::string_view line) override
Answer the first lookup command in the request and ignore CLIENT, which is a bare identification line...
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Split each sufficiently large socket write while curl constructs and uses this DICT connection.
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
DictMockServer()
Begin without a borrowed protobuf or open socketpair.
~DictMockServer() override
Release the server-owned socketpair half after curl has returned its client descriptor.
void ResetProtocolState() override
Reset DICT's response bookkeeping for a new drive.
const curl::fuzzer::proto::Scenario * scenario() const
Borrowed scenario for the synchronous drive, or nullptr outside RunLoop().
PingpongMockServer — shared line-oriented command/response transport for the mail-style protocol peer...