59 explicit MqttMockServer(curl::fuzzer::proto::MqttProbeMode mode = curl::fuzzer::proto::MQTT_PROBE_DEFAULT);
98 struct curl_sockaddr* address =
nullptr)
override;
100 void RunLoop(CURLM* multi, CURL* easy,
const curl::fuzzer::proto::Scenario& scenario)
override;
106 enum class ParseResult {
114 static ParseResult ParseRemainingLength(std::string_view bytes, std::size_t* header_size,
115 std::size_t* remaining_length);
117 void ResetForScenario(
const curl::fuzzer::proto::Scenario& scenario);
121 bool ServiceClientConnection();
123 void HandleClientPacket(
unsigned char first_byte, std::string_view body);
125 bool ReleaseNextServerChunk();
127 bool WriteServerBytes(std::string_view bytes);
129 static void CapturePrefix(std::string_view source, std::size_t limit, std::string* destination);
131 void FinishConnections();
133 void ApplyProbeOptions(CURL* easy)
const;
138 static constexpr std::size_t kMaxPacketBytes = 64 * 1024;
141 static constexpr std::size_t kMaxCapturedPacketBytes = 64 * 1024;
147 static constexpr int kMaxPacketsPerService = 16;
150 const curl::fuzzer::proto::MqttProbeMode mode_;
153 const curl::fuzzer::proto::Scenario* scenario_;
155 std::size_t server_chunk_count_;
157 std::size_t next_server_chunk_;
159 std::size_t packet_count_;
160 std::size_t connect_count_;
161 std::size_t publish_count_;
162 std::size_t subscribe_count_;
163 std::size_t qos1_publish_count_;
165 std::size_t active_pollset_probe_count_;
167 std::string pending_client_bytes_;
169 std::string packet_transcript_;
171 std::string published_topic_;
173 std::string published_payload_;
175 bool release_script_chunks_;
177 bool protocol_error_;
void RunLoop(CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override
Alternate curl transitions with immediate peer service until the transfer completes or deterministic ...