diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-06-06 23:04:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-06 23:04:11 +0200 |
commit | b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1 (patch) | |
tree | b6672a86793b53fdf3e07340515d731e45253677 /src/core/hle/service/sm/sm.h | |
parent | Merge pull request #2753 from yuriks/set-hle-handler (diff) | |
parent | Service: Make service registration part of the sm implementation (diff) | |
download | yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.tar yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.tar.gz yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.tar.bz2 yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.tar.lz yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.tar.xz yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.tar.zst yuzu-b242f1c5dd72f70d32f3a2d25d67974cdac5d9b1.zip |
Diffstat (limited to 'src/core/hle/service/sm/sm.h')
-rw-r--r-- | src/core/hle/service/sm/sm.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h new file mode 100644 index 000000000..5fac5455c --- /dev/null +++ b/src/core/hle/service/sm/sm.h @@ -0,0 +1,49 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <string> +#include <unordered_map> +#include "core/hle/kernel/kernel.h" +#include "core/hle/result.h" +#include "core/hle/service/service.h" + +namespace Kernel { +class ClientPort; +class ClientSession; +class ServerPort; +class SessionRequestHandler; +} // namespace Kernel + +namespace Service { +namespace SM { + +constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(1, ErrorModule::SRV, ErrorSummary::WouldBlock, + ErrorLevel::Temporary); // 0xD0406401 +constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(2, ErrorModule::SRV, ErrorSummary::WouldBlock, + ErrorLevel::Temporary); // 0xD0406402 +constexpr ResultCode ERR_INVALID_NAME_SIZE(5, ErrorModule::SRV, ErrorSummary::WrongArgument, + ErrorLevel::Permanent); // 0xD9006405 +constexpr ResultCode ERR_ACCESS_DENIED(6, ErrorModule::SRV, ErrorSummary::InvalidArgument, + ErrorLevel::Permanent); // 0xD8E06406 +constexpr ResultCode ERR_NAME_CONTAINS_NUL(7, ErrorModule::SRV, ErrorSummary::WrongArgument, + ErrorLevel::Permanent); // 0xD9006407 + +class ServiceManager { +public: + ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> RegisterService(std::string name, + unsigned int max_sessions); + ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> GetServicePort(const std::string& name); + ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ConnectToService(const std::string& name); + +private: + /// Map of services registered with the "srv:" service, retrieved using GetServiceHandle. + std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> registered_services; +}; + +extern std::unique_ptr<ServiceManager> g_service_manager; + +} // namespace SM +} // namespace Service |