Percy++
A C++ implementation of Private Information Retrieval (PIR) protocols
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
PercyServer Class Referenceabstract

An abstract base class for a PIR server. More...

#include <percyserver.h>

Inheritance diagram for PercyServer:
PercyAGServer PercyHybridServer PercyServer_Chor PercyServer_GF2E< GF2E_Element > PercyServer_ZZ_p RecursiveServer

Classes

class  Col
 
class  Elem
 
class  Matrix
 
class  Row
 
class  SubMatrix
 

Public Member Functions

virtual ~PercyServer ()
 Destructor. More...
 
void be_byzantine ()
 Tell the server to be Byzantine. More...
 
void set_strassen_max_depth (nqueries_t depth)
 Set the strassen max level. More...
 
nqueries_t get_strassen_max_depth ()
 Get the strassen max level. More...
 
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. More...
 
virtual bool handle_request (const std::vector< std::istream * > &isv, const std::vector< std::ostream * > &osv, const std::vector< std::iostream * > &workers=std::vector< std::iostream * >())
 Handle a request from a number of clients simultaneously. More...
 

Static Public Member Functions

static PercyServermake_server (DataStore *datastore, const PercyServerParams *params, PercyStats *stats=NULL)
 Factory method called to get a server object for the given parameters. More...
 

Static Public Attributes

static const nqueries_t STRASSEN_OPTIMAL = -1
 Special strassen max level, when set to this value, the optimal strategy is used. More...
 

Protected Member Functions

virtual bool handle_request_impl (const std::vector< unsigned char * > &requests, const std::vector< unsigned char * > &responses)=0
 Implementation of handle_request(). More...
 
virtual bool handle_request_distributed (const std::vector< unsigned char * > &requests, const std::vector< unsigned char * > &responses, const std::vector< std::iostream * > &workers)
 Implementation of handle_request() used for master servers. More...
 
virtual bool handle_request_threaded (const std::vector< unsigned char * > &requests, const std::vector< unsigned char * > &responses)
 Implementation of handle_request() to be used when using multithreading. More...
 
virtual void combine_results (unsigned char *result, const std::vector< unsigned char * > &worker_results)=0
 Combines the results of threads/workers when partitioning database records (DIST_SPLIT_RECORDS). More...
 
 PercyServer (DataStore *datastore, const PercyServerParams *serverparams, PercyStats *stats=NULL)
 Constructor. More...
 

Protected Attributes

bool byzantine
 Whether or not the server is Byzantine. More...
 
DataStoredatastore
 The database used by the server. More...
 
const PercyServerParamsserverparams
 The parameters for the server. More...
 
PercyStatsstats
 Statistics collection object. More...
 
nqueries_t strassen_max_depth
 Maximum depth allowed when using Strassen's matrix multiplication. More...
 
nqueries_t strassen_level_reached
 The strassen level reached in computation. More...
 
std::vector< PercyServer * > subservers
 When using multithreading, the server objects for the threads. More...
 

Friends

class RecursiveServer
 
void * thread_work (void *arg)
 
template<typename GF2E_Element_ >
std::ostream & operator<< (std::ostream &os, const Matrix< GF2E_Element_ > &m)
 
template<typename GF2E_Element_ >
std::ostream & operator<< (std::ostream &os, const SubMatrix< GF2E_Element_ > &m)
 

Detailed Description

An abstract base class for a PIR server.

Constructor & Destructor Documentation

virtual ~PercyServer ( )
virtual

Destructor.

PercyServer ( DataStore datastore,
const PercyServerParams serverparams,
PercyStats stats = NULL 
)
protected

Constructor.

Can only be called by derived classes.

Parameters
datastoreDatabase the server will use.
paramsParameters for the server.
statsStatistics collection object. No statistics will be collected if NULL.

Member Function Documentation

void be_byzantine ( )

Tell the server to be Byzantine.

virtual void combine_results ( unsigned char *  result,
const std::vector< unsigned char * > &  worker_results 
)
protectedpure virtual

Combines the results of threads/workers when partitioning database records (DIST_SPLIT_RECORDS).

Parameters
resultBuffer to be filled with combined result.
worker_resultsThe results from all threads/workers to be combined.
nqueries_t get_strassen_max_depth ( )

Get the strassen max level.

Returns
The strassen max level being used.
virtual bool handle_request ( std::istream &  is,
std::ostream &  os,
const std::vector< std::iostream * > &  workers = std::vector< std::iostream * >() 
)
virtual

Handle a request from a single client.

Parameters
isInput stream from the client.
osOutput stream to the client.
workersWhen the server is a master server, a list of input/output streams to/from the workers.
Returns
Returns false if there is an error, true otherwise.

Reimplemented in RecursiveServer.

virtual bool handle_request ( const std::vector< std::istream * > &  isv,
const std::vector< std::ostream * > &  osv,
const std::vector< std::iostream * > &  workers = std::vector< std::iostream * >() 
)
virtual

Handle a request from a number of clients simultaneously.

Parameters
isvInput vector of streams from the clients.
osvOutput vector of streams to the clients.
workersWhen the server is a master server, a list of input/output streams to/from the workers.
Returns
Returns false if there is an error, true otherwise.
virtual bool handle_request_distributed ( const std::vector< unsigned char * > &  requests,
const std::vector< unsigned char * > &  responses,
const std::vector< std::iostream * > &  workers 
)
protectedvirtual

Implementation of handle_request() used for master servers.

Must be implemented in derived classes.

Parameters
requestsA set of query requests, one for each query.
responsesBuffers that must be filled with the query responses.
workersWhen the server is a master server, a list of input/output streams to/from the workers.
Returns
Returns false is there is an error, true otherwise.
virtual bool handle_request_impl ( const std::vector< unsigned char * > &  requests,
const std::vector< unsigned char * > &  responses 
)
protectedpure virtual

Implementation of handle_request().

Must be implemented in derived classes.

Parameters
requestsA set of query requests, one for each query.
responsesBuffers that must be filled with the query responses.
Returns
Returns false is there is an error, true otherwise.
virtual bool handle_request_threaded ( const std::vector< unsigned char * > &  requests,
const std::vector< unsigned char * > &  responses 
)
protectedvirtual

Implementation of handle_request() to be used when using multithreading.

Must be implemented in derived classes.

Parameters
requestsA set of query requests, one for each query.
responsesBuffers that must be filled with the query responses.
Returns
Returns false is there is an error, true otherwise.
static PercyServer* make_server ( DataStore datastore,
const PercyServerParams params,
PercyStats stats = NULL 
)
static

Factory method called to get a server object for the given parameters.

Parameters
datastoreDatabase the server will use.
paramsParameters for the server.
statsStatistics collection object. No statistics will be collected if NULL.
Returns
New dynamically-allocated PercyServer pointer.
void set_strassen_max_depth ( nqueries_t  depth)

Set the strassen max level.

Parameters
depthThe strassen max level to use.

Member Data Documentation

bool byzantine
protected

Whether or not the server is Byzantine.

DataStore* datastore
protected

The database used by the server.

const PercyServerParams* serverparams
protected

The parameters for the server.

PercyStats* stats
protected

Statistics collection object.

nqueries_t strassen_level_reached
protected

The strassen level reached in computation.

nqueries_t strassen_max_depth
protected

Maximum depth allowed when using Strassen's matrix multiplication.

const nqueries_t STRASSEN_OPTIMAL = -1
static

Special strassen max level, when set to this value, the optimal strategy is used.

std::vector<PercyServer*> subservers
protected

When using multithreading, the server objects for the threads.


The documentation for this class was generated from the following file: