forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetwork_policy.h
51 lines (37 loc) · 1.5 KB
/
network_policy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <string_view>
namespace drake {
/** @addtogroup environment_variables
@{
@defgroup allow_network DRAKE_ALLOW_NETWORK
Users can set the environment variable `DRAKE_ALLOW_NETWORK` to a
colon-separated list to limit which components are permitted network access.
If `DRAKE_ALLOW_NETWORK` is unset or set to the empty string, then all
networking is allowed.
The component values supported by Drake are:
- <b>lcm</b> (see drake::lcm::DrakeLcm)
- <b>meshcat</b> (see drake::geometry::Meshcat)
- <b>package_map</b> (see drake::multibody::PackageMap)
- <b>render_gltf_client</b> (see drake::geometry::MakeRenderEngineVtk())
... as well as the special value <b>none</b>.
The environment variable only governs the *network* access of the component.
If the component also supports other mechanisms (e.g., files or memory buffers)
those are unaffected.
---
For example, to allow only lcm and meshcat, run this command in your terminal:
```sh
export DRAKE_ALLOW_NETWORK=lcm:meshcat
```
To disable all networking, run this command in your terminal:
```sh
export DRAKE_ALLOW_NETWORK=none
```
@} */
namespace internal {
/* Returns true iff the given component is allowed to access the network based
on the current value of the DRAKE_ALLOW_NETWORK environment variable.
@param component is the name to query, which must be alphanumeric lowercase
(underscores allowed) and must not be "none" nor the empty string. */
bool IsNetworkingAllowed(std::string_view component);
} // namespace internal
} // namespace drake