Skip to main content

zerodds_corba_ccm/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! OMG CORBA Component Model 4.0 (CCM).
5//!
6//! Crate `zerodds-corba-ccm`. Safety classification: **STANDARD**.
7//! Spec OMG CCM 4.0 (`formal/2006-04-01`) §6 + §13 (Lightweight Profile).
8//!
9//! Voller CCM-Container-Stack mit Component-Modell, Home-Modell,
10//! CIDL-Datenmodell, CIF (Component Implementation Framework),
11//! Container-Runtime, ORB-Extensions, Persistent-State-Service-Stub,
12//! Time-PSM und TimerEventService inkl. CosEventService-Adapter
13//! (Feature `cos-event`).
14//!
15//! ## Beispiel
16//!
17//! ```
18//! use zerodds_corba_ccm::conformance::CCM_CONFORMANCE_BASIC_LEVEL;
19//! assert_eq!(CCM_CONFORMANCE_BASIC_LEVEL, "OMG-CCM-4.0:Basic");
20//! ```
21
22#![cfg_attr(not(feature = "std"), no_std)]
23#![forbid(unsafe_code)]
24#![warn(missing_docs)]
25
26#[cfg(feature = "alloc")]
27extern crate alloc;
28
29pub mod cidl;
30pub mod cif;
31pub mod component_def;
32pub mod context;
33pub mod dynamic_api;
34pub mod home;
35pub mod orb_extensions;
36pub mod port;
37
38#[cfg(feature = "std")]
39pub mod container;
40#[cfg(all(feature = "std", feature = "cos-event"))]
41pub mod cos_event_bridge;
42#[cfg(feature = "std")]
43pub mod lifecycle;
44#[cfg(feature = "std")]
45pub mod orb_core;
46#[cfg(feature = "std")]
47pub mod pss;
48#[cfg(feature = "std")]
49pub mod time_psm;
50#[cfg(feature = "std")]
51pub mod timer;
52
53pub use cidl::{Composition, HomeExecutor, StorageHome, StorageType};
54pub use cif::{ComponentExecutor, ExecutorLocator, KeyedExecutor, SessionExecutor};
55pub use component_def::{
56    AttributeDef, ComponentDef, EventSinkDef, EventSourceDef, FacetDef, ReceptacleDef,
57};
58pub use context::ComponentContext;
59pub use home::{HomeDef, HomeFinder};
60pub use port::{ConnectionId, EventStream, PortRegistry};
61
62#[cfg(feature = "std")]
63pub use container::{Container, ContainerError, ContainerType, LifecycleState};
64#[cfg(all(feature = "std", feature = "cos-event"))]
65pub use cos_event_bridge::EventChannelTimerCallback;
66#[cfg(feature = "std")]
67pub use timer::{TimerEventService, TimerHandle, TimerKind};
68
69// ---------------------------------------------------------------------------
70// OMG CCM 4.0 §2 Conformance-Markers
71// ---------------------------------------------------------------------------
72
73/// OMG CCM 4.0 §2 Conformance-Levels — formal-Identifier pro
74/// Vendor-Conformance-Pfad. Tooling kann diese Strings als
75/// Capability-Marker konsumieren.
76pub mod conformance {
77    /// §2 Punkt 4 — Basic Level non-Java (IDL-Extensions + CIDL +
78    /// Container + XML-D&C, ORB-Voraussetzung). Aktiv, sobald
79    /// CIDL-AST + Container-Runtime-Lifecycle eingebunden sind.
80    pub const CCM_CONFORMANCE_BASIC_LEVEL: &str = "OMG-CCM-4.0:Basic";
81
82    /// §2 Punkt 5 — Basic Level Java (EJB1.1 + java-to-IDL).
83    /// Cross-Ref `crates/corba-ccm-ejb/`.
84    pub const CCM_CONFORMANCE_BASIC_LEVEL_JAVA: &str = "OMG-CCM-4.0:BasicJava";
85
86    /// §2 Punkt 7 — Lightweight CCM Profile (Subset gemaess §13).
87    pub const LIGHTWEIGHT_CCM_LEVEL: &str = "OMG-CCM-4.0:Lightweight";
88
89    /// §6.12 / §13.10 — Restriction-Marker fuer Lightweight-Filter.
90    pub const LWCCM_RESTRICTIONS_ENFORCED: &str = "OMG-CCM-4.0:LwCCM-Restrictions";
91
92    /// §13.3 — Lightweight Profile: Filter aktiviert, no-introspection,
93    /// keine generic Navigation, keine Type-Specific-Generic-Ops.
94    pub const LWCCM_FILTER_ACTIVE: &str = "OMG-CCM-4.0:LwCCM-Filter";
95
96    // -----------------------------------------------------------------
97    // CORBA 3.3 Part 3 — CCM-bezogene Conformance-Marker
98    // -----------------------------------------------------------------
99
100    /// CORBA 3.3 Part 3 §6.13 — CCM Conformance Requirements
101    /// (Doc-Marker; folgt §2 wenn IDL-Subset abgedeckt).
102    pub const CORBA_PART3_6_13_CCM_CONFORMANCE: &str = "OMG-CORBA-3.3-P3:6.13-CCM-Conformance";
103
104    /// CORBA 3.3 Part 3 §7 — Generic Interaction Support
105    /// (Simple Connectors §7.2 abgedeckt; Templated-Connectors §7.3/§7.4
106    /// als Codegen-Erweiterung addressbar).
107    pub const CORBA_PART3_7_GENERIC_INTERACTION: &str = "OMG-CORBA-3.3-P3:7-Generic-Interaction";
108
109    /// CORBA 3.3 Part 3 §14 — Lightweight CCM Profile-Constants/
110    /// Doc-Marker. Code unterstuetzt das volle Modell + LwCCM-Filter,
111    /// dieser Marker hebt das formale LwCCM-Conformance-Level hervor.
112    pub const CORBA_PART3_14_LIGHTWEIGHT_CCM_PROFILE: &str = "OMG-CORBA-3.3-P3:14-LwCCM-Profile";
113
114    /// CORBA 3.3 Part 2 §10.6 — CSIv2 Conformance Levels.
115    /// Spec listet drei Levels (0=ServerAuth, 1=ClientAuthN+Server,
116    /// 2=ClientAuthZ-Identity-Assertion). ZeroDDS deckt alle drei
117    /// via `crates/corba-csiv2/` ab.
118    pub const CORBA_PART2_10_6_CSIV2_LEVEL_0: &str = "OMG-CORBA-3.3-P2:10.6-CSIv2-L0";
119    /// CSIv2 Level 1 (Client-Authentication zusaetzlich).
120    pub const CORBA_PART2_10_6_CSIV2_LEVEL_1: &str = "OMG-CORBA-3.3-P2:10.6-CSIv2-L1";
121    /// CSIv2 Level 2 (Identity-Assertion + Authorization).
122    pub const CORBA_PART2_10_6_CSIV2_LEVEL_2: &str = "OMG-CORBA-3.3-P2:10.6-CSIv2-L2";
123
124    // -----------------------------------------------------------------
125    // CCM 4.0 §2 Optional Conformance-Marker (Punkte 3 + 8)
126    // -----------------------------------------------------------------
127
128    /// CCM 4.0 §2 Punkt 3 — Optional Extended Level. ZeroDDS-Stub-
129    /// Layer adressiert Persistent-State (`crates/ccm-pss`) und
130    /// Configurator-Iface; voller Extended Level ohne Vendor-ORB
131    /// nicht zertifizierbar.
132    pub const CCM_OPTIONAL_EXTENDED_LEVEL: &str = "OMG-CCM-4.0:Optional-Extended";
133
134    /// CCM 4.0 §2 Punkt 8 — ORB-Vendor. ZeroDDS liefert
135    /// `corba-ccm::orb_core::Orb` als Configuration-Layer-Stub
136    /// fuer Component-Specific-Erweiterungen am ORB.
137    pub const CCM_ORB_VENDOR_STUB: &str = "OMG-CCM-4.0:ORB-Vendor-Stub";
138}
139
140#[cfg(test)]
141mod conformance_tests {
142    use super::conformance::*;
143
144    #[test]
145    fn ccm_conformance_basic_level_marker_matches_spec() {
146        assert_eq!(CCM_CONFORMANCE_BASIC_LEVEL, "OMG-CCM-4.0:Basic");
147    }
148
149    #[test]
150    fn ccm_conformance_basic_level_java_marker_matches_spec() {
151        assert_eq!(CCM_CONFORMANCE_BASIC_LEVEL_JAVA, "OMG-CCM-4.0:BasicJava");
152    }
153
154    #[test]
155    fn lightweight_ccm_level_marker_matches_spec() {
156        assert_eq!(LIGHTWEIGHT_CCM_LEVEL, "OMG-CCM-4.0:Lightweight");
157    }
158
159    #[test]
160    fn lwccm_restrictions_marker_matches_spec() {
161        assert_eq!(
162            LWCCM_RESTRICTIONS_ENFORCED,
163            "OMG-CCM-4.0:LwCCM-Restrictions"
164        );
165    }
166
167    #[test]
168    fn lwccm_filter_marker_matches_spec() {
169        assert_eq!(LWCCM_FILTER_ACTIVE, "OMG-CCM-4.0:LwCCM-Filter");
170    }
171
172    #[test]
173    fn all_markers_are_distinct() {
174        let markers = [
175            CCM_CONFORMANCE_BASIC_LEVEL,
176            CCM_CONFORMANCE_BASIC_LEVEL_JAVA,
177            LIGHTWEIGHT_CCM_LEVEL,
178            LWCCM_RESTRICTIONS_ENFORCED,
179            LWCCM_FILTER_ACTIVE,
180            CORBA_PART3_6_13_CCM_CONFORMANCE,
181            CORBA_PART3_7_GENERIC_INTERACTION,
182            CORBA_PART3_14_LIGHTWEIGHT_CCM_PROFILE,
183            CORBA_PART2_10_6_CSIV2_LEVEL_0,
184            CORBA_PART2_10_6_CSIV2_LEVEL_1,
185            CORBA_PART2_10_6_CSIV2_LEVEL_2,
186        ];
187        let mut seen = std::collections::HashSet::new();
188        for m in markers {
189            assert!(seen.insert(m), "duplicate marker: {m}");
190        }
191    }
192
193    #[test]
194    fn corba_part3_6_13_marker_namespace() {
195        assert!(CORBA_PART3_6_13_CCM_CONFORMANCE.starts_with("OMG-CORBA-3.3-P3:"));
196    }
197
198    #[test]
199    fn corba_part3_7_marker_namespace() {
200        assert!(CORBA_PART3_7_GENERIC_INTERACTION.starts_with("OMG-CORBA-3.3-P3:"));
201    }
202
203    #[test]
204    fn corba_part3_14_marker_namespace() {
205        assert!(CORBA_PART3_14_LIGHTWEIGHT_CCM_PROFILE.starts_with("OMG-CORBA-3.3-P3:"));
206    }
207
208    #[test]
209    fn csiv2_level_markers_match_spec() {
210        assert_eq!(
211            CORBA_PART2_10_6_CSIV2_LEVEL_0,
212            "OMG-CORBA-3.3-P2:10.6-CSIv2-L0"
213        );
214        assert_eq!(
215            CORBA_PART2_10_6_CSIV2_LEVEL_1,
216            "OMG-CORBA-3.3-P2:10.6-CSIv2-L1"
217        );
218        assert_eq!(
219            CORBA_PART2_10_6_CSIV2_LEVEL_2,
220            "OMG-CORBA-3.3-P2:10.6-CSIv2-L2"
221        );
222    }
223}