2018-07-26 01:16:08 -04:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/result.h"
|
|
|
|
#include "core/hle/service/ldn/ldn.h"
|
|
|
|
#include "core/hle/service/sm/sm.h"
|
|
|
|
|
|
|
|
namespace Service::LDN {
|
|
|
|
|
|
|
|
class IMonitorService final : public ServiceFramework<IMonitorService> {
|
|
|
|
public:
|
|
|
|
explicit IMonitorService() : ServiceFramework{"IMonitorService"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "GetStateForMonitor"},
|
|
|
|
{1, nullptr, "GetNetworkInfoForMonitor"},
|
|
|
|
{2, nullptr, "GetIpv4AddressForMonitor"},
|
|
|
|
{3, nullptr, "GetDisconnectReasonForMonitor"},
|
|
|
|
{4, nullptr, "GetSecurityParameterForMonitor"},
|
|
|
|
{5, nullptr, "GetNetworkConfigForMonitor"},
|
|
|
|
{100, nullptr, "InitializeMonitor"},
|
|
|
|
{101, nullptr, "FinalizeMonitor"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class LDNM final : public ServiceFramework<LDNM> {
|
|
|
|
public:
|
|
|
|
explicit LDNM() : ServiceFramework{"ldn:m"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &LDNM::CreateMonitorService, "CreateMonitorService"}
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreateMonitorService(Kernel::HLERequestContext& ctx) {
|
2018-11-26 01:06:13 -05:00
|
|
|
LOG_DEBUG(Service_LDN, "called");
|
|
|
|
|
2018-07-26 01:16:08 -04:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushIpcInterface<IMonitorService>();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-04-10 14:48:37 -04:00
|
|
|
class ISystemLocalCommunicationService final
|
|
|
|
: public ServiceFramework<ISystemLocalCommunicationService> {
|
2018-07-26 01:16:08 -04:00
|
|
|
public:
|
2019-04-10 14:48:37 -04:00
|
|
|
explicit ISystemLocalCommunicationService()
|
|
|
|
: ServiceFramework{"ISystemLocalCommunicationService"} {
|
2018-07-26 01:16:08 -04:00
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "GetState"},
|
|
|
|
{1, nullptr, "GetNetworkInfo"},
|
|
|
|
{2, nullptr, "GetIpv4Address"},
|
|
|
|
{3, nullptr, "GetDisconnectReason"},
|
|
|
|
{4, nullptr, "GetSecurityParameter"},
|
|
|
|
{5, nullptr, "GetNetworkConfig"},
|
|
|
|
{100, nullptr, "AttachStateChangeEvent"},
|
|
|
|
{101, nullptr, "GetNetworkInfoLatestUpdate"},
|
|
|
|
{102, nullptr, "Scan"},
|
|
|
|
{103, nullptr, "ScanPrivate"},
|
|
|
|
{200, nullptr, "OpenAccessPoint"},
|
|
|
|
{201, nullptr, "CloseAccessPoint"},
|
|
|
|
{202, nullptr, "CreateNetwork"},
|
|
|
|
{203, nullptr, "CreateNetworkPrivate"},
|
|
|
|
{204, nullptr, "DestroyNetwork"},
|
|
|
|
{205, nullptr, "Reject"},
|
|
|
|
{206, nullptr, "SetAdvertiseData"},
|
|
|
|
{207, nullptr, "SetStationAcceptPolicy"},
|
|
|
|
{208, nullptr, "AddAcceptFilterEntry"},
|
|
|
|
{209, nullptr, "ClearAcceptFilter"},
|
|
|
|
{300, nullptr, "OpenStation"},
|
|
|
|
{301, nullptr, "CloseStation"},
|
|
|
|
{302, nullptr, "Connect"},
|
|
|
|
{303, nullptr, "ConnectPrivate"},
|
|
|
|
{304, nullptr, "Disconnect"},
|
|
|
|
{400, nullptr, "InitializeSystem"},
|
|
|
|
{401, nullptr, "FinalizeSystem"},
|
2019-04-10 14:48:37 -04:00
|
|
|
{402, nullptr, "SetOperationMode"},
|
|
|
|
{403, nullptr, "InitializeSystem2"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class IUserLocalCommunicationService final
|
|
|
|
: public ServiceFramework<IUserLocalCommunicationService> {
|
|
|
|
public:
|
|
|
|
explicit IUserLocalCommunicationService() : ServiceFramework{"IUserLocalCommunicationService"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, nullptr, "GetState"},
|
|
|
|
{1, nullptr, "GetNetworkInfo"},
|
|
|
|
{2, nullptr, "GetIpv4Address"},
|
|
|
|
{3, nullptr, "GetDisconnectReason"},
|
|
|
|
{4, nullptr, "GetSecurityParameter"},
|
|
|
|
{5, nullptr, "GetNetworkConfig"},
|
|
|
|
{100, nullptr, "AttachStateChangeEvent"},
|
|
|
|
{101, nullptr, "GetNetworkInfoLatestUpdate"},
|
|
|
|
{102, nullptr, "Scan"},
|
|
|
|
{103, nullptr, "ScanPrivate"},
|
|
|
|
{104, nullptr, "SetWirelessControllerRestriction"},
|
|
|
|
{200, nullptr, "OpenAccessPoint"},
|
|
|
|
{201, nullptr, "CloseAccessPoint"},
|
|
|
|
{202, nullptr, "CreateNetwork"},
|
|
|
|
{203, nullptr, "CreateNetworkPrivate"},
|
|
|
|
{204, nullptr, "DestroyNetwork"},
|
|
|
|
{205, nullptr, "Reject"},
|
|
|
|
{206, nullptr, "SetAdvertiseData"},
|
|
|
|
{207, nullptr, "SetStationAcceptPolicy"},
|
|
|
|
{208, nullptr, "AddAcceptFilterEntry"},
|
|
|
|
{209, nullptr, "ClearAcceptFilter"},
|
|
|
|
{300, nullptr, "OpenStation"},
|
|
|
|
{301, nullptr, "CloseStation"},
|
|
|
|
{302, nullptr, "Connect"},
|
|
|
|
{303, nullptr, "ConnectPrivate"},
|
|
|
|
{304, nullptr, "Disconnect"},
|
|
|
|
{400, nullptr, "Initialize"},
|
|
|
|
{401, nullptr, "Finalize"},
|
2020-02-16 01:24:34 -05:00
|
|
|
{402, &IUserLocalCommunicationService::Initialize2, "Initialize2"}, // 7.0.0+
|
2018-07-26 01:16:08 -04:00
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
2020-02-16 01:24:34 -05:00
|
|
|
|
|
|
|
void Initialize2(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_WARNING(Service_LDN, "(STUBBED) called");
|
|
|
|
// Result success seem make this services start network and continue.
|
|
|
|
// If we just pass result error then it will stop and maybe try again and again.
|
|
|
|
IPC::ResponseBuilder rb{ctx, 2};
|
|
|
|
rb.Push(RESULT_UNKNOWN);
|
|
|
|
}
|
2018-07-26 01:16:08 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class LDNS final : public ServiceFramework<LDNS> {
|
|
|
|
public:
|
|
|
|
explicit LDNS() : ServiceFramework{"ldn:s"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &LDNS::CreateSystemLocalCommunicationService, "CreateSystemLocalCommunicationService"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreateSystemLocalCommunicationService(Kernel::HLERequestContext& ctx) {
|
2018-11-26 01:06:13 -05:00
|
|
|
LOG_DEBUG(Service_LDN, "called");
|
|
|
|
|
2018-07-26 01:16:08 -04:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2019-04-10 14:48:37 -04:00
|
|
|
rb.PushIpcInterface<ISystemLocalCommunicationService>();
|
2018-07-26 01:16:08 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class LDNU final : public ServiceFramework<LDNU> {
|
|
|
|
public:
|
|
|
|
explicit LDNU() : ServiceFramework{"ldn:u"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &LDNU::CreateUserLocalCommunicationService, "CreateUserLocalCommunicationService"},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreateUserLocalCommunicationService(Kernel::HLERequestContext& ctx) {
|
2018-11-26 01:06:13 -05:00
|
|
|
LOG_DEBUG(Service_LDN, "called");
|
|
|
|
|
2018-07-26 01:16:08 -04:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2019-04-10 14:48:37 -04:00
|
|
|
rb.PushIpcInterface<IUserLocalCommunicationService>();
|
2018-07-26 01:16:08 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void InstallInterfaces(SM::ServiceManager& sm) {
|
|
|
|
std::make_shared<LDNM>()->InstallAsService(sm);
|
|
|
|
std::make_shared<LDNS>()->InstallAsService(sm);
|
|
|
|
std::make_shared<LDNU>()->InstallAsService(sm);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Service::LDN
|