xref: /xiu/protocol/rtsp/src/session/define.rs (revision 8e71d710)
1 use std::fmt;
2 
3 pub 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 
31 pub enum SessionType {
32     Client,
33     Server,
34 }
35 
36 impl fmt::Display for SessionType {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result37     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38         let client_type = match self {
39             SessionType::Client => String::from("client"),
40             SessionType::Server => String::from("server"),
41         };
42         write!(f, "{client_type}")
43     }
44 }
45