openthread/ot/types/
security_policy.rs1use crate::prelude_internal::*;
6
7#[derive(Default, Clone)]
9#[repr(transparent)]
10pub struct SecurityPolicy(pub otSecurityPolicy);
11
12impl_ot_castable!(SecurityPolicy, otSecurityPolicy);
13
14impl std::fmt::Debug for SecurityPolicy {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 f.debug_struct("SecurityPolicy")
17 .field("rotation_time_hours", &self.get_rotation_time_in_hours())
18 .field("version_threshold_for_routing", &self.get_version_threshold_for_routing())
19 .field("is_obtain_network_key_enabled", &self.is_obtain_network_key_enabled())
20 .field("is_native_commissioning_enabled", &self.is_native_commissioning_enabled())
21 .field("is_routers_enabled", &self.is_routers_enabled())
22 .field("is_external_commissioning_enabled", &self.is_external_commissioning_enabled())
23 .field(
24 "is_commercial_commissioning_enabled",
25 &self.is_commercial_commissioning_enabled(),
26 )
27 .field("is_autonomous_enrollment_enabled", &self.is_autonomous_enrollment_enabled())
28 .field(
29 "is_network_key_provisioning_enabled",
30 &self.is_network_key_provisioning_enabled(),
31 )
32 .field("is_toble_link_enabled", &self.is_toble_link_enabled())
33 .field("is_non_ccm_routers_enabled", &self.is_non_ccm_routers_enabled())
34 .finish()
35 }
36}
37
38#[allow(missing_docs)]
39impl SecurityPolicy {
40 pub fn get_rotation_time_in_hours(&self) -> u16 {
41 self.0.mRotationTime
42 }
43
44 pub fn is_obtain_network_key_enabled(&self) -> bool {
45 self.0.mObtainNetworkKeyEnabled()
46 }
47
48 pub fn is_native_commissioning_enabled(&self) -> bool {
49 self.0.mNativeCommissioningEnabled()
50 }
51
52 pub fn is_routers_enabled(&self) -> bool {
53 self.0.mRoutersEnabled()
54 }
55
56 pub fn is_external_commissioning_enabled(&self) -> bool {
57 self.0.mExternalCommissioningEnabled()
58 }
59
60 pub fn is_commercial_commissioning_enabled(&self) -> bool {
61 self.0.mCommercialCommissioningEnabled()
62 }
63
64 pub fn is_autonomous_enrollment_enabled(&self) -> bool {
65 self.0.mAutonomousEnrollmentEnabled()
66 }
67
68 pub fn is_network_key_provisioning_enabled(&self) -> bool {
69 self.0.mNetworkKeyProvisioningEnabled()
70 }
71
72 pub fn is_toble_link_enabled(&self) -> bool {
73 self.0.mTobleLinkEnabled()
74 }
75
76 pub fn is_non_ccm_routers_enabled(&self) -> bool {
77 self.0.mNonCcmRoutersEnabled()
78 }
79
80 pub fn get_version_threshold_for_routing(&self) -> u8 {
81 self.0.mVersionThresholdForRouting()
82 }
83}
84
85#[allow(missing_docs)]
86impl SecurityPolicy {
87 pub fn set_rotation_time_in_hours(&mut self, hours: u16) {
88 self.0.mRotationTime = hours
89 }
90
91 pub fn set_obtain_network_key_enabled(&mut self, x: bool) {
92 self.0.set_mObtainNetworkKeyEnabled(x)
93 }
94
95 pub fn set_native_commissioning_enabled(&mut self, x: bool) {
96 self.0.set_mNativeCommissioningEnabled(x)
97 }
98
99 pub fn set_routers_enabled(&mut self, x: bool) {
100 self.0.set_mRoutersEnabled(x)
101 }
102
103 pub fn set_external_commissioning_enabled(&mut self, x: bool) {
104 self.0.set_mExternalCommissioningEnabled(x)
105 }
106
107 pub fn set_commercial_commissioning_enabled(&mut self, x: bool) {
108 self.0.set_mCommercialCommissioningEnabled(x)
109 }
110
111 pub fn set_autonomous_enrollment_enabled(&mut self, x: bool) {
112 self.0.set_mAutonomousEnrollmentEnabled(x)
113 }
114
115 pub fn set_network_key_provisioning_enabled(&mut self, x: bool) {
116 self.0.set_mNetworkKeyProvisioningEnabled(x)
117 }
118
119 pub fn set_toble_link_enabled(&mut self, x: bool) {
120 self.0.set_mTobleLinkEnabled(x)
121 }
122
123 pub fn set_non_ccm_routers_enabled(&mut self, x: bool) {
124 self.0.set_mNonCcmRoutersEnabled(x)
125 }
126
127 pub fn set_version_threshold_for_routing(&mut self, x: u8) {
128 self.0.set_mVersionThresholdForRouting(x)
129 }
130}