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

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

#include <percyclient.h>

Inheritance diagram for PercyClient:
NullClient PercyAGClient PercyClient_Chor PercyClient_GF2E< GF2E_Element > PercyClient_ZZ_p PercyHybridClient RecursiveClient

Public Member Functions

virtual ~PercyClient ()
 Destructor. More...
 
nqueries_t encode_request (vector< dbsize_t > block_numbers, nqueries_t querybsize=1)
 Encode a request for the given block numbers. More...
 
dbsize_t send_request (nqueries_t request_identifier, std::vector< ostream * > &osvec, bool send_num_queries=true)
 Send the request for the given request ID. More...
 
dbsize_t receive_replies (nqueries_t request_identifier, std::vector< istream * > &isvec)
 Receive the servers' replies for a given request ID. More...
 
nqueries_t process_replies (nservers_t h)
 Process the servers' replies for all undecoded replies. More...
 
bool get_result (nqueries_t request_identifier, vector< PercyBlockResults > &results)
 Get the result for a given request ID. More...
 
bool fetch_blocks (nqueries_t &request_identifier, vector< dbsize_t > block_numbers, vector< ostream * > &osvec, vector< istream * > &isvec, vector< PercyBlockResults > &results, nqueries_t querybsize=1)
 Do encode_request(), send_request(), receive_replies(), process_replies(), and get_result() all in one shot. More...
 

Static Public Member Functions

static PercyClientmake_client (const PercyClientParams *clientparams, nservers_t num_servers, nservers_t t, sid_t *sids=NULL, PercyStats *stats=NULL)
 Factory method called to get a client object for the given parameters. More...
 

Protected Member Functions

const vector< dbsize_t > & get_block_numbers (nqueries_t request_identifier)
 Get the block numbers for a given request ID. More...
 
nqueries_t get_qbs (nqueries_t request_identifier)
 Get the number of blocks to request in a single query for a given request ID. More...
 
virtual void encode_request_impl (nqueries_t request_identifier)=0
 Implementation for encode_request(). More...
 
virtual dbsize_t send_request_impl (nqueries_t request_identifier, vector< ostream * > &osvec, bool send_num_queries=true)=0
 Implementation for send_request(). More...
 
virtual dbsize_t receive_replies_impl (nqueries_t request_identifier, vector< istream * > &isvec)=0
 Implementation for encode_request(). More...
 
virtual nqueries_t process_replies_impl (nservers_t h, vector< vector< PercyResult > > &results)=0
 Implementation for encode_request(). More...
 
 PercyClient (const PercyClientParams *clientparams, nservers_t num_servers, nservers_t t, PercyStats *stats=NULL)
 Constructor. More...
 

Protected Attributes

const PercyClientParamsclientparams
 Parameters for the client. More...
 
nservers_t num_servers
 The number of servers. More...
 
nservers_t t
 The privacy level. More...
 
vector< nservers_t > goodservers
 The server indices of servers that have not acted up. More...
 

Static Protected Attributes

static const bool randomize = true
 Randomize the requests for IT-PIR clients. More...
 

Friends

class RecursiveClient
 

Detailed Description

An abstract base class for a PIR client.

Constructor & Destructor Documentation

virtual ~PercyClient ( )
virtual

Destructor.

PercyClient ( const PercyClientParams clientparams,
nservers_t  num_servers,
nservers_t  t,
PercyStats stats = NULL 
)
protected

Constructor.

Can only be called by derived classes. Use make_client() to create a client object.

Parameters
clientparamsParameters for the client.
num_serversThe number of servers used
tThe privacy level. I.e. the maximum number of servers that can collude and the queries will remain private.
statsStatistics collection object. No statistics will be collected if NULL.

Member Function Documentation

nqueries_t encode_request ( vector< dbsize_t >  block_numbers,
nqueries_t  querybsize = 1 
)

Encode a request for the given block numbers.

Parameters
block_numbersThe requested block indices (0-based).
querybsizeThe number of blocks to request in one query.
Returns
On success, a positive request ID, zero otherwise.
virtual void encode_request_impl ( nqueries_t  request_identifier)
protectedpure virtual

Implementation for encode_request().

Parameters
request_identifierRequest ID.

Implemented in PercyHybridClient.

bool fetch_blocks ( nqueries_t &  request_identifier,
vector< dbsize_t >  block_numbers,
vector< ostream * > &  osvec,
vector< istream * > &  isvec,
vector< PercyBlockResults > &  results,
nqueries_t  querybsize = 1 
)

Do encode_request(), send_request(), receive_replies(), process_replies(), and get_result() all in one shot.

request_identifier will be set to the request_identifier for this request for use if not all queries are decoded successfully. In this case, process another request and call get_result with this identifier.

Parameters
request_identifierWill be set to the ID of this request.
block_numbersThe requested block indices (0-based).
osvecStreams for output to the servers.
isvecStreams for input from the servers.
resultsWill be filled with the results of this request.
querybsizeThe number of blocks to request in one query.
Returns
True if all queries were successful, false otherwise.
const vector<dbsize_t>& get_block_numbers ( nqueries_t  request_identifier)
inlineprotected

Get the block numbers for a given request ID.

Parameters
request_identifierRequest ID.
Returns
The blocks requested.
nqueries_t get_qbs ( nqueries_t  request_identifier)
inlineprotected

Get the number of blocks to request in a single query for a given request ID.

Parameters
request_identifierRequest ID.
Returns
The number of blocks to request in a single query.
bool get_result ( nqueries_t  request_identifier,
vector< PercyBlockResults > &  results 
)

Get the result for a given request ID.

Parameters
request_identifierRequest ID.
resultsThe results will be put into this vector.
Returns
Return true if the request's response has been received from the servers and has been successfully decoded, false otherwise.
static PercyClient* make_client ( const PercyClientParams clientparams,
nservers_t  num_servers,
nservers_t  t,
sid_t *  sids = NULL,
PercyStats stats = NULL 
)
static

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

Parameters
clientparamsParameters for the client.
num_serversThe number of servers used
tThe privacy level. I.e. the maximum number of servers that can collude and the queries will remain private.
sidsAn array of IDs for the servers that will be used.
statsStatistics collection object. No statistics will be collected if NULL.
Returns
New dynamically-allocated PercyClient pointer.
nqueries_t process_replies ( nservers_t  h)

Process the servers' replies for all undecoded replies.

The successfully decoded blocks are put in decoded_blocks and the undecoded block numbers will remain in undecoded_blocks.

Parameters
hThe number of honest servers.
Returns
The number of queries that we not successfully decoded.
virtual nqueries_t process_replies_impl ( nservers_t  h,
vector< vector< PercyResult > > &  results 
)
protectedpure virtual

Implementation for encode_request().

Parameters
hThe number of honest servers.
resultsWill be filled with the results for all requests for which a reply has been received received.
Returns
The number of queries that we not successfully decoded.

Implemented in PercyHybridClient.

dbsize_t receive_replies ( nqueries_t  request_identifier,
std::vector< istream * > &  isvec 
)

Receive the servers' replies for a given request ID.

Parameters
request_identifierRequest ID.
isvecStreams for input from the servers.
Returns
The total bytes received (from all servers combined)
virtual dbsize_t receive_replies_impl ( nqueries_t  request_identifier,
vector< istream * > &  isvec 
)
protectedpure virtual

Implementation for encode_request().

Parameters
request_identifierRequest ID.
isvecStreams for input from the servers.
Returns
The total bytes received (from all servers combined)

Implemented in PercyHybridClient.

dbsize_t send_request ( nqueries_t  request_identifier,
std::vector< ostream * > &  osvec,
bool  send_num_queries = true 
)

Send the request for the given request ID.

Parameters
request_identifierRequest ID.
osvecStreams for output to the servers.
send_num_queriesIf true, send the servers the number of queries prior to sending the queries.
Returns
The total bytes send (to all servers combined)
virtual dbsize_t send_request_impl ( nqueries_t  request_identifier,
vector< ostream * > &  osvec,
bool  send_num_queries = true 
)
protectedpure virtual

Implementation for send_request().

Parameters
request_identifierRequest ID.
osvecStreams for output to the servers
send_num_queriesIf true, send the servers the number of queries prior to sending the queries.
Returns
The total bytes send (to all servers combined)

Member Data Documentation

const PercyClientParams* clientparams
protected

Parameters for the client.

vector<nservers_t> goodservers
protected

The server indices of servers that have not acted up.

nservers_t num_servers
protected

The number of servers.

const bool randomize = true
staticprotected

Randomize the requests for IT-PIR clients.

nservers_t t
protected

The privacy level.

I.e. the maximum number of servers that can collude and the queries will remain private.


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