pirserver.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #ifndef __PIRSERVER_H__
  2. #define __PIRSERVER_H__
  3. #include <string>
  4. using std::string;
  5. // Derive a class from this, implementing the virtual functions, and
  6. // call mainloop().
  7. class PIRServer {
  8. public:
  9. // Fill the current params into the passed string argument
  10. virtual void get_params(string &params) = 0;
  11. // Store the given value at the given key. If the value is the
  12. // empty string, delete the key. If the key has already been
  13. // stored, overwrite the value with this one. The key will be
  14. // exactly 32 bytes long.
  15. virtual void store(const string &key, const string &value) = 0;
  16. // Perform a private lookup. The client's private query message is
  17. // lookup_query. If successful, return true and fill
  18. // lookup_response with the private response. If unsuccessful,
  19. // return false.
  20. virtual bool lookup(const string &lookup_query,
  21. string &lookup_response) = 0;
  22. // Call this to run the server, and exit when it returns
  23. void mainloop();
  24. };
  25. #endif