Skip to main content

zerodds_amqp_bridge/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! Crate `zerodds-amqp-bridge`. Safety classification: **STANDARD**.
5//!
6//! AMQP 1.0 (OASIS Standard) Wire-Codec — pure-Rust no_std + alloc,
7//! `forbid(unsafe_code)`. Implementiert das vollstaendige AMQP-1.0
8//! Type-System, Frame-Format, alle 9 Performatives und alle 7
9//! Message-Sections, plus den DDS-AMQP-1.0 Codec-/Codec-Lite-Profile-
10//! Marker.
11//!
12//! Spec-Referenzen:
13//!
14//! - **OASIS AMQP 1.0** Part 1 (Types), Part 2 (Transport), Part 3
15//!   (Messaging), Part 4 (Transactions), Part 5 (Security).
16//! - **OMG DDS-AMQP 1.0 (formal/2024-08-01)** §2.3 (Codec Profile),
17//!   §2.4 (Codec-Lite Profile), §6.1 (Direct-Embed Topology), §7
18//!   (Type-System-Mapping), §8 (Message-Section-Mapping).
19//!
20//! ## Schichten-Position
21//!
22//! Layer 5 — Bridges. Substrat fuer:
23//!
24//! - [`zerodds-amqp-endpoint`](../zerodds_amqp_endpoint/index.html) —
25//!   DDS-AMQP-1.0 Endpoint-Layer mit Direct-Embed-Topology.
26//!
27//! ## Public API (Stand 1.0.0-rc.1)
28//!
29//! **Type-System (`types`-Modul):**
30//!
31//! - [`AmqpValue`] / [`FormatCode`] / [`TypeError`].
32//! - [`encode_null`] / [`encode_boolean`] / [`encode_long`] /
33//!   [`encode_ulong`] / [`encode_string`] / [`encode_symbol`] /
34//!   [`encode_binary`] — Primitiv-Encoder.
35//! - [`decode_value`] — Variant-Decoder ueber alle Format-Codes.
36//!
37//! **Extended Types (`extended_types`-Modul):**
38//!
39//! - [`AmqpExtValue`] — Vollstaendiges Variant-Modell (Primitive +
40//!   Compound: list / map / array).
41//! - Encoder/Decoder fuer ubyte / ushort / uint / byte / short / int /
42//!   float / double / char / decimal32-64-128 / timestamp / uuid.
43//!
44//! **Frame-Format (`frame`-Modul):**
45//!
46//! - [`FrameHeader`] / [`FrameType`] / [`FrameError`].
47//! - [`encode_frame_header`] / [`decode_frame_header`] — 4-Byte SIZE
48//!   BE + DOFF + TYPE + CHANNEL BE + Extended-Header.
49//!
50//! **Performatives (`performatives`-Modul):**
51//!
52//! - [`open`] / [`begin`] / [`attach`] / [`flow`] / [`transfer`] /
53//!   [`disposition`] / [`detach`] / [`end`] / [`close`] — die 9
54//!   Transport-Performatives.
55//! - [`encode_performative`] / [`decode_performative`].
56//!
57//! **Message-Sections (`sections`-Modul):**
58//!
59//! - [`MessageSection`] — Header / Delivery-Annotations / Message-
60//!   Annotations / Properties / Application-Properties / AmqpValue /
61//!   AmqpSequence / Data / Footer.
62//! - [`validate_section_sequence`] — Reihenfolge-Pruefung gemaess
63//!   AMQP-1.0 Messaging §3.2.
64//!
65//! **Codec-Profile (`codec_profile`-Modul):**
66//!
67//! - `CodecProfile::{Full, Lite}`.
68//! - `active_profile()` (const) — `Full` per Default, `Lite` mit
69//!   Cargo-Feature `codec-lite`.
70//! - `is_codec_lite_value` / `is_codec_lite_section` — Conformance-
71//!   Pruefer fuer DDS-AMQP-1.0 §2.4.
72//!
73//! ## Beispiel
74//!
75//! ```rust
76//! use zerodds_amqp_bridge::{decode_value, encode_long, AmqpValue};
77//!
78//! let buf = encode_long(42);
79//! let (v, consumed) = decode_value(&buf).expect("decode");
80//! assert_eq!(v, AmqpValue::Long(42));
81//! assert_eq!(consumed, buf.len());
82//! ```
83
84#![forbid(unsafe_code)]
85#![warn(missing_docs)]
86
87extern crate alloc;
88
89pub mod codec_profile;
90pub mod extended_types;
91pub mod frame;
92pub mod performatives;
93pub mod sections;
94pub mod types;
95
96pub use extended_types::{
97    AmqpExtValue, decode_byte, decode_char, decode_double, decode_float, decode_int, decode_short,
98    decode_timestamp, decode_ubyte, decode_uint, decode_ushort, decode_uuid, encode_byte,
99    encode_char, encode_decimal32, encode_decimal64, encode_decimal128, encode_double,
100    encode_float, encode_int, encode_short, encode_timestamp, encode_ubyte, encode_uint,
101    encode_ushort, encode_uuid,
102};
103pub use frame::{FrameError, FrameHeader, FrameType, decode_frame_header, encode_frame_header};
104pub use performatives::{
105    attach, begin, close, decode_performative, detach, disposition, encode_performative, end, flow,
106    open, transfer,
107};
108pub use sections::{MessageSection, validate_section_sequence};
109pub use types::{
110    AmqpValue, FormatCode, TypeError, decode_value, encode_binary, encode_boolean, encode_long,
111    encode_null, encode_string, encode_symbol, encode_ulong,
112};