forked from organization/VRakLib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpacketreliability.v
39 lines (33 loc) · 1.43 KB
/
packetreliability.v
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
module vraklib
const (
reliability_unreliable = 0x00
reliability_unreliable_sequenced = 0x01
reliability_reliable = 0x02
reliability_reliable_ordered = 0x03
reliability_reliable_sequenced = 0x04
reliability_unreliable_with_ack_receipt = 0x05
reliability_reliable_with_ack_receipt = 0x06
reliability_reliable_ordered_with_ack_receipt = 0x07
)
const (
priority_normal = 0
priority_immediate = 1
)
fn reliability_is_reliable(reliability u8) bool {
return reliability == reliability_reliable ||
reliability == reliability_reliable_ordered_with_ack_receipt || reliability == reliability_reliable_sequenced ||
reliability == reliability_reliable_with_ack_receipt || reliability == reliability_reliable_ordered_with_ack_receipt
}
fn reliability_is_sequenced(reliability u8) bool {
return reliability == reliability_unreliable_sequenced ||
reliability == reliability_reliable_sequenced
}
fn reliability_is_ordered(reliability u8) bool {
return reliability == reliability_reliable_ordered ||
reliability == reliability_reliable_ordered_with_ack_receipt
}
fn reliability_is_sequenced_or_ordered(reliability u8) bool {
return reliability == reliability_unreliable_sequenced ||
reliability == reliability_reliable_ordered || reliability == reliability_reliable_sequenced ||
reliability == reliability_reliable_ordered_with_ack_receipt
}