-
Notifications
You must be signed in to change notification settings - Fork 2
/
packetreliability.v
42 lines (36 loc) · 1.15 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
40
41
42
module vraklib
const (
Unreliable = 0x00
UnreliableSequenced = 0x01
Reliable = 0x02
ReliableOrdered = 0x03
ReliableSequenced = 0x04
UnreliableWithAckReceipt = 0x05
ReliableWithAckReceipt = 0x06
ReliableOrderedWithAckReceipt = 0x07
)
const (
PriorityNormal = 0
PriorityImmediate = 1
)
fn reliability_is_reliable(reliability byte) bool {
return reliability == Reliable ||
reliability == ReliableOrderedWithAckReceipt ||
reliability == ReliableSequenced ||
reliability == ReliableWithAckReceipt ||
reliability == ReliableOrderedWithAckReceipt
}
fn reliability_is_sequenced(reliability byte) bool {
return reliability == UnreliableSequenced ||
reliability == ReliableSequenced
}
fn reliability_is_ordered(reliability byte) bool {
return reliability == ReliableOrdered ||
reliability == ReliableOrderedWithAckReceipt
}
fn reliability_is_sequenced_or_ordered(reliability byte) bool {
return reliability == UnreliableSequenced ||
reliability == ReliableOrdered ||
reliability == ReliableSequenced ||
reliability == ReliableOrderedWithAckReceipt
}