mirror of
https://git.citron-emu.org/citron/emu
synced 2025-05-13 03:10:36 +01:00
service/sockets: Implement network services for new firmware versions
This commit implements various network services required for newer firmware versions. Key changes include: - Add bsd:nu service for firmware 15.0.0+ with proper event handling - Add bsdcfg implementation with complete interface declarations - Add dns:priv and ethc (c/i) services - Register all new services in the service manager - Extend BSD implementation with additional socket operations - Remove room_network instance variable in favor of system.GetRoomNetwork() - Fix kernel event creation by using ServiceContext in all appropriate places - Update build system to include new source files Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
parent
175a427c27
commit
a1f3414bde
12 changed files with 624 additions and 59 deletions
|
@ -1045,6 +1045,14 @@ add_library(core STATIC
|
||||||
hle/service/sm/sm_controller.h
|
hle/service/sm/sm_controller.h
|
||||||
hle/service/sockets/bsd.cpp
|
hle/service/sockets/bsd.cpp
|
||||||
hle/service/sockets/bsd.h
|
hle/service/sockets/bsd.h
|
||||||
|
hle/service/sockets/bsd_nu.cpp
|
||||||
|
hle/service/sockets/bsd_nu.h
|
||||||
|
hle/service/sockets/bsdcfg.cpp
|
||||||
|
hle/service/sockets/bsdcfg.h
|
||||||
|
hle/service/sockets/dns_priv.cpp
|
||||||
|
hle/service/sockets/dns_priv.h
|
||||||
|
hle/service/sockets/ethc.cpp
|
||||||
|
hle/service/sockets/ethc.h
|
||||||
hle/service/sockets/nsd.cpp
|
hle/service/sockets/nsd.cpp
|
||||||
hle/service/sockets/nsd.h
|
hle/service/sockets/nsd.h
|
||||||
hle/service/sockets/sfdnsres.cpp
|
hle/service/sockets/sfdnsres.cpp
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
@ -479,6 +480,122 @@ void BSD::EventFd(HLERequestContext& ctx) {
|
||||||
BuildErrnoResponse(ctx, Errno::SUCCESS);
|
BuildErrnoResponse(ctx, Errno::SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BSD::Sysctl(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Return an error if not implemented
|
||||||
|
rb.Push<s32>(-1);
|
||||||
|
rb.PushEnum(Errno::INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::Ioctl(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Return an error if not implemented
|
||||||
|
rb.Push<s32>(-1);
|
||||||
|
rb.PushEnum(Errno::INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::ShutdownAllSockets(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push<s32>(0);
|
||||||
|
rb.PushEnum(Errno::SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::GetResourceStatistics(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push<s32>(0);
|
||||||
|
rb.PushEnum(Errno::SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::RecvMMsg(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Return an error if not implemented
|
||||||
|
rb.Push<s32>(-1);
|
||||||
|
rb.PushEnum(Errno::INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::SendMMsg(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Return an error if not implemented
|
||||||
|
rb.Push<s32>(-1);
|
||||||
|
rb.PushEnum(Errno::INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::RegisterResourceStatisticsName(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::RegisterClientShared(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::GetSocketStatistics(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push<s32>(0);
|
||||||
|
rb.PushEnum(Errno::SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::NifIoctl(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Return an error if not implemented
|
||||||
|
rb.Push<s32>(-1);
|
||||||
|
rb.PushEnum(Errno::INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::SetThreadCoreMask(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::GetThreadCoreMask(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::SocketExempt(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const u32 domain = rp.Pop<u32>();
|
||||||
|
const u32 type = rp.Pop<u32>();
|
||||||
|
const u32 protocol = rp.Pop<u32>();
|
||||||
|
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called - domain={} type={} protocol={}", domain, type, protocol);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push<s32>(-1); // Return -1 on exempted socket
|
||||||
|
rb.PushEnum(Errno::SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSD::Open(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
// Return an error if not implemented
|
||||||
|
rb.Push<s32>(-1);
|
||||||
|
rb.PushEnum(Errno::INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Work>
|
template <typename Work>
|
||||||
void BSD::ExecuteWork(HLERequestContext& ctx, Work work) {
|
void BSD::ExecuteWork(HLERequestContext& ctx, Work work) {
|
||||||
work.Execute(this);
|
work.Execute(this);
|
||||||
|
@ -508,9 +625,9 @@ std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protoco
|
||||||
|
|
||||||
LOG_INFO(Service, "New socket fd={}", fd);
|
LOG_INFO(Service, "New socket fd={}", fd);
|
||||||
|
|
||||||
auto room_member = room_network.GetRoomMember().lock();
|
auto room_member = system.GetRoomNetwork().GetRoomMember().lock();
|
||||||
if (room_member && room_member->IsConnected()) {
|
if (room_member && room_member->IsConnected()) {
|
||||||
descriptor.socket = std::make_shared<Network::ProxySocket>(room_network);
|
descriptor.socket = std::make_shared<Network::ProxySocket>(system.GetRoomNetwork());
|
||||||
} else {
|
} else {
|
||||||
descriptor.socket = std::make_shared<Network::Socket>();
|
descriptor.socket = std::make_shared<Network::Socket>();
|
||||||
}
|
}
|
||||||
|
@ -970,17 +1087,17 @@ void BSD::OnProxyPacketReceived(const Network::ProxyPacket& packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BSD::BSD(Core::System& system_, const char* name)
|
BSD::BSD(Core::System& system_, const char* name)
|
||||||
: ServiceFramework{system_, name}, room_network{system_.GetRoomNetwork()} {
|
: ServiceFramework{system_, name} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &BSD::RegisterClient, "RegisterClient"},
|
{0, &BSD::RegisterClient, "RegisterClient"},
|
||||||
{1, &BSD::StartMonitoring, "StartMonitoring"},
|
{1, &BSD::StartMonitoring, "StartMonitoring"},
|
||||||
{2, &BSD::Socket, "Socket"},
|
{2, &BSD::Socket, "Socket"},
|
||||||
{3, nullptr, "SocketExempt"},
|
{3, &BSD::SocketExempt, "SocketExempt"},
|
||||||
{4, nullptr, "Open"},
|
{4, &BSD::Open, "Open"},
|
||||||
{5, &BSD::Select, "Select"},
|
{5, &BSD::Select, "Select"},
|
||||||
{6, &BSD::Poll, "Poll"},
|
{6, &BSD::Poll, "Poll"},
|
||||||
{7, nullptr, "Sysctl"},
|
{7, &BSD::Sysctl, "Sysctl"},
|
||||||
{8, &BSD::Recv, "Recv"},
|
{8, &BSD::Recv, "Recv"},
|
||||||
{9, &BSD::RecvFrom, "RecvFrom"},
|
{9, &BSD::RecvFrom, "RecvFrom"},
|
||||||
{10, &BSD::Send, "Send"},
|
{10, &BSD::Send, "Send"},
|
||||||
|
@ -992,27 +1109,32 @@ BSD::BSD(Core::System& system_, const char* name)
|
||||||
{16, &BSD::GetSockName, "GetSockName"},
|
{16, &BSD::GetSockName, "GetSockName"},
|
||||||
{17, &BSD::GetSockOpt, "GetSockOpt"},
|
{17, &BSD::GetSockOpt, "GetSockOpt"},
|
||||||
{18, &BSD::Listen, "Listen"},
|
{18, &BSD::Listen, "Listen"},
|
||||||
{19, nullptr, "Ioctl"},
|
{19, &BSD::Ioctl, "Ioctl"},
|
||||||
{20, &BSD::Fcntl, "Fcntl"},
|
{20, &BSD::Fcntl, "Fcntl"},
|
||||||
{21, &BSD::SetSockOpt, "SetSockOpt"},
|
{21, &BSD::SetSockOpt, "SetSockOpt"},
|
||||||
{22, &BSD::Shutdown, "Shutdown"},
|
{22, &BSD::Shutdown, "Shutdown"},
|
||||||
{23, nullptr, "ShutdownAllSockets"},
|
{23, &BSD::ShutdownAllSockets, "ShutdownAllSockets"},
|
||||||
{24, &BSD::Write, "Write"},
|
{24, &BSD::Write, "Write"},
|
||||||
{25, &BSD::Read, "Read"},
|
{25, &BSD::Read, "Read"},
|
||||||
{26, &BSD::Close, "Close"},
|
{26, &BSD::Close, "Close"},
|
||||||
{27, &BSD::DuplicateSocket, "DuplicateSocket"},
|
{27, &BSD::DuplicateSocket, "DuplicateSocket"},
|
||||||
{28, nullptr, "GetResourceStatistics"},
|
{28, &BSD::GetResourceStatistics, "GetResourceStatistics"},
|
||||||
{29, nullptr, "RecvMMsg"},
|
{29, &BSD::RecvMMsg, "RecvMMsg"},
|
||||||
{30, nullptr, "SendMMsg"},
|
{30, &BSD::SendMMsg, "SendMMsg"},
|
||||||
{31, &BSD::EventFd, "EventFd"},
|
{31, &BSD::EventFd, "EventFd"},
|
||||||
{32, nullptr, "RegisterResourceStatisticsName"},
|
{32, &BSD::RegisterResourceStatisticsName, "RegisterResourceStatisticsName"},
|
||||||
{33, nullptr, "Initialize2"},
|
{33, &BSD::RegisterClientShared, "RegisterClientShared"},
|
||||||
|
{34, &BSD::GetSocketStatistics, "GetSocketStatistics"},
|
||||||
|
{35, &BSD::NifIoctl, "NifIoctl"},
|
||||||
|
{200, &BSD::SetThreadCoreMask, "SetThreadCoreMask"},
|
||||||
|
{201, &BSD::GetThreadCoreMask, "GetThreadCoreMask"},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
if (auto room_member = room_network.GetRoomMember().lock()) {
|
auto room_member = system.GetRoomNetwork().GetRoomMember().lock();
|
||||||
|
if (room_member) {
|
||||||
proxy_packet_received = room_member->BindOnProxyPacketReceived(
|
proxy_packet_received = room_member->BindOnProxyPacketReceived(
|
||||||
[this](const Network::ProxyPacket& packet) { OnProxyPacketReceived(packet); });
|
[this](const Network::ProxyPacket& packet) { OnProxyPacketReceived(packet); });
|
||||||
} else {
|
} else {
|
||||||
|
@ -1021,7 +1143,8 @@ BSD::BSD(Core::System& system_, const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
BSD::~BSD() {
|
BSD::~BSD() {
|
||||||
if (auto room_member = room_network.GetRoomMember().lock()) {
|
auto room_member = system.GetRoomNetwork().GetRoomMember().lock();
|
||||||
|
if (room_member) {
|
||||||
room_member->Unbind(proxy_packet_received);
|
room_member->Unbind(proxy_packet_received);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1031,31 +1154,4 @@ std::unique_lock<std::mutex> BSD::LockService() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
|
||||||
// clang-format off
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{0, nullptr, "SetIfUp"},
|
|
||||||
{1, nullptr, "SetIfUpWithEvent"},
|
|
||||||
{2, nullptr, "CancelIf"},
|
|
||||||
{3, nullptr, "SetIfDown"},
|
|
||||||
{4, nullptr, "GetIfState"},
|
|
||||||
{5, nullptr, "DhcpRenew"},
|
|
||||||
{6, nullptr, "AddStaticArpEntry"},
|
|
||||||
{7, nullptr, "RemoveArpEntry"},
|
|
||||||
{8, nullptr, "LookupArpEntry"},
|
|
||||||
{9, nullptr, "LookupArpEntry2"},
|
|
||||||
{10, nullptr, "ClearArpEntries"},
|
|
||||||
{11, nullptr, "ClearArpEntries2"},
|
|
||||||
{12, nullptr, "PrintArpEntries"},
|
|
||||||
{13, nullptr, "Unknown13"},
|
|
||||||
{14, nullptr, "Unknown14"},
|
|
||||||
{15, nullptr, "Unknown15"},
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
BSDCFG::~BSDCFG() = default;
|
|
||||||
|
|
||||||
} // namespace Service::Sockets
|
} // namespace Service::Sockets
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -124,11 +125,30 @@ private:
|
||||||
Errno bsd_errno{};
|
Errno bsd_errno{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LibraryConfigData {
|
||||||
|
u32 version;
|
||||||
|
u32 tcp_tx_buf_size;
|
||||||
|
u32 tcp_rx_buf_size;
|
||||||
|
u32 tcp_tx_buf_max_size;
|
||||||
|
u32 tcp_rx_buf_max_size;
|
||||||
|
u32 udp_tx_buf_size;
|
||||||
|
u32 udp_rx_buf_size;
|
||||||
|
u32 sb_efficiency;
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is nn::socket::sf::IClient
|
||||||
void RegisterClient(HLERequestContext& ctx);
|
void RegisterClient(HLERequestContext& ctx);
|
||||||
void StartMonitoring(HLERequestContext& ctx);
|
void StartMonitoring(HLERequestContext& ctx);
|
||||||
void Socket(HLERequestContext& ctx);
|
void Socket(HLERequestContext& ctx);
|
||||||
|
void SocketExempt(HLERequestContext& ctx);
|
||||||
|
void Open(HLERequestContext& ctx);
|
||||||
void Select(HLERequestContext& ctx);
|
void Select(HLERequestContext& ctx);
|
||||||
void Poll(HLERequestContext& ctx);
|
void Poll(HLERequestContext& ctx);
|
||||||
|
void Sysctl(HLERequestContext& ctx);
|
||||||
|
void Recv(HLERequestContext& ctx);
|
||||||
|
void RecvFrom(HLERequestContext& ctx);
|
||||||
|
void Send(HLERequestContext& ctx);
|
||||||
|
void SendTo(HLERequestContext& ctx);
|
||||||
void Accept(HLERequestContext& ctx);
|
void Accept(HLERequestContext& ctx);
|
||||||
void Bind(HLERequestContext& ctx);
|
void Bind(HLERequestContext& ctx);
|
||||||
void Connect(HLERequestContext& ctx);
|
void Connect(HLERequestContext& ctx);
|
||||||
|
@ -136,18 +156,25 @@ private:
|
||||||
void GetSockName(HLERequestContext& ctx);
|
void GetSockName(HLERequestContext& ctx);
|
||||||
void GetSockOpt(HLERequestContext& ctx);
|
void GetSockOpt(HLERequestContext& ctx);
|
||||||
void Listen(HLERequestContext& ctx);
|
void Listen(HLERequestContext& ctx);
|
||||||
|
void Ioctl(HLERequestContext& ctx);
|
||||||
void Fcntl(HLERequestContext& ctx);
|
void Fcntl(HLERequestContext& ctx);
|
||||||
void SetSockOpt(HLERequestContext& ctx);
|
void SetSockOpt(HLERequestContext& ctx);
|
||||||
void Shutdown(HLERequestContext& ctx);
|
void Shutdown(HLERequestContext& ctx);
|
||||||
void Recv(HLERequestContext& ctx);
|
void ShutdownAllSockets(HLERequestContext& ctx);
|
||||||
void RecvFrom(HLERequestContext& ctx);
|
|
||||||
void Send(HLERequestContext& ctx);
|
|
||||||
void SendTo(HLERequestContext& ctx);
|
|
||||||
void Write(HLERequestContext& ctx);
|
void Write(HLERequestContext& ctx);
|
||||||
void Read(HLERequestContext& ctx);
|
void Read(HLERequestContext& ctx);
|
||||||
void Close(HLERequestContext& ctx);
|
void Close(HLERequestContext& ctx);
|
||||||
void DuplicateSocket(HLERequestContext& ctx);
|
void DuplicateSocket(HLERequestContext& ctx);
|
||||||
|
void GetResourceStatistics(HLERequestContext& ctx);
|
||||||
|
void RecvMMsg(HLERequestContext& ctx);
|
||||||
|
void SendMMsg(HLERequestContext& ctx);
|
||||||
void EventFd(HLERequestContext& ctx);
|
void EventFd(HLERequestContext& ctx);
|
||||||
|
void RegisterResourceStatisticsName(HLERequestContext& ctx);
|
||||||
|
void RegisterClientShared(HLERequestContext& ctx);
|
||||||
|
void GetSocketStatistics(HLERequestContext& ctx);
|
||||||
|
void NifIoctl(HLERequestContext& ctx);
|
||||||
|
void SetThreadCoreMask(HLERequestContext& ctx);
|
||||||
|
void GetThreadCoreMask(HLERequestContext& ctx);
|
||||||
|
|
||||||
template <typename Work>
|
template <typename Work>
|
||||||
void ExecuteWork(HLERequestContext& ctx, Work work);
|
void ExecuteWork(HLERequestContext& ctx, Work work);
|
||||||
|
@ -171,30 +198,23 @@ private:
|
||||||
std::pair<s32, Errno> SendImpl(s32 fd, u32 flags, std::span<const u8> message);
|
std::pair<s32, Errno> SendImpl(s32 fd, u32 flags, std::span<const u8> message);
|
||||||
std::pair<s32, Errno> SendToImpl(s32 fd, u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> SendToImpl(s32 fd, u32 flags, std::span<const u8> message,
|
||||||
std::span<const u8> addr);
|
std::span<const u8> addr);
|
||||||
|
|
||||||
s32 FindFreeFileDescriptorHandle() noexcept;
|
s32 FindFreeFileDescriptorHandle() noexcept;
|
||||||
bool IsFileDescriptorValid(s32 fd) const noexcept;
|
bool IsFileDescriptorValid(s32 fd) const noexcept;
|
||||||
|
|
||||||
void BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept;
|
void BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept;
|
||||||
|
|
||||||
std::array<std::optional<FileDescriptor>, MAX_FD> file_descriptors;
|
|
||||||
|
|
||||||
Network::RoomNetwork& room_network;
|
|
||||||
|
|
||||||
/// Callback to parse and handle a received wifi packet.
|
|
||||||
void OnProxyPacketReceived(const Network::ProxyPacket& packet);
|
void OnProxyPacketReceived(const Network::ProxyPacket& packet);
|
||||||
|
|
||||||
// Callback identifier for the OnProxyPacketReceived event.
|
|
||||||
Network::RoomMember::CallbackHandle<Network::ProxyPacket> proxy_packet_received;
|
Network::RoomMember::CallbackHandle<Network::ProxyPacket> proxy_packet_received;
|
||||||
|
|
||||||
|
/// Mapping of file descriptors to sockets
|
||||||
|
std::array<std::optional<FileDescriptor>, MAX_FD> file_descriptors{};
|
||||||
|
|
||||||
|
/// Mutex to protect file descriptor operations
|
||||||
|
std::mutex mutex;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::unique_lock<std::mutex> LockService() override;
|
virtual std::unique_lock<std::mutex> LockService() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BSDCFG final : public ServiceFramework<BSDCFG> {
|
|
||||||
public:
|
|
||||||
explicit BSDCFG(Core::System& system_);
|
|
||||||
~BSDCFG() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Service::Sockets
|
} // namespace Service::Sockets
|
||||||
|
|
91
src/core/hle/service/sockets/bsd_nu.cpp
Normal file
91
src/core/hle/service/sockets/bsd_nu.cpp
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/sockets/bsd_nu.h"
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
ISfUserService::ISfUserService(Core::System& system_)
|
||||||
|
: ServiceFramework{system_, "ISfUserService"},
|
||||||
|
service_context{system_, "ISfUserService"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, &ISfUserService::Assign, "Assign"},
|
||||||
|
{128, &ISfUserService::GetUserInfo, "GetUserInfo"},
|
||||||
|
{129, &ISfUserService::GetStateChangedEvent, "GetStateChangedEvent"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISfUserService::~ISfUserService() = default;
|
||||||
|
|
||||||
|
void ISfUserService::Assign(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushIpcInterface<ISfAssignedNetworkInterfaceService>(system);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISfUserService::GetUserInfo(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISfUserService::GetStateChangedEvent(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
|
auto* event = service_context.CreateEvent("ISfUserService:StateChanged");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushCopyObjects(event->GetReadableEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
ISfAssignedNetworkInterfaceService::ISfAssignedNetworkInterfaceService(Core::System& system_)
|
||||||
|
: ServiceFramework{system_, "ISfAssignedNetworkInterfaceService"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, &ISfAssignedNetworkInterfaceService::AddSession, "AddSession"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISfAssignedNetworkInterfaceService::~ISfAssignedNetworkInterfaceService() = default;
|
||||||
|
|
||||||
|
void ISfAssignedNetworkInterfaceService::AddSession(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
BSD_NU::BSD_NU(Core::System& system_) : ServiceFramework{system_, "bsd:nu"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, &BSD_NU::CreateUserService, "CreateUserService"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
BSD_NU::~BSD_NU() = default;
|
||||||
|
|
||||||
|
void BSD_NU::CreateUserService(HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service, "called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushIpcInterface<ISfUserService>(system);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
46
src/core/hle/service/sockets/bsd_nu.h
Normal file
46
src/core/hle/service/sockets/bsd_nu.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
class ISfUserService final : public ServiceFramework<ISfUserService> {
|
||||||
|
public:
|
||||||
|
explicit ISfUserService(Core::System& system_);
|
||||||
|
~ISfUserService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Assign(HLERequestContext& ctx);
|
||||||
|
void GetUserInfo(HLERequestContext& ctx);
|
||||||
|
void GetStateChangedEvent(HLERequestContext& ctx);
|
||||||
|
|
||||||
|
KernelHelpers::ServiceContext service_context;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ISfAssignedNetworkInterfaceService final : public ServiceFramework<ISfAssignedNetworkInterfaceService> {
|
||||||
|
public:
|
||||||
|
explicit ISfAssignedNetworkInterfaceService(Core::System& system_);
|
||||||
|
~ISfAssignedNetworkInterfaceService() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void AddSession(HLERequestContext& ctx);
|
||||||
|
};
|
||||||
|
|
||||||
|
class BSD_NU final : public ServiceFramework<BSD_NU> {
|
||||||
|
public:
|
||||||
|
explicit BSD_NU(Core::System& system_);
|
||||||
|
~BSD_NU() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CreateUserService(HLERequestContext& ctx);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
140
src/core/hle/service/sockets/bsdcfg.cpp
Normal file
140
src/core/hle/service/sockets/bsdcfg.cpp
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/sockets/bsdcfg.h"
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
BSDCFG::BSDCFG(Core::System& system_)
|
||||||
|
: ServiceFramework{system_, "bsdcfg"},
|
||||||
|
service_context{system_, "BSDCFG"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, &BSDCFG::SetIfUp, "SetIfUp"},
|
||||||
|
{1, &BSDCFG::SetIfUpWithEvent, "SetIfUpWithEvent"},
|
||||||
|
{2, &BSDCFG::CancelIf, "CancelIf"},
|
||||||
|
{3, &BSDCFG::SetIfDown, "SetIfDown"},
|
||||||
|
{4, &BSDCFG::GetIfState, "GetIfState"},
|
||||||
|
{5, &BSDCFG::DhcpRenew, "DhcpRenew"},
|
||||||
|
{6, &BSDCFG::AddStaticArpEntry, "AddStaticArpEntry"},
|
||||||
|
{7, &BSDCFG::RemoveArpEntry, "RemoveArpEntry"},
|
||||||
|
{8, &BSDCFG::LookupArpEntry, "LookupArpEntry"},
|
||||||
|
{9, &BSDCFG::LookupArpEntry2, "LookupArpEntry2"},
|
||||||
|
{10, &BSDCFG::ClearArpEntries, "ClearArpEntries"},
|
||||||
|
{11, &BSDCFG::ClearArpEntries2, "ClearArpEntries2"},
|
||||||
|
{12, &BSDCFG::PrintArpEntries, "PrintArpEntries"},
|
||||||
|
{13, &BSDCFG::Cmd13, "Unknown13"},
|
||||||
|
{14, &BSDCFG::Cmd14, "Unknown14"},
|
||||||
|
{15, &BSDCFG::Cmd15, "Unknown15"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
BSDCFG::~BSDCFG() = default;
|
||||||
|
|
||||||
|
void BSDCFG::SetIfUp(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::SetIfUpWithEvent(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
|
auto* event = service_context.CreateEvent("BSDCFG:SetIfUpWithEvent");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushCopyObjects(event->GetReadableEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::CancelIf(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::SetIfDown(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::GetIfState(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push<u32>(1); // Interface is up (stubbed)
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::DhcpRenew(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::AddStaticArpEntry(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::RemoveArpEntry(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::LookupArpEntry(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::LookupArpEntry2(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::ClearArpEntries(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::ClearArpEntries2(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::PrintArpEntries(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::Cmd13(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::Cmd14(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BSDCFG::Cmd15(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
41
src/core/hle/service/sockets/bsdcfg.h
Normal file
41
src/core/hle/service/sockets/bsdcfg.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
class BSDCFG final : public ServiceFramework<BSDCFG> {
|
||||||
|
public:
|
||||||
|
explicit BSDCFG(Core::System& system_);
|
||||||
|
~BSDCFG() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetIfUp(HLERequestContext& ctx);
|
||||||
|
void SetIfUpWithEvent(HLERequestContext& ctx);
|
||||||
|
void CancelIf(HLERequestContext& ctx);
|
||||||
|
void SetIfDown(HLERequestContext& ctx);
|
||||||
|
void GetIfState(HLERequestContext& ctx);
|
||||||
|
void DhcpRenew(HLERequestContext& ctx);
|
||||||
|
void AddStaticArpEntry(HLERequestContext& ctx);
|
||||||
|
void RemoveArpEntry(HLERequestContext& ctx);
|
||||||
|
void LookupArpEntry(HLERequestContext& ctx);
|
||||||
|
void LookupArpEntry2(HLERequestContext& ctx);
|
||||||
|
void ClearArpEntries(HLERequestContext& ctx);
|
||||||
|
void ClearArpEntries2(HLERequestContext& ctx);
|
||||||
|
void PrintArpEntries(HLERequestContext& ctx);
|
||||||
|
void Cmd13(HLERequestContext& ctx);
|
||||||
|
void Cmd14(HLERequestContext& ctx);
|
||||||
|
void Cmd15(HLERequestContext& ctx);
|
||||||
|
|
||||||
|
KernelHelpers::ServiceContext service_context;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
20
src/core/hle/service/sockets/dns_priv.cpp
Normal file
20
src/core/hle/service/sockets/dns_priv.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
#include "core/hle/service/sockets/dns_priv.h"
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
DNS_PRIV::DNS_PRIV(Core::System& system_) : ServiceFramework{system_, "dns:priv"} {
|
||||||
|
// dns:priv doesn't have documented commands yet
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, nullptr, "DummyFunction"},
|
||||||
|
};
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
DNS_PRIV::~DNS_PRIV() = default;
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
20
src/core/hle/service/sockets/dns_priv.h
Normal file
20
src/core/hle/service/sockets/dns_priv.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
class DNS_PRIV final : public ServiceFramework<DNS_PRIV> {
|
||||||
|
public:
|
||||||
|
explicit DNS_PRIV(Core::System& system_);
|
||||||
|
~DNS_PRIV() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
31
src/core/hle/service/sockets/ethc.cpp
Normal file
31
src/core/hle/service/sockets/ethc.cpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
#include "core/hle/service/sockets/ethc.h"
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
ETHC_C::ETHC_C(Core::System& system_) : ServiceFramework{system_, "ethc:c"} {
|
||||||
|
// ethc:c doesn't have documented commands yet
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, nullptr, "DummyFunction"},
|
||||||
|
};
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ETHC_C::~ETHC_C() = default;
|
||||||
|
|
||||||
|
ETHC_I::ETHC_I(Core::System& system_) : ServiceFramework{system_, "ethc:i"} {
|
||||||
|
// ethc:i doesn't have documented commands yet
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, nullptr, "DummyFunction"},
|
||||||
|
};
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ETHC_I::~ETHC_I() = default;
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
26
src/core/hle/service/sockets/ethc.h
Normal file
26
src/core/hle/service/sockets/ethc.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::Sockets {
|
||||||
|
|
||||||
|
class ETHC_C final : public ServiceFramework<ETHC_C> {
|
||||||
|
public:
|
||||||
|
explicit ETHC_C(Core::System& system_);
|
||||||
|
~ETHC_C() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ETHC_I final : public ServiceFramework<ETHC_I> {
|
||||||
|
public:
|
||||||
|
explicit ETHC_I(Core::System& system_);
|
||||||
|
~ETHC_I() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::Sockets
|
|
@ -1,8 +1,13 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/server_manager.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/sockets/bsd.h"
|
#include "core/hle/service/sockets/bsd.h"
|
||||||
|
#include "core/hle/service/sockets/bsd_nu.h"
|
||||||
|
#include "core/hle/service/sockets/bsdcfg.h"
|
||||||
|
#include "core/hle/service/sockets/dns_priv.h"
|
||||||
|
#include "core/hle/service/sockets/ethc.h"
|
||||||
#include "core/hle/service/sockets/nsd.h"
|
#include "core/hle/service/sockets/nsd.h"
|
||||||
#include "core/hle/service/sockets/sfdnsres.h"
|
#include "core/hle/service/sockets/sfdnsres.h"
|
||||||
#include "core/hle/service/sockets/sockets.h"
|
#include "core/hle/service/sockets/sockets.h"
|
||||||
|
@ -12,12 +17,33 @@ namespace Service::Sockets {
|
||||||
void LoopProcess(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
auto server_manager = std::make_unique<ServerManager>(system);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
// Register BSD services
|
||||||
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD>(system, "bsd:s"));
|
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD>(system, "bsd:s"));
|
||||||
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD>(system, "bsd:u"));
|
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD>(system, "bsd:u"));
|
||||||
|
|
||||||
|
// Register BSD:A service for [18.0.0+]
|
||||||
|
server_manager->RegisterNamedService("bsd:a", std::make_shared<BSD>(system, "bsd:a"));
|
||||||
|
|
||||||
|
// Register BSD:NU service for [15.0.0+]
|
||||||
|
server_manager->RegisterNamedService("bsd:nu", std::make_shared<BSD_NU>(system));
|
||||||
|
|
||||||
|
// Register BSDCFG service
|
||||||
server_manager->RegisterNamedService("bsdcfg", std::make_shared<BSDCFG>(system));
|
server_manager->RegisterNamedService("bsdcfg", std::make_shared<BSDCFG>(system));
|
||||||
|
|
||||||
|
// Register NSD services
|
||||||
server_manager->RegisterNamedService("nsd:a", std::make_shared<NSD>(system, "nsd:a"));
|
server_manager->RegisterNamedService("nsd:a", std::make_shared<NSD>(system, "nsd:a"));
|
||||||
server_manager->RegisterNamedService("nsd:u", std::make_shared<NSD>(system, "nsd:u"));
|
server_manager->RegisterNamedService("nsd:u", std::make_shared<NSD>(system, "nsd:u"));
|
||||||
|
|
||||||
|
// Register SFDNSRES service
|
||||||
server_manager->RegisterNamedService("sfdnsres", std::make_shared<SFDNSRES>(system));
|
server_manager->RegisterNamedService("sfdnsres", std::make_shared<SFDNSRES>(system));
|
||||||
|
|
||||||
|
// Register DNS:PRIV service
|
||||||
|
server_manager->RegisterNamedService("dns:priv", std::make_shared<DNS_PRIV>(system));
|
||||||
|
|
||||||
|
// Register ETHC services
|
||||||
|
server_manager->RegisterNamedService("ethc:c", std::make_shared<ETHC_C>(system));
|
||||||
|
server_manager->RegisterNamedService("ethc:i", std::make_shared<ETHC_I>(system));
|
||||||
|
|
||||||
server_manager->StartAdditionalHostThreads("bsdsocket", 2);
|
server_manager->StartAdditionalHostThreads("bsdsocket", 2);
|
||||||
ServerManager::RunServer(std::move(server_manager));
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue