summaryrefslogtreecommitdiffstats
path: root/solec.ksy
diff options
context:
space:
mode:
Diffstat (limited to 'solec.ksy')
-rw-r--r--solec.ksy54
1 files changed, 42 insertions, 12 deletions
diff --git a/solec.ksy b/solec.ksy
index 82f3bf7..e7c24e1 100644
--- a/solec.ksy
+++ b/solec.ksy
@@ -3,32 +3,39 @@ meta:
file-extension: hex
endian: be
-enums:
- type:
- 0x01: handshake
- 0x02: ping
- 0x03: pong
- 0x04: message
- 0xFF: test
+doc: |
+ SOLEC protocol uses big endian encoding. Frames uses type-length-value format.
+
+doc-ref: https://git.sr.ht/~rctt/solec/blob/main/solec.svg
seq:
- - id: payload_type
+ - id: type_payload
type: u1
enum: type
- - id: payload_length
+ - id: len_payload
type: u2
- id: payload
+ size: len_payload
type:
- switch-on: payload_type
+ switch-on: type_payload
cases:
'type::handshake': handshake
'type::ping': ping
'type::pong': pong
-# 'type::message': message
+ 'type::message': message
'type::test': test
+enums:
+ type:
+ 0x01: handshake
+ 0x02: ping
+ 0x03: pong
+ 0x04: message
+ 0xFF: test
+
types:
string:
+ doc: UTF-8 encoded string.
seq:
- id: len_payload
type: u2
@@ -38,6 +45,7 @@ types:
encoding: UTF-8
binary:
+ doc: Binary data of unspecifed type.
seq:
- id: len_payload
type: u2
@@ -45,19 +53,41 @@ types:
size: len_payload
handshake:
+ doc: |
+ Handshake is sent by the client during connection initialization.
+ If protocol_ver_major is different than version used by the server
+ connection will be aborted.
seq:
- id: proto_ver_major
type: u1
- id: proto_ver_minor
type: u1
- ping: {}
+ ping:
+ doc: Ping does not contain any payload.
pong:
seq:
- id: timestamp
+ doc: |
+ Timestamp is set just before sending the pong message. It can be used
+ to meassure packet's travel time between server and client.
type: u8
+ message:
+ doc: |
+ Source and target fields are addresses in user@server format.
+ seq:
+ - id: source
+ type: string
+ - id: target
+ type: string
+ - id: timestamp
+ doc: Set just before sending the message.
+ type: u8
+ - id: content
+ type: string
+
test:
doc: Test payload, used for parsers testing
seq: