diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-12 20:53:09 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-16 21:39:42 +0300 |
| commit | 82871ba1bac1d62f69e1933b66659e62d2e5e063 (patch) | |
| tree | a906310fba89b670bcfda9625a6d776553d482f6 /pkg/messages/types/svcPacketEntities.go | |
| parent | net/svc messages finally getting parsed correctly (diff) | |
| download | sdp.go-82871ba1bac1d62f69e1933b66659e62d2e5e063.tar.gz sdp.go-82871ba1bac1d62f69e1933b66659e62d2e5e063.tar.bz2 sdp.go-82871ba1bac1d62f69e1933b66659e62d2e5e063.zip | |
another rewrite, v1.0.0
Diffstat (limited to 'pkg/messages/types/svcPacketEntities.go')
| -rw-r--r-- | pkg/messages/types/svcPacketEntities.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/messages/types/svcPacketEntities.go b/pkg/messages/types/svcPacketEntities.go new file mode 100644 index 0000000..b1c23e5 --- /dev/null +++ b/pkg/messages/types/svcPacketEntities.go | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | package messages | ||
| 2 | |||
| 3 | import "github.com/pektezol/bitreader" | ||
| 4 | |||
| 5 | type SvcPacketEntities struct { | ||
| 6 | MaxEntries int16 | ||
| 7 | IsDelta bool | ||
| 8 | DeltaFrom int32 | ||
| 9 | BaseLine bool | ||
| 10 | UpdatedEntries int16 | ||
| 11 | Length int32 | ||
| 12 | UpdatedBaseline bool | ||
| 13 | Data []byte | ||
| 14 | } | ||
| 15 | |||
| 16 | func ParseSvcPacketEntities(reader *bitreader.ReaderType) SvcPacketEntities { | ||
| 17 | svcPacketEntities := SvcPacketEntities{ | ||
| 18 | MaxEntries: int16(reader.TryReadBits(11)), | ||
| 19 | IsDelta: reader.TryReadBool(), | ||
| 20 | } | ||
| 21 | if svcPacketEntities.IsDelta { | ||
| 22 | svcPacketEntities.DeltaFrom = int32(reader.TryReadBits(32)) | ||
| 23 | } | ||
| 24 | svcPacketEntities.BaseLine = reader.TryReadBool() | ||
| 25 | svcPacketEntities.UpdatedEntries = int16(reader.TryReadBits(11)) | ||
| 26 | svcPacketEntities.Length = int32(reader.TryReadBits(20)) | ||
| 27 | svcPacketEntities.UpdatedBaseline = reader.TryReadBool() | ||
| 28 | svcPacketEntities.Data = reader.TryReadBitsToSlice(int(svcPacketEntities.Length)) | ||
| 29 | return svcPacketEntities | ||
| 30 | } | ||