|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
Namespaces | |
| namespace | internal |
Classes | |
| struct | ByteChunkingOptions |
| Bounds packet size and incomplete-message memory during reassembly. More... | |
| struct | BytePacket |
| Parsed packet metadata plus the owned piece of application payload. More... | |
| class | ByteReassembler |
| Bounded, thread-safe reassembly for interleaved binary messages. More... | |
| struct | ChannelFramingOptions |
| Packetisation and incomplete-message bounds for a binary WireStream. More... | |
| class | ChannelWireStream |
| Shared WireStream lifecycle and framing for binary channels. More... | |
| struct | CorsOptions |
| Cross-origin policy for an A11 HTTP surface. More... | |
| struct | DescribeEndpointOptions |
| Where and whether a server answers discovery over plain HTTP. More... | |
| struct | DownloadOptions |
| Where a download goes, and what proves it arrived intact. More... | |
| struct | FetchOptions |
| What to request, and how hard to try. More... | |
| class | Http2Client |
| An HTTP/2 client connection, reusable across many streams. More... | |
| class | Http2Connection |
| class | Http2DuplexStream |
| Client side of an HTTP/2 extended CONNECT stream. More... | |
| struct | Http2Options |
| Body-size limits, buffering thresholds, deadline, TLS, and HTTP protocol negotiation for an HTTP client or server. More... | |
| class | Http2RequestBodyStream |
| Pull-oriented request DATA for a request that stays open. More... | |
| class | Http2ResponseStream |
| A pull-oriented HTTP/2 response body stream. More... | |
| class | Http2ResponseWriter |
| Server-side handle for writing an HTTP/2 response to one request. More... | |
| class | Http2Server |
| An HTTP/2 server that dispatches each request to an async handler. More... | |
| struct | Http2TlsOptions |
| TLS settings for an HTTP/2 client or server (certificates, peer verification). More... | |
| class | HttpConnectionLease |
| A borrowed connection, held for as long as a caller needs it. More... | |
| class | HttpConnectionPool |
| Hands out connections to origins, sharing them while they are in use. More... | |
| struct | HttpPushedResponse |
| A response the server sent without being asked (HTTP/2 server push). More... | |
| struct | HttpRequest |
| A parsed HTTP/2 request: pseudo-headers, fields, and body. More... | |
| struct | HttpResponse |
| A fully buffered HTTP/2 response: head plus complete body. More... | |
| struct | HttpResponseHead |
| Status line and headers of an HTTP/2 response, without the body. More... | |
| class | HttpSseClientWireStream |
| The client-side HTTP SSE wire stream, dialing out to a server URL. More... | |
| struct | HttpSseOptions |
| Endpoint paths and transport tuning for an HTTP SSE wire stream. More... | |
| class | HttpSseServer |
| Hosts HTTP SSE wire streams on top of an HTTP/2 server. More... | |
| class | HttpSseServerWireStream |
| The server-side HTTP SSE wire stream, accepted from a client. More... | |
| class | HttpSseWireStream |
| Common base for the client and server HTTP SSE wire streams. More... | |
| class | InProcessWireStream |
| A WireStream endpoint wired directly to a peer in the same process. More... | |
| struct | ParsedUrl |
| An absolute URL split into the parts a connection needs. More... | |
| struct | ServerHeaderOptions |
| The response-header policy of one A11 HTTP surface. More... | |
| struct | SignallingAdmission |
| What a peer presented when asking to register an identity. More... | |
| class | SignallingEndpoint |
| An identity-bound endpoint into an in-process SignallingService. More... | |
| struct | SignallingMessage |
| One signalling payload: an SDP description, an ICE candidate, or an error. More... | |
| class | SignallingService |
| An in-process broker that routes signalling messages by identity. More... | |
| class | SignallingTransport |
| Abstract identity-bound channel over which signalling flows. More... | |
| struct | TurnServer |
| Address and credentials for a TURN relay used during ICE. More... | |
| struct | WebRtcConfiguration |
| ICE, fragmentation, and binding settings for a WebRTC connection. More... | |
| class | WebRtcWireServer |
| Accepts incoming WebRTC peer connections under a fixed identity. More... | |
| class | WebRtcWireStream |
| A WireStream that carries A11 traffic over a WebRTC data channel. More... | |
| struct | WebSocketClientOptions |
| Client-side tuning for a WebSocketWireStream connection. More... | |
| struct | WebSocketServerOptions |
| Listen address, path, and per-stream defaults for a WebSocketWireServer. More... | |
| class | WebSocketSignallingClient |
| A SignallingTransport that relays messages over a WebSocket. More... | |
| struct | WebSocketSignallingClientOptions |
| Connection tuning for a WebSocketSignallingClient. More... | |
| class | WebSocketSignallingServer |
| Fronts an in-process SignallingService over a WebSocket. More... | |
| struct | WebSocketSignallingServerOptions |
| Listen address, limits and policy hooks for a WebSocketSignallingServer. More... | |
| class | WebSocketWireServer |
| Accepts inbound WebSocket connections and hands each to a callback. More... | |
| class | WebSocketWireStream |
| A WireStream that carries A11 traffic over a client or accepted WebSocket. More... | |
| class | WireStream |
| A bidirectional, message-oriented channel between two A11 endpoints. More... | |
| struct | WireStreamOptions |
| Buffering, sizing, and deadline limits for a WireStream endpoint. More... | |
| class | WireStreamWithRecv |
| Pull-oriented adapter for a callback-driven WireStream. More... | |
Typedefs | |
| using | DescribeActionsHandler = std::function< absl::StatusOr< std::string >(std::string_view name, std::string_view query)> |
| Answers a discovery request without opening a wire stream. | |
| using | OnFetchProgress = std::function< void(std::uint64_t bytes_done, std::uint64_t bytes_total)> |
| Called as a body arrives. | |
| using | FetchSink = std::function< absl::Status(std::string_view chunk)> |
| Receives body chunks in order. | |
| using | HttpRelayObserver = std::function< absl::Status(std::string_view event, const HttpResponseHead &head, std::string_view data)> |
| Observe response headers/body/completion without altering the exchange. | |
| using | HttpHeaders = std::vector< std::pair< std::string, std::string > > |
| An ordered list of (name, value) HTTP/2 header fields. | |
| using | Http2RequestHandler = std::function< a11::Task(HttpRequest request, std::shared_ptr< Http2ResponseWriter > response)> |
| Callback dispatched for each inbound request, given a response writer. | |
| using | OnHttpSseConnect = std::function< a11::Task(std::shared_ptr< HttpSseServerWireStream >)> |
| Callback invoked with each accepted server-side SSE wire stream. | |
| using | HttpSseWireStreamServer = HttpSseServer |
| Alias for HttpSseServer, spelled to match the WireStream naming family. | |
| using | OnSignallingMessage = std::function< a11::Task(SignallingMessage message)> |
| Async callback invoked for each inbound SignallingMessage. | |
| using | OnWebRtcStream = std::function< a11::Task(std::shared_ptr< WebRtcWireStream >)> |
| Callback invoked with each newly negotiated peer WireStream. | |
| using | OnSignallingAdmission = std::function< a11::Task(SignallingAdmission)> |
| Decides whether a peer may register, asynchronously. | |
| using | OnSignallingDeparture = std::function< void(std::string identity)> |
| Notified when a registered identity's connection goes away. | |
| using | OnSignallingMessageFilter = std::function< absl::Status(SignallingMessage *absl_nonnull message)> |
| Inspects, rewrites or refuses each inbound message before routing. | |
| using | OnSignallingUnroutable = std::function< absl::Status(const SignallingMessage &message)> |
| Offered a message whose recipient is not connected to this server. | |
| using | OnWebSocketStream = std::function< a11::Task(std::shared_ptr< WebSocketWireStream >)> |
| Callback invoked with a fresh WireStream for each accepted connection. | |
| using | OnMessage = std::function< a11::Task(std::optional< data::WireMessage > message)> |
Called for each inbound message; std::nullopt signals the peer half-closed. | |
| using | OnDone = std::function< a11::Task()> |
| Called once, when the stream has fully finished (cleanly or via abort). | |
Enumerations | |
| enum class | BytePacketType : std::uint8_t { kCompleteBytes = 0x00 , kByteChunk = 0x01 , kLengthSuffixedByteChunk = 0x02 } |
| Packet shapes in the A11 byte-chunking wire format. More... | |
| enum class | ChannelEndpointRole { kClient , kServer , kEither } |
| Handshake role a binary channel endpoint is permitted to assume. More... | |
| enum class | SseOutboundDelivery { kPost , kStream } |
| How an SSE client hands its outbound WireMessages to the server. More... | |
| enum class | CachePolicy { kStream , kVolatile , kUnset } |
| How a response may be cached, which differs by what it is. More... | |
| enum class | SignallingMessageType { kDescription , kCandidate , kError } |
| The kind of payload a SignallingMessage carries. More... | |
| enum class | TurnRelayType { kUdp , kTcp , kTls } |
| Transport used to reach a TURN relay server. More... | |
Functions | |
| absl::StatusOr< std::vector< std::string > > | SplitBytesIntoPackets (std::string_view bytes, std::uint64_t transient_id, size_t packet_size) |
| Split bytes into A11 packets with fixed little-endian suffixes. | |
| absl::StatusOr< std::vector< std::string > > | SplitOwnedBytesIntoPackets (std::string bytes, std::uint64_t transient_id, size_t packet_size) |
| Split bytes the caller owns, reusing the buffer when it fits a packet. | |
| absl::StatusOr< BytePacket > | ParseBytePacket (std::string_view packet) |
| Parse and validate one packet without retaining the input view. | |
| absl::StatusOr< BytePacket > | ParseOwnedBytePacket (std::string packet) |
| Parse one packet, reusing its buffer as the payload. | |
| std::string_view | QueryOfPath (std::string_view path) |
The query part of path, without the ?. | |
| bool | MatchDescribePath (std::string_view path, const DescribeEndpointOptions &options, std::string *absl_nonnull name) |
Whether path addresses the describe endpoint, and what it names. | |
| std::optional< a11::Task > | TryDescribeOverHttp (const DescribeEndpointOptions &options, const HttpRequest &request, const std::shared_ptr< Http2ResponseWriter > &response, HttpHeaders extra_headers={}) |
Answers request from options, if it is addressed to it. | |
| absl::StatusOr< std::string > | FileSha1 (const std::filesystem::path &path) |
| Computes the SHA-1 of a file, as lowercase hex. | |
| a11::Future< std::filesystem::path > | Download (std::string url, DownloadOptions options) |
Downloads url to options.destination, verified and atomically. | |
| a11::Future< HttpResponse > | Fetch (std::string url, FetchOptions options={}) |
Fetches url and buffers the whole response. | |
| a11::Future< HttpResponseHead > | FetchToSink (std::string url, FetchSink sink, FetchOptions options={}, OnFetchProgress on_progress={}) |
Fetches url and hands the body to sink as it arrives. | |
| a11::Task | RelayHttp (std::string target, HttpRequest request, std::shared_ptr< Http2ResponseWriter > writer, Http2Options options={}, absl::Time deadline=absl::InfiniteFuture(), HttpRelayObserver observer={}, size_t max_observed_bytes=8 *1024 *1024) |
| Forward an exchange to an explicit URL without redirects or retries. | |
| std::uint16_t | DefaultPortForScheme (std::string_view scheme) |
| absl::StatusOr< ParsedUrl > | ParseUrl (std::string_view url) |
Parses an absolute http/https/ws/wss URL. | |
| absl::StatusOr< ParsedUrl > | ResolveReference (const ParsedUrl &base, std::string_view reference) |
Resolves reference against base, as a redirect target. | |
| void | NormalizeHttpHeaders (HttpHeaders *headers) |
| std::optional< std::string > | GetHttpHeader (const HttpHeaders &headers, std::string_view name) |
| void | EraseHttpHeader (HttpHeaders *headers, std::string_view name) |
| void | SetHttpHeader (HttpHeaders *headers, std::string name, std::string value) |
| absl::Status | ValidateHttpHeaders (const HttpHeaders &headers) |
| void | NormalizeHttpHeaders (HttpHeaders *absl_nonnull headers) |
Lowercases every field name in headers in place. | |
| void | EraseHttpHeader (HttpHeaders *absl_nonnull headers, std::string_view name) |
Removes every field named name from headers. | |
| void | SetHttpHeader (HttpHeaders *absl_nonnull headers, std::string name, std::string value) |
Replaces any existing name fields with a single (name, value) entry. | |
| void | ApplyCorsHeaders (const CorsOptions &options, HttpHeaders *absl_nonnull headers) |
Adds the cross-origin headers for options to headers. | |
| HttpHeaders | CorsHeaders (const CorsOptions &options) |
The cross-origin headers for options, and nothing else. | |
| void | ApplyServerHeaders (const ServerHeaderOptions &options, CachePolicy cache, HttpHeaders *absl_nonnull headers) |
| Adds the headers every response from an A11 server carries. | |
| bool | IsPreflight (const CorsOptions &options, std::string_view method) |
Whether method is a CORS preflight this policy should answer. | |
| internal::PathMtuOptions | BuildPathMtuOptions (const WebRtcConfiguration &configuration) |
| absl::StatusOr< rtc::Configuration > | BuildLibDataChannelConfiguration (const WebRtcConfiguration &configuration) |
| absl::StatusOr< data::ByteMap > | NormalizeWireHeaders (data::ByteMap headers) |
| Validate and case-normalise a wire header map, returning the normalised copy or a non-OK status if a header name/value is invalid. | |
Variables | |
| constexpr size_t | kMinimumBytePacketSize |
| Smallest packet that holds framing metadata and one payload byte. | |
| constexpr size_t | kMergeCeilingBytes = 64 * 1024 |
| constexpr std::string_view | kDefaultDescribeEndpoint = "/actions" |
| Default path serving the action descriptors. | |
| constexpr std::string_view | kSseStreamIdHeader = "x-a11-stream-id" |
| Response header naming the stream id assigned to an SSE connection. | |
| constexpr std::string_view | kSseHttpHeaderPrefix = "x-a11-http-" |
| Prefix under which application HTTP headers are tunneled over SSE. | |
| constexpr std::string_view | kSseOutboundModesHeader = "x-a11-outbound" |
Response header on the connect response listing the outbound delivery modes the server accepts, comma-separated – post, stream. | |
| constexpr std::string_view | kSseOutboundPostToken = "post" |
| Token for one-POST-per-message outbound delivery. | |
| constexpr std::string_view | kSseOutboundStreamToken = "stream" |
| Token for long-lived-request-body outbound delivery. | |
| constexpr std::string_view | kSseWireStreamContentType |
| Content type of a streamed outbound request body. | |
| constexpr std::string_view | kDefaultSseConnectEndpoint = "/connect" |
| Default path on which a client opens the SSE event stream. | |
| constexpr std::string_view | kDefaultSseMessageEndpoint |
Default message-post path template ({id} is the stream id). | |
| constexpr std::string_view | kServerHeaderValue = "a11" |
Value of the Server header A11's HTTP surfaces send. | |
| constexpr size_t | kWebRtcBaseMtu = 1280 |
| The MTU a WebRTC association uses until something better is confirmed. | |
| constexpr size_t | kWebRtcMinMtu = 512 |
Smallest MTU usrsctp will accept (SCTP_SMALLEST_PMTU). | |
| constexpr std::string_view | kAbortStatusHeader = "x-a11-abort-status" |
| Trailer key under which an aborting endpoint reports its terminal status. | |
| constexpr size_t | kMaxSingleMessageSize = 32 * 1024 * 1024 |
| Hard ceiling on the size of a single reassembled inbound WireMessage. | |
| using a11::net::DescribeActionsHandler = typedef std::function<absl::StatusOr<std::string>( std::string_view name, std::string_view query)> |
Answers a discovery request without opening a wire stream.
| name | Action to describe, or empty for the whole collection. |
| query | The URL query string, without the ?. Parsed by the implementation, which is where the request's shape is known. |
| using a11::net::FetchSink = typedef std::function<absl::Status(std::string_view chunk)> |
Receives body chunks in order.
Returning a non-OK status cancels the response and fails the fetch with that status, which is how a sink reports that it could not write.
| using a11::net::Http2RequestHandler = typedef std::function<a11::Task( HttpRequest request, std::shared_ptr<Http2ResponseWriter> response)> |
Callback dispatched for each inbound request, given a response writer.
| using a11::net::HttpHeaders = typedef std::vector<std::pair<std::string, std::string> > |
An ordered list of (name, value) HTTP/2 header fields.
Field names are normalized to lowercase. A compact sequence preserves repeated fields and wire order without allocating a tree node per field.
| using a11::net::HttpRelayObserver = typedef std::function<absl::Status( std::string_view event, const HttpResponseHead& head, std::string_view data)> |
Observe response headers/body/completion without altering the exchange.
Events are headers, body, complete, limit, or error. Body data is borrowed for the call. The observer is synchronous and bounded by the relay's byte limit; an observer failure disables observation while forwarding continues.
| using a11::net::HttpSseWireStreamServer = typedef HttpSseServer |
Alias for HttpSseServer, spelled to match the WireStream naming family.
| using a11::net::OnDone = typedef std::function<a11::Task()> |
Called once, when the stream has fully finished (cleanly or via abort).
| using a11::net::OnFetchProgress = typedef std::function<void(std::uint64_t bytes_done, std::uint64_t bytes_total)> |
Called as a body arrives.
| bytes_done | Bytes delivered to the sink so far. |
| bytes_total | Total from Content-Length, or 0 when it is unknown. |
| using a11::net::OnHttpSseConnect = typedef std::function<a11::Task(std::shared_ptr<HttpSseServerWireStream>)> |
Callback invoked with each accepted server-side SSE wire stream.
| using a11::net::OnMessage = typedef std::function<a11::Task(std::optional<data::WireMessage> message)> |
Called for each inbound message; std::nullopt signals the peer half-closed.
Returns an awaitable the transport awaits before delivering the next message (this is where a consumer applies backpressure).
| using a11::net::OnSignallingAdmission = typedef std::function<a11::Task(SignallingAdmission)> |
Decides whether a peer may register, asynchronously.
A failed task rejects the registration and its status becomes the HTTP response; an OK task admits. Asynchronous because the answer usually lives in a database, and this runs once per connection rather than per message.
| using a11::net::OnSignallingDeparture = typedef std::function<void(std::string identity)> |
Notified when a registered identity's connection goes away.
| using a11::net::OnSignallingMessage = typedef std::function<a11::Task(SignallingMessage message)> |
Async callback invoked for each inbound SignallingMessage.
| using a11::net::OnSignallingMessageFilter = typedef std::function<absl::Status(SignallingMessage* absl_nonnull message)> |
Inspects, rewrites or refuses each inbound message before routing.
Synchronous because signalling is ordered per connection and an asynchronous filter would either reorder messages or need a queue per connection to avoid it; the things a filter actually does – rate limiting, field checks – are arithmetic. A non-OK status refuses that one message and is reported to its sender as an error message; the connection stays open.
| using a11::net::OnSignallingUnroutable = typedef std::function<absl::Status(const SignallingMessage& message)> |
Offered a message whose recipient is not connected to this server.
The egress half of a federated fabric, paired with SignallingService::Deliver(): return OK once the message has been handed to whatever will carry it elsewhere, or a non-OK status to say it is genuinely undeliverable, which the sender is told about.
| using a11::net::OnWebRtcStream = typedef std::function<a11::Task(std::shared_ptr<WebRtcWireStream>)> |
Callback invoked with each newly negotiated peer WireStream.
| using a11::net::OnWebSocketStream = typedef std::function<a11::Task(std::shared_ptr<WebSocketWireStream>)> |
Callback invoked with a fresh WireStream for each accepted connection.
|
strong |
|
strong |
How a response may be cached, which differs by what it is.
Live streams use no-store and disable intermediary buffering. Mutable documents use no-cache so clients revalidate them.
|
strong |
|
strong |
The kind of payload a SignallingMessage carries.
| Enumerator | |
|---|---|
| kDescription | |
| kCandidate | |
| kError | |
|
strong |
How an SSE client hands its outbound WireMessages to the server.
The inbound direction is always the SSE event stream. Only the outbound one has a choice, and it is a reachability/throughput trade rather than a correctness one – the server accepts both, on the same endpoint, and a stream and a series of POSTs deliver the same messages.
|
strong |
| void a11::net::ApplyCorsHeaders | ( | const CorsOptions & | options, |
| HttpHeaders *absl_nonnull | headers | ||
| ) |
Adds the cross-origin headers for options to headers.
Vary: Origin comes with them whenever the policy names a specific origin, because a cache that kept one origin's response and served it to another would be handing out a header the second origin must not see.
| void a11::net::ApplyServerHeaders | ( | const ServerHeaderOptions & | options, |
| CachePolicy | cache, | ||
| HttpHeaders *absl_nonnull | headers | ||
| ) |
Adds the headers every response from an A11 server carries.
Idempotent. Existing route headers take precedence.
| options | The surface's policy. |
| cache | What kind of response this is. |
| headers | Headers to add to. |
| absl::StatusOr< rtc::Configuration > a11::net::BuildLibDataChannelConfiguration | ( | const WebRtcConfiguration & | configuration | ) |
| internal::PathMtuOptions a11::net::BuildPathMtuOptions | ( | const WebRtcConfiguration & | configuration | ) |
| HttpHeaders a11::net::CorsHeaders | ( | const CorsOptions & | options | ) |
The cross-origin headers for options, and nothing else.
ApplyServerHeaders also adds these headers.
| std::uint16_t a11::net::DefaultPortForScheme | ( | std::string_view | scheme | ) |
scheme, or 0 when the scheme is unknown. | a11::Future< std::filesystem::path > a11::net::Download | ( | std::string | url, |
| DownloadOptions | options | ||
| ) |
Downloads url to options.destination, verified and atomically.
Returns immediately when the destination already exists and either no digest was given or its digest matches. Otherwise streams the body to a temporary sibling, verifies, and renames.
| url | Absolute http/https URL. |
| options | Destination, expected digest, and request settings. |
| void a11::net::EraseHttpHeader | ( | HttpHeaders *absl_nonnull | headers, |
| std::string_view | name | ||
| ) |
Removes every field named name from headers.
| void a11::net::EraseHttpHeader | ( | HttpHeaders * | headers, |
| std::string_view | name | ||
| ) |
| a11::Future< HttpResponse > a11::net::Fetch | ( | std::string | url, |
| FetchOptions | options = {} |
||
| ) |
Fetches url and buffers the whole response.
| url | Absolute http/https URL. |
| options | What to request. |
transport.max_response_body_size, the mapped status for a 4xx/5xx, or DeadlineExceeded on timeout. | a11::Future< HttpResponseHead > a11::net::FetchToSink | ( | std::string | url, |
| FetchSink | sink, | ||
| FetchOptions | options = {}, |
||
| OnFetchProgress | on_progress = {} |
||
| ) |
Fetches url and hands the body to sink as it arrives.
The body is never accumulated, so this is the entry point for a response too large to hold. Redirect responses are followed without ever reaching the sink, so sink sees the body of exactly one response.
| url | Absolute http/https URL. |
| sink | Receives body chunks in order. |
| options | What to request. |
| on_progress | Optional progress callback, invoked from the fetching fiber between chunks. |
| absl::StatusOr< std::string > a11::net::FileSha1 | ( | const std::filesystem::path & | path | ) |
Computes the SHA-1 of a file, as lowercase hex.
Exposed because a caller checking a cache it did not populate wants the same digest this module verifies with.
| path | File to hash. |
| std::optional< std::string > a11::net::GetHttpHeader | ( | const HttpHeaders & | headers, |
| std::string_view | name | ||
| ) |
name, or nullopt if absent. | bool a11::net::IsPreflight | ( | const CorsOptions & | options, |
| std::string_view | method | ||
| ) |
Whether method is a CORS preflight this policy should answer.
| bool a11::net::MatchDescribePath | ( | std::string_view | path, |
| const DescribeEndpointOptions & | options, | ||
| std::string *absl_nonnull | name | ||
| ) |
Whether path addresses the describe endpoint, and what it names.
Matches both /actions and /actions/<name>, so one predicate answers the collection and the item route.
| path | Request path, already stripped of its query. |
| options | The endpoint's configuration. |
| name | Set to the named action, or empty for the collection. |
path is this endpoint at all. | void a11::net::NormalizeHttpHeaders | ( | HttpHeaders *absl_nonnull | headers | ) |
Lowercases every field name in headers in place.
| void a11::net::NormalizeHttpHeaders | ( | HttpHeaders * | headers | ) |
| absl::StatusOr< data::ByteMap > a11::net::NormalizeWireHeaders | ( | data::ByteMap | headers | ) |
Validate and case-normalise a wire header map, returning the normalised copy or a non-OK status if a header name/value is invalid.
| absl::StatusOr< BytePacket > a11::net::ParseBytePacket | ( | std::string_view | packet | ) |
Parse and validate one packet without retaining the input view.
| absl::StatusOr< BytePacket > a11::net::ParseOwnedBytePacket | ( | std::string | packet | ) |
Parse one packet, reusing its buffer as the payload.
Removes the metadata suffix in place and returns the remaining owned payload.
| absl::StatusOr< ParsedUrl > a11::net::ParseUrl | ( | std::string_view | url | ) |
Parses an absolute http/https/ws/wss URL.
The scheme is matched case-insensitively and stored lowercase. An absent port takes the scheme's default. A trailing fragment is discarded.
| url | The URL to parse. |
| std::string_view a11::net::QueryOfPath | ( | std::string_view | path | ) |
The query part of path, without the ?.
| a11::Task a11::net::RelayHttp | ( | std::string | target, |
| HttpRequest | request, | ||
| std::shared_ptr< Http2ResponseWriter > | writer, | ||
| Http2Options | options = {}, |
||
| absl::Time | deadline = absl::InfiniteFuture(), |
||
| HttpRelayObserver | observer = {}, |
||
| size_t | max_observed_bytes = 8 *1024 *1024 |
||
| ) |
Forward an exchange to an explicit URL without redirects or retries.
Status, body chunks, and trailers are relayed unchanged. Hop-by-hop headers and private x-a11-* fields are removed. The deadline belongs to this stream; cancellation leaves other requests on the pooled connection running.
| target | Host-selected absolute HTTP/HTTPS URL, including path/query. |
| request | Incoming method, headers, and buffered or streaming body. |
| writer | Downstream response writer, retained for the exchange. |
| options | Transport bounds and protocol/TLS settings. URL scheme selects TLS. The connection pool ignores connection-wide deadlines. |
| deadline | Absolute per-exchange deadline, including pool acquisition. |
| observer | Optional synchronous response observer, adopted at entry. |
| max_observed_bytes | Maximum body bytes delivered to the observer. |
| absl::StatusOr< ParsedUrl > a11::net::ResolveReference | ( | const ParsedUrl & | base, |
| std::string_view | reference | ||
| ) |
Resolves reference against base, as a redirect target.
Handles the four forms a Location header uses in practice: an absolute URL, a protocol-relative //host/path, an absolute path /path, and a relative path resolved against base's directory. Enough of RFC 3986 section 5 to follow redirects correctly, and no more.
| base | The URL the reference was received from. |
| reference | The reference to resolve. |
reference is empty or names an unsupported scheme. | void a11::net::SetHttpHeader | ( | HttpHeaders *absl_nonnull | headers, |
| std::string | name, | ||
| std::string | value | ||
| ) |
Replaces any existing name fields with a single (name, value) entry.
| void a11::net::SetHttpHeader | ( | HttpHeaders * | headers, |
| std::string | name, | ||
| std::string | value | ||
| ) |
| absl::StatusOr< std::vector< std::string > > a11::net::SplitBytesIntoPackets | ( | std::string_view | bytes, |
| std::uint64_t | transient_id, | ||
| size_t | packet_size | ||
| ) |
Split bytes into A11 packets with fixed little-endian suffixes.
| absl::StatusOr< std::vector< std::string > > a11::net::SplitOwnedBytesIntoPackets | ( | std::string | bytes, |
| std::uint64_t | transient_id, | ||
| size_t | packet_size | ||
| ) |
Split bytes the caller owns, reusing the buffer when it fits a packet.
Appends metadata to the owned buffer when the message fits one packet. The multi-packet result matches SplitBytesIntoPackets.
| std::optional< a11::Task > a11::net::TryDescribeOverHttp | ( | const DescribeEndpointOptions & | options, |
| const HttpRequest & | request, | ||
| const std::shared_ptr< Http2ResponseWriter > & | response, | ||
| HttpHeaders | extra_headers = {} |
||
| ) |
Answers request from options, if it is addressed to it.
The whole endpoint, for whichever server holds the port. GET and HEAD are answered with the JSON document; a failing describer's status code becomes the HTTP one, so an unknown action is a 404 with the describer's own message.
| options | The endpoint's configuration; a disabled one matches nothing. |
| request | The inbound request, query string included. |
| response | Where to write the answer. |
| extra_headers | Headers to include, typically CORS. |
| absl::Status a11::net::ValidateHttpHeaders | ( | const HttpHeaders & | headers | ) |
|
inlineconstexpr |
Trailer key under which an aborting endpoint reports its terminal status.
|
inlineconstexpr |
Default path serving the action descriptors.
|
inlineconstexpr |
Default path on which a client opens the SSE event stream.
|
inlineconstexpr |
Default message-post path template ({id} is the stream id).
|
inlineconstexpr |
Hard ceiling on the size of a single reassembled inbound WireMessage.
|
constexpr |
|
inlineconstexpr |
Smallest packet that holds framing metadata and one payload byte.
|
inlineconstexpr |
Value of the Server header A11's HTTP surfaces send.
|
inlineconstexpr |
Prefix under which application HTTP headers are tunneled over SSE.
|
inlineconstexpr |
Response header on the connect response listing the outbound delivery modes the server accepts, comma-separated – post, stream.
Omission means post only.
|
inlineconstexpr |
Token for one-POST-per-message outbound delivery.
|
inlineconstexpr |
Token for long-lived-request-body outbound delivery.
|
inlineconstexpr |
Response header naming the stream id assigned to an SSE connection.
|
inlineconstexpr |
Content type of a streamed outbound request body.
The body is a sequence of frames, each a four-byte little-endian payload length followed by that many bytes of the JSON WireMessage encoding the POST route carries one of. The length prefix supplies message boundaries across HTTP/2 DATA frames and HTTP/1.1 chunked bodies.
|
inlineconstexpr |
The MTU a WebRTC association uses until something better is confirmed.
The 1280-byte value follows the IPv6 minimum link MTU and RFC 8261's SCTP fallback. Path MTU discovery may confirm a larger value.
|
inlineconstexpr |
Smallest MTU usrsctp will accept (SCTP_SMALLEST_PMTU).