summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/hle_ipc.h
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-06-05 06:52:19 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-06-06 08:40:11 +0200
commite626a520ca8d3047449d7d7028d6b9c773a6b570 (patch)
treeb1308e008f8a79d94350da54df2feb3a62013934 /src/core/hle/kernel/hle_ipc.h
parentMerge pull request #2747 from atouchet/readme-url (diff)
downloadyuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.tar
yuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.tar.gz
yuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.tar.bz2
yuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.tar.lz
yuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.tar.xz
yuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.tar.zst
yuzu-e626a520ca8d3047449d7d7028d6b9c773a6b570.zip
Diffstat (limited to 'src/core/hle/kernel/hle_ipc.h')
-rw-r--r--src/core/hle/kernel/hle_ipc.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
new file mode 100644
index 000000000..b3550734c
--- /dev/null
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -0,0 +1,52 @@
+// Copyright 2017 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <vector>
+#include "core/hle/kernel/kernel.h"
+
+namespace Kernel {
+
+class ServerSession;
+
+/**
+ * Interface implemented by HLE Session handlers.
+ * This can be provided to a ServerSession in order to hook into several relevant events
+ * (such as a new connection or a SyncRequest) so they can be implemented in the emulator.
+ */
+class SessionRequestHandler {
+public:
+ /**
+ * Handles a sync request from the emulated application.
+ * @param server_session The ServerSession that was triggered for this sync request,
+ * it should be used to differentiate which client (As in ClientSession) we're answering to.
+ * TODO(Subv): Use a wrapper structure to hold all the information relevant to
+ * this request (ServerSession, Originator thread, Translated command buffer, etc).
+ * @returns ResultCode the result code of the translate operation.
+ */
+ virtual void HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) = 0;
+
+ /**
+ * Signals that a client has just connected to this HLE handler and keeps the
+ * associated ServerSession alive for the duration of the connection.
+ * @param server_session Owning pointer to the ServerSession associated with the connection.
+ */
+ void ClientConnected(Kernel::SharedPtr<Kernel::ServerSession> server_session);
+
+ /**
+ * Signals that a client has just disconnected from this HLE handler and releases the
+ * associated ServerSession.
+ * @param server_session ServerSession associated with the connection.
+ */
+ void ClientDisconnected(Kernel::SharedPtr<Kernel::ServerSession> server_session);
+
+protected:
+ /// List of sessions that are connected to this handler.
+ /// A ServerSession whose server endpoint is an HLE implementation is kept alive by this list
+ // for the duration of the connection.
+ std::vector<Kernel::SharedPtr<Kernel::ServerSession>> connected_sessions;
+};
+
+} // namespace Kernel