mahou/protocol

97 lines
No EOL
2.3 KiB
Text

PROTOCOL
all numbers are packed unless stated otherwise
packed values are msb
strings are predefined sizes and are terminated at the
first NUL character (0x0). max string length is the region
length minus one, for the required NUL.
byte n is b.n
region n is r.n
---
b. 0: 0xDE
b. 1: 0xAD
b. 2: packet id
b.3-6: total body length - uint
byte the bytes after the header octet bytes bytes:
raw body data shoved next to each other with no separation
---
client -> server
id 0: clerical request
r.0 - clerical id - byte
r.1 - action - byte
| start - 0
| stop - 1
id 1: alert prompt response
r.0 - clerical id - byte
r.1 - prompt id - byte
id 2: boolean prompt response
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - response - bool
id 3: string prompt response
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - response - string (256b)
id 4: list prompt response
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - response - ushort
id 5: ctx change response
r.0 - ack - bool
r.1 - ctx id - ushort
---
server -> client
id 0: clerical response
r.0 - clerical id - byte
r.1 - success - bool
id 1: alert prompt
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - prompt width - ushort
r.3 - text - string (512b)
id 2: boolean prompt
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - prompt width - ushort
r.3 - text - string (512b)
id 3: string prompt
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - prompt width - ushort
r.3 - text - string (512b)
r.4 - strlen - byte
id 4: list prompt
r.0 - clerical id - byte
r.1 - prompt id - byte
r.2 - prompt width - ushort
r.3 - text - string (512b)
r.4 - option count - n - ushort
r.x | 4 < x <= 4+n
- option text - string (256b)
id 5: ctx change request
r.0 - ctx id - ushort
---
CLERICAL IDs
id 0: register
id 1: login