protocol 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. The tor process will launch the pirserver process, and hold pipes to the
  2. pirserver's stdin, stdout, and stderr. All communication between the
  3. processes is over those pipes. Anything the pirserver outputs over the
  4. stderr pipe should be logged by the tor process. If the pirserver finds
  5. its stdin has reached EOF, it should terminate.
  6. The general format of request messages (tor -> pirserver) is:
  7. request_id: 8 bytes
  8. request_type: 1 byte
  9. body_len: 4 bytes (big-endian unsigned int)
  10. body: (body_len) bytes
  11. The general format of response messages (pirserver -> tor) is:
  12. request_id: 8 bytes (must match the request_id being responded to)
  13. response_type: 1 byte
  14. body_len: 4 bytes (big-endian unsigned int)
  15. body: (body_len) bytes
  16. There are three request types:
  17. PIRSERVER_REQUEST_PARAMS (0x01)
  18. Request the current pirserver params data
  19. The body_len must be 0. The pirserver will respond with
  20. PIRSERVER_RESPONSE_PARAMS. (TODO: do we want to allow for an error
  21. response to this request?)
  22. PIRSERVER_REQUEST_STORE (0x02)
  23. Store an object with a given 32-byte key
  24. The body_len must be at least 32. The first 32 bytes of the body
  25. are the key under which to store the object, and the remaining bytes
  26. are the object. If body_len is exactly 32, it means to remove the
  27. object with the specified key. Storing an object with an
  28. already-existing key will overwrite the old object with that key.
  29. This request does not elicit a response from the pirserver.
  30. PIRSERVER_REQUEST_LOOKUP (0x03)
  31. Privately look up an object
  32. The body_len will depend on the details of the particular private
  33. lookup scheme (XPIR, ZeroTrace, trivial, etc.).
  34. There are three response types:
  35. PIRSERVER_RESPONSE_PARAMS (0xFF)
  36. Reply with the current pirserver params data
  37. The body is the params data, which will be sent to the client either
  38. in an HTTP 200 reply to an explicit params request, or else in a
  39. special cell piggybacked on the creation of the directory lookup
  40. circuit. The body_len will depend on the details on the particular
  41. private lookup scheme.
  42. PIRSERVER_RESPONSE_LOOKUP_SUCCESS (0xFE)
  43. Response to a successful lookup
  44. The body is the result of the private lookup requested by the
  45. corresponding PIRSERVER_REQUEST_LOOKUP. The body_len will depend on
  46. the details on the particular private lookup scheme.
  47. PIRSERVER_RESPONSE_LOOKUP_FAILURE (0xFD)
  48. Response to a failed lookup
  49. The body_len must be 0.