ROS 2 rclcpp + rcl - rolling  rolling-a919a6e5
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 "rmw/security_options.h"
31 
32 #ifndef ROS_SECURITY_ENCLAVE_OVERRIDE
34 # define ROS_SECURITY_ENCLAVE_OVERRIDE "ROS_SECURITY_ENCLAVE_OVERRIDE"
35 #endif
36 
37 #ifndef ROS_SECURITY_KEYSTORE_VAR_NAME
39 # define ROS_SECURITY_KEYSTORE_VAR_NAME "ROS_SECURITY_KEYSTORE"
40 #endif
41 
42 #ifndef ROS_SECURITY_STRATEGY_VAR_NAME
44 # define ROS_SECURITY_STRATEGY_VAR_NAME "ROS_SECURITY_STRATEGY"
45 #endif
46 
47 #ifndef ROS_SECURITY_ENABLE_VAR_NAME
49 # define ROS_SECURITY_ENABLE_VAR_NAME "ROS_SECURITY_ENABLE"
50 #endif
51 
53 
68 RCL_PUBLIC
71  const char * name,
72  const rcutils_allocator_t * allocator,
73  rmw_security_options_t * security_options);
74 
76 
85 RCL_PUBLIC
87 rcl_security_enabled(bool * use_security);
88 
90 
100 RCL_PUBLIC
101 rcl_ret_t
102 rcl_get_enforcement_policy(rmw_security_enforcement_policy_t * policy);
103 
105 
125 RCL_PUBLIC
126 char *
127 rcl_get_secure_root(const char * name, const rcl_allocator_t * allocator);
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #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:87
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:149
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:67
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:29
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:24