curl-fuzzer C++ reference
Loading...
Searching...
No Matches
telnet_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_TELNET_MOCK_SERVER_H_
11#define PROTO_FUZZER_TELNET_MOCK_SERVER_H_
12
13#include <curl/curl.h>
14
15#include "curl_fuzzer.pb.h"
17
18namespace proto_fuzzer {
19
30class TelnetMockServer final : public MockServerBase {
31 public:
34
35 void ConfigureRequestData(ScenarioRequestData* request_data) override;
36
37 protected:
38 curl_socket_t HandleOpenSocket(curlsocktype purpose = CURLSOCKTYPE_IPCXN,
39 struct curl_sockaddr* address = nullptr) override;
40 void RunLoop(CURLM* multi, CURL* easy, const curl::fuzzer::proto::Scenario& scenario) override;
41
42 private:
43 static void DrainBeforeUploadRead(void* userdata);
44
45 const curl::fuzzer::proto::Scenario* scenario_;
46 bool socket_opened_;
47};
48
49} // namespace proto_fuzzer
50
51#endif // PROTO_FUZZER_TELNET_MOCK_SERVER_H_
Builds HTTP headers or TELNET options, MIME state, and upload callbacks whose storage or userdata lib...
curl_socket_t HandleOpenSocket(curlsocktype purpose=CURLSOCKTYPE_IPCXN, struct curl_sockaddr *address=nullptr) override
Create one socketpair, preload every raw response fragment curl can observe, then half-close the peer...
void ConfigureRequestData(ScenarioRequestData *request_data) override
Attach the synchronous peer drain to TELNET's upload callback.
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Drive a small number of non-waiting multi transitions.
TelnetMockServer()
Start without a borrowed scenario.
~TelnetMockServer() override
The base owns and closes the server half after curl releases its client fd.
MockServerBase — common plumbing shared by every protocol-specific mock server.