|
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
|
Classes | |
| struct | BackoffConfig |
| class | Connection |
| struct | ConnectionConfig |
| struct | ConnectionStats |
| struct | DatagramHandlerArchetype |
| A handler that accepts every datagram: the shape poll() is checked against. More... | |
| struct | DatagramSourceStats |
| struct | DatagramSubscription |
| struct | DpdkConfig |
| class | DpdkDatagramSource |
| struct | DpdkStats |
| struct | DpdkSubscription |
| class | EcdsaP256Key |
| class | Ed25519Key |
| A parsed Ed25519 key (private, or public only for verification). Move-only. More... | |
| class | ExponentialBackoff |
| class | FixedHexString |
Fixed-capacity, NUL-terminated hex string (no heap). size() excludes the terminator. More... | |
| class | HmacSha256Key |
| HMAC-SHA256 with the key schedule precomputed (see the header comment). More... | |
| class | HttpClient |
| struct | HttpClientConfig |
| struct | HttpClientStats |
| struct | HttpResponse |
| class | IoHandler |
| class | KernelDatagramSource |
| struct | KernelSourceConfig |
| struct | KernelSourceOpen |
Outcome of open(). err is 0 or -errno of the step that failed, for subscription line. More... | |
| struct | McastInterface |
| Interface for multicast membership and IP_MULTICAST_IF: an IPv4 address or an interface index. More... | |
| class | QueryBuilder |
| Builds "k1=v1\&k2=v2" into a fixed buffer, percent-encoding values. More... | |
| class | Reactor |
| struct | RxMeta |
| class | UdpSocket |
| struct | Url |
| class | WsClient |
| struct | WsClientConfig |
| struct | WsStats |
| struct | XdpConfig |
| class | XdpDatagramSource |
| class | XdpFilter |
| The BPF objects of one interface: subscription hash map, XSKMAP, per-CPU fallback counter and the program, plus its XDP link once attached. More... | |
| struct | XdpInterfaceQueues |
| struct | XdpInterfaceStatus |
| struct | XdpSocketStats |
| XDP_STATISTICS of one socket, as of the last refresh_stats(). More... | |
| struct | XdpStats |
| struct | XdpSubscription |
Concepts | |
| concept | ConnectionHandler |
| concept | WsClientHandler |
| concept | DatagramSource |
Typedefs | |
| using | TimerId = std::uint64_t |
| using | Sha1Digest = std::array< std::uint8_t, kSha1Size > |
| using | Sha256Digest = std::array< std::uint8_t, kSha256Size > |
| using | HexSha256 = FixedHexString< kSha256Size > |
| using | HexSha384 = FixedHexString< kSha384Size > |
| using | HexSha512 = FixedHexString< kSha512Size > |
| using | HttpResponseCallback = std::function< void(const HttpResponse &)> |
| using | HttpTargetMaker = std::function< std::string()> |
| Makes a request's target (path and query) when the request is written. | |
Enumerations | |
| enum class | IoEvent : std::uint32_t { None = 0 , Read = 1 , Write = 2 , ReadWrite = 3 } |
| enum class | ReactorBackend : std::uint8_t { Epoll , IoUring } |
| enum class | ConnState : std::uint8_t { Idle , Resolving , Connecting , TlsHandshake , WsHandshake , Authenticating , Subscribing , Live , Stale , Closing , Backoff } |
| enum class | WsProgress : std::uint8_t { TcpConnected , UpgradeSent } |
| Milestones before the upgrade completes, so owners can report fine-grained states. More... | |
| enum class | WsState : std::uint8_t { Idle , Connecting , Upgrading , Open , Closing , Closed } |
| enum class | HttpClientState : std::uint8_t { Idle , Connecting , Ready , Closed } |
| enum class | XdpMode : std::uint8_t { Auto , ZeroCopy , NativeCopy , Generic } |
| Attach and bind mode. More... | |
Functions | |
| constexpr IoEvent | operator| (IoEvent a, IoEvent b) noexcept |
| constexpr bool | has (IoEvent set, IoEvent flag) noexcept |
| std::string_view | to_string (ReactorBackend backend) noexcept |
| "epoll" / "io_uring", the spelling of [engine] net_backend. | |
| bool | parse_reactor_backend (std::string_view text, ReactorBackend &out) noexcept |
Parses "epoll" / "io_uring". Returns false (and leaves out alone) for anything else. | |
| std::string_view | to_string (ConnState s) noexcept |
| void | validate_connection_config (const ConnectionConfig &cfg, Url &url) |
Throws std::invalid_argument on a bad URL; fills url (views into cfg.url). | |
| bool | hmac_sha256 (std::string_view key, std::string_view data, std::span< std::uint8_t, kSha256Size > out) noexcept |
| HMAC-SHA256(key, data). | |
| HexSha256 | hmac_sha256_hex (std::string_view key, std::string_view data) noexcept |
| HexSha384 | hmac_sha384_hex (std::string_view key, std::string_view data) noexcept |
| HMAC-SHA384(key, data) as lowercase hex (Gemini signs its requests and the WebSocket upgrade with it). | |
| HexSha512 | hmac_sha512_hex (std::string_view key, std::string_view data) noexcept |
| HMAC-SHA512(key, data) as lowercase hex (Gate APIv4 signs REST requests and WebSocket logins with it) and SHA-512(data) as lowercase hex (the body digest inside a Gate signature string). | |
| HexSha512 | sha512_hex (std::string_view data) noexcept |
| bool | sha1 (std::string_view data, std::span< std::uint8_t, kSha1Size > out) noexcept |
| bool | sha256 (std::string_view data, std::span< std::uint8_t, kSha256Size > out) noexcept |
| Sha1Digest | sha1 (std::string_view data) noexcept |
| Sha256Digest | sha256 (std::string_view data) noexcept |
| constexpr std::size_t | base64_encoded_size (std::size_t n) noexcept |
RFC 4648 §4 base64 with '=' padding. base64_encoded_size(n) is the exact output size. | |
| constexpr std::size_t | base64_max_decoded_size (std::size_t n) noexcept |
| std::size_t | base64_encode (std::span< const std::uint8_t > in, std::span< char > out) noexcept |
Writes into out (must be >= base64_encoded_size(in.size())); returns bytes written or 0 if the output is too small. | |
| std::string | base64_encode (std::span< const std::uint8_t > in) |
| std::string | base64_encode (std::string_view in) |
| constexpr std::size_t | base64url_encoded_size (std::size_t n) noexcept |
| RFC 4648 §5 base64url without padding, the encoding of JWS/JWT segments. | |
| std::size_t | base64url_encode (std::span< const std::uint8_t > in, std::span< char > out) noexcept |
| std::string | base64url_encode (std::string_view in) |
| std::size_t | base64url_decode (std::string_view in, std::span< std::uint8_t > out) noexcept |
| Unpadded base64url; SIZE_MAX on malformed input or insufficient output space. | |
| std::size_t | base64_decode (std::string_view in, std::span< std::uint8_t > out) noexcept |
| Decodes standard base64 (padding required, no whitespace). | |
| bool | base64_decode (std::string_view in, std::string &out) |
| bool | random_bytes (std::span< std::uint8_t > out) noexcept |
| CSPRNG (RAND_bytes). Returns false if the RNG is unavailable. | |
| std::string | ed25519_sign_base64 (std::string_view private_key_pem, std::string_view data) |
Ed25519 signature (base64) of data using a PEM-encoded PKCS#8 private key. | |
| constexpr bool | is_url_unreserved (char c) noexcept |
| RFC 3986 unreserved characters pass through; everything else becomes %XX. | |
| std::size_t | percent_encode (std::string_view in, std::span< char > out) noexcept |
Returns bytes written, or 0 if out is too small (worst case 3 * in.size()). | |
| bool | parse_ipv4 (std::string_view text, std::uint32_t &out_be) noexcept |
| Parses dotted-quad IPv4 into network byte order. Returns false on anything else. | |
| constexpr bool | is_ipv4_multicast (std::uint32_t addr_be) noexcept |
| int | enable_hw_timestamps (std::string_view ifname) noexcept |
SIOCSHWTSTAMP on ifname: hardware timestamps for all received packets, TX off. | |
| constexpr std::string_view | to_string (XdpMode m) noexcept |
| std::string | xdp_capability_error () |
| "" when the process has CAP_NET_ADMIN, CAP_NET_RAW, CAP_BPF (or CAP_SYS_ADMIN) and CAP_IPC_LOCK in its effective set; otherwise names the missing ones and the setcap command. | |
| std::string | xdp_kernel_error () |
| "" on Linux 5.11 or later; otherwise the reason. | |
| bool | dpdk_available () noexcept |
| True when this build has the DPDK backend. | |
Variables | |
| constexpr TimerId | kInvalidTimer = 0 |
| constexpr std::size_t | kSha1Size = 20 |
| constexpr std::size_t | kSha256Size = 32 |
| constexpr std::size_t | kSha384Size = 48 |
| constexpr std::size_t | kSha512Size = 64 |
| constexpr std::size_t | kEd25519SignatureSize = 64 |
| constexpr std::size_t | kEd25519Base64Size = 88 |
| base64_encoded_size(64) | |
| constexpr std::size_t | kEs256SignatureSize = 64 |
| ECDSA on P-256 with SHA-256 (JWS "ES256", RFC 7518 §3.4): the signature is r || s, 32 bytes each, big-endian. | |
| using fastmm::net::TimerId = typedef std::uint64_t |
| using fastmm::net::Sha1Digest = typedef std::array<std::uint8_t, kSha1Size> |
| using fastmm::net::Sha256Digest = typedef std::array<std::uint8_t, kSha256Size> |
| using fastmm::net::HexSha256 = typedef FixedHexString<kSha256Size> |
| using fastmm::net::HexSha384 = typedef FixedHexString<kSha384Size> |
| using fastmm::net::HexSha512 = typedef FixedHexString<kSha512Size> |
| using fastmm::net::HttpResponseCallback = typedef std::function<void(const HttpResponse&)> |
| using fastmm::net::HttpTargetMaker = typedef std::function<std::string()> |
Makes a request's target (path and query) when the request is written.
Empty: the request is not sent and fails with NetError::Canceled.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
noexcept |
"epoll" / "io_uring", the spelling of [engine] net_backend.
|
noexcept |
Parses "epoll" / "io_uring". Returns false (and leaves out alone) for anything else.
|
noexcept |
| void fastmm::net::validate_connection_config | ( | const ConnectionConfig & | cfg, |
| Url & | url | ||
| ) |
Throws std::invalid_argument on a bad URL; fills url (views into cfg.url).
|
noexcept |
HMAC-SHA256(key, data).
out receives 32 bytes. Never throws; returns false on OpenSSL failure (should not happen for valid inputs).
|
noexcept |
|
noexcept |
HMAC-SHA384(key, data) as lowercase hex (Gemini signs its requests and the WebSocket upgrade with it).
Control path: the key schedule is not kept. Never fails for valid inputs.
|
noexcept |
HMAC-SHA512(key, data) as lowercase hex (Gate APIv4 signs REST requests and WebSocket logins with it) and SHA-512(data) as lowercase hex (the body digest inside a Gate signature string).
Control path: no key schedule is kept. Never fail for valid inputs.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
constexprnoexcept |
RFC 4648 §4 base64 with '=' padding. base64_encoded_size(n) is the exact output size.
|
constexprnoexcept |
|
noexcept |
Writes into out (must be >= base64_encoded_size(in.size())); returns bytes written or 0 if the output is too small.
| std::string fastmm::net::base64_encode | ( | std::span< const std::uint8_t > | in | ) |
| std::string fastmm::net::base64_encode | ( | std::string_view | in | ) |
|
constexprnoexcept |
RFC 4648 §5 base64url without padding, the encoding of JWS/JWT segments.
Writes into out (>= base64url_encoded_size(in.size())); returns bytes written, 0 if out is too small.
|
noexcept |
| std::string fastmm::net::base64url_encode | ( | std::string_view | in | ) |
|
noexcept |
Unpadded base64url; SIZE_MAX on malformed input or insufficient output space.
|
noexcept |
Decodes standard base64 (padding required, no whitespace).
Returns bytes written or SIZE_MAX on malformed input / insufficient output space.
| bool fastmm::net::base64_decode | ( | std::string_view | in, |
| std::string & | out | ||
| ) |
|
noexcept |
CSPRNG (RAND_bytes). Returns false if the RNG is unavailable.
| std::string fastmm::net::ed25519_sign_base64 | ( | std::string_view | private_key_pem, |
| std::string_view | data | ||
| ) |
Ed25519 signature (base64) of data using a PEM-encoded PKCS#8 private key.
Returns an empty string if the key cannot be loaded or is not Ed25519. Parses the PEM on every call: keep an Ed25519Key for repeated signing.
|
constexprnoexcept |
RFC 3986 unreserved characters pass through; everything else becomes %XX.
|
inlinenoexcept |
Returns bytes written, or 0 if out is too small (worst case 3 * in.size()).
|
noexcept |
Parses dotted-quad IPv4 into network byte order. Returns false on anything else.
|
constexprnoexcept |
< first octet 224..239, lowest byte in network order
|
noexcept |
SIOCSHWTSTAMP on ifname: hardware timestamps for all received packets, TX off.
Needs CAP_NET_ADMIN and a NIC that supports it; the setting is device-wide and outlives the process. Returns 0 or -errno (-EOPNOTSUPP / -EINVAL without NIC support, -EPERM without the capability).
|
constexprnoexcept |
| std::string fastmm::net::xdp_capability_error | ( | ) |
"" when the process has CAP_NET_ADMIN, CAP_NET_RAW, CAP_BPF (or CAP_SYS_ADMIN) and CAP_IPC_LOCK in its effective set; otherwise names the missing ones and the setcap command.
| std::string fastmm::net::xdp_kernel_error | ( | ) |
"" on Linux 5.11 or later; otherwise the reason.
|
noexcept |
True when this build has the DPDK backend.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
base64_encoded_size(64)
|
inlineconstexpr |
ECDSA on P-256 with SHA-256 (JWS "ES256", RFC 7518 §3.4): the signature is r || s, 32 bytes each, big-endian.
Coinbase CDP API keys are such keys ("\--\---BEGIN EC PRIVATE KEY\--\---"). Signing draws a fresh random nonce (OpenSSL), so two signatures of the same data differ. Move-only; control path (OpenSSL allocates per signature).