-
Notifications
You must be signed in to change notification settings - Fork 4
Login Protocol
The login protocol is basically a series of 3 standard labrad request/response pairs. They are formatted in exactly the same manner as ordinary labrad requests. That is, the packet format is (ww)iws
meaning (context, request_ID, destination_ID, requests)
and the requests string is a flattened list of requests with type *(wws)
meaning (setting_ID, type_tag, data).
Client sends to the manager a message with: Any context, any positive request_ID, destination 1 (manager) with zero records. This is likely the only message in the labrad protocol that has no records. The manager uses this request to detect the client endianness (based on the byte order of the destination, known to be '1').
The manager sends a response to the same context, negative request ID, and a single response: (setting=0, type='s', data=pw_challenge). This is the only response (other than possibly an error response) which does not contain the same record structure as the request that generated it.
Client sends a request from any context, any positive request_ID, to destination 1 and a single record (0, 's', MD5(pw_challenge+password))
If the password hash matches, the manager sends a response with a single record (0, 's', 'welcome message'). Otherwise it sends a response with an error record and drops the connection.
Client sends request (any context, positive ID, destination 1) to setting 0. For clients, the request data is (ws): (protocol version (currently 2), client name). For servers, the request data is (wsss): (protocol version, server name, description, remarks).
The manager selects an ID. For servers, this fails if another server with the same name is connected. The manager also remembers the ID of all servers that have ever connected. If a server reconnects, it will reuse the old ID. Clients take the first available ID that is not reserved for a server.
The manager responds with simply (w): the assigned ID.