protocol_client 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. The tor process will launch the pirclient process, and hold pipes to the
  2. pirclient's stdin, stdout, and stderr. All communication between the
  3. processes is over those pipes. Anything the pirclient outputs over the
  4. stderr pipe should be logged by the tor process. If the pirclient finds
  5. its stdin has reached EOF, it should terminate.
  6. The general format of request messages (tor -> pirclient) 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 (pirclient -> 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 two request types:
  17. PIRCLIENT_REQUEST_CREATE (0x41)
  18. Request the creation of a private query
  19. The body_len must be at least 32. The first 32 bytes of the body
  20. are the plaintext query, and the remaining bytes are the current
  21. pirserver params for the server we're going to send this query to.
  22. PIRCLIENT_REQUEST_EXTRACT (0x42)
  23. Extract the plaintext data from a PIR response
  24. The body_len must be at least 8. The first 8 bytes of the body
  25. are the Query ID returned in the PIRCLIENT_RESPONSE_CREATE message,
  26. and the remaining bytes are the PIR response. Any given Query ID
  27. must be used in at most one PIRCLIENT_REQUEST_EXTRACT message (and
  28. it should be exactly one).
  29. There are two response types:
  30. PIRCLIENT_RESPONSE_CREATE (0xBF)
  31. Reply with a PIR query
  32. The body begins with an 8-byte Query ID (which the tor process
  33. should hold on to, to match it to the corresponding PIR response in
  34. the PIRCLIENT_REQUEST_EXTRACT message). The remainder of the body
  35. is the PIR query to send to the server. A body_len of 0 indicates
  36. an error.
  37. PIRCLIENT_RESPONSE_EXTRACT (0xBE)
  38. Reply with the plaintext data extracted from a PIR response
  39. The body is the plaintext of the response received from the PIR
  40. server. A body_len of 0 indicates an error.