Skip to main content

flash_lso/packet/
mod.rs

1use crate::types::{AMFVersion, Value};
2
3/// Reading of AMF Packets
4pub mod read;
5
6/// Writing of AMF Packets
7pub mod write;
8
9/// An AMF Packet Header
10#[derive(Debug, Clone)]
11pub struct Header {
12    /// The name of this header.
13    pub name: String,
14
15    /// If true, the endpoint must immediately abort and error if it does not understand this header.
16    pub must_understand: bool,
17
18    /// The value of this header.
19    pub value: Value,
20}
21
22/// An AMF Packet Header
23#[derive(Debug, Clone)]
24pub struct Message {
25    /// The target URI that this message is intended for.
26    pub target_uri: String,
27
28    /// The response URI for this message.
29    ///
30    /// For requests, this should be a unique identifier to represent "this message", for example `/1`.
31    /// Responses will target this URI, suffixed with either `/onResult` or `/onStatus` (for success or failure).
32    ///
33    /// For responses this may be empty.
34    pub response_uri: String,
35
36    /// The contents of this message.
37    pub contents: Value,
38}
39
40/// An AMF Packet
41#[derive(Debug, Clone)]
42pub struct Packet {
43    /// The version of this packet. Does not affect serialization.
44    pub version: AMFVersion,
45
46    /// Any headers associated with every message inside this packet.
47    pub headers: Vec<Header>,
48
49    /// All messages included inside this packet.
50    pub messages: Vec<Message>,
51}