From 173bde2eca6fbf9a79e3ec3a80b85fd339e3496d Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 12 Nov 2018 14:52:57 +0100 Subject: [PATCH] meso: KPort mini skeleton --- .../mesosphere/processes/KClientPort.hpp | 34 ++++++++++++++++++ .../include/mesosphere/processes/KPort.hpp | 36 +++++++++++++++++++ .../mesosphere/processes/KServerPort.hpp | 31 ++++++++++++++++ mesosphere/source/processes/KClientPort.cpp | 20 +++++++++++ mesosphere/source/processes/KPort.cpp | 20 +++++++++++ mesosphere/source/processes/KServerPort.cpp | 20 +++++++++++ 6 files changed, 161 insertions(+) create mode 100644 mesosphere/include/mesosphere/processes/KClientPort.hpp create mode 100644 mesosphere/include/mesosphere/processes/KPort.hpp create mode 100644 mesosphere/include/mesosphere/processes/KServerPort.hpp create mode 100644 mesosphere/source/processes/KClientPort.cpp create mode 100644 mesosphere/source/processes/KPort.cpp create mode 100644 mesosphere/source/processes/KServerPort.cpp diff --git a/mesosphere/include/mesosphere/processes/KClientPort.hpp b/mesosphere/include/mesosphere/processes/KClientPort.hpp new file mode 100644 index 000000000..1aa721f05 --- /dev/null +++ b/mesosphere/include/mesosphere/processes/KClientPort.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace mesosphere +{ + +class KPort; +class KServerPort; + +class KClientPort final : + public KSynchronizationObject, + public IClient { + + public: + + MESOSPHERE_AUTO_OBJECT_TRAITS(SynchronizationObject, ClientPort); + + virtual ~KClientPort(); + + virtual bool IsSignaled() const override; + + private: + friend class KPort; + +}; + +MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(ClientPort); + +} \ No newline at end of file diff --git a/mesosphere/include/mesosphere/processes/KPort.hpp b/mesosphere/include/mesosphere/processes/KPort.hpp new file mode 100644 index 000000000..2d08c9144 --- /dev/null +++ b/mesosphere/include/mesosphere/processes/KPort.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace mesosphere +{ + +class KPort final : + public KAutoObject, + public ISetAllocated, + public IClientServerParent { + + public: + MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Port); + + virtual ~KPort(); + + Result Initialize(); + + private: + friend class KClientPort; + friend class KServerPort; + + bool isClientAlive = false; + bool isServerAlive = false; + bool isLight = false; +}; + +MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(Port); + +} \ No newline at end of file diff --git a/mesosphere/include/mesosphere/processes/KServerPort.hpp b/mesosphere/include/mesosphere/processes/KServerPort.hpp new file mode 100644 index 000000000..958c5ac71 --- /dev/null +++ b/mesosphere/include/mesosphere/processes/KServerPort.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +namespace mesosphere +{ + +class KPort; +class KClientPort; + +class KServerPort final : + public KSynchronizationObject, + public IServer { + + public: + + MESOSPHERE_AUTO_OBJECT_TRAITS(SynchronizationObject, ServerPort); + + virtual ~KServerPort(); + + virtual bool IsSignaled() const override; + + private: + friend class KPort; + +}; + +MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(ServerPort); + +} \ No newline at end of file diff --git a/mesosphere/source/processes/KClientPort.cpp b/mesosphere/source/processes/KClientPort.cpp new file mode 100644 index 000000000..b478e5a07 --- /dev/null +++ b/mesosphere/source/processes/KClientPort.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +namespace mesosphere +{ + +KClientPort::~KClientPort() +{ + KScopedCriticalSection critsec{}; + parent->isClientAlive = false; +} + +bool KClientPort::IsSignaled() const +{ + return false; // TODO +} + +} diff --git a/mesosphere/source/processes/KPort.cpp b/mesosphere/source/processes/KPort.cpp new file mode 100644 index 000000000..d6942c04c --- /dev/null +++ b/mesosphere/source/processes/KPort.cpp @@ -0,0 +1,20 @@ +#include +#include + +namespace mesosphere +{ + +KPort::~KPort() +{ +} + +Result KPort::Initialize() +{ + SetClientServerParent(); + isClientAlive = true; + isServerAlive = true; + + return ResultSuccess(); +} + +} diff --git a/mesosphere/source/processes/KServerPort.cpp b/mesosphere/source/processes/KServerPort.cpp new file mode 100644 index 000000000..c6fe88479 --- /dev/null +++ b/mesosphere/source/processes/KServerPort.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +namespace mesosphere +{ + +KServerPort::~KServerPort() +{ + KScopedCriticalSection critsec{}; + parent->isServerAlive = false; +} + +bool KServerPort::IsSignaled() const +{ + return false; // TODO +} + +}