[][src]Trait sunrise_libuser::sm::IUserInterfaceAsync

pub trait IUserInterfaceAsync {
    fn initialize<'a>(
        &'a mut self,
        work_queue: WorkQueue<'static>,
        pid: Pid
    ) -> FutureObj<'a, Result<(), Error>>;
fn get_service<'a>(
        &'a mut self,
        work_queue: WorkQueue<'static>,
        name: u64
    ) -> FutureObj<'a, Result<ClientSession, Error>>;
fn register_service<'a>(
        &'a mut self,
        work_queue: WorkQueue<'static>,
        name: u64,
        is_light: bool,
        max_handles: u32
    ) -> FutureObj<'a, Result<ServerPort, Error>>;
fn unregister_service<'a>(
        &'a mut self,
        work_queue: WorkQueue<'static>,
        name: u64
    ) -> FutureObj<'a, Result<(), Error>>; fn dispatch<'a>(
        &'a mut self,
        work_queue: WorkQueue<'static>,
        cmdid: u32,
        buf: &'a mut [u8]
    ) -> FutureObj<Result<(), Error>> { ... } }

Service Manager

Services are system processes running in the background which wait for incoming requests. When a process wants to communicate with a service, it first needs to get a handle to the named service, and then it can communicate with the service via inter-process communication (each service has a name up to 8 characters).

Handles for services are retrieved from the service manager port, "sm:", and are released via svcCloseHandle or when a process is terminated or crashes.

Manager service "sm:m" allows the Process Manager to tell sm: about the permissions of each process. By default, SM assumes a process has no permissions, and as such cannot access any service. "sm:m" RegisterProcess calls allows PM to tell the Service Manager about which services a certain process is allowed to access or host.

A Service is very similar to a kernel-managed Named Port: You can connect to it, and it returns a ClientSession. The difference is that a Service handled by "sm:" has an additional permission check done to ensure it isn't accessed by an unprivileged process.

Required methods

fn initialize<'a>(
    &'a mut self,
    work_queue: WorkQueue<'static>,
    pid: Pid
) -> FutureObj<'a, Result<(), Error>>

Initialize the UserInterface, acquiring the Pid of the remote process, which will then be used to validate the permissions of each calls.

fn get_service<'a>(
    &'a mut self,
    work_queue: WorkQueue<'static>,
    name: u64
) -> FutureObj<'a, Result<ClientSession, Error>>

Returns a handle to the given service. IPC messages may be sent to this handle through svcSendSyncRequest.

fn register_service<'a>(
    &'a mut self,
    work_queue: WorkQueue<'static>,
    name: u64,
    is_light: bool,
    max_handles: u32
) -> FutureObj<'a, Result<ServerPort, Error>>

Registers a service with the given name. The user can use svcAcceptSession on the returned handle to get a new Session handle, and use svcReplyAndReceive on those handles to reply to IPC requests.

fn unregister_service<'a>(
    &'a mut self,
    work_queue: WorkQueue<'static>,
    name: u64
) -> FutureObj<'a, Result<(), Error>>

Unregisters a service with the given name. Future calls to get_service will loop until the service is re-registered through register_service.

If the service doesn't exist, this returns a ServiceNotRegistered error.

Loading content...

Provided methods

fn dispatch<'a>(
    &'a mut self,
    work_queue: WorkQueue<'static>,
    cmdid: u32,
    buf: &'a mut [u8]
) -> FutureObj<Result<(), Error>>

Handle an incoming IPC request.

Loading content...

Implementors

Loading content...