curl-fuzzer C++ reference
Loading...
Searching...
No Matches
mock_server_base.cc File Reference

Implementation of MockServerBase — shared trampolines, shared select() helper, DriveScenario multi-handle RAII, and the scheme classifier that produces the right subclass for a Scenario. More...

Go to the source code of this file.

Functions

curl_socket_t proto_fuzzer::MockServerBaseOpenSocketTrampoline (void *clientp, curlsocktype purpose, struct curl_sockaddr *address)
 C trampoline for CURLOPT_OPENSOCKETFUNCTION.
int proto_fuzzer::MockServerBaseSockOptTrampoline (void *clientp, curl_socket_t curlfd, curlsocktype purpose)
 Translate explicit peer transport metadata into curl's sockopt callback contract.

Detailed Description

Implementation of MockServerBase — shared trampolines, shared select() helper, DriveScenario multi-handle RAII, and the scheme classifier that produces the right subclass for a Scenario.

Definition in file mock_server_base.cc.

Function Documentation

◆ MockServerBaseOpenSocketTrampoline()

curl_socket_t proto_fuzzer::MockServerBaseOpenSocketTrampoline ( void * clientp,
curlsocktype purpose,
struct curl_sockaddr * address )

C trampoline for CURLOPT_OPENSOCKETFUNCTION.

Declared at namespace scope so it can be a friend of MockServerBase.

Parameters
clientpPointer to the MockServerBase instance.
purposeThe socket role curl is asking the mock to provide.
addressCurl's mutable description of the intended destination.
Returns
The client-side socket fd as a curl_socket_t.

Definition at line 48 of file mock_server_base.cc.

◆ MockServerBaseSockOptTrampoline()

int proto_fuzzer::MockServerBaseSockOptTrampoline ( void * clientp,
curl_socket_t curlfd,
curlsocktype purpose )

Translate explicit peer transport metadata into curl's sockopt callback contract.

The descriptor is used only as an opaque identity; sandbox policy must not decide whether an otherwise valid in-process transport can run.

Parameters
clientpPointer to the MockServerBase instance.
curlfdDescriptor returned by the open-socket callback.
purposeSocket role assigned by curl.
Returns
CURL_SOCKOPT_ALREADY_CONNECTED for prepared stream peers, otherwise CURL_SOCKOPT_OK.

Definition at line 61 of file mock_server_base.cc.