blob: 8000a55400aaea50b3dbcab0e369b1b72905c6fa (
plain) (
blame)
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
|
package messages
import (
"github.com/pektezol/bitreader"
)
type SvcPacketEntities struct {
MaxEntries uint16
IsDelta bool
DeltaFrom int32
BaseLine bool
UpdatedEntries uint16
Length uint32
UpdatedBaseline bool
Data []byte
}
func ParseSvcPacketEntities(reader *bitreader.Reader) SvcPacketEntities {
svcPacketEntities := SvcPacketEntities{
MaxEntries: uint16(reader.TryReadBits(11)),
IsDelta: reader.TryReadBool(),
}
if svcPacketEntities.IsDelta {
svcPacketEntities.DeltaFrom = reader.TryReadSInt32()
} else {
svcPacketEntities.DeltaFrom = -1
}
svcPacketEntities.BaseLine = reader.TryReadBool()
svcPacketEntities.UpdatedEntries = uint16(reader.TryReadBits(11))
svcPacketEntities.Length = uint32(reader.TryReadBits(20))
svcPacketEntities.UpdatedBaseline = reader.TryReadBool()
svcPacketEntities.Data = reader.TryReadBitsToSlice(uint64(svcPacketEntities.Length))
return svcPacketEntities
}
|