Skip to main content

imsg_session/
lib.rs

1//! Session lifecycle — RFCOMM/iroh connect, OBEX handshake, retry policy, MNS relay, and store
2//! sync. SDP channel discovery happens upstream in `imsg-transport::discover`; callers here pass
3//! an already-resolved device/channel or hub target.
4
5pub mod conn;
6pub mod contacts;
7pub mod fetch;
8pub mod lifecycle;
9pub mod live;
10pub mod loop_util;
11pub mod mns;
12pub mod outbox;
13pub mod relay;
14pub mod retry;
15pub mod sync;
16pub mod util;
17pub mod watch;
18
19// `pub mod` under cfg(test): shared across mns/relay test modules; must be `pub` to escape
20// `redundant_pub_crate`. cfg(test)-gating keeps it out of the real crate API.
21#[cfg(test)]
22pub mod test_support;
23
24pub use map_core::mns_event::{EventType, MnsEvent};
25pub use map_core::MapError;
26pub use pbap_core::PbapError;
27pub use relay::run_mns_relay;
28pub use retry::{classify, Disposition};
29pub use transport::TransportError;
30
31/// MAP/PBAP/transport layer errors.
32#[derive(Debug, thiserror::Error)]
33pub enum SessionError {
34    /// OBEX MAP layer; either CONNECT failed or a command was rejected.
35    #[error("MAP session error: {0}")]
36    Map(#[from] MapError),
37    /// OBEX PBAP layer; CONNECT failed or command rejected.
38    #[error("PBAP session error: {0}")]
39    Pbap(#[from] PbapError),
40    /// RFCOMM or pre-OBEX I/O failure.
41    #[error("transport error: {0}")]
42    Transport(#[from] TransportError),
43}