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,36 +2,39 @@
// 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) {
{0x000100C3, nullptr, "Initialize"}, static const FunctionInfo functions[] = {
{0x00020000, nullptr, "Finalize"}, // clang-format off
{0x00030000, nullptr, "GetEventDesc"}, {0x000100C3, nullptr, "Initialize"},
{0x00040000, nullptr, "GetChannel"}, {0x00020000, nullptr, "Finalize"},
{0x00050180, nullptr, "StartScan"}, {0x00030000, nullptr, "GetEventDesc"},
{0x00060000, nullptr, "StopScan"}, {0x00040000, nullptr, "GetChannel"},
{0x00070080, nullptr, "GetServerInfo"}, {0x00050180, nullptr, "StartScan"},
{0x00080100, nullptr, "GetTitleInfo"}, {0x00060000, nullptr, "StopScan"},
{0x00090040, nullptr, "GetTitleInfoInOrder"}, {0x00070080, nullptr, "GetServerInfo"},
{0x000A0080, nullptr, "DeleteScanInfo"}, {0x00080100, nullptr, "GetTitleInfo"},
{0x000B0100, nullptr, "PrepareForSystemDownload"}, {0x00090040, nullptr, "GetTitleInfoInOrder"},
{0x000C0000, nullptr, "StartSystemDownload"}, {0x000A0080, nullptr, "DeleteScanInfo"},
{0x000D0100, nullptr, "StartTitleDownload"}, {0x000B0100, nullptr, "PrepareForSystemDownload"},
{0x000E0000, nullptr, "GetMyStatus"}, {0x000C0000, nullptr, "StartSystemDownload"},
{0x000F0040, nullptr, "GetConnectingNodes"}, {0x000D0100, nullptr, "StartTitleDownload"},
{0x00100040, nullptr, "GetNodeInfo"}, {0x000E0000, nullptr, "GetMyStatus"},
{0x00110000, nullptr, "GetWirelessRebootPassphrase"}, {0x000F0040, nullptr, "GetConnectingNodes"},
{0x00120000, nullptr, "StopSession"}, {0x00100040, nullptr, "GetNodeInfo"},
{0x00130100, nullptr, "GetCupVersion"}, {0x00110000, nullptr, "GetWirelessRebootPassphrase"},
{0x00140100, nullptr, "GetDupAvailability"}, {0x00120000, nullptr, "StopSession"},
}; {0x00130100, nullptr, "GetCupVersion"},
{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,33 +2,36 @@
// 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) {
{0x00010083, nullptr, "Initialize"}, static const FunctionInfo functions[] = {
{0x00020000, nullptr, "Finalize"}, // clang-format off
{0x00030000, nullptr, "GetEventDesc"}, {0x00010083, nullptr, "Initialize"},
{0x00040000, nullptr, "GetChannels"}, {0x00020000, nullptr, "Finalize"},
{0x00050180, nullptr, "StartScan"}, {0x00030000, nullptr, "GetEventDesc"},
{0x00060000, nullptr, "StopScan"}, {0x00040000, nullptr, "GetChannels"},
{0x00070080, nullptr, "GetServerInfo"}, {0x00050180, nullptr, "StartScan"},
{0x00080100, nullptr, "GetTitleInfo"}, {0x00060000, nullptr, "StopScan"},
{0x00090040, nullptr, "GetTitleInfoInOrder"}, {0x00070080, nullptr, "GetServerInfo"},
{0x000A0080, nullptr, "DeleteScanInfo"}, {0x00080100, nullptr, "GetTitleInfo"},
{0x000B0100, nullptr, "StartFakeSession"}, {0x00090040, nullptr, "GetTitleInfoInOrder"},
{0x000C0000, nullptr, "GetMyStatus"}, {0x000A0080, nullptr, "DeleteScanInfo"},
{0x000D0040, nullptr, "GetConnectingNodes"}, {0x000B0100, nullptr, "StartFakeSession"},
{0x000E0040, nullptr, "GetNodeInfo"}, {0x000C0000, nullptr, "GetMyStatus"},
{0x000F0000, nullptr, "GetWirelessRebootPassphrase"}, {0x000D0040, nullptr, "GetConnectingNodes"},
{0x00100000, nullptr, "StopSession"}, {0x000E0040, nullptr, "GetNodeInfo"},
{0x00110203, nullptr, "Initialize2"}, {0x000F0000, nullptr, "GetWirelessRebootPassphrase"},
}; {0x00100000, nullptr, "StopSession"},
{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,43 +4,46 @@
#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) {
{0x00010183, nullptr, "Initialize"}, static const FunctionInfo functions[] = {
{0x00020000, nullptr, "Finalize"}, // clang-format off
{0x00030000, nullptr, "GetServerState"}, {0x00010183, nullptr, "Initialize"},
{0x00040000, nullptr, "GetEventDescription"}, {0x00020000, nullptr, "Finalize"},
{0x00050080, nullptr, "StartAccepting"}, {0x00030000, nullptr, "GetServerState"},
{0x00060000, nullptr, "EndAccepting"}, {0x00040000, nullptr, "GetEventDescription"},
{0x00070000, nullptr, "StartDistribution"}, {0x00050080, nullptr, "StartAccepting"},
{0x000800C0, nullptr, "SendWirelessRebootPassphrase"}, {0x00060000, nullptr, "EndAccepting"},
{0x00090040, nullptr, "AcceptClient"}, {0x00070000, nullptr, "StartDistribution"},
{0x000A0040, nullptr, "DisconnectClient"}, {0x000800C0, nullptr, "SendWirelessRebootPassphrase"},
{0x000B0042, nullptr, "GetConnectingClients"}, {0x00090040, nullptr, "AcceptClient"},
{0x000C0040, nullptr, "GetClientInfo"}, {0x000A0040, nullptr, "DisconnectClient"},
{0x000D0040, nullptr, "GetClientState"}, {0x000B0042, nullptr, "GetConnectingClients"},
{0x000E0040, IsChild, "IsChild"}, {0x000C0040, nullptr, "GetClientInfo"},
{0x000F0303, nullptr, "InitializeWithName"}, {0x000D0040, nullptr, "GetClientState"},
{0x00100000, nullptr, "GetDupNoticeNeed"}, {0x000E0040, &DLP_SRVR::IsChild, "IsChild"},
}; {0x000F0303, nullptr, "InitializeWithName"},
{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();