Beaconizer-protocols: Difference between revisions
Line 42: | Line 42: | ||
=== BMSG_C2S_REQUESTER_CONNECT === | === BMSG_C2S_REQUESTER_CONNECT === | ||
packint(1) protocol_version | |||
string user_name | |||
string computer_name | |||
string dbserver_ip | |||
If ''protocol_version'' is not 0, 1, or 2 then the client is moved to state BCS_ERROR_PROTOCOL, otherwise it is moved to state BCS_REQUESTER. | |||
The rest of the fields are stored for later use. | |||
=== BMSG_C2S_TEXT_CMD === | === BMSG_C2S_TEXT_CMD === |
Revision as of 17:59, 9 June 2019
Beaconizers connect to the master server on port 48813 and to other BeaconServer instances on ports ranging from 48812 to 48913. They use the common Network protocol.
Commands, client to server
All BeaconServer modes accept the same messages from clients. Clients have a state, stored in BeaconServerClientData.state, which is BCS_NOT_CONNECTED for newly connected clients.
BMSG_C2S_CONNECT
bits(32) exe_crc_old optional, if exe_crc_old is 0: packint(1) protocol_version bits(32) exe_crc string user_name string computer_name bits(1) is_sentry
If the client is in state BCS_ERROR_NONLOCAL_IP then this message is ignored, other than recording the names and version. If the client is in any other state which is not BCS_NOT_CONNECTED then the state is set to BCS_ERROR_PROTOCOL and this message is ignored. Otherwise, when the state is BCS_NOT_CONNECTED:
If exe_crc_old is not 0, then it is the exe_crc value. Otherwise, the optional version is used.
If exe_crc does not match the crc of the executable for the server receiving the message, then the client will be moved to state BCS_ERROR_PROTOCOL in production mode, and sent a BMSG_S2C_CONNECT_REPLY with good set to 0 in development mode, and the client is moved to state BCS_NEEDS_MORE_EXE_DATA.
If exe_crc does match, then the client will be accepted. If is_sentry is true then the client type will be set to BCT_SENTRY and the state to BCS_SENTRY. If is_sentry is false then the client type will be set to BCT_WORKER and the client state to BCS_CONNECTED.
BMSG_S2C_CONNECT_REPLY is sent with good set to 1.
BMSG_C2S_SERVER_CONNECT
packint(1) protocol_version bits(32) exe_crc string user_name string computer_name packint(1) server_port when protocol_version is at least 1: bits(1) is_request_server
If the client is in state BCS_ERROR_NONLOCAL_IP then this message is ignored, other than recording the names and version. If the client is in any other state which is not BCS_NOT_CONNECTED then the state is set to BCS_ERROR_PROTOCOL and this message is ignored. Otherwise, when the state is BCS_NOT_CONNECTED:
The crc match is checked against this binary and printed on the console but otherwise ignored.
The other fields are recorded for later use.
The client state is moved to BCS_SERVER and BMSG_S2C_CONNECT_REPLY is sent with good set to 1.
BMSG_C2S_REQUESTER_CONNECT
packint(1) protocol_version string user_name string computer_name string dbserver_ip
If protocol_version is not 0, 1, or 2 then the client is moved to state BCS_ERROR_PROTOCOL, otherwise it is moved to state BCS_REQUESTER.
The rest of the fields are stored for later use.
BMSG_C2S_TEXT_CMD
Commands, server to client
BMSG_S2C_CONNECT_REPLY
bits(1) good when good is 1: bits(32) client_uid string server_uid optional, when good is 0: packint(1) size bits(size * 8) data
When good is 1, the connection is being accepted. Otherwise, this indicates that the client should get a new executable, and optionally contains the data.