![]() |
Kurlyk
|
Primary namespace for the Kurlyk library, encompassing initialization, request management, and utility functions. More...
Namespaces | |
| namespace | core |
| namespace | startup |
| namespace | utils |
Classes | |
| class | HttpRequest |
| Represents an HTTP request. More... | |
| class | HttpResponse |
| Represents the response received from an HTTP request, including headers, content, and status. More... | |
| class | HttpClient |
| Concrete HTTP client for making requests to a specific host. More... | |
| class | HttpRequestManager |
| Manages and processes HTTP requests using a singleton pattern. More... | |
| class | HttpBatchRequestHandler |
| Handles multiple asynchronous HTTP requests using libcurl's multi interface. More... | |
| class | HttpRateLimiter |
| Manages rate limits for HTTP requests, ensuring compliance with set limits. More... | |
| class | HttpRequestContext |
| Represents the context of an HTTP request, including the request object, callback function, retry attempts, and timing. More... | |
| class | HttpRequestHandler |
| Manages asynchronous HTTP requests, including handling responses, retries, and error processing. More... | |
| class | Cookie |
| Represents an HTTP cookie. More... | |
| struct | SubmitResult |
| Represents the synchronous result of trying to enqueue or submit work. More... | |
| class | BaseWebSocketClient |
| Base class implementing core functionality for WebSocket clients, managing events, states, and message sending. More... | |
| class | IWebSocketClient |
| Legacy internal compatibility interface for full WebSocket client implementations. More... | |
| class | IWebSocketSender |
| Public sender abstraction used by WebSocketEventData::sender. More... | |
| class | WebSocketEventData |
| Encapsulates data for a WebSocket event, providing information about event type, message, status, and errors. More... | |
| class | WebSocketRateLimiter |
| Manages rate limiting for WebSocket requests based on predefined limits. More... | |
| class | EmscriptenWebSocketClientAdapter |
| A WebSocket client implementation using the Emscripten API. More... | |
| class | SimpleWebSocketClientAdapter |
| A WebSocket client adapter that leverages the Simple WebSocket Server library for managing WebSocket connections. More... | |
| class | SimpleWebSocketWorker |
| Singleton worker that manages asynchronous WebSocket operations. More... | |
| class | WebSocketConfig |
| Configuration parameters for establishing and managing WebSocket connections. More... | |
| class | WebSocketSendInfo |
| Holds information for sending a WebSocket message, including rate limiting, close status, and a callback. More... | |
| class | WebSocketClient |
| Public facade for managing WebSocket connections, events, and message sending. More... | |
| class | WebSocketManager |
| Manages backend-specific WebSocket client instances and coordinates their lifecycle. More... | |
Typedefs | |
| using | HttpRequestPtr = std::unique_ptr<HttpRequest> |
| A unique pointer to an HttpRequest object for memory management. | |
| using | HttpResponsePtr = std::unique_ptr<HttpResponse> |
| A unique pointer to an HttpResponse object for memory management. | |
| using | HttpResponseCallback = std::function<void(HttpResponsePtr response)> |
| Type definition for the callback function used to handle HTTP responses. | |
| using | Headers = utils::CaseInsensitiveMultimap |
| Alias for HTTP headers, providing a case-insensitive unordered multimap. | |
| using | QueryParams = utils::CaseInsensitiveMultimap |
| Alias for query parameters in HTTP requests, stored case-insensitively. | |
| using | Cookies = utils::CaseInsensitiveCookieMultimap |
| Alias for HTTP cookies, stored case-insensitively. | |
| using | WebSocketClientPtr = std::shared_ptr<IWebSocketClient> |
| Legacy shared-pointer alias for the internal compatibility interface. | |
| using | WebSocketSenderPtr = std::shared_ptr<IWebSocketSender> |
| Shared pointer alias for the sender abstraction used in WebSocketEventData. | |
| using | selected_backend_client_ptr = std::shared_ptr<selected_backend_client_t> |
| Shared pointer to the compile-time selected backend client type. | |
| using | selected_backend_client_weak_ptr = std::weak_ptr<selected_backend_client_t> |
| Weak pointer to the compile-time selected backend client type. | |
Enumerations | |
| enum class | ProxyType { PROXY_HTTP = 0 , PROXY_HTTPS , PROXY_HTTP_1_0 , PROXY_SOCKS4 , PROXY_SOCKS4A , PROXY_SOCKS5 , PROXY_SOCKS5_HOSTNAME } |
| Enumeration of supported proxy types compatible with libcurl. More... | |
| enum class | RateLimitType { RL_GENERAL , RL_SPECIFIC } |
| Defines rate limit scope categories. More... | |
| enum class | WebSocketEventType { WS_OPEN , WS_MESSAGE , WS_CLOSE , WS_ERROR } |
| Types of WebSocket events. More... | |
Functions | |
| long | create_rate_limit (long requests_per_period, long period_ms) |
| Creates a rate limit with specified parameters. | |
| long | create_rate_limit_rpm (long requests_per_minute) |
| Creates a rate limit based on Requests Per Minute (RPM). | |
| long | create_rate_limit_rps (long requests_per_second) |
| Creates a rate limit based on Requests Per Second (RPS). | |
| bool | remove_limit (long limit_id) |
| Removes an existing rate limit with the specified identifier. | |
| uint64_t | generate_request_id () |
| Generates a new unique request ID. | |
| void | set_max_pending_requests (std::size_t max_pending_requests) |
| Sets the maximum number of requests accepted into the global pending queue. | |
| std::size_t | max_pending_requests () |
| Returns the current global pending queue limit. | |
| void | cancel_request_by_id (uint64_t request_id, std::function< void()> callback) |
| Cancels a request by its unique identifier. | |
| std::future< void > | cancel_request_by_id (uint64_t request_id) |
| Cancels a request by its unique identifier and returns a future. | |
| HttpResponsePtr | make_submit_error_response (const SubmitResult &submit_result) |
| Creates a ready HTTP response describing a synchronous submission rejection. | |
| void | safe_set_response (std::shared_ptr< std::promise< HttpResponsePtr > > promise, HttpResponsePtr response) |
| Safely sets an HTTP response on the provided promise. | |
| SubmitResult | submit_http_request (std::unique_ptr< HttpRequest > request_ptr, HttpResponseCallback callback) |
| Attempts to submit an HTTP request and reports the admission result. | |
| bool | http_request (std::unique_ptr< HttpRequest > request_ptr, HttpResponseCallback callback) |
| Sends an HTTP request with callback. | |
| std::future< HttpResponsePtr > | http_request (std::unique_ptr< HttpRequest > request_ptr) |
| Sends an HTTP request asynchronously and returns a future with the response. | |
| uint64_t | http_request (const std::string &method, const std::string &url, const QueryParams &query, const Headers &headers, const std::string &content, HttpResponseCallback callback) |
| Sends an HTTP request with detailed parameters and a callback. | |
| uint64_t | http_request (const std::string &method, const std::string &url, const QueryParams &query, const Headers &headers, const std::string &content, bool streaming, HttpResponseCallback callback) |
| Sends an HTTP request with detailed parameters, streaming mode, and a callback. | |
| std::pair< uint64_t, std::future< HttpResponsePtr > > | http_request (const std::string &method, const std::string &url, const QueryParams &query, const Headers &headers, const std::string &content) |
| Sends an HTTP request asynchronously with detailed parameters and returns a future. | |
| uint64_t | http_request (const std::string &method, const std::string &host, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, HttpResponseCallback callback) |
| Sends an HTTP request with a specified host, path, and callback. | |
| uint64_t | http_request (const std::string &method, const std::string &host, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, bool streaming, HttpResponseCallback callback) |
| Sends an HTTP request with host/path parameters, streaming mode, and a callback. | |
| uint64_t | http_get (const std::string &url, const QueryParams &query, const Headers &headers, HttpResponseCallback callback) |
| Sends an asynchronous HTTP GET request with a callback. | |
| uint64_t | http_get (const std::string &url, const QueryParams &query, const Headers &headers, bool streaming, HttpResponseCallback callback) |
| Sends an asynchronous HTTP GET request with streaming callbacks. | |
| std::pair< uint64_t, std::future< HttpResponsePtr > > | http_get (const std::string &url, const QueryParams &query, const Headers &headers) |
| Sends an asynchronous HTTP GET request and returns a future with the response. | |
| uint64_t | http_post (const std::string &url, const QueryParams &query, const Headers &headers, const std::string &content, HttpResponseCallback callback) |
| Sends an asynchronous HTTP POST request with a callback. | |
| uint64_t | http_post (const std::string &url, const QueryParams &query, const Headers &headers, const std::string &content, bool streaming, HttpResponseCallback callback) |
| Sends an asynchronous HTTP POST request with streaming callbacks. | |
| std::pair< uint64_t, std::future< HttpResponsePtr > > | http_post (const std::string &url, const QueryParams &query, const Headers &headers, const std::string &content) |
| Sends an asynchronous HTTP POST request and returns a future with the response. | |
| void | init (const bool use_async=true) |
| Initializes the Kurlyk library, setting up necessary managers and the network worker. | |
| void | deinit () |
| Deinitializes the Kurlyk library, stopping async processing or cleaning up synchronous state. | |
| void | process () |
| Processes pending requests (used in synchronous mode). | |
| void | shutdown () |
| Shuts down all network operations, resetting the state of the network worker and clearing pending requests. | |
| void | add_error_handler (::kurlyk::core::NetworkWorker::ErrorHandler handler) |
| Registers a global error handler for the network worker. | |
| const std::string & | to_str (ProxyType value) noexcept |
| Converts a ProxyType enum value to its string representation. | |
| const std::string & | to_str (RateLimitType value) noexcept |
| Converts a RateLimitType enum value to its string representation. | |
| const std::string & | to_str (WebSocketEventType value) noexcept |
| Converts a WebSocketEventType enum value to its string representation. | |
| template<typename T> | |
| T | to_enum (const std::string &str) |
| Template specialization to convert string to enum value. | |
| template<> | |
| ProxyType | to_enum< ProxyType > (const std::string &str) |
| template<> | |
| RateLimitType | to_enum< RateLimitType > (const std::string &str) |
| template<> | |
| WebSocketEventType | to_enum< WebSocketEventType > (const std::string &str) |
| std::ostream & | operator<< (std::ostream &os, ProxyType type) |
| std::ostream & | operator<< (std::ostream &os, RateLimitType type) |
| std::ostream & | operator<< (std::ostream &os, WebSocketEventType type) |
Primary namespace for the Kurlyk library, encompassing initialization, request management, and utility functions.
Alias for HTTP cookies, stored case-insensitively.
Definition at line 68 of file CaseInsensitiveMultimap.hpp.
Alias for HTTP headers, providing a case-insensitive unordered multimap.
Definition at line 62 of file CaseInsensitiveMultimap.hpp.
| using kurlyk::HttpRequestPtr = std::unique_ptr<HttpRequest> |
A unique pointer to an HttpRequest object for memory management.
Definition at line 290 of file HttpRequest.hpp.
| using kurlyk::HttpResponseCallback = std::function<void(HttpResponsePtr response)> |
Type definition for the callback function used to handle HTTP responses.
| response | A pointer to the HttpResponse object. |
Definition at line 37 of file HttpResponse.hpp.
| using kurlyk::HttpResponsePtr = std::unique_ptr<HttpResponse> |
A unique pointer to an HttpResponse object for memory management.
Definition at line 33 of file HttpResponse.hpp.
Alias for query parameters in HTTP requests, stored case-insensitively.
Definition at line 65 of file CaseInsensitiveMultimap.hpp.
| using kurlyk::selected_backend_client_ptr = std::shared_ptr<selected_backend_client_t> |
Shared pointer to the compile-time selected backend client type.
Definition at line 29 of file WebSocketManager.hpp.
| using kurlyk::selected_backend_client_weak_ptr = std::weak_ptr<selected_backend_client_t> |
Weak pointer to the compile-time selected backend client type.
Definition at line 31 of file WebSocketManager.hpp.
| using kurlyk::WebSocketClientPtr = std::shared_ptr<IWebSocketClient> |
Legacy shared-pointer alias for the internal compatibility interface.
Definition at line 80 of file IWebSocketClient.hpp.
| using kurlyk::WebSocketSenderPtr = std::shared_ptr<IWebSocketSender> |
Shared pointer alias for the sender abstraction used in WebSocketEventData.
Definition at line 87 of file IWebSocketSender.hpp.
|
strong |
|
strong |
|
strong |
|
inline |
Registers a global error handler for the network worker.
| handler | Callback invoked when an error is reported. |
Definition at line 44 of file runtime.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Deinitializes the Kurlyk library, stopping async processing or cleaning up synchronous state.
Call this function after manual init(true) or init(false) before exiting the application.
Definition at line 26 of file runtime.hpp.
|
inline |
|
inline |
Sends an asynchronous HTTP GET request and returns a future with the response.
| url | The full request URL. |
| query | Query parameters for the GET request. |
| headers | HTTP headers to include. |
|
inline |
Sends an asynchronous HTTP GET request with streaming callbacks.
| url | Full request URL. |
| query | Query parameters for the GET request. |
| headers | HTTP headers to include. |
| streaming | If true, invokes callback for each received body chunk. |
| callback | Callback function invoked for chunks and request completion. |
|
inline |
Sends an asynchronous HTTP GET request with a callback.
| url | The full request URL. |
| query | Query parameters for the GET request. |
| headers | HTTP headers to include. |
| callback | Callback function to be executed upon request completion. |
|
inline |
Sends an asynchronous HTTP POST request and returns a future with the response.
| url | The full request URL. |
| query | Query parameters for the POST request. |
| headers | HTTP headers to include. |
| content | The body content for the POST request. |
|
inline |
Sends an asynchronous HTTP POST request with streaming callbacks.
| url | Full request URL. |
| query | Query parameters for the POST request. |
| headers | HTTP headers to include. |
| content | Body content for the POST request. |
| streaming | If true, invokes callback for each received body chunk. |
| callback | Callback function invoked for chunks and request completion. |
|
inline |
Sends an asynchronous HTTP POST request with a callback.
| url | The full request URL. |
| query | Query parameters for the POST request. |
| headers | HTTP headers to include. |
| content | The body content for the POST request. |
| callback | Callback function to be executed upon request completion. |
|
inline |
Sends an HTTP request with host/path parameters, streaming mode, and a callback.
| method | HTTP method (e.g., "GET", "POST"). |
| host | Host name or IP address. |
| path | URL path for the request. |
| query | Query parameters for the request. |
| headers | HTTP headers to include. |
| content | Body content for POST requests. |
| streaming | If true, invokes callback for each received body chunk. |
| callback | Callback function invoked for chunks and request completion. |
|
inline |
Sends an HTTP request with a specified host, path, and callback.
| method | HTTP method (e.g., "GET", "POST"). |
| host | Host name or IP address. |
| path | URL path for the request. |
| query | Query parameters for the request. |
| headers | HTTP headers to include. |
| content | The body content for POST requests. |
| callback | Callback function to be executed upon request completion. |
|
inline |
Sends an HTTP request asynchronously with detailed parameters and returns a future.
| method | HTTP method (e.g., "GET", "POST"). |
| url | The full request URL. |
| query | Query parameters for the request. |
| headers | HTTP headers to include. |
| content | The body content for POST requests. |
|
inline |
Sends an HTTP request with detailed parameters, streaming mode, and a callback.
| method | HTTP method (e.g., "GET", "POST"). |
| url | Full request URL. |
| query | Query parameters for the request. |
| headers | HTTP headers to include. |
| content | Body content for POST requests. |
| streaming | If true, invokes callback for each received body chunk. |
| callback | Callback function invoked for chunks and request completion. |
|
inline |
Sends an HTTP request with detailed parameters and a callback.
| method | HTTP method (e.g., "GET", "POST"). |
| url | The full request URL. |
| query | Query parameters for the request. |
| headers | HTTP headers to include. |
| content | The body content for POST requests. |
| callback | Callback function to be executed upon request completion. |
|
inline |
Sends an HTTP request asynchronously and returns a future with the response.
| request_ptr | The HTTP request object with the request details. |
|
inline |
Sends an HTTP request with callback.
| request_ptr | The HTTP request object with the request details. |
| callback | The callback function to be called upon request completion. |
|
inline |
Initializes the Kurlyk library, setting up necessary managers and the network worker.
| use_async | If true, enables asynchronous processing for requests. Call this function before using the library to ensure all components are initialized. |
Definition at line 13 of file runtime.hpp.
|
inline |
Creates a ready HTTP response describing a synchronous submission rejection.
| submit_result | Submission result containing the rejection error code. |
|
inline |
|
inline |
Definition at line 79 of file type_utils.hpp.
|
inline |
Definition at line 83 of file type_utils.hpp.
|
inline |
Definition at line 87 of file type_utils.hpp.
|
inline |
Processes pending requests (used in synchronous mode).
This function should be called periodically if the library is used in synchronous mode.
Definition at line 32 of file runtime.hpp.
|
inline |
|
inline |
|
inline |
Sets the maximum number of requests accepted into the global pending queue.
| max_pending_requests | Queue limit, or 0 to keep the queue unbounded. |
|
inline |
Shuts down all network operations, resetting the state of the network worker and clearing pending requests.
Use this function to stop all network operations and prepare the library for shutdown.
Definition at line 38 of file runtime.hpp.
|
inline |
Attempts to submit an HTTP request and reports the admission result.
| request_ptr | The HTTP request object with the request details. |
| callback | The callback function to be called upon request completion. |
| T kurlyk::to_enum | ( | const std::string & | str | ) |
Template specialization to convert string to enum value.
|
inline |
Definition at line 40 of file type_utils.hpp.
|
inline |
Definition at line 56 of file type_utils.hpp.
|
inline |
Definition at line 67 of file type_utils.hpp.
|
inlinenoexcept |
Converts a ProxyType enum value to its string representation.
Definition at line 11 of file type_utils.hpp.
|
inlinenoexcept |
Converts a RateLimitType enum value to its string representation.
Definition at line 20 of file type_utils.hpp.
|
inlinenoexcept |
Converts a WebSocketEventType enum value to its string representation.
Definition at line 28 of file type_utils.hpp.