2019-12-09 12:57:37 +01:00
|
|
|
/*
|
2021-10-04 21:59:10 +02:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2019-12-09 12:57:37 +01: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-12 00:02:10 +02:00
|
|
|
#include <stratosphere.hpp>
|
2019-12-09 12:57:37 +01:00
|
|
|
#include "sm_utils.hpp"
|
|
|
|
|
|
|
|
namespace ams::sm::mitm {
|
|
|
|
|
|
|
|
/* Mitm API. */
|
2021-10-05 02:12:32 +02:00
|
|
|
Result InstallMitm(os::NativeHandle *out_port, os::NativeHandle *out_query, ServiceName name) {
|
2021-04-11 02:59:54 +02:00
|
|
|
return impl::DoWithPerThreadSession([&](TipcService *fwd) {
|
2019-12-09 12:57:37 +01:00
|
|
|
return smAtmosphereMitmInstall(fwd, out_port, out_query, impl::ConvertName(name));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result UninstallMitm(ServiceName name) {
|
2021-04-14 08:58:10 +02:00
|
|
|
return smAtmosphereMitmUninstall(impl::ConvertName(name));
|
2019-12-09 12:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Result DeclareFutureMitm(ServiceName name) {
|
2021-04-14 08:58:10 +02:00
|
|
|
return smAtmosphereMitmDeclareFuture(impl::ConvertName(name));
|
2019-12-09 12:57:37 +01:00
|
|
|
}
|
|
|
|
|
2020-09-07 19:40:43 +02:00
|
|
|
Result ClearFutureMitm(ServiceName name) {
|
2021-04-14 08:58:10 +02:00
|
|
|
return smAtmosphereMitmClearFuture(impl::ConvertName(name));
|
2020-09-07 19:40:43 +02:00
|
|
|
}
|
|
|
|
|
2019-12-09 12:57:37 +01: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 08:58:10 +02:00
|
|
|
return smAtmosphereHasMitm(out, impl::ConvertName(name));
|
2019-12-09 12:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Result WaitMitm(ServiceName name) {
|
2021-04-14 08:58:10 +02:00
|
|
|
return smAtmosphereWaitMitm(impl::ConvertName(name));
|
2019-12-09 12:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|