Asylo
|
A manager object for shared resources. More...
#include <shared_resource_manager.h>
Public Member Functions | |
template<typename T , typename Deleter = std::default_delete<T>> | |
Status | RegisterManagedResource (const SharedName &name, T *pointer) |
Registers a shared resource and passes ownership to the SharedResourceManager. More... | |
template<typename T > | |
Status | RegisterUnmanagedResource (const SharedName &name, T *pointer) |
Registers a shared resource owned by that remains owned by the caller. More... | |
template<typename T > | |
T * | AcquireResource (const SharedName &name) |
Acquires a named resource. More... | |
bool | ReleaseResource (const SharedName &name) |
Releases a named resource. More... | |
A manager object for shared resources.
A manager object responsible for reference-counted untrusted resources which are shared between trusted and untrusted code.
|
inline |
Acquires a named resource.
Acquires a named resource by incrementing its reference count and returning a pointer to an object owned by the EnclaveManager. Returns nullptr if the named resource does not exist.
|
inline |
Registers a shared resource and passes ownership to the SharedResourceManager.
Registers a shared resource of type T by name and transfers ownership of the object to the manager. Managed resources are objects allocated in the untrusted partition of the application and are addressable by name from trusted code.
Each resource is associated with a reference count, which is initialized to one (1) at the time the resource is registered. Resource counts are managed explicitly by calls to AcquireResource and ReleaseResource. Resources are automatically disposed of and removed from the resource table when their reference count reaches zero (0).
name | The name to register to this resource. |
pointer | A pointer to a value that this resource owns and will dispose of once it is no longer referenced. |
|
inline |
Registers a shared resource owned by that remains owned by the caller.
Has the same behavior as RegisterManagedResource, except that the ownership of the resource remains with the caller. This means that that the resource will not be deleted by the EnclaveManager when its reference count reaches zero (0). This is appropriate for pointers to objects the caller owns and would like to make available inside the enclave.
name | The name to register to this resource. |
pointer | A pointer to a value owned by the caller. |
bool asylo::SharedResourceManager::ReleaseResource | ( | const SharedName & | name | ) |
Releases a named resource.
Releases a named resource by decrementing its reference count. Removes it from the resource table and delegates finalization to its resource handle when the reference count reaches zero (0). Returns false if the named resource does not exist.