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_fkcl.h"
#include "core/hle/service/dlp/dlp_srvr.h"
#include "core/hle/service/service.h"
namespace Service {
namespace DLP {
void Init() {
AddService(new DLP_CLNT_Interface);
AddService(new DLP_FKCL_Interface);
AddService(new DLP_SRVR_Interface);
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<DLP_CLNT>()->InstallAsService(service_manager);
std::make_shared<DLP_FKCL>()->InstallAsService(service_manager);
std::make_shared<DLP_SRVR>()->InstallAsService(service_manager);
}
void Shutdown() {}
} // namespace DLP
} // namespace Service

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,23 +4,26 @@
#include "common/common_types.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/service/dlp/dlp_srvr.h"
namespace Service {
namespace DLP {
static void IsChild(Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
void DLP_SRVR::IsChild(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0E, 0, 0);
cmd_buff[1] = RESULT_SUCCESS.raw;
cmd_buff[2] = 0;
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
rb.Push(false);
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"},
{0x00020000, nullptr, "Finalize"},
{0x00030000, nullptr, "GetServerState"},
@ -34,13 +37,13 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000B0042, nullptr, "GetConnectingClients"},
{0x000C0040, nullptr, "GetClientInfo"},
{0x000D0040, nullptr, "GetClientState"},
{0x000E0040, IsChild, "IsChild"},
{0x000E0040, &DLP_SRVR::IsChild, "IsChild"},
{0x000F0303, nullptr, "InitializeWithName"},
{0x00100000, nullptr, "GetDupNoticeNeed"},
// clang-format on
};
DLP_SRVR_Interface::DLP_SRVR_Interface() {
Register(FunctionTable);
RegisterHandlers(functions);
}
} // namespace DLP

View file

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

View file

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