diff options
Diffstat (limited to 'docs/protocol.ksy')
| -rw-r--r-- | docs/protocol.ksy | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/docs/protocol.ksy b/docs/protocol.ksy new file mode 100644 index 0000000..169ba18 --- /dev/null +++ b/docs/protocol.ksy @@ -0,0 +1,126 @@ +meta: + id: solec + file-extension: hex + endian: be + +doc: SOLEC protocol +doc-ref: https://git.rctt.net/solec/plain/docs/protocol.svg?h=main + +seq: + - id: type_payload + type: u1 + enum: payload_type + - id: len_payload + type: u2 + - id: payload + size: len_payload + type: + switch-on: type_payload + cases: + 'payload_type::success': success + 'payload_type::error': error + 'payload_type::handshake': handshake + 'payload_type::user_auth': user_auth + 'payload_type::server_auth': server_auth + 'payload_type::message': message + 'payload_type::test': test + +enums: + payload_type: + 0x01: success + 0x02: error + 0x03: handshake + 0x04: user_auth + 0x05: message + 0x06: server_auth + 0xFF: test + + error_type: + 0x01: user_auth_failed + 0x02: not_found + + conn_type: + 0x01: user_conn + 0x02: server_conn + +types: + string: + doc: UTF-8 encoded string. + seq: + - id: len_payload + type: u2 + - id: payload + type: str + size: len_payload + encoding: UTF-8 + + success: + doc: Send from server if operation succeded. + + error: + doc: Senf from server if operation failed. + seq: + - id: error_code + type: u1 + enum: error_type + + 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 + - id: conn_type + type: u1 + enum: conn_type + + user_auth: + seq: + - id: name + type: string + - id: pass + type: string + + server_auth: + seq: + - id: name + type: string + + 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: + - id: num1 + type: u1 + - id: time1 + type: u8 + - id: str1 + type: string + - id: num2 + type: u2 + - id: str2 + type: string + - id: num3 + type: u4 + - id: str3 + type: string + - id: num4 + type: u8 + |
