summaryrefslogtreecommitdiff
path: root/src/to_srv.rs
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-02-15 23:44:21 +0100
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-02-15 23:54:40 +0100
commit58f9e0a0005aab59dfd987bddb09952f3a5c195b (patch)
tree3809aeb1459d86edba39942767ddace0501e83d2 /src/to_srv.rs
parent03b44a9e68f76a9e0aa612b9597cc879bbc37157 (diff)
downloadmt_net-58f9e0a0005aab59dfd987bddb09952f3a5c195b.tar.xz
Add wrappers around mt_rudp
Diffstat (limited to 'src/to_srv.rs')
-rw-r--r--src/to_srv.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/to_srv.rs b/src/to_srv.rs
index 704acdb..dc9a342 100644
--- a/src/to_srv.rs
+++ b/src/to_srv.rs
@@ -77,6 +77,10 @@ pub enum ToSrvPkt {
#[mt(len = "u8")]
blocks: Vec<[i16; 3]>,
} = 37,
+ HaveMedia {
+ #[mt(len = "u8")]
+ tokens: Vec<u32>,
+ } = 41,
InvAction {
#[mt(len = "()")]
action: String,
@@ -113,7 +117,7 @@ pub enum ToSrvPkt {
#[mt(len = "(DefCfg, (DefCfg, u32))")]
fields: HashMap<String, String>,
} = 60,
- ReqMedia {
+ RequestMedia {
filenames: Vec<String>,
} = 64,
CltReady {
@@ -138,3 +142,24 @@ pub enum ToSrvPkt {
} = 82,
Disco = 0xffff,
}
+
+impl PktInfo for ToSrvPkt {
+ fn pkt_info(&self) -> (u8, bool) {
+ use ToSrvPkt::*;
+
+ match self {
+ Init { .. } => (1, false),
+ Init2 { .. }
+ | RequestMedia { .. }
+ | CltReady { .. }
+ | FirstSrp { .. }
+ | SrpBytesA { .. }
+ | SrpBytesM { .. } => (1, true),
+ PlayerPos { .. } => (0, false),
+ GotBlocks { .. } | HaveMedia { .. } | DeletedBlocks { .. } | RemovedSounds { .. } => {
+ (2, true)
+ }
+ _ => (0, true),
+ }
+ }
+}