2019-12-09 11:57:37 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2019-12-09 11:57:37 +00:00
|
|
|
*
|
|
|
|
* 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
|
2021-10-01 02:21:08 +00:00
|
|
|
#include <stratosphere/sf/sf_common.hpp>
|
|
|
|
#include <stratosphere/sf/cmif/sf_cmif_pointer_and_size.hpp>
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
namespace ams::sf::hipc {
|
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
void *GetMessageBufferOnTls();
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
constexpr size_t TlsMessageBufferSize = 0x100;
|
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
|
|
|
ALWAYS_INLINE void *GetMessageBufferOnTls() {
|
|
|
|
return svc::GetThreadLocalRegion()->message_buffer;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
enum class ReceiveResult {
|
|
|
|
Success,
|
|
|
|
Closed,
|
|
|
|
NeedsRetry,
|
|
|
|
};
|
|
|
|
|
2021-10-04 21:54:13 +00:00
|
|
|
void AttachMultiWaitHolderForAccept(os::MultiWaitHolderType *holder, os::NativeHandle port);
|
|
|
|
void AttachMultiWaitHolderForReply(os::MultiWaitHolderType *holder, os::NativeHandle request);
|
2020-04-08 09:21:35 +00:00
|
|
|
|
2021-10-04 21:54:13 +00:00
|
|
|
Result Receive(ReceiveResult *out_recv_result, os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer);
|
|
|
|
Result Receive(bool *out_closed, os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer);
|
|
|
|
Result Reply(os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer);
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2021-10-04 21:54:13 +00:00
|
|
|
Result CreateSession(os::NativeHandle *out_server_handle, os::NativeHandle *out_client_handle);
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|