10#ifndef PROTO_FUZZER_RTSP_MOCK_SERVER_H_
11#define PROTO_FUZZER_RTSP_MOCK_SERVER_H_
18#include "curl_fuzzer.pb.h"
21namespace proto_fuzzer {
55 void ConfigureClient(CURL* easy, curl::fuzzer::proto::RtspProbeMode mode);
77 struct curl_sockaddr* address =
nullptr)
override;
79 void HandleLine(std::string_view line)
override;
86 static std::size_t ProbeWriteCallback(
char* contents, std::size_t size, std::size_t nmemb,
void* userdata);
88 void BeginRequest(std::string_view line);
92 void ParseHeader(std::string_view line);
96 bool have_client_cseq_;
97 bool have_content_length_;
98 std::uint32_t client_cseq_;
99 std::uint32_t last_client_cseq_;
100 std::size_t content_length_;
101 std::size_t request_count_;
102 std::size_t response_count_;
103 std::string last_request_line_;
104 std::string last_method_;
105 std::string last_stream_uri_;
106 curl::fuzzer::proto::RtspProbeMode probe_mode_;
107 std::size_t client_write_failure_count_;
108 std::size_t opened_transport_count_;
const curl::fuzzer::proto::Scenario * scenario() const
Borrowed scenario for the synchronous drive, or nullptr outside RunLoop().
void HandleLine(std::string_view line) override
Consume one complete request line or header line.
std::size_t opened_transport_count() const
void HandleBodyComplete() override
Release the reply after an announced request body was drained exactly.
void ConfigureClient(CURL *easy, curl::fuzzer::proto::RtspProbeMode mode)
Install only the callback and receive-buffer boundary required by the split-RTP probe.
void ObserveState() override
Retain protocol outcomes in coverage and introspector builds.
std::size_t response_count() const
Expose how many scripted replies could be released before the bounded script ran out.
void ResetProtocolState() override
Clear RTSP's per-request parse state before the next drive.
RtspMockServer()
Begin without a borrowed protobuf or open socketpair.
std::size_t client_write_failure_count() const
~RtspMockServer() override
Release the server-owned socketpair half after curl has returned its client descriptor.
const std::string & last_method() const
std::size_t request_count() const
Expose how far the bounded request stream progressed.
CURLcode DriveCrossOriginReuseScenario(CURL *easy, const curl::fuzzer::proto::Scenario &scenario)
Run three ordinary OPTIONS-style exchanges through one multi connection cache.
std::uint32_t last_client_cseq() const
Expose the last parsed client sequence number so tests can verify that one request advanced the excha...
const std::string & last_stream_uri() const
const std::string & last_request_line() const
curl_socket_t HandleOpenSocket(curlsocktype purpose=CURLSOCKTYPE_IPCXN, struct curl_sockaddr *address=nullptr) override
Count successfully handed-off transports without changing the shared request-aligned socket construct...
PingpongMockServer — shared line-oriented command/response transport for the mail-style protocol peer...