Expand description
Crate zerodds-grpc-bridge. Safety classification: STANDARD.
gRPC-over-HTTP/2 + gRPC-Web wire codec — pure-Rust no_std + alloc, forbid(unsafe_code). Implements the gRPC-specific
wire elements that sit above the HTTP/2 stack: length-prefixed
message (LPM), path parsing, timeout header, status codes,
custom-metadata encoding (incl. the -bin suffix convention),
gRPC-Web trailer frames and a gRPC server skeleton for
caller-configured HTTP/2 listeners.
Spec: gRPC HTTP/2 Protocol (length-prefixed message + path + timeout + status + custom metadata) + gRPC-Web Specification (trailer frame + content types).
§Layer position
Layer 5 — bridges. Sits on zerodds-http2
(RFC 9113 framing + stream state + flow control) and
zerodds-hpack (RFC 7541 header
compression). The HTTP/2 connection lifecycle and HEADERS/CONTINUATION
encoding come from these substrate crates; gRPC-bridge concentrates
on the gRPC application-layer wire format.
§Public API (Stand 1.0.0-rc.1)
encode_message/decode_message/FrameError— gRPC Length-Prefixed-Message (LPM): Compressed-Flag (1 byte) + Message-Length (4-byte BE) + Message-Bytes.parse_path/PathError—/<service>/<method>from the HTTP:path.encode_timeout/decode_timeout/TimeoutUnit/TimeoutError—grpc-timeoutHeader value + unit (H/M/S/m/u/n).Status— all 17 gRPC status codes (0..=16).encode_header_value/decode_header_value/encode_base64/decode_base64/is_binary_header/BIN_SUFFIX/MetadataError— Custom-Metadata-Encoding (-bin-Suffix → Base64).request_headers/response_headers/content_types— standard header sets for request/response/gRPC-Web/JSON.GrpcServer/GrpcRequest/GrpcResponse— gRPC server skeleton for caller-configured HTTP/2 listeners.
§Example
use zerodds_grpc_bridge::{decode_message, encode_message};
let msg = b"hello-grpc";
let wire = encode_message(msg, false).expect("encode");
let (flag, payload, consumed) = decode_message(&wire).expect("decode");
assert_eq!(flag, 0);
assert_eq!(payload, msg);
assert_eq!(consumed, wire.len());Re-exports§
pub use frame::FrameError;pub use frame::decode_message;pub use frame::encode_message;pub use metadata::BIN_SUFFIX;pub use metadata::MetadataError;pub use metadata::content_types;pub use metadata::decode_base64;pub use metadata::decode_header_value;pub use metadata::encode_base64;pub use metadata::encode_header_value;pub use metadata::is_binary_header;pub use metadata::request_headers;pub use metadata::response_headers;pub use path::PathError;pub use path::parse_path;pub use server::GrpcRequest;pub use server::GrpcResponse;pub use server::GrpcServer;pub use status::Status;pub use timeout::TimeoutError;pub use timeout::TimeoutUnit;pub use timeout::decode_timeout;pub use timeout::encode_timeout;
Modules§
- bridge_
security - gRPC bridge §7.x bridge-security wireup.
- daemon_
runtime - Cross-cutting daemon runtime for the gRPC daemon.
- frame
- gRPC Length-Prefixed-Message — Spec §“Requests” + §“Responses”.
- metadata
- Custom-Metadata encoding per the gRPC spec.
- path
- gRPC HTTP
:pathparsing — Spec §“Call-Definition”. - qos_
translation - §6 — DDS QoS → gRPC behavior translation.
- reflection
- gRPC Server Reflection Service (
grpc.reflection.v1alpha.ServerReflection). - server
- gRPC-over-HTTP/2 server skeleton.
- service_
gen - Auto-generation of gRPC service definitions per DDS topic.
- status
- gRPC
grpc-statusCodes — Spec §“Status”. - timeout
- gRPC
grpc-timeoutHeader — Spec §“Timeout”.