|
curl-fuzzer C++ reference
|
Owns the socket and timer callback state required by libcurl's event-driven multi API. More...
#include <multi_socket_driver.h>
Classes | |
| struct | DriveResult |
| Result from one non-blocking event-loop turn. More... | |
Public Member Functions | |
| MultiSocketDriver () | |
| Construct detached callback state. | |
| ~MultiSocketDriver () | |
| The owner deliberately destroys this after curl_multi_cleanup, so there is no callback deregistration or libcurl access left for the destructor. | |
| bool | Install (CURLM *multi) |
| Install socket/timer callbacks on a caller-owned multi before adding an easy handle. | |
| CURLMcode | Start (int *running_handles) |
| Start libcurl's socket state machine through the documented timeout pseudo-socket without waiting for a real timer. | |
| DriveResult | DriveReady (int *running_handles) |
| Run one bounded, non-blocking event-loop turn: poll the callback-provided watch set with a zero timeout and report readiness back to libcurl. | |
| void | ProbeControlApis () |
| Exercise the wakeup and timeout-query APIs from a valid live-multi state. | |
| bool | watch_exhausted () const |
Owns the socket and timer callback state required by libcurl's event-driven multi API.
The fuzzer must retain callback storage until after the easy handle leaves the multi and the multi is cleaned up: either operation can synchronously issue CURL_POLL_REMOVE. A fixed watch table provides stable addresses for curl_multi_assign while preventing a mutated transfer from allocating an unbounded application-side poll set.
Definition at line 30 of file multi_socket_driver.h.
| proto_fuzzer::MultiSocketDriver::MultiSocketDriver | ( | ) |
Construct detached callback state.
Install() supplies the multi only after all watch storage has reached its final address.
Definition at line 54 of file multi_socket_driver.cc.
| MultiSocketDriver::DriveResult proto_fuzzer::MultiSocketDriver::DriveReady | ( | int * | running_handles | ) |
Run one bounded, non-blocking event-loop turn: poll the callback-provided watch set with a zero timeout and report readiness back to libcurl.
The snapshot is intentional: a socket action may synchronously remove the current watch or install another one, so the callback-owned table must not be iterated as a live container across that call. Service a deferred zero timer after socket callbacks, never recursively from the timer callback.
| running_handles | In/out unfinished-transfer count. |
Definition at line 101 of file multi_socket_driver.cc.
| bool proto_fuzzer::MultiSocketDriver::Install | ( | CURLM * | multi | ) |
Install socket/timer callbacks on a caller-owned multi before adding an easy handle.
curl may announce a timer during curl_multi_add_handle, so installing later would miss the event that starts an otherwise idle socket-action application.
| multi | Multi handle that outlives this driver. |
Definition at line 67 of file multi_socket_driver.cc.
| void proto_fuzzer::MultiSocketDriver::ProbeControlApis | ( | ) |
Exercise the wakeup and timeout-query APIs from a valid live-multi state.
A zero-timeout query is informational; wakeup is also non-blocking when no other thread is in a poll call, which is the deterministic behavior this lane needs. Neither call waits or changes the operation budget.
Definition at line 168 of file multi_socket_driver.cc.
| CURLMcode proto_fuzzer::MultiSocketDriver::Start | ( | int * | running_handles | ) |
Start libcurl's socket state machine through the documented timeout pseudo-socket without waiting for a real timer.
This creates the first socket and gives the callback its initial watch without a wall-clock dependency.
| running_handles | Receives the number of unfinished transfers. |
Definition at line 84 of file multi_socket_driver.cc.
|
inline |
Definition at line 55 of file multi_socket_driver.h.