Merge pull request #3893 from NarcolepticK/dlp-migrate-framework

service/dlp: Migrate to ServiceFramework
This commit is contained in:
Weiyi Wang 2018-06-29 17:39:17 +03:00 committed by GitHub
commit 1eeccdd556
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 100 deletions

View file

@ -6,18 +6,15 @@
#include "core/hle/service/dlp/dlp_clnt.h" #include "core/hle/service/dlp/dlp_clnt.h"
#include "core/hle/service/dlp/dlp_fkcl.h" #include "core/hle/service/dlp/dlp_fkcl.h"
#include "core/hle/service/dlp/dlp_srvr.h" #include "core/hle/service/dlp/dlp_srvr.h"
#include "core/hle/service/service.h"
namespace Service { namespace Service {
namespace DLP { namespace DLP {
void Init() { void InstallInterfaces(SM::ServiceManager& service_manager) {
AddService(new DLP_CLNT_Interface); std::make_shared<DLP_CLNT>()->InstallAsService(service_manager);
AddService(new DLP_FKCL_Interface); std::make_shared<DLP_FKCL>()->InstallAsService(service_manager);
AddService(new DLP_SRVR_Interface); std::make_shared<DLP_SRVR>()->InstallAsService(service_manager);
} }
void Shutdown() {}
} // namespace DLP } // namespace DLP
} // namespace Service } // namespace Service

View file

@ -4,14 +4,13 @@
#pragma once #pragma once
#include "core/hle/service/service.h"
namespace Service { namespace Service {
namespace DLP { namespace DLP {
/// Initializes the DLP services. /// Initializes the DLP services.
void Init(); void InstallInterfaces(SM::ServiceManager& service_manager);
/// Shuts down the DLP services.
void Shutdown();
} // namespace DLP } // namespace DLP
} // namespace Service } // namespace Service

View file

@ -2,12 +2,15 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/dlp/dlp_clnt.h" #include "core/hle/service/dlp/dlp_clnt.h"
namespace Service { namespace Service {
namespace DLP { namespace DLP {
const Interface::FunctionInfo FunctionTable[] = { DLP_CLNT::DLP_CLNT() : ServiceFramework("dlp:CLNT", 1) {
static const FunctionInfo functions[] = {
// clang-format off
{0x000100C3, nullptr, "Initialize"}, {0x000100C3, nullptr, "Initialize"},
{0x00020000, nullptr, "Finalize"}, {0x00020000, nullptr, "Finalize"},
{0x00030000, nullptr, "GetEventDesc"}, {0x00030000, nullptr, "GetEventDesc"},
@ -28,10 +31,10 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00120000, nullptr, "StopSession"}, {0x00120000, nullptr, "StopSession"},
{0x00130100, nullptr, "GetCupVersion"}, {0x00130100, nullptr, "GetCupVersion"},
{0x00140100, nullptr, "GetDupAvailability"}, {0x00140100, nullptr, "GetDupAvailability"},
}; // clang-format on
};
DLP_CLNT_Interface::DLP_CLNT_Interface() { RegisterHandlers(functions);
Register(FunctionTable);
} }
} // namespace DLP } // namespace DLP

View file

@ -9,13 +9,10 @@
namespace Service { namespace Service {
namespace DLP { namespace DLP {
class DLP_CLNT_Interface final : public Interface { class DLP_CLNT final : public ServiceFramework<DLP_CLNT> {
public: public:
DLP_CLNT_Interface(); DLP_CLNT();
~DLP_CLNT() = default;
std::string GetPortName() const override {
return "dlp:CLNT";
}
}; };
} // namespace DLP } // namespace DLP

View file

@ -2,12 +2,15 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/dlp/dlp_fkcl.h" #include "core/hle/service/dlp/dlp_fkcl.h"
namespace Service { namespace Service {
namespace DLP { namespace DLP {
const Interface::FunctionInfo FunctionTable[] = { DLP_FKCL::DLP_FKCL() : ServiceFramework("dlp:FKCL", 1) {
static const FunctionInfo functions[] = {
// clang-format off
{0x00010083, nullptr, "Initialize"}, {0x00010083, nullptr, "Initialize"},
{0x00020000, nullptr, "Finalize"}, {0x00020000, nullptr, "Finalize"},
{0x00030000, nullptr, "GetEventDesc"}, {0x00030000, nullptr, "GetEventDesc"},
@ -25,10 +28,10 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000F0000, nullptr, "GetWirelessRebootPassphrase"}, {0x000F0000, nullptr, "GetWirelessRebootPassphrase"},
{0x00100000, nullptr, "StopSession"}, {0x00100000, nullptr, "StopSession"},
{0x00110203, nullptr, "Initialize2"}, {0x00110203, nullptr, "Initialize2"},
}; // clang-format on
};
DLP_FKCL_Interface::DLP_FKCL_Interface() { RegisterHandlers(functions);
Register(FunctionTable);
} }
} // namespace DLP } // namespace DLP

View file

@ -9,13 +9,10 @@
namespace Service { namespace Service {
namespace DLP { namespace DLP {
class DLP_FKCL_Interface final : public Interface { class DLP_FKCL final : public ServiceFramework<DLP_FKCL> {
public: public:
DLP_FKCL_Interface(); DLP_FKCL();
~DLP_FKCL() = default;
std::string GetPortName() const override {
return "dlp:FKCL";
}
}; };
} // namespace DLP } // namespace DLP

View file

@ -4,23 +4,26 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/ipc.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/dlp/dlp_srvr.h" #include "core/hle/service/dlp/dlp_srvr.h"
namespace Service { namespace Service {
namespace DLP { namespace DLP {
static void IsChild(Interface* self) { void DLP_SRVR::IsChild(Kernel::HLERequestContext& ctx) {
u32* cmd_buff = Kernel::GetCommandBuffer(); IPC::RequestParser rp(ctx, 0x0E, 0, 0);
cmd_buff[1] = RESULT_SUCCESS.raw; IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
cmd_buff[2] = 0; rb.Push(RESULT_SUCCESS);
rb.Push(false);
NGLOG_WARNING(Service_DLP, "(STUBBED) called"); NGLOG_WARNING(Service_DLP, "(STUBBED) called");
} }
const Interface::FunctionInfo FunctionTable[] = { DLP_SRVR::DLP_SRVR() : ServiceFramework("dlp:SRVR", 1) {
static const FunctionInfo functions[] = {
// clang-format off
{0x00010183, nullptr, "Initialize"}, {0x00010183, nullptr, "Initialize"},
{0x00020000, nullptr, "Finalize"}, {0x00020000, nullptr, "Finalize"},
{0x00030000, nullptr, "GetServerState"}, {0x00030000, nullptr, "GetServerState"},
@ -34,13 +37,13 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000B0042, nullptr, "GetConnectingClients"}, {0x000B0042, nullptr, "GetConnectingClients"},
{0x000C0040, nullptr, "GetClientInfo"}, {0x000C0040, nullptr, "GetClientInfo"},
{0x000D0040, nullptr, "GetClientState"}, {0x000D0040, nullptr, "GetClientState"},
{0x000E0040, IsChild, "IsChild"}, {0x000E0040, &DLP_SRVR::IsChild, "IsChild"},
{0x000F0303, nullptr, "InitializeWithName"}, {0x000F0303, nullptr, "InitializeWithName"},
{0x00100000, nullptr, "GetDupNoticeNeed"}, {0x00100000, nullptr, "GetDupNoticeNeed"},
}; // clang-format on
};
DLP_SRVR_Interface::DLP_SRVR_Interface() { RegisterHandlers(functions);
Register(FunctionTable);
} }
} // namespace DLP } // namespace DLP

View file

@ -9,13 +9,13 @@
namespace Service { namespace Service {
namespace DLP { namespace DLP {
class DLP_SRVR_Interface final : public Interface { class DLP_SRVR final : public ServiceFramework<DLP_SRVR> {
public: public:
DLP_SRVR_Interface(); DLP_SRVR();
~DLP_SRVR() = default;
std::string GetPortName() const override { private:
return "dlp:SRVR"; void IsChild(Kernel::HLERequestContext& ctx);
}
}; };
} // namespace DLP } // namespace DLP

View file

@ -242,7 +242,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
CAM::InstallInterfaces(*sm); CAM::InstallInterfaces(*sm);
CECD::Init(); CECD::Init();
CFG::InstallInterfaces(*sm); CFG::InstallInterfaces(*sm);
DLP::Init(); DLP::InstallInterfaces(*sm);
FRD::InstallInterfaces(*sm); FRD::InstallInterfaces(*sm);
GSP::InstallInterfaces(*sm); GSP::InstallInterfaces(*sm);
HID::InstallInterfaces(*sm); HID::InstallInterfaces(*sm);
@ -269,7 +269,6 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
/// Shutdown ServiceManager /// Shutdown ServiceManager
void Shutdown() { void Shutdown() {
DLP::Shutdown();
CECD::Shutdown(); CECD::Shutdown();
BOSS::Shutdown(); BOSS::Shutdown();
FS::ArchiveShutdown(); FS::ArchiveShutdown();