mahou/protocol

51 lines
1.1 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
---
byte the zero: 0xDE
byte the one: 0xAD
byte the two: packet id
byte the 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: registration attempt
r.0 - username - string (max 9b)
r.1 - pin - ushort (max 9999)
id 1: login attempt
r.0 - username - string (max 9b)
r.1 - pin - ushort (max 9999)
id 2: ctx change response
r.0 - ack - bool
r.1 - ctx id - ushort
---
server -> client
id 0: registration response
r.0 - succeeded - bool
r.1 - status - string (17b)
id 1: login response
r.0 - succeeded - bool
r.1 - user id - ushort
r.2 - status - string (17b)
id 2: ctx change request
r.0 - ctx id - ushort