mahou/protocol

52 lines
1.2 KiB
Text
Raw Normal View History

PROTOCOL
this is almost a carbon copy of every other tcp/ip protocol i write
don't care enough to make it fancy
2017-10-18 21:59:50 +00:00
all numbers are packed unless stated otherwise
packed values are msb
2017-10-18 21:59:50 +00:00
byte n is b.n
region n is r.n
---
byte the zero: packet id
byte the one: region count
2017-10-18 21:59:50 +00:00
for 0 <= n < b.1
byte the byte after the previous byte byte:
region length < 128: one byte
region length >= 128: two bytes, highest bit on msb always 1
2017-10-18 21:59:50 +00:00
byte the bytes after the header octet bytes bytes:
raw body data shoved next to each other with no separation
---
2017-10-18 21:59:50 +00:00
client -> server
id 0: registration attempt
r.0 - username - string
r.1 - pin - ushort (max 9999)
id 1: login attempt
r.0 - username - string
r.1 - pin - ushort (max 9999)
id 2: ctx change response
r.0 - ack - bool
r.1 - ctx id - ushort
---
server -> client
2017-10-18 21:59:50 +00:00
id 0: registration response
r.0 - succeeded - bool
r.1 - status - string
2017-10-18 21:59:50 +00:00
id 1: login response
r.0 - succeeded - bool
r.1 -> status - string (if r.0 false)
-> user id - ushort (if r.0 true)
id 2: ctx change request
r.0 - ctx id - ushort