2019-07-18 04:04:00 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2019 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 "sm_utils.hpp"
|
|
|
|
|
2019-10-24 10:30:10 +01:00
|
|
|
namespace ams::sm::mitm {
|
2019-07-18 04:04:00 +01:00
|
|
|
|
|
|
|
/* Mitm API. */
|
|
|
|
Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name) {
|
|
|
|
return impl::DoWithMitmSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereMitmInstall(out_port, out_query, impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result UninstallMitm(ServiceName name) {
|
|
|
|
return impl::DoWithMitmSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereMitmUninstall(impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result DeclareFutureMitm(ServiceName name) {
|
|
|
|
return impl::DoWithMitmSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereMitmDeclareFuture(impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-10-11 07:49:28 +01:00
|
|
|
Result AcknowledgeSession(Service *out_service, os::ProcessId *out_pid, ncm::TitleId *out_tid, ServiceName name) {
|
2019-07-18 04:04:00 +01:00
|
|
|
return impl::DoWithMitmSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereMitmAcknowledgeSession(out_service, &out_pid->value, &out_tid->value, impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result HasMitm(bool *out, ServiceName name) {
|
|
|
|
return impl::DoWithUserSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereHasMitm(out, impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result WaitMitm(ServiceName name) {
|
|
|
|
return impl::DoWithUserSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereWaitMitm(impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|