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) {
|
2019-11-21 07:58:18 +00:00
|
|
|
return impl::DoWithPerThreadSession([&](Service *fwd) {
|
|
|
|
return smAtmosphereMitmInstall(fwd, out_port, out_query, impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Result UninstallMitm(ServiceName name) {
|
2019-11-21 07:58:18 +00:00
|
|
|
return impl::DoWithUserSession([&]() {
|
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) {
|
2019-11-21 07:58:18 +00:00
|
|
|
return impl::DoWithUserSession([&]() {
|
2019-10-23 08:07:20 +01:00
|
|
|
return smAtmosphereMitmDeclareFuture(impl::ConvertName(name));
|
2019-07-18 04:04:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-11-21 12:03:19 +00:00
|
|
|
Result AcknowledgeSession(Service *out_service, MitmProcessInfo *out_info, ServiceName name) {
|
2019-11-21 07:58:18 +00:00
|
|
|
return impl::DoWithMitmAcknowledgementSession([&]() {
|
2019-11-21 12:03:19 +00:00
|
|
|
return smAtmosphereMitmAcknowledgeSession(out_service, reinterpret_cast<void *>(out_info), 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
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|