mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-10 15:16:34 +00:00
54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) 2018-2020 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/>.
|
|
*/
|
|
|
|
#pragma once
|
|
#include <stratosphere/sf/sf_common.hpp>
|
|
#include <stratosphere/sf/sf_out.hpp>
|
|
#include <stratosphere/sf/sf_shared_object.hpp>
|
|
|
|
namespace ams::sf {
|
|
|
|
class IServiceObject : public ISharedObject {
|
|
public:
|
|
virtual ~IServiceObject() { /* ... */ }
|
|
};
|
|
|
|
template<typename T>
|
|
concept IsServiceObject = std::derived_from<T, IServiceObject>;
|
|
|
|
class IMitmServiceObject : public IServiceObject {
|
|
public:
|
|
virtual ~IMitmServiceObject() { /* ... */ }
|
|
};
|
|
|
|
class MitmServiceImplBase {
|
|
protected:
|
|
std::shared_ptr<::Service> forward_service;
|
|
sm::MitmProcessInfo client_info;
|
|
public:
|
|
MitmServiceImplBase(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : forward_service(std::move(s)), client_info(c) { /* ... */ }
|
|
};
|
|
|
|
template<typename T>
|
|
concept IsMitmServiceObject = IsServiceObject<T> && std::derived_from<T, IMitmServiceObject>;
|
|
|
|
template<typename T>
|
|
concept IsMitmServiceImpl = requires (std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) {
|
|
{ T(std::forward<std::shared_ptr<::Service>>(s), c) };
|
|
{ T::ShouldMitm(c) } -> std::same_as<bool>;
|
|
};
|
|
|
|
}
|