diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-08 21:20:01 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-08 21:20:01 -0300 |
| commit | dbad4b699e35442920baa60c13f76e95904fe317 (patch) | |
| tree | 70e35b6879349a750ea5be0b02790bb8d32d00b1 /src | |
| parent | 602af97c269bdc211cc7aeb34e436152053395cc (diff) | |
| download | RNT-dbad4b699e35442920baa60c13f76e95904fe317.tar.gz RNT-dbad4b699e35442920baa60c13f76e95904fe317.zip | |
restructure project and add readme
Diffstat (limited to 'src')
| -rw-r--r-- | src/CursorManager.cpp | 5 | ||||
| -rw-r--r-- | src/HandlerManager.cpp | 63 | ||||
| -rw-r--r-- | src/IdentityManager.cpp | 14 | ||||
| -rw-r--r-- | src/LifecycleManager.cpp | 17 | ||||
| -rw-r--r-- | src/NT.cpp | 6 | ||||
| -rw-r--r-- | src/NamespaceReferenceManager.cpp | 5 | ||||
| -rw-r--r-- | src/ObjectManager.cpp | 9 | ||||
| -rw-r--r-- | src/PermissionsManager.cpp | 19 | ||||
| -rw-r--r-- | src/WAM.cpp | 5 |
9 files changed, 142 insertions, 1 deletions
diff --git a/src/CursorManager.cpp b/src/CursorManager.cpp new file mode 100644 index 0000000..8ae4496 --- /dev/null +++ b/src/CursorManager.cpp @@ -0,0 +1,5 @@ +#include "CursorManager.h" + +namespace nt +{ +} diff --git a/src/HandlerManager.cpp b/src/HandlerManager.cpp new file mode 100644 index 0000000..895f553 --- /dev/null +++ b/src/HandlerManager.cpp @@ -0,0 +1,63 @@ +#include "HandlerManager.h" + +#include "IdentityManager.h" +#include "LifecycleManager.h" +#include "PermissionsManager.h" + +namespace nt +{ + void HandlerManager::DeallocateHandle(struct handle* handle) + { + } + + struct HandlerManager::handle HandlerManager::Open(std::vector<std::string> object_path, void* connection_context) + { + ObjectManager objects; + PermissionsManager permissions; + IdentityManager identities; + LifecycleManager lifecycles; + ObjectManager::registry* retrieved_object = objects.Find((const std::vector<std::string>)object_path); + if (permissions.Access(retrieved_object, (const void*)connection_context) + && identities.CanOpen(retrieved_object) + && lifecycles.Contention(retrieved_object)) { + // Starts monitoring this guy + lifecycles.Monitor(retrieved_object); + return { retrieved_object, connection_context }; // Return a successful handle + } + else { + // Return something more algebraic instead of null or an int + return {}; + }; + } + + bool HandlerManager::Close(struct handle* handle) + { + if (handle == nullptr) { + return false; + } + PermissionsManager permissions; + IdentityManager identities; + LifecycleManager lifecycles; + // Somehow grab the object pointer and connection (maybe drop it...) from the handle + ObjectManager::registry* object = handle->object; + void* connection_context = handle->connection_context; + // Checking for permissions here may be relevant. + // What if we have a handle but no permission? Spooky + if (permissions.Access(object, connection_context) + && identities.CanClose(object) + // TODO: I think that in this case we do not need to worry about contention. + // But be careful to evaluate this scenario later. + //&& LifecycleManager::Contention(retrieved_object) + ) { + // Stops monitoring this guy + lifecycles.Unmonitor(object); + DeallocateHandle(handle); + return true; // Return a successful handle + } + else { + // Return something more algebraic instead of null or an int. + // It's kinda bad to not even report what went wrong. + return false; + }; + } +} diff --git a/src/IdentityManager.cpp b/src/IdentityManager.cpp new file mode 100644 index 0000000..93ad705 --- /dev/null +++ b/src/IdentityManager.cpp @@ -0,0 +1,14 @@ +#include "IdentityManager.h" + +namespace nt +{ + const bool IdentityManager::CanOpen(ObjectManager::registry* object) + { + return object != nullptr; + } + + const bool IdentityManager::CanClose(ObjectManager::registry* object) + { + return object != nullptr; + } +} diff --git a/src/LifecycleManager.cpp b/src/LifecycleManager.cpp new file mode 100644 index 0000000..bcab4b5 --- /dev/null +++ b/src/LifecycleManager.cpp @@ -0,0 +1,17 @@ +#include "LifecycleManager.h" + +namespace nt +{ + void LifecycleManager::Monitor(ObjectManager::registry* object) + { + } + + const bool LifecycleManager::Contention(ObjectManager::registry* object) + { + return object != nullptr; + } + + void LifecycleManager::Unmonitor(ObjectManager::registry* object) + { + } +} @@ -1,4 +1,4 @@ -#include "NT.h" +#include "Runtime.h" #ifdef NT_CONSOLE_APP #include <iostream> @@ -10,6 +10,10 @@ namespace nt { return true; } + + void NT::SimulateEntryCall() + { + } } #ifdef NT_CONSOLE_APP diff --git a/src/NamespaceReferenceManager.cpp b/src/NamespaceReferenceManager.cpp new file mode 100644 index 0000000..1d9baac --- /dev/null +++ b/src/NamespaceReferenceManager.cpp @@ -0,0 +1,5 @@ +#include "NamespaceReferenceManager.h" + +namespace nt +{ +} diff --git a/src/ObjectManager.cpp b/src/ObjectManager.cpp new file mode 100644 index 0000000..ff85af2 --- /dev/null +++ b/src/ObjectManager.cpp @@ -0,0 +1,9 @@ +#include "ObjectManager.h" + +namespace nt +{ + struct ObjectManager::registry* ObjectManager::Find(const std::vector<std::string> object_path) + { + return nullptr; + } +} diff --git a/src/PermissionsManager.cpp b/src/PermissionsManager.cpp new file mode 100644 index 0000000..228dd2d --- /dev/null +++ b/src/PermissionsManager.cpp @@ -0,0 +1,19 @@ +#include "PermissionsManager.h" + +namespace nt +{ + std::set<AUTH_CLAIM> PermissionsManager::Firewall(AUTH_METHOD method) + { + return {}; + } + + const bool PermissionsManager::Access(const ObjectManager::registry* object, const void* connection_context) + { + // Checks the security descriptor on the head of the object we find in the ObjectManager::registry + // Then additionally check other metadata yet to be defined in the connection_context, + // like user group, policy, etc. + // Yet to decide if this should be summoned at every attempt to get ahold of an object, + // that might produce significant overhead. How can we solve this? + return object != nullptr && connection_context != nullptr; + } +} diff --git a/src/WAM.cpp b/src/WAM.cpp new file mode 100644 index 0000000..9088cd0 --- /dev/null +++ b/src/WAM.cpp @@ -0,0 +1,5 @@ +#include "WAM.h" + +namespace nt +{ +} |
