1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2026 Jeff Kim <hiking90@gmail.com>
// SPDX-License-Identifier: Apache-2.0
//! One entry point for every transport: [`serve`] a service and
//! [`connect`] to one with a URI, whether the transport is kernel binder
//! (`binder://`) or binder-over-socket RPC (`unix://`, `unix-abstract://`,
//! `vsock://`, `tls://`). The AIDL-generated stubs, service `impl`s and
//! call sites are already transport-agnostic; this module makes the
//! bootstrap (publish / look up) transport-agnostic too.
//!
//! ```no_run
//! # use rsbinder::*;
//! # fn demo(service: SIBinder) -> Result<()> {
//! // server — transport chosen by the URI only
//! rsbinder::serve("binder://")? // or "unix:///tmp/hello.sock"
//! .add("hello", service)?
//! .run()?;
//! # Ok(()) }
//! # fn client() -> Result<SIBinder> {
//! // client
//! rsbinder::connect_binder("binder://hello")
//! // rsbinder::connect::<dyn IHello>("unix:///tmp/hello.sock#hello")
//! # }
//! ```
//!
//! The low-level types ([`crate::ProcessState`], [`crate::hub`],
//! `crate::rpc::{RpcServer, RpcSession}`) are unchanged and remain the
//! direct path; this is a thin layer over them with no wire change.
//!
//! # What the URI does *not* hide
//!
//! | | `binder://` | RPC schemes |
//! |---|---|---|
//! | `@EnforcePermission` | enforced via the system permission service | **denied** (no caller uid model) — authorize with `ServeOptions::authorizer` |
//! | [`crate::get_calling_uid`] | kernel-vouched | kernel-vouched on `unix://`, fail-closed sentinel elsewhere |
//! | death | process death | session disconnect |
//! | `list_services`, notifications, lazy services | via [`crate::hub`] | not available |
//! | an option that does not apply | [`crate::StatusCode::BadValue`] at `run`/`open`, logged |
pub use ;
pub use Authorizer;
pub use ;
pub use Endpoint;
use crateResult;
use crate::;
/// Start assembling a server on `uri` (see [`uri`] for the grammar; a
/// `#service` fragment is ignored). Add services with [`Server::add`],
/// then [`Server::run`] or [`Server::spawn`].
/// Resolve the service named by the URI's `#fragment` (or `binder://name`)
/// and cast it to `T`. Kernel: waits for registration; RPC: opens a
/// session and looks the name up. The returned proxy keeps its RPC
/// session alive — nothing else needs to be held.
Sized>
/// [`connect`] without the interface cast.
/// Async [`connect`] for the Tokio runtime: runs the blocking connect on
/// `spawn_blocking`. `T` may be a generated `dyn IFooAsync<Tokio>`.
pub async Sized + 'static>