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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use tl_proto::{TlRead, TlWrite};
use super::HashRef;
#[derive(Debug, Copy, Clone, TlRead, TlWrite)]
#[tl(boxed, scheme = "scheme.tl")]
pub enum Message<'tl> {
#[tl(id = "rldp.message")]
Message {
#[tl(size_hint = 32)]
id: HashRef<'tl>,
data: &'tl [u8],
},
#[tl(id = "rldp.answer")]
Answer {
#[tl(size_hint = 32)]
query_id: HashRef<'tl>,
data: &'tl [u8],
},
#[tl(id = "rldp.query")]
Query {
#[tl(size_hint = 32)]
query_id: HashRef<'tl>,
max_answer_size: u64,
timeout: u32,
data: &'tl [u8],
},
}
#[derive(Debug, Copy, Clone, TlRead, TlWrite)]
#[tl(boxed, scheme = "scheme.tl")]
pub enum MessagePart<'tl> {
#[tl(id = "rldp.messagePart")]
MessagePart {
#[tl(size_hint = 32)]
transfer_id: HashRef<'tl>,
fec_type: RaptorQFecType,
part: u32,
total_size: u64,
seqno: u32,
data: &'tl [u8],
},
#[tl(id = "rldp.confirm", size_hint = 40)]
Confirm {
transfer_id: HashRef<'tl>,
part: u32,
seqno: u32,
},
#[tl(id = "rldp.complete", size_hint = 36)]
Complete {
transfer_id: HashRef<'tl>,
part: u32,
},
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, TlRead, TlWrite)]
#[tl(boxed, id = "fec.raptorQ", size_hint = 12, scheme = "scheme.tl")]
pub struct RaptorQFecType {
pub total_len: u32,
pub packet_len: u32,
pub packet_count: u32,
}