yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #281 from mailwl/sockets-services

Service/sockets: add bsd:s, nsd:a, nsd:u services
This commit is contained in:
bunnei 2018-03-25 15:45:18 -04:00 committed by GitHub
commit a0933d92fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 96 additions and 32 deletions

View File

@ -189,8 +189,10 @@ add_library(core STATIC
hle/service/sm/controller.h hle/service/sm/controller.h
hle/service/sm/sm.cpp hle/service/sm/sm.cpp
hle/service/sm/sm.h hle/service/sm/sm.h
hle/service/sockets/bsd_u.cpp hle/service/sockets/bsd.cpp
hle/service/sockets/bsd_u.h hle/service/sockets/bsd.h
hle/service/sockets/nsd.cpp
hle/service/sockets/nsd.h
hle/service/sockets/sfdnsres.cpp hle/service/sockets/sfdnsres.cpp
hle/service/sockets/sfdnsres.h hle/service/sockets/sfdnsres.h
hle/service/sockets/sockets.cpp hle/service/sockets/sockets.cpp

View File

@ -3,12 +3,12 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/sockets/bsd_u.h" #include "core/hle/service/sockets/bsd.h"
namespace Service { namespace Service {
namespace Sockets { namespace Sockets {
void BSD_U::RegisterClient(Kernel::HLERequestContext& ctx) { void BSD::RegisterClient(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
@ -17,7 +17,7 @@ void BSD_U::RegisterClient(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // bsd errno rb.Push<u32>(0); // bsd errno
} }
void BSD_U::StartMonitoring(Kernel::HLERequestContext& ctx) { void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
@ -26,7 +26,7 @@ void BSD_U::StartMonitoring(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // bsd errno rb.Push<u32>(0); // bsd errno
} }
void BSD_U::Socket(Kernel::HLERequestContext& ctx) { void BSD::Socket(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
u32 domain = rp.Pop<u32>(); u32 domain = rp.Pop<u32>();
@ -44,7 +44,7 @@ void BSD_U::Socket(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // bsd errno rb.Push<u32>(0); // bsd errno
} }
void BSD_U::Connect(Kernel::HLERequestContext& ctx) { void BSD::Connect(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -54,7 +54,7 @@ void BSD_U::Connect(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // bsd errno rb.Push<u32>(0); // bsd errno
} }
void BSD_U::SendTo(Kernel::HLERequestContext& ctx) { void BSD::SendTo(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -64,7 +64,7 @@ void BSD_U::SendTo(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // bsd errno rb.Push<u32>(0); // bsd errno
} }
void BSD_U::Close(Kernel::HLERequestContext& ctx) { void BSD::Close(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -74,13 +74,15 @@ void BSD_U::Close(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); // bsd errno rb.Push<u32>(0); // bsd errno
} }
BSD_U::BSD_U() : ServiceFramework("bsd:u") { BSD::BSD(const char* name) : ServiceFramework(name) {
static const FunctionInfo functions[] = {{0, &BSD_U::RegisterClient, "RegisterClient"}, static const FunctionInfo functions[] = {
{1, &BSD_U::StartMonitoring, "StartMonitoring"}, {0, &BSD::RegisterClient, "RegisterClient"},
{2, &BSD_U::Socket, "Socket"}, {1, &BSD::StartMonitoring, "StartMonitoring"},
{11, &BSD_U::SendTo, "SendTo"}, {2, &BSD::Socket, "Socket"},
{14, &BSD_U::Connect, "Connect"}, {11, &BSD::SendTo, "SendTo"},
{26, &BSD_U::Close, "Close"}}; {14, &BSD::Connect, "Connect"},
{26, &BSD::Close, "Close"},
};
RegisterHandlers(functions); RegisterHandlers(functions);
} }

View File

@ -10,10 +10,10 @@
namespace Service { namespace Service {
namespace Sockets { namespace Sockets {
class BSD_U final : public ServiceFramework<BSD_U> { class BSD final : public ServiceFramework<BSD> {
public: public:
BSD_U(); explicit BSD(const char* name);
~BSD_U() = default; ~BSD() = default;
private: private:
void RegisterClient(Kernel::HLERequestContext& ctx); void RegisterClient(Kernel::HLERequestContext& ctx);

View File

@ -0,0 +1,34 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/sockets/nsd.h"
namespace Service {
namespace Sockets {
NSD::NSD(const char* name) : ServiceFramework(name) {
static const FunctionInfo functions[] = {
{10, nullptr, "GetSettingName"},
{11, nullptr, "GetEnvironmentIdentifier"},
{12, nullptr, "GetDeviceId"},
{13, nullptr, "DeleteSettings"},
{14, nullptr, "ImportSettings"},
{20, nullptr, "Resolve"},
{21, nullptr, "ResolveEx"},
{30, nullptr, "GetNasServiceSetting"},
{31, nullptr, "GetNasServiceSettingEx"},
{40, nullptr, "GetNasRequestFqdn"},
{41, nullptr, "GetNasRequestFqdnEx"},
{42, nullptr, "GetNasApiFqdn"},
{43, nullptr, "GetNasApiFqdnEx"},
{50, nullptr, "GetCurrentSetting"},
{60, nullptr, "ReadSaveDataFromFsForTest"},
{61, nullptr, "WriteSaveDataToFsForTest"},
{62, nullptr, "DeleteSaveDataOfFsForTest"},
};
RegisterHandlers(functions);
}
} // namespace Sockets
} // namespace Service

View File

@ -0,0 +1,20 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/service/service.h"
namespace Service {
namespace Sockets {
class NSD final : public ServiceFramework<NSD> {
public:
explicit NSD(const char* name);
~NSD() = default;
};
} // namespace Sockets
} // namespace Service

View File

@ -19,16 +19,18 @@ void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) {
} }
SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") { SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
static const FunctionInfo functions[] = {{0, nullptr, "SetDnsAddressesPrivate"}, static const FunctionInfo functions[] = {
{1, nullptr, "GetDnsAddressPrivate"}, {0, nullptr, "SetDnsAddressesPrivate"},
{2, nullptr, "GetHostByName"}, {1, nullptr, "GetDnsAddressPrivate"},
{3, nullptr, "GetHostByAddr"}, {2, nullptr, "GetHostByName"},
{4, nullptr, "GetHostStringError"}, {3, nullptr, "GetHostByAddr"},
{5, nullptr, "GetGaiStringError"}, {4, nullptr, "GetHostStringError"},
{6, &SFDNSRES::GetAddrInfo, "GetAddrInfo"}, {5, nullptr, "GetGaiStringError"},
{7, nullptr, "GetNameInfo"}, {6, &SFDNSRES::GetAddrInfo, "GetAddrInfo"},
{8, nullptr, "RequestCancelHandle"}, {7, nullptr, "GetNameInfo"},
{9, nullptr, "CancelSocketCall"}}; {8, nullptr, "RequestCancelHandle"},
{9, nullptr, "CancelSocketCall"},
};
RegisterHandlers(functions); RegisterHandlers(functions);
} }

View File

@ -12,7 +12,7 @@ namespace Sockets {
class SFDNSRES final : public ServiceFramework<SFDNSRES> { class SFDNSRES final : public ServiceFramework<SFDNSRES> {
public: public:
SFDNSRES(); explicit SFDNSRES();
~SFDNSRES() = default; ~SFDNSRES() = default;
private: private:

View File

@ -2,7 +2,8 @@
// 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/service/sockets/bsd_u.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/sfdnsres.h"
#include "core/hle/service/sockets/sockets.h" #include "core/hle/service/sockets/sockets.h"
@ -10,7 +11,10 @@ namespace Service {
namespace Sockets { namespace Sockets {
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<BSD_U>()->InstallAsService(service_manager); std::make_shared<BSD>("bsd:s")->InstallAsService(service_manager);
std::make_shared<BSD>("bsd:u")->InstallAsService(service_manager);
std::make_shared<NSD>("nsd:a")->InstallAsService(service_manager);
std::make_shared<NSD>("nsd:u")->InstallAsService(service_manager);
std::make_shared<SFDNSRES>()->InstallAsService(service_manager); std::make_shared<SFDNSRES>()->InstallAsService(service_manager);
} }