summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/ldn/ldn.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ldn/ldn.cpp92
1 files changed, 48 insertions, 44 deletions
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp
index e5099d61f..9d149a7cd 100644
--- a/src/core/hle/service/ldn/ldn.cpp
+++ b/src/core/hle/service/ldn/ldn.cpp
@@ -8,6 +8,7 @@
#include "core/hle/service/ldn/ldn.h"
#include "core/hle/service/ldn/ldn_results.h"
#include "core/hle/service/ldn/ldn_types.h"
+#include "core/hle/service/server_manager.h"
#include "core/internal_network/network.h"
#include "core/internal_network/network_interface.h"
#include "network/network.h"
@@ -49,7 +50,7 @@ public:
RegisterHandlers(functions);
}
- void CreateMonitorService(Kernel::HLERequestContext& ctx) {
+ void CreateMonitorService(HLERequestContext& ctx) {
LOG_DEBUG(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -106,7 +107,7 @@ class IUserLocalCommunicationService final
: public ServiceFramework<IUserLocalCommunicationService> {
public:
explicit IUserLocalCommunicationService(Core::System& system_)
- : ServiceFramework{system_, "IUserLocalCommunicationService", ServiceThreadType::CreateNew},
+ : ServiceFramework{system_, "IUserLocalCommunicationService"},
service_context{system, "IUserLocalCommunicationService"},
room_network{system_.GetRoomNetwork()}, lan_discovery{room_network} {
// clang-format off
@@ -168,7 +169,7 @@ public:
state_change_event->Signal();
}
- void GetState(Kernel::HLERequestContext& ctx) {
+ void GetState(HLERequestContext& ctx) {
State state = State::Error;
if (is_initialized) {
@@ -180,7 +181,7 @@ public:
rb.PushEnum(state);
}
- void GetNetworkInfo(Kernel::HLERequestContext& ctx) {
+ void GetNetworkInfo(HLERequestContext& ctx) {
const auto write_buffer_size = ctx.GetWriteBufferSize();
if (write_buffer_size != sizeof(NetworkInfo)) {
@@ -204,7 +205,7 @@ public:
rb.Push(ResultSuccess);
}
- void GetIpv4Address(Kernel::HLERequestContext& ctx) {
+ void GetIpv4Address(HLERequestContext& ctx) {
const auto network_interface = Network::GetSelectedNetworkInterface();
if (!network_interface) {
@@ -233,13 +234,13 @@ public:
rb.PushRaw(subnet_mask);
}
- void GetDisconnectReason(Kernel::HLERequestContext& ctx) {
+ void GetDisconnectReason(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.PushEnum(lan_discovery.GetDisconnectReason());
}
- void GetSecurityParameter(Kernel::HLERequestContext& ctx) {
+ void GetSecurityParameter(HLERequestContext& ctx) {
SecurityParameter security_parameter{};
NetworkInfo info{};
const Result rc = lan_discovery.GetNetworkInfo(info);
@@ -260,7 +261,7 @@ public:
rb.PushRaw<SecurityParameter>(security_parameter);
}
- void GetNetworkConfig(Kernel::HLERequestContext& ctx) {
+ void GetNetworkConfig(HLERequestContext& ctx) {
NetworkConfig config{};
NetworkInfo info{};
const Result rc = lan_discovery.GetNetworkInfo(info);
@@ -282,7 +283,7 @@ public:
rb.PushRaw<NetworkConfig>(config);
}
- void AttachStateChangeEvent(Kernel::HLERequestContext& ctx) {
+ void AttachStateChangeEvent(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -290,7 +291,7 @@ public:
rb.PushCopyObjects(state_change_event->GetReadableEvent());
}
- void GetNetworkInfoLatestUpdate(Kernel::HLERequestContext& ctx) {
+ void GetNetworkInfoLatestUpdate(HLERequestContext& ctx) {
const std::size_t network_buffer_size = ctx.GetWriteBufferSize(0);
const std::size_t node_buffer_count = ctx.GetWriteBufferNumElements<NodeLatestUpdate>(1);
@@ -320,15 +321,15 @@ public:
rb.Push(ResultSuccess);
}
- void Scan(Kernel::HLERequestContext& ctx) {
+ void Scan(HLERequestContext& ctx) {
ScanImpl(ctx);
}
- void ScanPrivate(Kernel::HLERequestContext& ctx) {
+ void ScanPrivate(HLERequestContext& ctx) {
ScanImpl(ctx, true);
}
- void ScanImpl(Kernel::HLERequestContext& ctx, bool is_private = false) {
+ void ScanImpl(HLERequestContext& ctx, bool is_private = false) {
IPC::RequestParser rp{ctx};
const auto channel{rp.PopEnum<WifiChannel>()};
const auto scan_filter{rp.PopRaw<ScanFilter>()};
@@ -357,40 +358,40 @@ public:
rb.Push<u32>(count);
}
- void SetWirelessControllerRestriction(Kernel::HLERequestContext& ctx) {
+ void SetWirelessControllerRestriction(HLERequestContext& ctx) {
LOG_WARNING(Service_LDN, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
- void OpenAccessPoint(Kernel::HLERequestContext& ctx) {
+ void OpenAccessPoint(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.OpenAccessPoint());
}
- void CloseAccessPoint(Kernel::HLERequestContext& ctx) {
+ void CloseAccessPoint(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.CloseAccessPoint());
}
- void CreateNetwork(Kernel::HLERequestContext& ctx) {
+ void CreateNetwork(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
CreateNetworkImpl(ctx);
}
- void CreateNetworkPrivate(Kernel::HLERequestContext& ctx) {
+ void CreateNetworkPrivate(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
CreateNetworkImpl(ctx, true);
}
- void CreateNetworkImpl(Kernel::HLERequestContext& ctx, bool is_private = false) {
+ void CreateNetworkImpl(HLERequestContext& ctx, bool is_private = false) {
IPC::RequestParser rp{ctx};
const auto security_config{rp.PopRaw<SecurityConfig>()};
@@ -404,49 +405,49 @@ public:
rb.Push(lan_discovery.CreateNetwork(security_config, user_config, network_Config));
}
- void DestroyNetwork(Kernel::HLERequestContext& ctx) {
+ void DestroyNetwork(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.DestroyNetwork());
}
- void SetAdvertiseData(Kernel::HLERequestContext& ctx) {
+ void SetAdvertiseData(HLERequestContext& ctx) {
const auto read_buffer = ctx.ReadBuffer();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.SetAdvertiseData(read_buffer));
}
- void SetStationAcceptPolicy(Kernel::HLERequestContext& ctx) {
+ void SetStationAcceptPolicy(HLERequestContext& ctx) {
LOG_WARNING(Service_LDN, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
- void AddAcceptFilterEntry(Kernel::HLERequestContext& ctx) {
+ void AddAcceptFilterEntry(HLERequestContext& ctx) {
LOG_WARNING(Service_LDN, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
- void OpenStation(Kernel::HLERequestContext& ctx) {
+ void OpenStation(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.OpenStation());
}
- void CloseStation(Kernel::HLERequestContext& ctx) {
+ void CloseStation(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.CloseStation());
}
- void Connect(Kernel::HLERequestContext& ctx) {
+ void Connect(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
struct Parameters {
SecurityConfig security_config;
@@ -480,14 +481,14 @@ public:
static_cast<u16>(parameters.local_communication_version)));
}
- void Disconnect(Kernel::HLERequestContext& ctx) {
+ void Disconnect(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.Disconnect());
}
- void Initialize(Kernel::HLERequestContext& ctx) {
+ void Initialize(HLERequestContext& ctx) {
const auto rc = InitializeImpl(ctx);
if (rc.IsError()) {
LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw);
@@ -497,7 +498,7 @@ public:
rb.Push(rc);
}
- void Finalize(Kernel::HLERequestContext& ctx) {
+ void Finalize(HLERequestContext& ctx) {
if (auto room_member = room_network.GetRoomMember().lock()) {
room_member->Unbind(ldn_packet_received);
}
@@ -508,7 +509,7 @@ public:
rb.Push(lan_discovery.Finalize());
}
- void Initialize2(Kernel::HLERequestContext& ctx) {
+ void Initialize2(HLERequestContext& ctx) {
const auto rc = InitializeImpl(ctx);
if (rc.IsError()) {
LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw);
@@ -518,7 +519,7 @@ public:
rb.Push(rc);
}
- Result InitializeImpl(Kernel::HLERequestContext& ctx) {
+ Result InitializeImpl(HLERequestContext& ctx) {
const auto network_interface = Network::GetSelectedNetworkInterface();
if (!network_interface) {
LOG_ERROR(Service_LDN, "No network interface is set");
@@ -561,7 +562,7 @@ public:
RegisterHandlers(functions);
}
- void CreateSystemLocalCommunicationService(Kernel::HLERequestContext& ctx) {
+ void CreateSystemLocalCommunicationService(HLERequestContext& ctx) {
LOG_DEBUG(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -582,7 +583,7 @@ public:
RegisterHandlers(functions);
}
- void CreateUserLocalCommunicationService(Kernel::HLERequestContext& ctx) {
+ void CreateUserLocalCommunicationService(HLERequestContext& ctx) {
LOG_DEBUG(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -646,7 +647,7 @@ public:
RegisterHandlers(functions);
}
- void Initialize(Kernel::HLERequestContext& ctx) {
+ void Initialize(HLERequestContext& ctx) {
LOG_WARNING(Service_LDN, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
@@ -667,7 +668,7 @@ public:
RegisterHandlers(functions);
}
- void CreateNetworkervice(Kernel::HLERequestContext& ctx) {
+ void CreateNetworkervice(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 reserved_input = rp.Pop<u64>();
const u32 input = rp.Pop<u32>();
@@ -680,7 +681,7 @@ public:
rb.PushIpcInterface<INetworkService>(system);
}
- void CreateMonitorService(Kernel::HLERequestContext& ctx) {
+ void CreateMonitorService(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 reserved_input = rp.Pop<u64>();
@@ -705,7 +706,7 @@ public:
RegisterHandlers(functions);
}
- void CreateNetworkervice(Kernel::HLERequestContext& ctx) {
+ void CreateNetworkervice(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 reserved_input = rp.Pop<u64>();
const u32 input = rp.Pop<u32>();
@@ -718,7 +719,7 @@ public:
rb.PushIpcInterface<INetworkService>(system);
}
- void CreateMonitorService(Kernel::HLERequestContext& ctx) {
+ void CreateMonitorService(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 reserved_input = rp.Pop<u64>();
@@ -730,12 +731,15 @@ public:
}
};
-void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
- std::make_shared<LDNM>(system)->InstallAsService(sm);
- std::make_shared<LDNS>(system)->InstallAsService(sm);
- std::make_shared<LDNU>(system)->InstallAsService(sm);
- std::make_shared<LP2PAPP>(system)->InstallAsService(sm);
- std::make_shared<LP2PSYS>(system)->InstallAsService(sm);
+void LoopProcess(Core::System& system) {
+ auto server_manager = std::make_unique<ServerManager>(system);
+
+ server_manager->RegisterNamedService("ldn:m", std::make_shared<LDNM>(system));
+ server_manager->RegisterNamedService("ldn:s", std::make_shared<LDNS>(system));
+ server_manager->RegisterNamedService("ldn:u", std::make_shared<LDNU>(system));
+ server_manager->RegisterNamedService("lp2p:app", std::make_shared<LP2PAPP>(system));
+ server_manager->RegisterNamedService("lp2p:sys", std::make_shared<LP2PSYS>(system));
+ ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::LDN