diff options
| author | bt <bt@rctt.net> | 2026-03-10 22:50:53 +0100 |
|---|---|---|
| committer | bt <bt@rctt.net> | 2026-03-10 22:53:32 +0100 |
| commit | 7cdd5c04d5e966b3c90a3d86720e0823b4f7ee2c (patch) | |
| tree | 2da446610bed492542c1c3fe31145fcc1ca82081 /PROTOCOL.md | |
| parent | 69192d956aa2b6b3dbf87bac0e265e718b49dd70 (diff) | |
| download | solec-7cdd5c04d5e966b3c90a3d86720e0823b4f7ee2c.tar.gz solec-7cdd5c04d5e966b3c90a3d86720e0823b4f7ee2c.zip | |
Update spec
Diffstat (limited to 'PROTOCOL.md')
| -rw-r--r-- | PROTOCOL.md | 74 |
1 files changed, 16 insertions, 58 deletions
diff --git a/PROTOCOL.md b/PROTOCOL.md index 895d1df..886161c 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -2,48 +2,41 @@ # SOLEC protocol specification +## Data format + * Payload can contain multiple numeric types or binary data in a single frame * Numeric types are big endian -* Numeric types names are same as in [Go](https://go.dev/ref/spec#Numeric_types) * See [test payload](#Test) for an example of complex data structure -## Frame +### Frame structure | Type | Description | |----------|----------------| | `uint8` | Payload type | | `uint16` | Payload length | -| `[]any` | Payload | - +| `any` | Payload | -## Data types -### Numeric types +### Special types -* `uint8` -* `uint16` -* `uint32` -* `uint64` +#### Strings and binary -### `binary` +Strings and binary data are prefixed wtith 2 bytes denoting their length. +Strings are UTF-8 encoded. -| Type | Description | -|--------|----------------| -| uint16 | Data length | -| binary | Data | +#### Timestamps -### `string` +Timestamps are stored as `uint64` in [Unix format](https://en.wikipedia.org/wiki/Unix_time). +Timezone is always set to UTC. -UTF-8 encoded string encapsulated in `bianry` type. +### Payloads -### `time` +All payload types are described in following files: -[Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) stored in `uint16`. -Timezone is always UTC. +* [Kaitai Struct](https://git.sr.ht/~rctt/solec/blob/main/solec.ksy) +* [SVG graph](https://git.sr.ht/~rctt/solec/blob/main/solec.svg) -# Payloads - -## Payload prefixes +### Payload types | Type | Name | |------|--------------| @@ -53,39 +46,4 @@ Timezone is always UTC. | 0x04 | Message | | 0xFF | Test | -## Payload types - -### Handshake - -| Type | Name | Description | -|--------|---------------------|----------------------------------------------------------| -| uint8 | ProtocolVersionMajor | Bumped if changes are incompatible with previous version | -| uint8 | PrococolVersionMinor | Bumber if changes are backwards compatible | - - -### Ping - -Can be send by client or server. Receiver shoudl reply with `Pong`. - -### Pong - -Reply to `ping`. - -| Type | Name | Description | -|--------|------|-------------------------| -| uint64 | Time | Set just before sending | - -### Test - -Used for testing purposes. Can change at any time. -| Type | Name | Description | -|--------|-------|-------------| -| uint8 | Num1 | | -| time | Time1 | | -| string | Str1 | | -| uint16 | Num2 | | -| binary | Bin1 | | -| uint32 | Num3 | | -| string | Str2 | | -| uint64 | Num4 | | |
