|
curl-fuzzer C++ reference
|
Resolver-lane peer that exposes two cached loopback addresses and returns unconnected non-blocking sockets, so every address reaches curl's normal TCP connect path. More...
#include <happy_eyeballs_mock_server.h>
Public Member Functions | |
| HappyEyeballsMockServer () | |
| Construct an idle peer with no listener or accepted connections. | |
| ~HappyEyeballsMockServer () override | |
| Release listeners and accepted loopback peers. | |
| void | Install (CURL *easy) override |
| Install the shared socket callbacks and remember the easy handle for the later resolve/port/timeout setopts. | |
| void | ConfigureRequestData (ScenarioRequestData *request_data) override |
| Replace the resolver lane's single-address mapping with a two-address entry for the fixed canonical host and point the URL's effective port at the ephemeral listener. | |
| std::size_t | opened_socket_count () const |
| std::size_t | accepted_peer_count () const |
| int | listener_port () const |
| Public Member Functions inherited from proto_fuzzer::MockServerBase | |
| virtual | ~MockServerBase () |
| Out-of-line destructor so MockConnection can stay forward-declared in the base header (its complete type is only needed where unique_ptr is instantiated for destruction). | |
| virtual void | ObserveState () |
| Default no-op for peers without protocol-specific observations. | |
| CURLcode | DriveScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario) |
| Run 'scenario' to completion on 'easy': allocate a multi, attach 'easy', delegate protocol-specific work to RunLoop, consume its completion message, and clean up. | |
| virtual CURLcode | DriveEasyScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario, bool use_events=false) |
| Run through the public easy entrypoint when a protocol mock can preload all peer work before curl takes control. | |
| virtual ConnectOnlyRunStats | DriveConnectOnlyScenario (CURL *easy, const curl::fuzzer::proto::Scenario &scenario) |
| Establish a CONNECT_ONLY transport, then perform bounded direct I/O. | |
| void | SetMultiObserver (MultiObserver observer) |
| Register an observer invoked with the live multi handle after 'easy' is attached and before the drive loop starts. | |
| MockConnection * | connection () |
Protected Member Functions | |
| curl_socket_t | HandleOpenSocket (curlsocktype purpose, struct curl_sockaddr *address) override |
| Hand curl a fresh unconnected socket for every address its happy-eyeballs filter decides to race. | |
| SocketSetupDisposition | GetSocketSetupDisposition (curl_socket_t curlfd, curlsocktype purpose) const override |
| Stream peers must follow curl's ordinary connect path; unlike the socketpair mocks, the descriptor is deliberately not connected yet. | |
| void | RunLoop (CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override |
| Run a bounded perform loop that also accepts real loopback connections and serves their response scripts. | |
| Protected Member Functions inherited from proto_fuzzer::MockServerBase | |
| MockServerBase (MultiDrivePolicy drive_policy=MultiDrivePolicy::kPerform) | |
| Construct an empty base instance with a fixed multi-drive policy. | |
| virtual void | HandleDetachedMulti (CurlMultiPtr multi) |
| Dispose of or retain the multi after its easy handle has been removed. | |
| MultiSocketDriver * | multi_socket_driver () |
| Expose the callback state installed for the current socket-action drive. | |
| std::size_t | additional_handle_cleanup_count () const |
| void | ResumeResponseIfRequested (CURL *easy) |
| Resume receive-side callback output at one bounded drive boundary when the dedicated API plan requested it. | |
| void | ApplyPendingBackpressure () |
| Apply the BackpressureConfig cached by DriveScenario to the new connection_. | |
Additional Inherited Members | |
| Public Types inherited from proto_fuzzer::MockServerBase | |
| using | MultiObserver = std::function<void(CURLM*)> |
| Callback type used to publish the driving multi handle to observers. | |
| Static Protected Member Functions inherited from proto_fuzzer::MockServerBase | |
| static int | WaitOnMultiFdset (CURLM *multi, CURLMcode *rc) |
| Wait on curl's fdset with a short timeout. | |
| static void | ProbeMultiPollset (CURLM *multi) |
| Ask curl to construct and inspect its connection-filter pollset without waiting. | |
| static bool | MultiPollsetWantsWrite (CURLM *multi, curl_socket_t socket) |
| Inspect one socket's current writable interest through curl's public multi fdset API. | |
| static bool | UsesTimedDrive (const curl::fuzzer::proto::Scenario &scenario) |
| Treat a non-default BackpressureConfig as an explicit request for the slower, timed drive policy. | |
| Protected Attributes inherited from proto_fuzzer::MockServerBase | |
| std::unique_ptr< MockConnection > | connection_ |
| The per-scenario MockConnection, lazily created by HandleOpenSocket(). | |
| int | pending_recv_buf_bytes_ |
| Cached SO_RCVBUF/SO_SNDBUF setting in bytes. | |
| std::size_t | pending_drain_limit_ |
| Cached per-call DrainIncoming byte budget. | |
| MultiSocketDriver * | multi_socket_driver_ |
| Non-owning pointer into DriveScenario's stack. | |
| std::size_t | additional_handle_cleanup_count_ |
| Number of application-created handles, excluding the caller's parent, successfully removed from the current multi and cleaned up. | |
| bool | resume_response_ |
| True only for an API-plan multi drive with its one-shot write callback. | |
| MultiObserver | multi_observer_ |
| Observer receiving the live multi handle at the start of a drive. | |
| Static Protected Attributes inherited from proto_fuzzer::MockServerBase | |
| static constexpr int | kMaxDriveIterations = 512 |
| Hard operation budget for one scenario. | |
| static constexpr int | kMaxIdleIterations = 8 |
| Consecutive no-progress budget for ordinary scenarios. | |
| static constexpr int | kMaxTimedIdleIterations = 256 |
| Explicit backpressure scenarios get a larger idle budget and may use the short timed wait above. | |
Resolver-lane peer that exposes two cached loopback addresses and returns unconnected non-blocking sockets, so every address reaches curl's normal TCP connect path.
The first address deliberately has a full accept queue and stays in progress; the second address has a real listener that serves the scenario response to the winner.
Definition at line 33 of file happy_eyeballs_mock_server.h.
|
override |
Release listeners and accepted loopback peers.
curl owns every socket it received from HandleOpenSocket; only the accepted server halves, listeners, and backlog-filling clients are closed here.
Definition at line 113 of file happy_eyeballs_mock_server.cc.
|
inline |
Definition at line 49 of file happy_eyeballs_mock_server.h.
|
overridevirtual |
Replace the resolver lane's single-address mapping with a two-address entry for the fixed canonical host and point the URL's effective port at the ephemeral listener.
This runs after ScenarioRequestData has installed its own list, so the race mapping is the one curl loads.
| request_data | Installed request state; unused by this transport. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 140 of file happy_eyeballs_mock_server.cc.
|
overrideprotectedvirtual |
Stream peers must follow curl's ordinary connect path; unlike the socketpair mocks, the descriptor is deliberately not connected yet.
| curlfd | Descriptor returned by HandleOpenSocket. |
| purpose | Socket role assigned by curl. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 199 of file happy_eyeballs_mock_server.cc.
|
overrideprotectedvirtual |
Hand curl a fresh unconnected socket for every address its happy-eyeballs filter decides to race.
The sockopt callback reports kNeedsSetup, so curl performs the real non-blocking connect on this descriptor.
| purpose | Socket role; only outbound IPCXN sockets are produced. |
| address | curl's mutable destination description. |
Implements proto_fuzzer::MockServerBase.
Definition at line 174 of file happy_eyeballs_mock_server.cc.
|
overridevirtual |
Install the shared socket callbacks and remember the easy handle for the later resolve/port/timeout setopts.
The zero happy-eyeballs delay makes the second address eligible as soon as the first connect is in progress.
| easy | Easy handle that will drive this peer. |
Reimplemented from proto_fuzzer::MockServerBase.
Reimplemented in proto_fuzzer::InterfaceOptionMockServer.
Definition at line 126 of file happy_eyeballs_mock_server.cc.
|
inline |
Definition at line 52 of file happy_eyeballs_mock_server.h.
|
inline |
Definition at line 46 of file happy_eyeballs_mock_server.h.
|
overrideprotectedvirtual |
Run a bounded perform loop that also accepts real loopback connections and serves their response scripts.
Explicit short select waits let the kernel report connect completion without busy-spinning.
| multi | Multi handle already containing easy. |
| easy | Easy handle driving this peer. |
| scenario | Source of the bounded response scripts. |
Implements proto_fuzzer::MockServerBase.
Definition at line 224 of file happy_eyeballs_mock_server.cc.