mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 21:51:45 +00:00
htcs: add hipc server/service object skeletons
This commit is contained in:
parent
10255f7f51
commit
b898241112
9 changed files with 464 additions and 3 deletions
|
@ -18,3 +18,4 @@
|
|||
#include <stratosphere/htcs/htcs_types.hpp>
|
||||
#include <stratosphere/htcs/impl/htcs_manager_holder.hpp>
|
||||
#include <stratosphere/htcs/impl/htcs_channel_ids.hpp>
|
||||
#include <stratosphere/htcs/server/htcs_hipc_server.hpp>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
void Initialize();
|
||||
|
||||
void RegisterHipcServer();
|
||||
void LoopHipcServer();
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_manager_service_object.hpp"
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
namespace {
|
||||
|
||||
static constexpr inline size_t NumServers = 1;
|
||||
static constexpr inline size_t MaxSessions = 63;
|
||||
static constexpr inline sm::ServiceName ServiceName = sm::ServiceName::Encode("htcs");
|
||||
|
||||
struct ServerOptions {
|
||||
static constexpr size_t PointerBufferSize = 0x80;
|
||||
static constexpr size_t MaxDomains = 0x10;
|
||||
static constexpr size_t MaxDomainObjects = 100;
|
||||
};
|
||||
|
||||
using ServerManager = sf::hipc::ServerManager<NumServers, ServerOptions, MaxSessions>;
|
||||
|
||||
/* Service object. */
|
||||
ServerManager g_server_manager;
|
||||
|
||||
/* Service object. */
|
||||
constinit sf::UnmanagedServiceObject<tma::IHtcsManager, ManagerServiceObject> g_htcs_service_object;
|
||||
|
||||
}
|
||||
|
||||
void Initialize() {
|
||||
/* Add a reference to the htcs manager. */
|
||||
htcs::impl::HtcsManagerHolder::AddReference();
|
||||
}
|
||||
|
||||
void RegisterHipcServer() {
|
||||
/* Register the service. */
|
||||
R_ABORT_UNLESS(g_server_manager.RegisterObjectForServer(g_htcs_service_object.GetShared(), ServiceName, MaxSessions));
|
||||
}
|
||||
|
||||
void LoopHipcServer() {
|
||||
/* Loop, servicing services. */
|
||||
g_server_manager.LoopProcess();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_manager_service_object.hpp"
|
||||
#include "htcs_socket_service_object.hpp"
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
namespace {
|
||||
|
||||
struct ServiceObjectAllocatorTag;
|
||||
using ServiceObjectAllocator = ams::sf::ExpHeapStaticAllocator<32_KB, ServiceObjectAllocatorTag>;
|
||||
using ServiceObjectFactory = ams::sf::ObjectFactory<typename ServiceObjectAllocator::Policy>;
|
||||
|
||||
class StaticAllocatorInitializer {
|
||||
public:
|
||||
StaticAllocatorInitializer() {
|
||||
ServiceObjectAllocator::Initialize(lmem::CreateOption_ThreadSafe);
|
||||
}
|
||||
} g_static_allocator_initializer;
|
||||
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::GetPeerNameAny(sf::Out<htcs::HtcsPeerName> out) {
|
||||
AMS_ABORT("ManagerServiceObject::GetPeerNameAny");
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::GetDefaultHostName(sf::Out<htcs::HtcsPeerName> out) {
|
||||
AMS_ABORT("ManagerServiceObject::GetDefaultHostName");
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::CreateSocketOld(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out) {
|
||||
return this->CreateSocket(out_err, out, false);
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::CreateSocket(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, bool enable_disconnection_emulation) {
|
||||
AMS_ABORT("ManagerServiceObject::CreateSocket");
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::RegisterProcessId(const sf::ClientProcessId &client_pid) {
|
||||
/* NOTE: Nintend does nothing here. */
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::MonitorManager(const sf::ClientProcessId &client_pid) {
|
||||
/* NOTE: Nintend does nothing here. */
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::StartSelect(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InMapAliasArray<s32> &read_handles, const sf::InMapAliasArray<s32> &write_handles, const sf::InMapAliasArray<s32> &exception_handles, s64 tv_sec, s64 tv_usec) {
|
||||
AMS_ABORT("ManagerServiceObject::StartSelect");
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::EndSelect(sf::Out<s32> out_err, sf::Out<s32> out_res, const sf::OutMapAliasArray<s32> &read_handles, const sf::OutMapAliasArray<s32> &write_handles, const sf::OutMapAliasArray<s32> &exception_handles, u32 task_id) {
|
||||
AMS_ABORT("ManagerServiceObject::EndSelect");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
class ManagerServiceObject : public sf::ISharedObject {
|
||||
public:
|
||||
Result Socket(sf::Out<s32> out_err, sf::Out<s32> out_sock);
|
||||
Result Close(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc);
|
||||
Result Connect(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, const htcs::SockAddrHtcs &address);
|
||||
Result Bind(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, const htcs::SockAddrHtcs &address);
|
||||
Result Listen(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 backlog_count);
|
||||
Result Accept(sf::Out<s32> out_err, sf::Out<s32> out_res, sf::Out<htcs::SockAddrHtcs> out_address, s32 desc);
|
||||
Result Recv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutBuffer &buffer, s32 desc, s32 flags);
|
||||
Result Send(sf::Out<s32> out_err, sf::Out<s64> out_size, s32 desc, const sf::InBuffer &buffer, s32 flags);
|
||||
Result Shutdown(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 how);
|
||||
Result Fcntl(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 command, s32 value);
|
||||
Result GetPeerNameAny(sf::Out<htcs::HtcsPeerName> out);
|
||||
Result GetDefaultHostName(sf::Out<htcs::HtcsPeerName> out);
|
||||
Result CreateSocketOld(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out);
|
||||
Result CreateSocket(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, bool enable_disconnection_emulation);
|
||||
Result RegisterProcessId(const sf::ClientProcessId &client_pid);
|
||||
Result MonitorManager(const sf::ClientProcessId &client_pid);
|
||||
Result StartSelect(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InMapAliasArray<s32> &read_handles, const sf::InMapAliasArray<s32> &write_handles, const sf::InMapAliasArray<s32> &exception_handles, s64 tv_sec, s64 tv_usec);
|
||||
Result EndSelect(sf::Out<s32> out_err, sf::Out<s32> out_res, const sf::OutMapAliasArray<s32> &read_handles, const sf::OutMapAliasArray<s32> &write_handles, const sf::OutMapAliasArray<s32> &exception_handles, u32 task_id);
|
||||
};
|
||||
static_assert(tma::IsIHtcsManager<ManagerServiceObject>);
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_manager_service_object.hpp"
|
||||
#include "htcs_socket_service_object.hpp"
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
#define AMS_HTCS_MANAGER_DEPRECATED_API() AMS_ABORT("Deprecated IHtcsManager API %s was called.\n", AMS_CURRENT_FUNCTION_NAME)
|
||||
|
||||
Result ManagerServiceObject::Socket(sf::Out<s32> out_err, sf::Out<s32> out_sock) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Close(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Connect(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, const htcs::SockAddrHtcs &address) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Bind(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, const htcs::SockAddrHtcs &address) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Listen(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 backlog_count) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Accept(sf::Out<s32> out_err, sf::Out<s32> out_res, sf::Out<htcs::SockAddrHtcs> out_address, s32 desc) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Recv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutBuffer &buffer, s32 desc, s32 flags) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Send(sf::Out<s32> out_err, sf::Out<s64> out_size, s32 desc, const sf::InBuffer &buffer, s32 flags) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Shutdown(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 how) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::Fcntl(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 command, s32 value) {
|
||||
/* NOTE: This is a deprecated API, and Nintendo aborts when it is called. */
|
||||
AMS_HTCS_MANAGER_DEPRECATED_API();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_socket_service_object.hpp"
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
SocketServiceObject::SocketServiceObject(ManagerServiceObject *manager, s32 desc) : m_manager(manager, true), m_desc(desc) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
SocketServiceObject::~SocketServiceObject() {
|
||||
AMS_ABORT("SocketServiceObject::~SocketServiceObject");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Close(sf::Out<s32> out_err, sf::Out<s32> out_res) {
|
||||
AMS_ABORT("SocketServiceObject::Close");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Connect(sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address) {
|
||||
AMS_ABORT("SocketServiceObject::Connect");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Bind(sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address) {
|
||||
AMS_ABORT("SocketServiceObject::Bind");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Listen(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 backlog_count) {
|
||||
AMS_ABORT("SocketServiceObject::Listen");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Accept(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address) {
|
||||
AMS_ABORT("SocketServiceObject::Accept");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Recv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::Recv");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Send(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::InAutoSelectBuffer &buffer, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::Send");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Shutdown(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 how) {
|
||||
AMS_ABORT("SocketServiceObject::Shutdown");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::Fcntl(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 command, s32 value) {
|
||||
AMS_ABORT("SocketServiceObject::Fcntl");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::AcceptStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event) {
|
||||
AMS_ABORT("SocketServiceObject::AcceptStart");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::AcceptResults(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::AcceptResults");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::RecvStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::RecvStart");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::RecvResults(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::RecvResults");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle mem_handle, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::RecvLargeStart");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendStartOld(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::SendStartOld");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle mem_handle, s64 aligned_size, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::SendLargeStart");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendResults(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::SendResults");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::StartSend(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, sf::Out<s64> out_max_size, s64 size, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::StartSend");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::ContinueSendOld(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::ContinueSendOld");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::EndSend(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::EndSend");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::StartRecv(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s64 size, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::StartRecv");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::EndRecv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::EndRecv");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InNonSecureAutoSelectBuffer &buffer, s32 flags) {
|
||||
AMS_ABORT("SocketServiceObject::SendStart");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::ContinueSend(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id) {
|
||||
AMS_ABORT("SocketServiceObject::ContinueSend");
|
||||
}
|
||||
|
||||
Result SocketServiceObject::GetPrimitive(sf::Out<s32> out) {
|
||||
AMS_ABORT("SocketServiceObject::GetPrimitive");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_manager_service_object.hpp"
|
||||
|
||||
namespace ams::htcs::server {
|
||||
|
||||
class SocketServiceObject {
|
||||
private:
|
||||
sf::SharedPointer<ManagerServiceObject> m_manager;
|
||||
s32 m_desc;
|
||||
public:
|
||||
SocketServiceObject(ManagerServiceObject *manager, s32 desc);
|
||||
~SocketServiceObject();
|
||||
public:
|
||||
Result Close(sf::Out<s32> out_err, sf::Out<s32> out_res);
|
||||
Result Connect(sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address);
|
||||
Result Bind(sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address);
|
||||
Result Listen(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 backlog_count);
|
||||
Result Accept(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address);
|
||||
Result Recv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, s32 flags);
|
||||
Result Send(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::InAutoSelectBuffer &buffer, s32 flags);
|
||||
Result Shutdown(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 how);
|
||||
Result Fcntl(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 command, s32 value);
|
||||
Result AcceptStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event);
|
||||
Result AcceptResults(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address, u32 task_id);
|
||||
Result RecvStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags);
|
||||
Result RecvResults(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id);
|
||||
Result RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle mem_handle, s32 flags);
|
||||
Result SendStartOld(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags);
|
||||
Result SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle mem_handle, s64 aligned_size, s32 flags);
|
||||
Result SendResults(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id);
|
||||
Result StartSend(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, sf::Out<s64> out_max_size, s64 size, s32 flags);
|
||||
Result ContinueSendOld(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id);
|
||||
Result EndSend(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id);
|
||||
Result StartRecv(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s64 size, s32 flags);
|
||||
Result EndRecv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id);
|
||||
Result SendStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InNonSecureAutoSelectBuffer &buffer, s32 flags);
|
||||
Result ContinueSend(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id);
|
||||
Result GetPrimitive(sf::Out<s32> out);
|
||||
};
|
||||
static_assert(tma::IsISocket<SocketServiceObject>);
|
||||
|
||||
}
|
|
@ -214,7 +214,7 @@ namespace ams::htc {
|
|||
}
|
||||
|
||||
void HtcsIpcThreadFunction(void *arg) {
|
||||
//htcs::server::LoopHipcServer();
|
||||
htcs::server::LoopHipcServer();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -263,8 +263,8 @@ int main(int argc, char **argv)
|
|||
os::SetThreadNamePointer(std::addressof(htcfs_ipc_thread), AMS_GET_SYSTEM_THREAD_NAME(htc, HtcfsIpc));
|
||||
|
||||
/* Initialize the htcs server. */
|
||||
//htcs::server::Initialize();
|
||||
//htcs::server::RegisterHipcServer();
|
||||
htcs::server::Initialize();
|
||||
htcs::server::RegisterHipcServer();
|
||||
|
||||
/* Create the htcs ipc threads. */
|
||||
os::ThreadType htcs_ipc_threads[htc::NumHtcsIpcThreads];
|
||||
|
|
Loading…
Reference in a new issue