From eaa9f968a629b8743f22a2277a5332942a3cd9d9 Mon Sep 17 00:00:00 2001 From: mailwl Date: Tue, 30 Jan 2018 09:29:47 +0300 Subject: [WIP] sfdnsres: stub (#146) sfdnsres: Add several stubs --- src/core/CMakeLists.txt | 1 + src/core/hle/service/sockets/bsd_u.cpp | 13 ++++++++++- src/core/hle/service/sockets/bsd_u.h | 1 + src/core/hle/service/sockets/sfdnsres.cpp | 36 +++++++++++++++++++++++++++++++ src/core/hle/service/sockets/sfdnsres.h | 3 ++- 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/core/hle/service/sockets/sfdnsres.cpp (limited to 'src') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d2fcc2c7e..70a38ff6c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -145,6 +145,7 @@ add_library(core STATIC hle/service/sm/sm.h hle/service/sockets/bsd_u.cpp hle/service/sockets/bsd_u.h + hle/service/sockets/sfdnsres.cpp hle/service/sockets/sfdnsres.h hle/service/sockets/sockets.cpp hle/service/sockets/sockets.h diff --git a/src/core/hle/service/sockets/bsd_u.cpp b/src/core/hle/service/sockets/bsd_u.cpp index 4fd960bd8..629ffb040 100644 --- a/src/core/hle/service/sockets/bsd_u.cpp +++ b/src/core/hle/service/sockets/bsd_u.cpp @@ -55,11 +55,22 @@ void BSD_U::SendTo(Kernel::HLERequestContext& ctx) { rb.Push(0); // bsd errno } +void BSD_U::Close(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 4}; + + rb.Push(RESULT_SUCCESS); + rb.Push(0); // ret + rb.Push(0); // bsd errno +} + BSD_U::BSD_U() : ServiceFramework("bsd:u") { static const FunctionInfo functions[] = {{0, &BSD_U::RegisterClient, "RegisterClient"}, {2, &BSD_U::Socket, "Socket"}, {11, &BSD_U::SendTo, "SendTo"}, - {14, &BSD_U::Connect, "Connect"}}; + {14, &BSD_U::Connect, "Connect"}, + {26, &BSD_U::Close, "Close"}}; RegisterHandlers(functions); } diff --git a/src/core/hle/service/sockets/bsd_u.h b/src/core/hle/service/sockets/bsd_u.h index 1fe96d850..fde08a22b 100644 --- a/src/core/hle/service/sockets/bsd_u.h +++ b/src/core/hle/service/sockets/bsd_u.h @@ -20,6 +20,7 @@ private: void Socket(Kernel::HLERequestContext& ctx); void Connect(Kernel::HLERequestContext& ctx); void SendTo(Kernel::HLERequestContext& ctx); + void Close(Kernel::HLERequestContext& ctx); /// Id to use for the next open file descriptor. u32 next_fd = 1; diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp new file mode 100644 index 000000000..4d7bc7c3e --- /dev/null +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -0,0 +1,36 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/sockets/sfdnsres.h" + +namespace Service { +namespace Sockets { + +void SFDNSRES::GetAddrInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + LOG_WARNING(Service, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + + rb.Push(RESULT_SUCCESS); +} + +SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") { + static const FunctionInfo functions[] = {{0, nullptr, "SetDnsAddressesPrivate"}, + {1, nullptr, "GetDnsAddressPrivate"}, + {2, nullptr, "GetHostByName"}, + {3, nullptr, "GetHostByAddr"}, + {4, nullptr, "GetHostStringError"}, + {5, nullptr, "GetGaiStringError"}, + {6, &SFDNSRES::GetAddrInfo, "GetAddrInfo"}, + {7, nullptr, "GetNameInfo"}, + {8, nullptr, "RequestCancelHandle"}, + {9, nullptr, "CancelSocketCall"}}; + RegisterHandlers(functions); +} + +} // namespace Sockets +} // namespace Service diff --git a/src/core/hle/service/sockets/sfdnsres.h b/src/core/hle/service/sockets/sfdnsres.h index 32a3ac8c5..b726a30fd 100644 --- a/src/core/hle/service/sockets/sfdnsres.h +++ b/src/core/hle/service/sockets/sfdnsres.h @@ -12,10 +12,11 @@ namespace Sockets { class SFDNSRES final : public ServiceFramework { public: - SFDNSRES() : ServiceFramework("sfdnsres") {} + SFDNSRES(); ~SFDNSRES() = default; private: + void GetAddrInfo(Kernel::HLERequestContext& ctx); }; } // namespace Sockets -- cgit v1.2.3