Percy++
A C++ implementation of Private Information Retrieval (PIR) protocols
|
An abstract base class for a PIR client. More...
#include <percyclient.h>
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 PercyClient * | make_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 PercyClientParams * | clientparams |
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 |
An abstract base class for a PIR client.
|
virtual |
Destructor.
|
protected |
Constructor.
Can only be called by derived classes. Use make_client() to create a client object.
clientparams | Parameters for the client. |
num_servers | The number of servers used |
t | The privacy level. I.e. the maximum number of servers that can collude and the queries will remain private. |
stats | Statistics collection object. No statistics will be collected if NULL. |
nqueries_t encode_request | ( | vector< dbsize_t > | block_numbers, |
nqueries_t | querybsize = 1 |
||
) |
Encode a request for the given block numbers.
block_numbers | The requested block indices (0-based). |
querybsize | The number of blocks to request in one query. |
|
protectedpure virtual |
Implementation for encode_request().
request_identifier | Request 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.
request_identifier | Will be set to the ID of this request. |
block_numbers | The requested block indices (0-based). |
osvec | Streams for output to the servers. |
isvec | Streams for input from the servers. |
results | Will be filled with the results of this request. |
querybsize | The number of blocks to request in one query. |
|
inlineprotected |
Get the block numbers for a given request ID.
request_identifier | Request ID. |
|
inlineprotected |
Get the number of blocks to request in a single query for a given request ID.
request_identifier | Request ID. |
bool get_result | ( | nqueries_t | request_identifier, |
vector< PercyBlockResults > & | results | ||
) |
Get the result for a given request ID.
request_identifier | Request ID. |
results | The results will be put into this vector. |
|
static |
Factory method called to get a client object for the given parameters.
clientparams | Parameters for the client. |
num_servers | The number of servers used |
t | The privacy level. I.e. the maximum number of servers that can collude and the queries will remain private. |
sids | An array of IDs for the servers that will be used. |
stats | Statistics collection object. No statistics will be collected if NULL. |
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.
h | The number of honest servers. |
|
protectedpure virtual |
Implementation for encode_request().
h | The number of honest servers. |
results | Will be filled with the results for all requests for which a reply has been received received. |
Implemented in PercyHybridClient.
dbsize_t receive_replies | ( | nqueries_t | request_identifier, |
std::vector< istream * > & | isvec | ||
) |
Receive the servers' replies for a given request ID.
request_identifier | Request ID. |
isvec | Streams for input from the servers. |
|
protectedpure virtual |
Implementation for encode_request().
request_identifier | Request ID. |
isvec | Streams for input from the servers. |
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.
request_identifier | Request ID. |
osvec | Streams for output to the servers. |
send_num_queries | If true, send the servers the number of queries prior to sending the queries. |
|
protectedpure virtual |
Implementation for send_request().
request_identifier | Request ID. |
osvec | Streams for output to the servers |
send_num_queries | If true, send the servers the number of queries prior to sending the queries. |
|
protected |
Parameters for the client.
|
protected |
The server indices of servers that have not acted up.
|
protected |
The number of servers.
|
staticprotected |
Randomize the requests for IT-PIR clients.
|
protected |
The privacy level.
I.e. the maximum number of servers that can collude and the queries will remain private.