xrtsp/session/
define.rs

1use std::fmt;
2
3pub mod rtsp_method_name {
4    pub const OPTIONS: &str = "OPTIONS";
5    pub const DESCRIBE: &str = "DESCRIBE";
6    pub const ANNOUNCE: &str = "ANNOUNCE";
7    pub const SETUP: &str = "SETUP";
8    pub const PLAY: &str = "PLAY";
9    pub const PAUSE: &str = "PAUSE";
10    pub const TEARDOWN: &str = "TEARDOWN";
11    pub const GET_PARAMETER: &str = "GET_PARAMETER";
12    pub const SET_PARAMETER: &str = "SET_PARAMETER";
13    pub const REDIRECT: &str = "REDIRECT";
14    pub const RECORD: &str = "RECORD";
15
16    pub const ARRAY: [&str; 11] = [
17        OPTIONS,
18        DESCRIBE,
19        ANNOUNCE,
20        SETUP,
21        PLAY,
22        PAUSE,
23        TEARDOWN,
24        GET_PARAMETER,
25        SET_PARAMETER,
26        REDIRECT,
27        RECORD,
28    ];
29}
30
31pub enum ServerSessionType {
32    Pull,
33    Push,
34}
35
36pub enum ClientSessionType {
37    Pull,
38    Push,
39}
40
41impl fmt::Display for ServerSessionType {
42    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
43        let client_type = match self {
44            ServerSessionType::Pull => String::from("pull"),
45            ServerSessionType::Push => String::from("push"),
46        };
47        write!(f, "{client_type}")
48    }
49}
50
51pub const USER_AGENT: &str = "xiu 0.12.8";