pub struct DataProtection {
logical_name: ObisCode,
protection_buffer: Vec<u8>,
protection_object_list: Vec<ProtectionObject>,
protection_parameters_get: Vec<Vec<u8>>,
protection_parameters_set: Vec<Vec<u8>>,
required_protection: u8,
}Expand description
Data protection interface class (class_id = 30, version = 0) per
IEC 62056-6-2 §4.4.9. Provides end-to-end protection of grouped attributes
and method invocations.
The actual cryptographic protection (compression / encryption / authentication / digital signature) belongs to the ciphering layer, which is not implemented here. The three methods therefore validate their parameters and return best-effort results.
Fields§
§logical_name: ObisCode§protection_buffer: Vec<u8>§protection_object_list: Vec<ProtectionObject>§protection_parameters_get: Vec<Vec<u8>>§protection_parameters_set: Vec<Vec<u8>>§required_protection: u8Implementations§
Source§impl DataProtection
impl DataProtection
Sourcepub fn new(config: DataProtectionConfig) -> Self
pub fn new(config: DataProtectionConfig) -> Self
Builds a new DataProtection from its configuration.
Sourcefn get_protected_attributes(&self, _data: CosemDataType) -> CosemDataType
fn get_protected_attributes(&self, _data: CosemDataType) -> CosemDataType
Method 1: get_protected_attributes — returns the protected data built
from the object list. Best-effort: returns the current protection buffer.
Sourcefn set_protected_attributes(
&mut self,
data: CosemDataType,
) -> Result<CosemDataType, String>
fn set_protected_attributes( &mut self, data: CosemDataType, ) -> Result<CosemDataType, String>
Method 2: set_protected_attributes — applies protected attribute values.
Best-effort: stores the supplied protected data into the buffer.
Sourcefn invoke_protected_method(_data: CosemDataType) -> CosemDataType
fn invoke_protected_method(_data: CosemDataType) -> CosemDataType
Method 3: invoke_protected_method — invokes a protected method.
Best-effort: succeeds after validating a parameter is present.
Trait Implementations§
Source§impl Clone for DataProtection
impl Clone for DataProtection
Source§fn clone(&self) -> DataProtection
fn clone(&self) -> DataProtection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataProtection
impl Debug for DataProtection
Source§impl<'de> Deserialize<'de> for DataProtection
impl<'de> Deserialize<'de> for DataProtection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl InterfaceClass for DataProtection
impl InterfaceClass for DataProtection
Source§fn logical_name(&self) -> &ObisCode
fn logical_name(&self) -> &ObisCode
Source§fn attributes(&self) -> Vec<(u8, CosemDataType)>
fn attributes(&self) -> Vec<(u8, CosemDataType)>
(attribute_id, value) pairs.