Skip to main content

antenna_protocol/state/
output.rs

1use crate::{MsgPayload, PeerID, Scheduled, SignalingPayload, UserMsgPayload, handshake::HandshakeOutput};
2
3/// Common event that client FSM sends
4#[derive(Debug, Clone)]
5pub enum Output<Msg: UserMsgPayload> {
6    /// Handshake event for a known peer
7    Handshake {
8        peer: PeerID,
9        event: HandshakeOutput,
10    },
11
12    /// Bootstrap host: create an open offer (joiner peer ID not yet known)
13    InitOpenOffer,
14
15    /// Bootstrap host: open offer SDP is ready to be shared out-of-band with a joiner
16    OfferReady(SignalingPayload),
17
18    /// Bootstrap joiner: SDP answer is ready to be shared out-of-band with the host
19    AnswerReady(SignalingPayload),
20
21    /// Send message to other peer in mesh
22    SendMessage {
23        peer_to: PeerID,
24        data: MsgPayload<Msg>,
25    },
26
27    /// Initiate receiving message from any outer sender
28    ReceiveMessage {
29        peer_from: PeerID,
30        data: MsgPayload<Msg>,
31    },
32
33    /// Notify about new peer connected to mesh
34    PeerConnected { peer: PeerID },
35
36    /// Notify about peer that gracefully left the mesh
37    PeerDisconnected { peer: PeerID },
38
39    /// Notify about peer lost due to connection failure (abrupt, candidate for reconnect)
40    PeerLost { peer: PeerID },
41
42    /// All relay handshakes complete — this peer is fully meshed and may send messages
43    Available,
44
45    /// Mesh has no connected peers — this peer can no longer send messages
46    Unavailable,
47
48    /// Local node sent disconnect notices to all peers; driver must close all connections
49    Disconnecting,
50
51    /// Driver should schedule a timer
52    ScheduleTimer { kind: Scheduled, after_ms: u64 },
53}