curl-fuzzer C++ reference
Loading...
Searching...
No Matches
proto_fuzzer::TransferSession Class Reference

Own per-transfer resources with one teardown contract: detach request callbacks and lists, clean the easy, then release share state, baseline lists, and anonymous files. More...

#include <transfer_session.h>

Public Member Functions

bool Initialize ()
 Allocate the easy lazily so unused concurrent-transfer slots stay empty.
CURL * easy () const
 Borrow the owned easy; callers must not clean it themselves.
void ApplyBaseline (const curl::fuzzer::proto::Scenario &scenario)
 Apply baseline options and retain their CONNECT_TO storage.
bool ResetConfiguration ()
 Reset pre-transfer configuration while preserving prepared parser files.
bool PrepareInputFiles (const curl::fuzzer::proto::Scenario &scenario, ScenarioRunMode mode)
 Copy bounded parser inputs into lazily allocated anonymous files.
const char * FileSourcePath () const
 Return the pathname of the prepared FILE source/sink.
void ApplyInputFiles ()
 Apply prepared parser paths after baseline and peer installation.
void ApplyPinnedPublicKeyFile ()
 Install the prepared public-key pin path after generic scalar options.
void ConfigureAltSvcRouting (const std::string &host_path)
 Enable isolated Alt-Svc routing for the canonical deep-HTTP authority.
ScenarioRequestData * InstallRequestData (const curl::fuzzer::proto::Scenario &scenario, bool apply_resolve_entries=false)
 Install owned request attachments.
ApiLifecycle * InstallApiLifecycle (const curl::fuzzer::proto::ApiPlan &plan, std::string_view url)
 Install API/share state that survives easy cleanup.
void Close ()
 Release all resources in their required order. Safe to call repeatedly.

Detailed Description

Own per-transfer resources with one teardown contract: detach request callbacks and lists, clean the easy, then release share state, baseline lists, and anonymous files.

The installed peer and any borrowed Scenario must outlive this session. Multi owners must remove the easy before Close(). Sessions cannot move because callbacks retain addresses of their state.

Definition at line 32 of file transfer_session.h.

Member Function Documentation

◆ ApplyBaseline()

void proto_fuzzer::TransferSession::ApplyBaseline ( const curl::fuzzer::proto::Scenario & scenario)

Apply baseline options and retain their CONNECT_TO storage.

Parameters
scenarioTransfer whose scheme, trace_ids, and trace_config select the peer allowlist and trace configuration.

Definition at line 93 of file transfer_session.cc.

◆ ApplyPinnedPublicKeyFile()

void proto_fuzzer::TransferSession::ApplyPinnedPublicKeyFile ( )

Install the prepared public-key pin path after generic scalar options.

This field is the only protobuf-controlled route to curl's filename-backed pin parser; the path itself always names a descriptor owned by this session.

Definition at line 180 of file transfer_session.cc.

◆ ConfigureAltSvcRouting()

void proto_fuzzer::TransferSession::ConfigureAltSvcRouting ( const std::string & host_path)

Enable isolated Alt-Svc routing for the canonical deep-HTTP authority.

Parameters
host_pathScenario URL authority/path used by this transfer.

Definition at line 191 of file transfer_session.cc.

◆ easy()

CURL * proto_fuzzer::TransferSession::easy ( ) const

Borrow the owned easy; callers must not clean it themselves.

Returns
Easy handle, or nullptr before successful initialization.

Definition at line 88 of file transfer_session.cc.

◆ FileSourcePath()

const char * proto_fuzzer::TransferSession::FileSourcePath ( ) const

Return the pathname of the prepared FILE source/sink.

The path names only a descriptor owned by this session and is unavailable in every other lane.

Returns
Stable /proc/self/fd/N path, or nullptr without a ready source.

Definition at line 146 of file transfer_session.cc.

◆ Initialize()

bool proto_fuzzer::TransferSession::Initialize ( )

Allocate the easy lazily so unused concurrent-transfer slots stay empty.

Returns
Whether the session has a usable easy handle.

Definition at line 79 of file transfer_session.cc.

◆ InstallApiLifecycle()

ApiLifecycle * proto_fuzzer::TransferSession::InstallApiLifecycle ( const curl::fuzzer::proto::ApiPlan & plan,
std::string_view url )

Install API/share state that survives easy cleanup.

Parameters
planLive plan until session teardown.
urlURL used only during lifecycle construction.
Returns
Lifecycle owner, or nullptr if absent/already installed.

Definition at line 226 of file transfer_session.cc.

◆ InstallRequestData()

ScenarioRequestData * proto_fuzzer::TransferSession::InstallRequestData ( const curl::fuzzer::proto::Scenario & scenario,
bool apply_resolve_entries = false )

Install owned request attachments.

The Scenario remains borrowed.

Parameters
scenarioLive, unmodified source until session teardown.
apply_resolve_entriesInstall resolver-lane mappings.
Returns
Request owner, or nullptr without an easy or if already installed.

Definition at line 213 of file transfer_session.cc.

◆ PrepareInputFiles()

bool proto_fuzzer::TransferSession::PrepareInputFiles ( const curl::fuzzer::proto::Scenario & scenario,
ScenarioRunMode mode )

Copy bounded parser inputs into lazily allocated anonymous files.

Parameters
scenarioSource of parser-file bytes; not retained.
modeSelect the FILE source or deep HTTP/TLS parser inputs.
Returns
False after easy initialization, when paths may be retained.

Definition at line 116 of file transfer_session.cc.

◆ ResetConfiguration()

bool proto_fuzzer::TransferSession::ResetConfiguration ( )

Reset pre-transfer configuration while preserving prepared parser files.

Returns
False if request or API callback state has already been installed.

Definition at line 102 of file transfer_session.cc.


The documentation for this class was generated from the following files: