2019-11-25 15:28:48 -08:00
|
|
|
// Copyright 2019 yuzu emulator team
|
2016-06-14 16:03:30 -07:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-06-18 11:39:26 -07:00
|
|
|
#include <memory>
|
2016-12-14 09:33:49 -08:00
|
|
|
#include <string>
|
2019-11-25 15:28:48 -08:00
|
|
|
|
2020-12-21 22:36:53 -08:00
|
|
|
#include "core/hle/kernel/k_synchronization_object.h"
|
2019-11-25 15:28:48 -08:00
|
|
|
#include "core/hle/result.h"
|
2018-12-31 15:09:41 -08:00
|
|
|
|
|
|
|
union ResultCode;
|
2016-06-14 16:03:30 -07:00
|
|
|
|
2020-03-31 12:10:44 -07:00
|
|
|
namespace Core::Memory {
|
2019-11-26 11:10:49 -08:00
|
|
|
class Memory;
|
|
|
|
}
|
|
|
|
|
2020-09-14 11:03:10 -07:00
|
|
|
namespace Core::Timing {
|
|
|
|
class CoreTiming;
|
|
|
|
}
|
|
|
|
|
2016-06-14 16:03:30 -07:00
|
|
|
namespace Kernel {
|
|
|
|
|
2018-08-28 09:30:33 -07:00
|
|
|
class KernelCore;
|
2017-01-04 20:23:17 -08:00
|
|
|
class Session;
|
2017-06-29 10:30:34 -07:00
|
|
|
class Thread;
|
2016-06-14 16:03:30 -07:00
|
|
|
|
2020-12-21 22:36:53 -08:00
|
|
|
class ClientSession final : public KSynchronizationObject {
|
2016-06-14 16:03:30 -07:00
|
|
|
public:
|
2019-11-24 17:15:51 -08:00
|
|
|
explicit ClientSession(KernelCore& kernel);
|
|
|
|
~ClientSession() override;
|
|
|
|
|
2019-11-25 15:28:48 -08:00
|
|
|
friend class Session;
|
2016-06-14 16:03:30 -07:00
|
|
|
|
2016-11-30 20:28:31 -08:00
|
|
|
std::string GetTypeName() const override {
|
|
|
|
return "ClientSession";
|
|
|
|
}
|
2016-12-05 08:02:08 -08:00
|
|
|
|
2016-11-30 20:28:31 -08:00
|
|
|
std::string GetName() const override {
|
|
|
|
return name;
|
|
|
|
}
|
2016-06-14 16:03:30 -07:00
|
|
|
|
2019-04-11 13:30:52 -07:00
|
|
|
static constexpr HandleType HANDLE_TYPE = HandleType::ClientSession;
|
2016-11-30 20:28:31 -08:00
|
|
|
HandleType GetHandleType() const override {
|
|
|
|
return HANDLE_TYPE;
|
|
|
|
}
|
2016-06-14 16:03:30 -07:00
|
|
|
|
2020-09-14 11:03:10 -07:00
|
|
|
ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory,
|
|
|
|
Core::Timing::CoreTiming& core_timing);
|
2019-11-25 15:28:48 -08:00
|
|
|
|
2020-02-11 13:36:39 -08:00
|
|
|
bool IsSignaled() const override;
|
|
|
|
|
2019-03-05 15:24:00 -08:00
|
|
|
private:
|
2019-11-25 15:28:48 -08:00
|
|
|
static ResultVal<std::shared_ptr<ClientSession>> Create(KernelCore& kernel,
|
|
|
|
std::shared_ptr<Session> parent,
|
|
|
|
std::string name = "Unknown");
|
|
|
|
|
2017-01-04 20:23:17 -08:00
|
|
|
/// The parent session, which links to the server endpoint.
|
|
|
|
std::shared_ptr<Session> parent;
|
2016-06-14 16:03:30 -07:00
|
|
|
|
2019-03-05 15:24:00 -08:00
|
|
|
/// Name of the client session (optional)
|
|
|
|
std::string name;
|
2016-06-14 16:03:30 -07:00
|
|
|
};
|
|
|
|
|
2018-01-19 23:48:02 -08:00
|
|
|
} // namespace Kernel
|