dzura/server/docs/protocol/requests.szun

144 lines
2.6 KiB
Plaintext

### Status Codes ##
# General
0000 OK
0001 ERROR
0002 NOAUTH
00FE SERVER_ERROR
00FF NOT_IMPLEMENTED
# Context Specific
0010 BAD_HANDLE
0011 BAD_SECRET
0012 BAD_CODE
###
## Authentication ##
# 0010 REGISTER
Req_Register {
handle :sequence # username
secret :sequence # password
code :sequence # invitation code
}
Res_Register {
status :block<2>
# OK - registration accepted
# BAD_HANDLE - handle empty or not vacant
# BAD_SECRET - secret is empty
# BAD_CODE - code not accepted
token :block<8> # auth key
secret :block<16> # resume code
}
# 0011 AUTH
Req_Auth {
handle :sequence # username
secret :sequence # password
}
Res_Auth {
status :block<2>
# STATUS_OK - authentication successful
# ERROR - authentication failed
token :block<8> # auth key
secret :block<16> # resume code
}
# 0012 AUTH_RESUME
Req_AuthResume {
token :block<8> # auth key
secret :block<16> # resume code
}
Res_AuthResume {
status :block<2>
# OK - resume accepted
# ERROR - auth/code pair not accepted
}
# 0013 AUTH_REVOKE
Req_AuthRevoke { }
Res_AuthRevoke { }
## Session ##
# 0020 SESSION_LIST
Req_SessionList {
flags :block<2>
# 0[2] Game State
# 2[1] Is Player
# 3[1] Is Live
page :block<2>
}
Res_SessionList {
records :list<{
token :block<8> # session key
handle_dawn :sequence # username of dawn player
handle_dusk :sequence # username of dusk player
turn :block<2> # turn number
last_move :block<3> # most recent move code
viewers :block<4> # number of viewers
player :bool # user is player
}>
}
# 0021 SESSION_CREATE
Req_SessionCreate { }
Res_SessionCreate {
status :block<2>
token :block<8>
mode :block<1>
# 0: Player Dawn
# 1: Player Dusk
# 2: Spectator
}
# 0022 SESSION_JOIN
Res_SessionJoin {
token :block<8> # session key
}
Req_SessionJoin {
status :block<2>
# OK
# NOAUTH
token :block<8> # session key
mode :block<1>
# 0: Player Dawn
# 1: Player Dusk
# 2: Spectator
}
# 002E SESSION_LEAVE
Req_SessionLeave { }
Res_SessionLeave { }
# 002F SESSION_RETIRE
Req_SessionRetire {
token :block<8> # session key
}
Res_SessionRetire {
status:block<2>
}
## Game ##
# 0030 GAME_STATE
Req_GameState {
token :block<8> # session token
}
Res_GameState {
}
# 0031 GAME_PLAY
Req_GamePlay {
token :block<8> # session token
}
Res_GamePlay {
}