Fast DDS  Version 3.6.1.0
Fast DDS
EndpointSecurityAttributes.hpp
1 // Copyright 2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
18 #ifndef FASTDDS_RTPS_ATTRIBUTES__ENDPOINTSECURITYATTRIBUTES_HPP
19 #define FASTDDS_RTPS_ATTRIBUTES__ENDPOINTSECURITYATTRIBUTES_HPP
20 
21 #include <cstdint>
22 
23 namespace eprosima {
24 namespace fastdds {
25 namespace rtps {
26 namespace security {
27 
29 
30 #define PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ENCRYPTED (0x00000001UL << 0)
31 #define PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_PAYLOAD_ENCRYPTED (0x00000001UL << 1)
32 #define PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ORIGIN_AUTHENTICATED (0x00000001UL << 2)
33 #define PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_VALID (0x00000001UL << 31)
34 
35 #define PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_MASK_DEFAULT PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_VALID
36 
38 {
42  , is_payload_encrypted(false)
43  {
44  }
45 
48  : is_submessage_encrypted((mask & PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ENCRYPTED) != 0)
50  PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ORIGIN_AUTHENTICATED) != 0)
51  , is_payload_encrypted((mask & PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_PAYLOAD_ENCRYPTED) != 0)
52  {
53  }
54 
58 
60 
61 };
62 
64 
65 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_READ_PROTECTED (0x00000001UL << 0)
66 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_WRITE_PROTECTED (0x00000001UL << 1)
67 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_DISCOVERY_PROTECTED (0x00000001UL << 2)
68 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_PROTECTED (0x00000001UL << 3)
69 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_PAYLOAD_PROTECTED (0x00000001UL << 4)
70 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_KEY_PROTECTED (0x00000001UL << 5)
71 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_LIVELINESS_PROTECTED (0x00000001UL << 6)
72 #define ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_VALID (0x00000001UL << 31)
73 
75 {
77  : is_read_protected(false)
78  , is_write_protected(false)
79  , is_discovery_protected(false)
82  , is_payload_protected(false)
83  , is_key_protected(false)
85  {
86  }
87 
90  : is_read_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_READ_PROTECTED) != 0)
91  , is_write_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_WRITE_PROTECTED) != 0)
92  , is_discovery_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_DISCOVERY_PROTECTED) != 0)
93  , is_liveliness_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_LIVELINESS_PROTECTED) != 0)
94  , is_submessage_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_PROTECTED) != 0)
95  , is_payload_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_PAYLOAD_PROTECTED) != 0)
96  , is_key_protected((mask & ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_KEY_PROTECTED) != 0)
98  {
99  }
100 
102 
104 
106 
108 
110 
112 
114 
116 
118 
119  bool match(
120  const EndpointSecurityAttributesMask remoteMask,
121  const PluginEndpointSecurityAttributesMask remotePluginMask) const;
122 
123 };
124 
125 } // namespace security
126 } // namespace rtps
127 } // namespace fastdds
128 } // namespace eprosima
129 
130 #endif // FASTDDS_RTPS_ATTRIBUTES__ENDPOINTSECURITYATTRIBUTES_HPP
uint32_t PluginEndpointSecurityAttributesMask
Definition: EndpointSecurityAttributes.hpp:28
uint32_t EndpointSecurityAttributesMask
Definition: EndpointSecurityAttributes.hpp:63
Definition: EndpointSecurityAttributes.hpp:75
PluginEndpointSecurityAttributesMask plugin_endpoint_attributes
Definition: EndpointSecurityAttributes.hpp:115
EndpointSecurityAttributes(const EndpointSecurityAttributesMask mask)
Definition: EndpointSecurityAttributes.hpp:88
bool is_payload_protected
Definition: EndpointSecurityAttributes.hpp:111
bool is_liveliness_protected
Definition: EndpointSecurityAttributes.hpp:107
bool match(const EndpointSecurityAttributesMask remoteMask, const PluginEndpointSecurityAttributesMask remotePluginMask) const
bool is_read_protected
Definition: EndpointSecurityAttributes.hpp:101
EndpointSecurityAttributes()
Definition: EndpointSecurityAttributes.hpp:76
bool is_key_protected
Definition: EndpointSecurityAttributes.hpp:113
bool is_write_protected
Definition: EndpointSecurityAttributes.hpp:103
bool is_submessage_protected
Definition: EndpointSecurityAttributes.hpp:109
bool is_discovery_protected
Definition: EndpointSecurityAttributes.hpp:105
Definition: EndpointSecurityAttributes.hpp:38
PluginEndpointSecurityAttributesMask mask() const
PluginEndpointSecurityAttributes(const PluginEndpointSecurityAttributesMask mask)
Definition: EndpointSecurityAttributes.hpp:46
PluginEndpointSecurityAttributes()
Definition: EndpointSecurityAttributes.hpp:39
bool is_payload_encrypted
Definition: EndpointSecurityAttributes.hpp:57
bool is_submessage_encrypted
Definition: EndpointSecurityAttributes.hpp:55
bool is_submessage_origin_authenticated
Definition: EndpointSecurityAttributes.hpp:56