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