RLBox
rlbox_types.hpp
1 #pragma once
2 // IWYU pragma: private, include "rlbox.hpp"
3 // IWYU pragma: friend "rlbox_.*\.hpp"
4 
5 namespace rlbox {
6 
7 template<typename T, typename T_Sbx>
9 {
10 private:
11  T data{ 0 };
12 
13 public:
14  template<typename T2 = T>
15  void set_zero()
16  {
17  data = 0;
18  }
19 };
20 
21 template<typename T, typename T_Sbx>
22 class tainted;
23 
24 template<typename T, typename T_Sbx>
25 class tainted_volatile;
26 
34 {
35 private:
36  bool val;
37 
38 public:
39  tainted_boolean_hint(bool init)
40  : val(init)
41  {}
43  inline tainted_boolean_hint& operator=(bool rhs)
44  {
45  val = rhs;
46  return *this;
47  }
48  inline tainted_boolean_hint operator!() { return tainted_boolean_hint(!val); }
49  template<size_t N>
50  inline bool unverified_safe_because(const char (&reason)[N]) const
51  {
52  (void)reason; /* unused */
53  return val;
54  }
55  inline bool UNSAFE_unverified() const { return val; }
56  inline bool UNSAFE_unverified() { return val; }
57  inline auto INTERNAL_unverified_safe() { return UNSAFE_unverified(); }
58  inline auto INTERNAL_unverified_safe() const { return UNSAFE_unverified(); }
59 };
60 
68 {
69 private:
70  int val;
71 
72 public:
73  tainted_int_hint(int init)
74  : val(init)
75  {}
76  tainted_int_hint(const tainted_int_hint&) = default;
77  inline tainted_int_hint& operator=(int rhs)
78  {
79  val = rhs;
80  return *this;
81  }
82  inline tainted_boolean_hint operator!() { return tainted_boolean_hint(!val); }
83  template<size_t N>
84  inline int unverified_safe_because(const char (&reason)[N]) const
85  {
86  (void)reason; /* unused */
87  return val;
88  }
89  inline int UNSAFE_unverified() const { return val; }
90  inline int UNSAFE_unverified() { return val; }
91  inline auto INTERNAL_unverified_safe() { return UNSAFE_unverified(); }
92  inline auto INTERNAL_unverified_safe() const { return UNSAFE_unverified(); }
93 };
94 
95 template<typename T_Sbx>
96 class rlbox_sandbox;
97 
98 template<typename T, typename T_Sbx>
99 class sandbox_callback;
100 
101 template<typename T, typename T_Sbx>
102 class app_pointer;
103 
104 class rlbox_noop_sandbox;
105 
106 class rlbox_dylib_sandbox;
107 }
Definition: rlbox_policy_types.hpp:182
Class that implements the null sandbox. This sandbox doesn't actually provide any isolation and only ...
Definition: rlbox_dylib_sandbox.hpp:54
Class that implements the null sandbox. This sandbox doesn't actually provide any isolation and only ...
Definition: rlbox_noop_sandbox.hpp:45
Encapsulation for sandboxes.
Definition: rlbox_sandbox.hpp:95
Definition: rlbox_policy_types.hpp:37
Tainted boolean value that serves as a "hint" and not a definite answer. Comparisons with a tainted_v...
Definition: rlbox_types.hpp:34
Tainted integer value that serves as a "hint" and not a definite answer. Comparisons with a tainted_v...
Definition: rlbox_types.hpp:68
Definition: rlbox_types.hpp:9
Tainted volatile values are like tainted values but still point to sandbox memory....
Definition: rlbox.hpp:1101
Definition: rlbox_types.hpp:22