Skip to main content

zerodds_security/
data_tagging.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! Data tagging plugin SPI (OMG DDS-Security 1.1 §8.7).
5//!
6//! Optional plugin for application-level labels (classification
7//! markers, data sensitivity, etc.). Attached to every DataWriter/Reader
8//! and propagated on the wire via the `DataTags` submessage.
9//!
10//! In v1.3 only as a trait interface — production use only comes
11//! with NGVA/FACE integration in v2.0.
12//!
13//! zerodds-lint: allow no_dyn_in_safe
14//! (The plugin SPI needs `Box<dyn DataTaggingPlugin>`.)
15
16extern crate alloc;
17
18use alloc::boxed::Box;
19use alloc::string::String;
20use alloc::vec::Vec;
21
22/// A tag = name + value pair (comparable to [`crate::Property`],
23/// but at application-data level, not at participant-config level).
24#[derive(Debug, Clone, PartialEq, Eq)]
25pub struct DataTag {
26    /// Tag name.
27    pub name: String,
28    /// Tag value.
29    pub value: String,
30}
31
32/// Data tagging plugin (spec §8.7.2).
33pub trait DataTaggingPlugin: Send + Sync {
34    /// Attach tags to an endpoint (DataWriter/Reader). The tags
35    /// are propagated to remote participants via SEDP.
36    fn set_tags(&mut self, endpoint_guid: [u8; 16], tags: Vec<DataTag>);
37
38    /// Query the tags of an endpoint.
39    fn get_tags(&self, endpoint_guid: [u8; 16]) -> Vec<DataTag>;
40
41    /// Plugin class id.
42    fn plugin_class_id(&self) -> &str;
43}
44
45/// Factory alias.
46pub type DataTaggingBox = Box<dyn DataTaggingPlugin>;