Percy++
A C++ implementation of Private Information Retrieval (PIR) protocols
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
hybridserver.h
1 // Percy++ Copyright 2007,2012,2013 Ian Goldberg <iang@cs.uwaterloo.ca>,
2 // Casey Devet <cjdevet@cs.uwaterloo.ca>,
3 // Paul Hendry <pshdenry@uwaterloo.ca>,
4 // Ryan Henry <rhenry@cs.uwaterloo.ca>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of version 2 of the GNU General Public License as
8 // published by the Free Software Foundation.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // There is a copy of the GNU General Public License in the COPYING file
16 // packaged with this plugin; if you cannot find it, write to the Free
17 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 
20 #ifndef __HYBRIDSERVER_H__
21 #define __HYBRIDSERVER_H__
22 
23 #include <iostream>
24 #include "datastore.h"
25 #include "hybridparams.h"
26 #include "percyserver.h"
27 
28 NTL_CLIENT
29 
30 // This class implements the server-side computation for the hybrid recursive
31 // PIR scheme
32 
34 public:
35  // Initialize a server with the given DataStore and AG params.
37  const HybridServerParams * params, PercyStats * stats = NULL);
38  virtual ~PercyHybridServer ();
39 
40 protected:
41  // Implementation called by handle_request()
42  virtual bool handle_request_impl (std::istream &is, std::ostream &os,
43  nqueries_t num_queries);
44 
45  // Called by handle_request_{threaded,master}() to figure out what parts of
46  // the query need to be sent to each worker. The result is a set of data
47  // blocks (all contained in the query) for each worker.
48  virtual std::vector<BufferList> worker_query_parts (nqueries_t num_queries,
49  unsigned char * query);
50 
51  // Called by handle_request_{threaded,master}() to combine worker results
52  // when splitting the database (i.e. not when splitting queries)
53  virtual void combine_results (nqueries_t num_queries,
54  unsigned char * result, std::vector<unsigned char*> worker_results);
55 
56  const HybridServerParams * params;
57 
58  // Sub Params
59  const PercyServerParams& it_params;
60  const AGServerParams& c_params;
61 
62  // DataStores
63  DataStore * it_datastore;
64  DataStore * c_datastore;
65 
66  // Servers
67  PercyServer * it_server;
68  PercyServer * c_server;
69 };
70 
71 #endif
Definition: percystats.h:66
A simple database object.
Definition: datastore.h:34
PercyStats * stats
Statistics collection object.
Definition: percyserver.h:141
An abstract base class for a PIR server.
Definition: percyserver.h:34
Definition: hybridserver.h:33
Server parameters.
Definition: percyparams.h:251
DataStore * datastore
The database used by the server.
Definition: percyserver.h:137