-
Notifications
You must be signed in to change notification settings - Fork 5
UDP Protocol
Work in progress
All multibyte integers are in network byte order (MSB-first).
All text strings are UTF-8.
Timestamps are 64-bit milliseconds since the Unix epoch (1970-01-01T00:00:00Z).
type: 16-bit, not 0xFFFF ( data_len: 16-bit data: (data_len) bytes ) * 0 or more trailer: 16-bit, 0xFFFF
data[0]: flags (16-bit) 0x0001: SYNC_REQ data[1]: domains
A gatekeeper sends HELLO to the master on startup and every XXX seconds as long as it's alive. The master will publish messages to all gatekeepers that it has received a HELLO from in the past 3*XXX seconds.
If a gatekeeper has not received a complete SYNC since it has started up, it should set the SYNC_REQ flag; the master will reply with a SYNC. Otherwise, the flag should be cleared.
"domains" is a NULL-separated list of domains that the gatekeeper is interested in receiving notifications about.
data[0]: domain data[1]: identifier data[2]: status (8-bit) 0x01: ACCEPTED 0x02: REJECTED 0x03: DELAYED data[3]: rcv_ts (timestamp) data[4]: delay_ts (timestamp) data[5]: log_info
A gatekeeper should send an ACCOUNTING message when it receives a request from a client. "domain" is the domain the request was received on and "identifier" is the identifier of the requesting client within that domain. "status" indicates the disposition of the request -- ACCEPTED if the request was accepted immediately, REJECTED if the request was rejected, and DELAYED if the request was queued with the intent of accepting it at some later time.
rcv_ts is the time at which the request was received.
delay_ts is the time at which the request will be accepted, if status is DELAYED, and zero otherwise.
log_info is optional information the gatekeeper is sending to the master for logging or statistics purposes. This field doesn't have any designated use right now.
data[0]: domain data[1]: identifier data[2]: delay_ts (timestamp)
Tells the gatekeeper not to accept requests from "identifier" on "domain" until after "delay_ts".
data[0]: flags 0x0001: MORE data[3n+1]: domain data[3n+2]: identifier data[3n+3]: delay_ts (timestamp)
Basically a series of DELAY_UNTIL commands, embedded in a single packet and used to bring a newly-joined gatekeeper up to date. If the entire server state is too much to fit in a single packet, all but the last will have the MORE flag set. A gatekeeper considers the sync complete when it receives a SYNC packet without the MORE flag set.