Files
eden/src/core/hle/service/sockets/sockets.cpp
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
3.7 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2023-02-18 16:26:48 -05:00
#include "core/hle/service/server_manager.h"
#include "core/hle/service/sockets/bsd.h"
#include "core/hle/service/sockets/nsd.h"
#include "core/hle/service/sockets/sfdnsres.h"
#include "core/hle/service/sockets/sockets.h"
namespace Service::Sockets {
class ETHC_C final : public ServiceFramework<ETHC_C> {
public:
explicit ETHC_C(Core::System& system_)
: ServiceFramework{system_, "ethc:c"} {}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "Cancel"},
FunctionInfo{2, nullptr, "GetResult"},
FunctionInfo{3, nullptr, "GetMediaList"},
FunctionInfo{4, nullptr, "SetMediaType"},
FunctionInfo{5, nullptr, "GetMediaType"},
FunctionInfo{6, nullptr, "GetMacAddress"}
);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
};
class ETHC_I final : public ServiceFramework<ETHC_I> {
public:
explicit ETHC_I(Core::System& system_)
: ServiceFramework{system_, "ethc:i"} {}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "GetReadableHandle"},
FunctionInfo{1, nullptr, "Cancel"},
FunctionInfo{2, nullptr, "GetResult"},
FunctionInfo{3, nullptr, "GetInterfaceList"},
FunctionInfo{4, nullptr, "GetInterfaceCount"}
);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
};
class ISfDriverServiceCreator final : public ServiceFramework<ISfDriverServiceCreator> {
public:
explicit ISfDriverServiceCreator(Core::System& system_)
: ServiceFramework{system_, "eth:nd"} {}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "CreateDriverService"}
);
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
};
2023-02-18 16:26:48 -05:00
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("ethc:c", std::make_shared<ETHC_C>(system), 5);
server_manager->RegisterNamedService("ethc:i", std::make_shared<ETHC_I>(system), 5);
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD_USA>(system, "bsd:s", false), 0x7E);
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD_USA>(system, "bsd:u", true), 0x0f);
server_manager->RegisterNamedService("bsd:a", std::make_shared<BSD_USA>(system, "bsd:a", true), 0x17);
server_manager->RegisterNamedService("bsd:nu", std::make_shared<BSD_NU>(system), 4);
server_manager->RegisterNamedService("bsdcfg", std::make_shared<BSDCFG>(system, "bsdcfg"));
server_manager->RegisterNamedService("ifcfg", std::make_shared<BSDCFG>(system, "ifcfg"));
2023-02-18 16:26:48 -05:00
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("sfdnsres", std::make_shared<SFDNSRES>(system), 30);
server_manager->RegisterNamedService("dns:priv", std::make_shared<DNS_PRIV>(system));
server_manager->RegisterNamedService("eth:nd", std::make_shared<ISfDriverServiceCreator>(system));
2023-02-18 16:26:48 -05:00
server_manager->StartAdditionalHostThreads("bsdsocket", 2);
ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::Sockets