2018-04-22 05:17:57 +02:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
|
|
|
#include <stratosphere/iserviceobject.hpp>
|
|
|
|
|
|
|
|
enum UserServiceCmd {
|
|
|
|
User_Cmd_Initialize = 0,
|
|
|
|
User_Cmd_GetService = 1,
|
|
|
|
User_Cmd_RegisterService = 2,
|
|
|
|
User_Cmd_UnregisterService = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
class UserService : IServiceObject {
|
2018-04-22 05:40:26 +02:00
|
|
|
u64 pid;
|
2018-04-22 09:13:36 +02:00
|
|
|
bool has_initialized;
|
2018-04-22 05:40:26 +02:00
|
|
|
|
2018-04-22 05:17:57 +02:00
|
|
|
public:
|
|
|
|
Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size);
|
2018-04-22 09:13:36 +02:00
|
|
|
UserService() : pid(U64_MAX), has_initialized(false) { }
|
2018-04-22 05:17:57 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
/* Actual commands. */
|
|
|
|
std::tuple<Result> initialize(PidDescriptor pid);
|
|
|
|
std::tuple<Result, MovedHandle> get_service(u64 service);
|
|
|
|
std::tuple<Result, MovedHandle> register_service(u64 service, u8 is_light, u32 max_sessions);
|
|
|
|
std::tuple<Result> unregister_service(u64 service);
|
|
|
|
};
|