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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#pragma once
// IWYU pragma: private, include "rlbox.hpp"
// IWYU pragma: friend "rlbox_.*\.hpp"
namespace rlbox {
template<typename T, typename T_Sbx>
class tainted_opaque
{
private:
T data{ 0 };
public:
template<typename T2 = T>
void set_zero()
{
data = 0;
}
};
template<typename T, typename T_Sbx>
class tainted;
template<typename T, typename T_Sbx>
class tainted_volatile;
class tainted_boolean_hint;
class tainted_int_hint;
template<typename T_Sbx>
class rlbox_sandbox;
template<typename T, typename T_Sbx>
class sandbox_callback;
template<typename T, typename T_Sbx>
class app_pointer;
class rlbox_noop_sandbox;
class rlbox_dylib_sandbox;
}
#define RLBOX_DEFINE_BASE_TYPES_FOR(SBXNAME, SBXTYPE) \
namespace rlbox { \
class rlbox_##SBXTYPE##_sandbox; \
} \
using rlbox_##SBXNAME##_sandbox_type = rlbox::rlbox_##SBXTYPE##_sandbox; \
using rlbox_sandbox_##SBXNAME = \
rlbox::rlbox_sandbox<rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using sandbox_callback_##SBXNAME = \
rlbox::sandbox_callback<T, rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using tainted_##SBXNAME = rlbox::tainted<T, rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using tainted_opaque_##SBXNAME = \
rlbox::tainted_opaque<T, rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using tainted_volatile_##SBXNAME = \
rlbox::tainted_volatile<T, rlbox_##SBXNAME##_sandbox_type>; \
using rlbox::tainted_boolean_hint; \
template<typename T> \
using app_pointer_##SBXNAME = \
rlbox::app_pointer<T, rlbox_##SBXNAME##_sandbox_type>;
// This is like RLBOX_DEFINE_BASE_TYPES_FOR but with an explicit sandbox type
#define RLBOX_DEFINE_BASE_TYPES_FOR_TYPE(SBXNAME, SBXTYPE) \
using rlbox_##SBXNAME##_sandbox_type = SBXTYPE; \
using rlbox_sandbox_##SBXNAME = \
rlbox::rlbox_sandbox<rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using sandbox_callback_##SBXNAME = \
rlbox::sandbox_callback<T, rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using tainted_##SBXNAME = rlbox::tainted<T, rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using tainted_opaque_##SBXNAME = \
rlbox::tainted_opaque<T, rlbox_##SBXNAME##_sandbox_type>; \
template<typename T> \
using tainted_volatile_##SBXNAME = \
rlbox::tainted_volatile<T, rlbox_##SBXNAME##_sandbox_type>; \
using rlbox::tainted_boolean_hint; \
template<typename T> \
using app_pointer_##SBXNAME = \
rlbox::app_pointer<T, rlbox_##SBXNAME##_sandbox_type>;
|