Protocols/OSCAR/Datatypes: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Strings ==") |
No edit summary |
||
Line 1: | Line 1: | ||
== Strings == | The protocol is built on top of some common base types described below; these are the building blocks for all the other datatypes and SNACs. When encoding or decoding these types, make sure to use network byte order. | ||
== Base Types == | |||
{| border="1" | |||
! Name | |||
! Size | |||
! Notes | |||
|- | |||
| u08 | |||
| 1 byte | |||
| Unsigned byte | |||
|- | |||
| u16 | |||
| 2 bytes | |||
| Unsigned two byte short | |||
|- | |||
| u32 | |||
| 4 bytes | |||
| Unsigned four byte int | |||
|- | |||
| f32 | |||
| 4 bytes | |||
| Four byte float | |||
|- | |||
| t70 | |||
| 4 bytes | |||
| Unsigned four byte timestamp, from UNIX EPOCH | |||
|- | |||
| UUID | |||
| 16 bytes | |||
| Sixteen bytes that represent a [Protocols/OSCAR/UUID|UUID] also known as a GUID | |||
|- | |||
| blob | |||
| length bytes | |||
| Used in a [Protocols/OSCAR/TLV|TLV], data type and size is defined by external values | |||
|- | |||
| empty | |||
| 0 bytes | |||
| Used in a [Protocols/OSCAR/TLV|TLV], existence of tag causes behavior, the data is ignored | |||
|} | |||
=== Strings === | |||
In general strings are not NULL terminated and are encoded using UTF8. A string is said to be ''compressed'' if all white spaces are removed and all upper case characters are converted to lower case. | |||
{| border="1" | |||
! Name | |||
! Size | |||
! Notes | |||
|- | |||
| string | |||
| data | |||
| Inside of [Protocols/OSCAR/TLV|TLVs] a string inherits its length from the TLV length | |||
|- | |||
| string08 | |||
| u08 + data | |||
| One byte length followed by that many bytes of data | |||
|- | |||
| string16 | |||
| u16 + data | |||
| Two byte length followed by that many bytes of data | |||
|} |
Revision as of 03:16, 17 March 2020
The protocol is built on top of some common base types described below; these are the building blocks for all the other datatypes and SNACs. When encoding or decoding these types, make sure to use network byte order.
Base Types
Name | Size | Notes |
---|---|---|
u08 | 1 byte | Unsigned byte |
u16 | 2 bytes | Unsigned two byte short |
u32 | 4 bytes | Unsigned four byte int |
f32 | 4 bytes | Four byte float |
t70 | 4 bytes | Unsigned four byte timestamp, from UNIX EPOCH |
UUID | 16 bytes | UUID] also known as a GUID |
blob | length bytes | TLV], data type and size is defined by external values |
empty | 0 bytes | TLV], existence of tag causes behavior, the data is ignored |
Strings
In general strings are not NULL terminated and are encoded using UTF8. A string is said to be compressed if all white spaces are removed and all upper case characters are converted to lower case.
Name | Size | Notes |
---|---|---|
string | data | TLVs] a string inherits its length from the TLV length |
string08 | u08 + data | One byte length followed by that many bytes of data |
string16 | u16 + data | Two byte length followed by that many bytes of data |