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
use ockam_core::Message;
use serde::{Deserialize, Serialize};

/// A command message type for a Portal
#[derive(Serialize, Deserialize, Message, Debug)]
pub enum PortalMessage {
    /// First message that Inlet sends to the Outlet
    Ping,
    /// First message that Outlet sends to the Inlet
    Pong,
    /// Message to indicate that connection from Outlet to the target,
    /// or from the target to the Inlet was dropped
    Disconnect,
    /// Message with binary payload
    Payload(Vec<u8>),
}

/// An internal message type for a Portal
#[derive(Serialize, Deserialize, Message)]
pub enum PortalInternalMessage {
    /// Connection was dropped
    Disconnect,
}

///Maximum allowed size for a payload
pub const MAX_PAYLOAD_SIZE: usize = 48 * 1024;