pub struct CallContext { /* private fields */ }Expand description
What a handler knows about the request it is serving.
Implementations§
Source§impl CallContext
impl CallContext
pub fn conn_id(&self) -> u64
Sourcepub fn app(&self) -> &str
pub fn app(&self) -> &str
The app label the client declared in hello (already allowlisted); for a device caller,
the device id.
The label is a claim: any process of the current user can declare any allowlisted
label. Use it to choose what a caller may ask for, never as proof of who is asking.
peer is what the OS verified.
Sourcepub fn peer(&self) -> Option<&PeerIdentity>
pub fn peer(&self) -> Option<&PeerIdentity>
Who the OS says is on the other end of this connection, from the peer check that ran
before any byte was read: the uid on Unix, the user SID on Windows, and the process id
where the platform reports it (Linux, macOS and Windows). None for a caller that is not
a local app (a device has no OS peer).
This is the fact, as opposed to the app label. The user is always the
current user, since any other peer was refused. A pid identifies the process only while
it runs: record it for an audit trail, do not authorise by it later.
Sourcepub fn peer_closed(&self) -> bool
pub fn peer_closed(&self) -> bool
The client went away while this request was running.
Sourcepub fn handoff_requested(&self) -> bool
pub fn handoff_requested(&self) -> bool
A higher-ranked host asked for the service: return
ServiceError::handoff at the next safe boundary.