2018-01-18 11:35:03 -08:00
|
|
|
// 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"
|
2018-03-25 02:41:00 -07:00
|
|
|
#include "core/hle/service/sockets/bsd.h"
|
2018-01-18 11:35:03 -08:00
|
|
|
|
2018-04-19 18:41:44 -07:00
|
|
|
namespace Service::Sockets {
|
2018-01-18 11:35:03 -08:00
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
void BSD::RegisterClient(Kernel::HLERequestContext& ctx) {
|
2018-04-24 07:53:44 -07:00
|
|
|
NGLOG_WARNING(Service, "(STUBBED) called");
|
2018-01-18 11:35:03 -08:00
|
|
|
|
2018-01-23 16:52:18 -08:00
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
2018-01-18 11:35:03 -08:00
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0); // bsd errno
|
|
|
|
}
|
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) {
|
2018-04-24 07:53:44 -07:00
|
|
|
NGLOG_WARNING(Service, "(STUBBED) called");
|
2018-02-22 02:04:23 -08:00
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 3};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0); // bsd errno
|
|
|
|
}
|
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
void BSD::Socket(Kernel::HLERequestContext& ctx) {
|
2018-01-18 11:35:03 -08:00
|
|
|
IPC::RequestParser rp{ctx};
|
|
|
|
|
|
|
|
u32 domain = rp.Pop<u32>();
|
|
|
|
u32 type = rp.Pop<u32>();
|
|
|
|
u32 protocol = rp.Pop<u32>();
|
|
|
|
|
2018-04-24 07:53:44 -07:00
|
|
|
NGLOG_WARNING(Service, "(STUBBED) called domain={} type={} protocol={}", domain, type,
|
|
|
|
protocol);
|
2018-01-18 11:35:03 -08:00
|
|
|
|
|
|
|
u32 fd = next_fd++;
|
|
|
|
|
2018-01-23 16:52:18 -08:00
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
2018-01-18 11:35:03 -08:00
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(fd);
|
|
|
|
rb.Push<u32>(0); // bsd errno
|
|
|
|
}
|
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
void BSD::Connect(Kernel::HLERequestContext& ctx) {
|
2018-04-24 07:53:44 -07:00
|
|
|
NGLOG_WARNING(Service, "(STUBBED) called");
|
2018-01-18 11:35:03 -08:00
|
|
|
|
2018-01-23 16:52:18 -08:00
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
2018-01-18 11:35:03 -08:00
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0); // ret
|
|
|
|
rb.Push<u32>(0); // bsd errno
|
|
|
|
}
|
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
void BSD::SendTo(Kernel::HLERequestContext& ctx) {
|
2018-04-24 07:53:44 -07:00
|
|
|
NGLOG_WARNING(Service, "(STUBBED) called");
|
2018-01-18 11:35:03 -08:00
|
|
|
|
2018-01-23 16:52:18 -08:00
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
2018-01-18 11:35:03 -08:00
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0); // ret
|
|
|
|
rb.Push<u32>(0); // bsd errno
|
|
|
|
}
|
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
void BSD::Close(Kernel::HLERequestContext& ctx) {
|
2018-04-24 07:53:44 -07:00
|
|
|
NGLOG_WARNING(Service, "(STUBBED) called");
|
2018-01-29 22:29:47 -08:00
|
|
|
|
|
|
|
IPC::ResponseBuilder rb{ctx, 4};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u32>(0); // ret
|
|
|
|
rb.Push<u32>(0); // bsd errno
|
|
|
|
}
|
|
|
|
|
2018-03-25 02:41:00 -07:00
|
|
|
BSD::BSD(const char* name) : ServiceFramework(name) {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &BSD::RegisterClient, "RegisterClient"},
|
|
|
|
{1, &BSD::StartMonitoring, "StartMonitoring"},
|
|
|
|
{2, &BSD::Socket, "Socket"},
|
2018-04-17 08:37:43 -07:00
|
|
|
{3, nullptr, "SocketExempt"},
|
|
|
|
{4, nullptr, "Open"},
|
|
|
|
{5, nullptr, "Select"},
|
|
|
|
{6, nullptr, "Poll"},
|
|
|
|
{7, nullptr, "Sysctl"},
|
|
|
|
{8, nullptr, "Recv"},
|
|
|
|
{9, nullptr, "RecvFrom"},
|
|
|
|
{10, nullptr, "Send"},
|
2018-03-25 02:41:00 -07:00
|
|
|
{11, &BSD::SendTo, "SendTo"},
|
2018-04-17 08:37:43 -07:00
|
|
|
{12, nullptr, "Accept"},
|
|
|
|
{13, nullptr, "Bind"},
|
2018-03-25 02:41:00 -07:00
|
|
|
{14, &BSD::Connect, "Connect"},
|
2018-04-17 08:37:43 -07:00
|
|
|
{15, nullptr, "GetPeerName"},
|
|
|
|
{16, nullptr, "GetSockName"},
|
|
|
|
{17, nullptr, "GetSockOpt"},
|
|
|
|
{18, nullptr, "Listen"},
|
|
|
|
{19, nullptr, "Ioctl"},
|
|
|
|
{20, nullptr, "Fcntl"},
|
|
|
|
{21, nullptr, "SetSockOpt"},
|
|
|
|
{22, nullptr, "Shutdown"},
|
|
|
|
{23, nullptr, "ShutdownAllSockets"},
|
|
|
|
{24, nullptr, "Write"},
|
|
|
|
{25, nullptr, "Read"},
|
2018-03-25 02:41:00 -07:00
|
|
|
{26, &BSD::Close, "Close"},
|
2018-04-17 08:37:43 -07:00
|
|
|
{27, nullptr, "DuplicateSocket"},
|
|
|
|
{28, nullptr, "GetResourceStatistics"},
|
|
|
|
{29, nullptr, "RecvMMsg"},
|
|
|
|
{30, nullptr, "SendMMsg"},
|
2018-03-25 02:41:00 -07:00
|
|
|
};
|
2018-01-18 11:35:03 -08:00
|
|
|
RegisterHandlers(functions);
|
|
|
|
}
|
|
|
|
|
2018-04-19 18:41:44 -07:00
|
|
|
} // namespace Service::Sockets
|