Percy++
A C++ implementation of Private Information Retrieval (PIR) protocols
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
recursiveserver.h
1 // Percy++ Copyright 2007,2012,2013,2014
2 // Ian Goldberg <iang@cs.uwaterloo.ca>,
3 // Casey Devet <cjdevet@uwaterloo.ca>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of version 2 of the GNU General Public License as
7 // published by the Free Software Foundation.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // There is a copy of the GNU General Public License in the COPYING file
15 // packaged with this plugin; if you cannot find it, write to the Free
16 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301 USA
18 
19 #ifndef __RECURSIVESERVER_H__
20 #define __RECURSIVESERVER_H__
21 
22 #include <iostream>
23 #include "datastore.h"
24 #include "recursiveparams.h"
25 #include "percyserver.h"
26 
27 NTL_CLIENT
28 
30 
31 class RecursiveServer : public PercyServer {
32 public:
39  const RecursiveServerParams * serverparams, PercyStats * stats = NULL);
40 
42  virtual ~RecursiveServer ();
43 
44  virtual bool handle_request (std::istream &is, std::ostream &os,
45  const std::vector<std::iostream*> &workers =
46  std::vector<std::iostream*>());
47 
48 private:
49  virtual bool handle_request_impl (
50  const std::vector<unsigned char*> &requests,
51  const std::vector<unsigned char*> &responses);
52 
53  virtual bool handle_request_distributed (
54  const std::vector<unsigned char*> &requests,
55  const std::vector<unsigned char*> &responses,
56  const std::vector<std::iostream*> &workers);
57 
58  virtual bool handle_request_threaded (
59  const std::vector<unsigned char*> &requests,
60  const std::vector<unsigned char*> &responses);
61 
62  virtual void combine_results (unsigned char * result,
63  const std::vector<unsigned char*> &worker_results);
64 
65  const RecursiveServerParams * serverparams;
66  const RecursiveParams * params;
67  bool dist_first_only;
68  std::vector<DataStore*> iteration_datastores;
69  std::vector<PercyServer*> iteration_servers;
70 
71  bool handle_request_worker (std::istream& is, std::ostream&os);
72 };
73 
74 #endif
Definition: recursiveparams.h:24
Definition: percystats.h:66
A simple database object.
Definition: datastore.h:34
virtual bool handle_request(std::istream &is, std::ostream &os, const std::vector< std::iostream * > &workers=std::vector< std::iostream * >())
Handle a request from a single client.
virtual ~RecursiveServer()
Destructor.
PercyStats * stats
Statistics collection object.
Definition: percyserver.h:141
An abstract base class for a PIR server.
Definition: percyserver.h:34
RecursiveServer(DataStore *datastore, const RecursiveServerParams *serverparams, PercyStats *stats=NULL)
Constructor.
A PIR server for recursive PIR protocols.
Definition: recursiveserver.h:31
DataStore * datastore
The database used by the server.
Definition: percyserver.h:137
Definition: recursiveparams.h:102