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/>.
|
|
|
|
*/
|
2020-05-11 22:02:10 +00:00
|
|
|
#include <stratosphere.hpp>
|
2019-12-09 11:57:37 +00:00
|
|
|
#include "sm_utils.hpp"
|
|
|
|
|
|
|
|
namespace ams::sm::mitm {
|
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
|
|
|
#if AMS_SF_MITM_SUPPORTED
|
2019-12-09 11:57:37 +00:00
|
|
|
/* Mitm API. */
|
2021-10-05 00:12:32 +00:00
|
|
|
Result InstallMitm(os::NativeHandle *out_port, os::NativeHandle *out_query, ServiceName name) {
|
2021-04-11 00:59:54 +00:00
|
|
|
return impl::DoWithPerThreadSession([&](TipcService *fwd) {
|
2019-12-09 11:57:37 +00:00
|
|
|
return smAtmosphereMitmInstall(fwd, out_port, out_query, impl::ConvertName(name));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result UninstallMitm(ServiceName name) {
|
2021-04-14 06:58:10 +00:00
|
|
|
return smAtmosphereMitmUninstall(impl::ConvertName(name));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result DeclareFutureMitm(ServiceName name) {
|
2021-04-14 06:58:10 +00:00
|
|
|
return smAtmosphereMitmDeclareFuture(impl::ConvertName(name));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
2020-09-07 17:40:43 +00:00
|
|
|
Result ClearFutureMitm(ServiceName name) {
|
2021-04-14 06:58:10 +00:00
|
|
|
return smAtmosphereMitmClearFuture(impl::ConvertName(name));
|
2020-09-07 17:40:43 +00:00
|
|
|
}
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
Result AcknowledgeSession(Service *out_service, MitmProcessInfo *out_info, ServiceName name) {
|
|
|
|
return impl::DoWithMitmAcknowledgementSession([&]() {
|
|
|
|
return smAtmosphereMitmAcknowledgeSession(out_service, reinterpret_cast<void *>(out_info), impl::ConvertName(name));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result HasMitm(bool *out, ServiceName name) {
|
2021-04-14 06:58:10 +00:00
|
|
|
return smAtmosphereHasMitm(out, impl::ConvertName(name));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result WaitMitm(ServiceName name) {
|
2021-04-14 06:58:10 +00:00
|
|
|
return smAtmosphereWaitMitm(impl::ConvertName(name));
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|
2022-03-06 20:08:20 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
}
|