diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2022-11-10 22:59:32 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-16 21:39:40 +0300 |
| commit | 9f5e8f230d35fffb106088b72e5fdb148905f450 (patch) | |
| tree | 2f22a5357a7bea2ce516b9a5e56e21435414529a /packets/messages/types/SvcCreateStringTable.go | |
| parent | upgraded to v1.2.3 (diff) | |
| download | sdp.go-9f5e8f230d35fffb106088b72e5fdb148905f450.tar.gz sdp.go-9f5e8f230d35fffb106088b72e5fdb148905f450.tar.bz2 sdp.go-9f5e8f230d35fffb106088b72e5fdb148905f450.zip | |
added almost all net/svc messages - currently broken
Diffstat (limited to 'packets/messages/types/SvcCreateStringTable.go')
| -rw-r--r-- | packets/messages/types/SvcCreateStringTable.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/packets/messages/types/SvcCreateStringTable.go b/packets/messages/types/SvcCreateStringTable.go new file mode 100644 index 0000000..6e97ea7 --- /dev/null +++ b/packets/messages/types/SvcCreateStringTable.go | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | package types | ||
| 2 | |||
| 3 | import "github.com/pektezol/bitreader" | ||
| 4 | |||
| 5 | type SvcCreateStringTable struct { | ||
| 6 | Name string | ||
| 7 | MaxEntries uint16 | ||
| 8 | NumEntries uint8 | ||
| 9 | UserDataFixedSize bool | ||
| 10 | UserDataSize uint16 | ||
| 11 | UserDataSizeBits uint8 | ||
| 12 | Flags uint8 | ||
| 13 | StringData int | ||
| 14 | } | ||
| 15 | |||
| 16 | func ParseSvcCreateStringTable(reader *bitreader.ReaderType) SvcCreateStringTable { | ||
| 17 | svccreatestringtable := SvcCreateStringTable{ | ||
| 18 | Name: reader.TryReadString(), | ||
| 19 | MaxEntries: reader.TryReadInt16(), | ||
| 20 | } | ||
| 21 | svccreatestringtable.NumEntries = uint8(reader.TryReadBits(HighestBitIndex(uint(svccreatestringtable.MaxEntries)) + 1)) | ||
| 22 | length := reader.TryReadBits(20) | ||
| 23 | svccreatestringtable.UserDataFixedSize = reader.TryReadBool() | ||
| 24 | if svccreatestringtable.UserDataFixedSize { | ||
| 25 | svccreatestringtable.UserDataSize = uint16(reader.TryReadBits(12)) | ||
| 26 | svccreatestringtable.UserDataSizeBits = uint8(reader.TryReadBits(4)) | ||
| 27 | } | ||
| 28 | svccreatestringtable.Flags = uint8(reader.TryReadBits(2)) | ||
| 29 | svccreatestringtable.StringData = int(reader.TryReadBits(int(length / 8))) | ||
| 30 | return svccreatestringtable | ||
| 31 | |||
| 32 | } | ||