|
curl-fuzzer C++ reference
|
Runs the existing WebSocket Upgrade, framing, callback, and manual-I/O behavior over a verified nonblocking TLS connection. More...
#include <tls_websocket_mock_server.h>
Public Member Functions | |
| TlsWebSocketMockServer (curl::fuzzer::proto::TlsCertificateChainProfile certificate_chain=curl::fuzzer::proto::TLS_CERTIFICATE_CHAIN_DEFAULT_EC) | |
| Construct a secure WebSocket peer with the selected certificate chain. | |
| void | ObserveState () override |
| Retain protocol outcomes in coverage and introspector builds. | |
| void | Install (CURL *easy) override |
| Install the common WebSocket callbacks, then require verification against the checked-in TLS test certificate. | |
| std::size_t | completed_handshake_count () const |
| Public Member Functions inherited from proto_fuzzer::WebSocketMockServer | |
| WebSocketMockServer () | |
| Construct an idle WebSocketMockServer with no queued frames. | |
| ~WebSocketMockServer () override | |
| Default destructor; the owned MockConnection (if any) cleans up its socketpair. | |
| void | ObserveState () override |
| Retain protocol outcomes in coverage and introspector builds. | |
| void | Install (CURL *easy) override |
| Install the shared socket trampolines via the base, then layer a WebSocket-aware WRITEFUNCTION / HEADERFUNCTION on top. | |
| void | SetFrames (std::vector< std::string > frames) |
| Queue RFC 6455 wire-byte chunks to emit once the handshake has completed. | |
| void | SetManualDelivery (bool manual) |
| Toggle streaming (false, default) vs manual (true) chunk delivery. | |
| bool | manual_delivery () const |
| bool | TryAdvanceHandshake (bool *made_progress=nullptr) |
| Drive the WebSocket opening handshake: read whatever curl has written so far, and once we've seen the end of the request headers, reply with a valid 101 Switching Protocols. | |
| bool | handshake_sent () const |
| bool | DeliverNextChunk () |
| Push the next queued frame when curl is ready. | |
| bool | has_more_chunks () const |
| std::size_t | remaining_chunks () const |
| const std::string & | PeekChunk (std::size_t index) const |
| Access a pending chunk without consuming it. | |
| void | ConsumeChunk () |
| Advance the pending-chunk cursor by one. No-op when no chunks remain. | |
| bool | PushRawBytes (const unsigned char *data, std::size_t size) |
| Push raw bytes onto the server fd. | |
| bool | ws_probe_fired () const |
| Return the one-shot probe gate. | |
| void | MarkWsProbeFired () |
| Flip the one-shot gate closed. | |
| CURL * | easy_handle () const |
| std::size_t | manual_received_bytes () 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 | ConfigureRequestData (ScenarioRequestData *request_data) |
| Bind protocol-specific work to the request-data callbacks after their per-scenario state has been constructed. | |
| 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 | |
| std::unique_ptr< MockConnection > | CreateConnection () override |
| Create one TLS-wrapped socketpair for the WebSocket exchange. | |
| std::size_t | DrainHandshakeData () override |
| Advance TLS and expose only decrypted application bytes to the inherited WebSocket observer. | |
| void | FlushTransport () override |
| Turn queued application plaintext into TLS records before curl's next receive call, including the final frame in a manual-drive scenario. | |
| Protected Member Functions inherited from proto_fuzzer::WebSocketMockServer | |
| void | ObserveIncomingData (const unsigned char *data, std::size_t size) override |
| Collect application bytes consumed by the active transport. | |
| curl_socket_t | HandleOpenSocket (curlsocktype purpose=CURLSOCKTYPE_IPCXN, struct curl_sockaddr *address=nullptr) override |
| Called by the OPENSOCKETFUNCTION trampoline in the base class. | |
| void | RunLoop (CURLM *multi, CURL *easy, const curl::fuzzer::proto::Scenario &scenario) override |
| Seed the mock from the scenario, then run the perform loop. | |
| 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. | |
| virtual SocketSetupDisposition | GetSocketSetupDisposition (curl_socket_t curlfd, curlsocktype purpose) const |
| Describe the socket returned by HandleOpenSocket without issuing native descriptor queries. | |
| 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. | |
Runs the existing WebSocket Upgrade, framing, callback, and manual-I/O behavior over a verified nonblocking TLS connection.
Definition at line 26 of file tls_websocket_mock_server.h.
|
explicit |
Construct a secure WebSocket peer with the selected certificate chain.
| certificate_chain | Fixed certificate-chain profile to present. |
Definition at line 16 of file tls_websocket_mock_server.cc.
| std::size_t proto_fuzzer::TlsWebSocketMockServer::completed_handshake_count | ( | ) | const |
Definition at line 53 of file tls_websocket_mock_server.cc.
|
overrideprotectedvirtual |
Create one TLS-wrapped socketpair for the WebSocket exchange.
Reimplemented from proto_fuzzer::WebSocketMockServer.
Definition at line 35 of file tls_websocket_mock_server.cc.
|
overrideprotectedvirtual |
Advance TLS and expose only decrypted application bytes to the inherited WebSocket observer.
Reimplemented from proto_fuzzer::WebSocketMockServer.
Definition at line 40 of file tls_websocket_mock_server.cc.
|
overridevirtual |
Install the common WebSocket callbacks, then require verification against the checked-in TLS test certificate.
| easy | Easy handle that will initiate the WSS exchange. |
Reimplemented from proto_fuzzer::MockServerBase.
Definition at line 28 of file tls_websocket_mock_server.cc.