2014-10-30 01:38:33 +00:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-17 05:38:14 +00:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-10-30 01:38:33 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-07-16 17:39:48 +00:00
|
|
|
#include <unordered_map>
|
2014-10-30 01:38:33 +00:00
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
2018-09-22 12:23:08 +00:00
|
|
|
namespace Service::SOC {
|
2014-10-30 01:38:33 +00:00
|
|
|
|
2018-07-16 17:39:48 +00:00
|
|
|
/// Holds information about a particular socket
|
|
|
|
struct SocketHolder {
|
|
|
|
u32 socket_fd; ///< The socket descriptor
|
|
|
|
bool blocking; ///< Whether the socket is blocking or not, it is only read on Windows.
|
|
|
|
};
|
|
|
|
|
|
|
|
class SOC_U final : public ServiceFramework<SOC_U> {
|
2014-10-30 01:38:33 +00:00
|
|
|
public:
|
2016-12-10 12:51:50 +00:00
|
|
|
SOC_U();
|
|
|
|
~SOC_U();
|
2014-12-21 19:52:10 +00:00
|
|
|
|
2018-07-16 17:39:48 +00:00
|
|
|
private:
|
|
|
|
void Socket(Kernel::HLERequestContext& ctx);
|
|
|
|
void Bind(Kernel::HLERequestContext& ctx);
|
|
|
|
void Fcntl(Kernel::HLERequestContext& ctx);
|
|
|
|
void Listen(Kernel::HLERequestContext& ctx);
|
|
|
|
void Accept(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetHostId(Kernel::HLERequestContext& ctx);
|
|
|
|
void Close(Kernel::HLERequestContext& ctx);
|
|
|
|
void SendTo(Kernel::HLERequestContext& ctx);
|
2018-08-21 06:38:14 +00:00
|
|
|
void RecvFromOther(Kernel::HLERequestContext& ctx);
|
2018-07-16 17:39:48 +00:00
|
|
|
void RecvFrom(Kernel::HLERequestContext& ctx);
|
|
|
|
void Poll(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetSockName(Kernel::HLERequestContext& ctx);
|
|
|
|
void Shutdown(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetPeerName(Kernel::HLERequestContext& ctx);
|
|
|
|
void Connect(Kernel::HLERequestContext& ctx);
|
|
|
|
void InitializeSockets(Kernel::HLERequestContext& ctx);
|
|
|
|
void ShutdownSockets(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetSockOpt(Kernel::HLERequestContext& ctx);
|
|
|
|
void SetSockOpt(Kernel::HLERequestContext& ctx);
|
|
|
|
|
|
|
|
/// Close all open sockets
|
|
|
|
void CleanupSockets();
|
|
|
|
|
|
|
|
/// Holds info about the currently open sockets
|
|
|
|
std::unordered_map<u32, SocketHolder> open_sockets;
|
2014-10-30 01:38:33 +00:00
|
|
|
};
|
|
|
|
|
2018-07-16 17:39:48 +00:00
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager);
|
|
|
|
|
2018-09-22 12:23:08 +00:00
|
|
|
} // namespace Service::SOC
|