ROS 2 rclcpp + rcl - rolling  rolling-e7363f10
ROS 2 C++ Client Library with ROS Client Library
security.h
Go to the documentation of this file.
1 // Copyright 2018-2020 Open Source Robotics Foundation, Inc.
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 
16 
17 #ifndef RCL__SECURITY_H_
18 #define RCL__SECURITY_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include <stdbool.h>
26 
27 #include "rcl/allocator.h"
28 #include "rcl/types.h"
29 #include "rcl/visibility_control.h"
30 #include "rcutils/allocator.h"
31 
32 #include "rmw/security_options.h"
33 
34 #ifndef ROS_SECURITY_ENCLAVE_OVERRIDE
36 # define ROS_SECURITY_ENCLAVE_OVERRIDE "ROS_SECURITY_ENCLAVE_OVERRIDE"
37 #endif
38 
39 #ifndef ROS_SECURITY_KEYSTORE_VAR_NAME
41 # define ROS_SECURITY_KEYSTORE_VAR_NAME "ROS_SECURITY_KEYSTORE"
42 #endif
43 
44 #ifndef ROS_SECURITY_STRATEGY_VAR_NAME
46 # define ROS_SECURITY_STRATEGY_VAR_NAME "ROS_SECURITY_STRATEGY"
47 #endif
48 
49 #ifndef ROS_SECURITY_ENABLE_VAR_NAME
51 # define ROS_SECURITY_ENABLE_VAR_NAME "ROS_SECURITY_ENABLE"
52 #endif
53 
55 
70 RCL_PUBLIC
73  const char * name,
74  const rcutils_allocator_t * allocator,
75  rmw_security_options_t * security_options);
76 
78 
87 RCL_PUBLIC
89 rcl_security_enabled(bool * use_security);
90 
92 
102 RCL_PUBLIC
103 rcl_ret_t
104 rcl_get_enforcement_policy(rmw_security_enforcement_policy_t * policy);
105 
107 
127 RCL_PUBLIC
128 char *
129 rcl_get_secure_root(const char * name, const rcl_allocator_t * allocator);
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif // RCL__SECURITY_H_
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:31
RCL_PUBLIC rcl_ret_t rcl_get_enforcement_policy(rmw_security_enforcement_policy_t *policy)
Get security enforcement policy from the environment.
Definition: security.c:92
RCL_PUBLIC char * rcl_get_secure_root(const char *name, const rcl_allocator_t *allocator)
Return the secure root given a enclave name.
Definition: security.c:154
RCL_PUBLIC rcl_ret_t rcl_security_enabled(bool *use_security)
Check if security has to be used, according to the environment.
Definition: security.c:72
RCL_PUBLIC rcl_ret_t rcl_get_security_options_from_environment(const char *name, const rcutils_allocator_t *allocator, rmw_security_options_t *security_options)
Initialize security options from values in the environment variables and given names.
Definition: security.c:34
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:25