| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
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
28 typedef uint32_t PluginEndpointSecurityAttributesMask;
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
37 struct PluginEndpointSecurityAttributes
38{
39 PluginEndpointSecurityAttributes()
40 : is_submessage_encrypted(false)
41 , is_submessage_origin_authenticated(false)
42 , is_payload_encrypted(false)
43 {
44 }
45
46 explicit PluginEndpointSecurityAttributes(
47 const PluginEndpointSecurityAttributesMask mask)
48 : is_submessage_encrypted((mask & PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ENCRYPTED) != 0)
49 , is_submessage_origin_authenticated((mask &
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
55 bool is_submessage_encrypted;
56 bool is_submessage_origin_authenticated;
57 bool is_payload_encrypted;
58
59 PluginEndpointSecurityAttributesMask mask() const;
60
61};
62
63 typedef uint32_t EndpointSecurityAttributesMask;
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
74 struct EndpointSecurityAttributes
75{
76 EndpointSecurityAttributes()
77 : is_read_protected(false)
78 , is_write_protected(false)
79 , is_discovery_protected(false)
80 , is_liveliness_protected(false)
81 , is_submessage_protected(false)
82 , is_payload_protected(false)
83 , is_key_protected(false)
84 , plugin_endpoint_attributes(0UL)
85 {
86 }
87
88 explicit EndpointSecurityAttributes(
89 const EndpointSecurityAttributesMask mask)
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)
97 , plugin_endpoint_attributes(0UL)
98 {
99 }
100
101 bool is_read_protected;
102
103 bool is_write_protected;
104
105 bool is_discovery_protected;
106
107 bool is_liveliness_protected;
108
109 bool is_submessage_protected;
110
111 bool is_payload_protected;
112
113 bool is_key_protected;
114
115 PluginEndpointSecurityAttributesMask plugin_endpoint_attributes;
116
117 EndpointSecurityAttributesMask mask() const;
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
eprosima::fastdds::rtps::security
Definition EndpointSecurityAttributes.hpp:26
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributesMask
uint32_t PluginEndpointSecurityAttributesMask
Definition EndpointSecurityAttributes.hpp:28
eprosima::fastdds::rtps::security::EndpointSecurityAttributesMask
uint32_t EndpointSecurityAttributesMask
Definition EndpointSecurityAttributes.hpp:63
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::plugin_endpoint_attributes
PluginEndpointSecurityAttributesMask plugin_endpoint_attributes
Definition EndpointSecurityAttributes.hpp:115
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::EndpointSecurityAttributes
EndpointSecurityAttributes(const EndpointSecurityAttributesMask mask)
Definition EndpointSecurityAttributes.hpp:88
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_payload_protected
bool is_payload_protected
Definition EndpointSecurityAttributes.hpp:111
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_liveliness_protected
bool is_liveliness_protected
Definition EndpointSecurityAttributes.hpp:107
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::match
bool match(const EndpointSecurityAttributesMask remoteMask, const PluginEndpointSecurityAttributesMask remotePluginMask) const
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_read_protected
bool is_read_protected
Definition EndpointSecurityAttributes.hpp:101
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::EndpointSecurityAttributes
EndpointSecurityAttributes()
Definition EndpointSecurityAttributes.hpp:76
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_key_protected
bool is_key_protected
Definition EndpointSecurityAttributes.hpp:113
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_write_protected
bool is_write_protected
Definition EndpointSecurityAttributes.hpp:103
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_submessage_protected
bool is_submessage_protected
Definition EndpointSecurityAttributes.hpp:109
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::mask
EndpointSecurityAttributesMask mask() const
eprosima::fastdds::rtps::security::EndpointSecurityAttributes::is_discovery_protected
bool is_discovery_protected
Definition EndpointSecurityAttributes.hpp:105
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes::mask
PluginEndpointSecurityAttributesMask mask() const
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes::PluginEndpointSecurityAttributes
PluginEndpointSecurityAttributes(const PluginEndpointSecurityAttributesMask mask)
Definition EndpointSecurityAttributes.hpp:46
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes::PluginEndpointSecurityAttributes
PluginEndpointSecurityAttributes()
Definition EndpointSecurityAttributes.hpp:39
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes::is_payload_encrypted
bool is_payload_encrypted
Definition EndpointSecurityAttributes.hpp:57
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes::is_submessage_encrypted
bool is_submessage_encrypted
Definition EndpointSecurityAttributes.hpp:55
eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes::is_submessage_origin_authenticated
bool is_submessage_origin_authenticated
Definition EndpointSecurityAttributes.hpp:56