functions to initialize parameter arrays More...
#include "platform.h"
#include "gnunet_common.h"
#include "gnunet_pq_lib.h"
#include "gnunet_time_lib.h"
#include "pq.h"
Go to the source code of this file.
Data Structures | |
struct | qconv_array_cls |
Closure for the array type handlers. More... | |
Macros | |
#define | RETURN_UNLESS(cond) |
Functions | |
static int | qconv_null (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_null (void) |
Generate query parameter to create a NULL value. More... | |
static int | qconv_fixed (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_fixed_size (const void *ptr, size_t ptr_size) |
Generate query parameter for a buffer ptr of ptr_size bytes. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_string (const char *ptr) |
Generate query parameter for a string. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_bool (bool b) |
Pass a boolean into a query. More... | |
static int | qconv_uint16 (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_uint16 (const uint16_t *x) |
Generate query parameter for an uint16_t in host byte order. More... | |
static int | qconv_uint32 (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_uint32 (const uint32_t *x) |
Generate query parameter for an uint32_t in host byte order. More... | |
static int | qconv_uint64 (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_uint64 (const uint64_t *x) |
Generate query parameter for an uint64_t in host byte order. More... | |
static int | qconv_int64 (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_int64 (const int64_t *x) |
Generate query parameter for an int64_t in host byte order. More... | |
static int | qconv_rsa_public_key (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x) |
Generate query parameter for an RSA public key. More... | |
static int | qconv_rsa_signature (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x) |
Generate query parameter for an RSA signature. More... | |
static int | qconv_rel_time (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_relative_time (const struct GNUNET_TIME_Relative *x) |
Generate query parameter for a relative time value. More... | |
static int | qconv_abs_time (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x) |
Generate query parameter for an absolute time value. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x) |
Generate query parameter for an absolute time value. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_timestamp (const struct GNUNET_TIME_Timestamp *x) |
Generate query parameter for a timestamp. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_timestamp_nbo (const struct GNUNET_TIME_TimestampNBO *x) |
Generate query parameter for a timestamp in NBO. More... | |
static void | qconv_array_cls_cleanup (void *cls) |
Callback to cleanup a qconv_array_cls to be used during GNUNET_PQ_cleanup_query_params_closures. More... | |
static int | qconv_array (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters for arrays. More... | |
static struct GNUNET_PQ_QueryParam | query_param_array_generic (unsigned int num, bool continuous, const void *elements, const size_t *sizes, size_t same_size, enum array_types typ, Oid oid) |
Function to generate a typ specific query parameter and corresponding closure. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_bool (unsigned int num, const bool *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of bool in host byte order. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_uint16 (unsigned int num, const uint16_t *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of uint16_t in host byte order. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_uint32 (unsigned int num, const uint32_t *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of uint32_t in host byte order. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_uint64 (unsigned int num, const uint64_t *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of uint64 in host byte order. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_bytes (unsigned int num, const void *elements, const size_t *sizes, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of buffers elements, each of corresponding size given in sizes. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_ptrs_bytes (unsigned int num, const void *elements[static num], const size_t *sizes, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of buffers elements, with sizes sizes. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_bytes_same_size (unsigned int num, const void *elements, size_t same_size, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of buffers elements, each of the same size size. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_ptrs_bytes_same_size (unsigned int num, const void *elements[static num], size_t same_size, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of pointers to buffers elements, each of the same size size. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_string (unsigned int num, const char *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of strings (continuous) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_ptrs_string (unsigned int num, const char *elements[static num], struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of strings (pointers) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_abs_time (unsigned int num, const struct GNUNET_TIME_Absolute *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of absolute time stamps (continuous) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_ptrs_abs_time (unsigned int num, const struct GNUNET_TIME_Absolute *elements[], struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of absolute time stamps (pointers) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_rel_time (unsigned int num, const struct GNUNET_TIME_Relative *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of relative time stamps (continuous) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_ptrs_rel_time (unsigned int num, const struct GNUNET_TIME_Relative *elements[], struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of relative time stamps (pointers) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_timestamp (unsigned int num, const struct GNUNET_TIME_Timestamp *elements, struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of time stamps (continuous) More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_array_ptrs_timestamp (unsigned int num, const struct GNUNET_TIME_Timestamp *elements[], struct GNUNET_PQ_Context *db) |
Generate query parameter for an array of time stamps (pointers) More... | |
static int | qconv_blind_sign_pub (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_blind_sign_pub (const struct GNUNET_CRYPTO_BlindSignPublicKey *pub) |
Generate query parameter for a blind sign public key of variable size. More... | |
static int | qconv_blind_sign_priv (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_blind_sign_priv (const struct GNUNET_CRYPTO_BlindSignPrivateKey *priv) |
Generate query parameter for a blind sign private key of variable size. More... | |
static int | qconv_unblinded_sig (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_unblinded_sig (const struct GNUNET_CRYPTO_UnblindedSignature *sig) |
Generate query parameter for an unblinded signature of variable size. More... | |
static int | qconv_blinded_sig (void *cls, const void *data, size_t data_len, void *param_values[], int param_lengths[], int param_formats[], unsigned int param_length, void *scratch[], unsigned int scratch_length) |
Function called to convert input argument into SQL parameters. More... | |
struct GNUNET_PQ_QueryParam | GNUNET_PQ_query_param_blinded_sig (const struct GNUNET_CRYPTO_BlindedSignature *b_sig) |
Generate query parameter for a blinded signature of variable size. More... | |
functions to initialize parameter arrays
Definition in file pq_query_helper.c.
#define RETURN_UNLESS | ( | cond | ) |
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 46 of file pq_query_helper.c.
References data, and GNUNET_break.
Referenced by GNUNET_PQ_query_param_null().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_null | ( | void | ) |
Generate query parameter to create a NULL value.
Definition at line 71 of file pq_query_helper.c.
References qconv_null(), and res.
Referenced by postgres_plugin_put().
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 97 of file pq_query_helper.c.
References data, and GNUNET_break.
Referenced by GNUNET_PQ_query_param_fixed_size().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_fixed_size | ( | const void * | ptr, |
size_t | ptr_size | ||
) |
Generate query parameter for a buffer ptr of ptr_size bytes.
ptr | pointer to the query parameter to pass |
ptr_size | number of bytes in ptr |
Definition at line 120 of file pq_query_helper.c.
References qconv_fixed(), res, and GNUNET_PQ_QueryParam::size.
Referenced by GNUNET_PQ_query_param_bool(), GNUNET_PQ_query_param_string(), namecache_postgres_cache_block(), namestore_postgres_store_records(), postgres_plugin_put(), and postgres_plugin_remove_key().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_string | ( | const char * | ptr | ) |
Generate query parameter for a string.
ptr | pointer to the string query parameter to pass |
Definition at line 136 of file pq_query_helper.c.
References GNUNET_PQ_query_param_fixed_size().
Referenced by GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_run_sql(), namestore_postgres_clear_editor_hint(), namestore_postgres_edit_records(), namestore_postgres_lookup_records(), and namestore_postgres_store_records().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_bool | ( | bool | b | ) |
Pass a boolean into a query.
b | boolean bit to pass |
Definition at line 144 of file pq_query_helper.c.
References GNUNET_PQ_query_param_fixed_size().
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 169 of file pq_query_helper.c.
References data, GNUNET_break, and GNUNET_new.
Referenced by GNUNET_PQ_query_param_uint16().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint16 | ( | const uint16_t * | x | ) |
Generate query parameter for an uint16_t in host byte order.
x | pointer to the query parameter to pass |
Definition at line 198 of file pq_query_helper.c.
References qconv_uint16(), and res.
Referenced by postgres_plugin_get_key().
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 226 of file pq_query_helper.c.
References data, GNUNET_break, and GNUNET_new.
Referenced by GNUNET_PQ_query_param_uint32().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint32 | ( | const uint32_t * | x | ) |
Generate query parameter for an uint32_t in host byte order.
x | pointer to the query parameter to pass |
Definition at line 255 of file pq_query_helper.c.
References qconv_uint32(), and res.
Referenced by namestore_postgres_store_records(), postgres_plugin_get(), postgres_plugin_get_closest(), postgres_plugin_get_key(), postgres_plugin_get_zero_anonymity(), and postgres_plugin_put().
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 283 of file pq_query_helper.c.
References data, GNUNET_break, GNUNET_htonll(), and GNUNET_new.
Referenced by GNUNET_PQ_query_param_uint64().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_uint64 | ( | const uint64_t * | x | ) |
Generate query parameter for an uint64_t in host byte order.
x | pointer to the query parameter to pass |
Definition at line 312 of file pq_query_helper.c.
References qconv_uint64(), and res.
Referenced by namestore_postgres_iterate_records(), namestore_postgres_store_records(), postgres_plugin_del(), postgres_plugin_get_key(), postgres_plugin_get_zero_anonymity(), postgres_plugin_put(), process_result(), and repl_proc().
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 340 of file pq_query_helper.c.
References data, GNUNET_break, GNUNET_htonll(), and GNUNET_new.
Referenced by GNUNET_PQ_query_param_int64().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_int64 | ( | const int64_t * | x | ) |
Generate query parameter for an int64_t in host byte order.
x | pointer to the query parameter to pass |
Definition at line 369 of file pq_query_helper.c.
References qconv_int64(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 397 of file pq_query_helper.c.
References data, GNUNET_break, and GNUNET_CRYPTO_rsa_public_key_encode().
Referenced by GNUNET_PQ_query_param_rsa_public_key().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_rsa_public_key | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | x | ) |
Generate query parameter for an RSA public key.
The database must contain a BLOB type in the respective position.
x | the query parameter to pass. |
Definition at line 425 of file pq_query_helper.c.
References qconv_rsa_public_key(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 453 of file pq_query_helper.c.
References data, GNUNET_break, and GNUNET_CRYPTO_rsa_signature_encode().
Referenced by GNUNET_PQ_query_param_rsa_signature().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_rsa_signature | ( | const struct GNUNET_CRYPTO_RsaSignature * | x | ) |
Generate query parameter for an RSA signature.
The database must contain a BLOB type in the respective position.
x | the query parameter to pass |
Definition at line 481 of file pq_query_helper.c.
References qconv_rsa_signature(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 508 of file pq_query_helper.c.
References data, GNUNET_break, GNUNET_htonll(), GNUNET_new, GNUNET_TIME_Relative::rel_value_us, and u.
Referenced by GNUNET_PQ_query_param_relative_time().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_relative_time | ( | const struct GNUNET_TIME_Relative * | x | ) |
Generate query parameter for a relative time value.
The database must store a 64-bit integer.
x | pointer to the query parameter to pass |
Definition at line 539 of file pq_query_helper.c.
References qconv_rel_time(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 567 of file pq_query_helper.c.
References GNUNET_TIME_Absolute::abs_value_us, data, GNUNET_break, GNUNET_htonll(), GNUNET_new, and u.
Referenced by GNUNET_PQ_query_param_absolute_time().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_absolute_time | ( | const struct GNUNET_TIME_Absolute * | x | ) |
Generate query parameter for an absolute time value.
The database must store a 64-bit integer.
x | pointer to the query parameter to pass |
Definition at line 598 of file pq_query_helper.c.
References qconv_abs_time(), and res.
Referenced by delete_old_block(), GNUNET_PQ_query_param_timestamp(), namecache_postgres_cache_block(), namecache_postgres_expire_blocks(), postgres_plugin_del(), postgres_plugin_get(), postgres_plugin_get_closest(), postgres_plugin_get_expiration(), and postgres_plugin_put().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_absolute_time_nbo | ( | const struct GNUNET_TIME_AbsoluteNBO * | x | ) |
Generate query parameter for an absolute time value.
The database must store a 64-bit integer.
x | pointer to the query parameter to pass |
Definition at line 612 of file pq_query_helper.c.
References GNUNET_PQ_query_param_auto_from_type.
Referenced by GNUNET_PQ_query_param_timestamp_nbo().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_timestamp | ( | const struct GNUNET_TIME_Timestamp * | x | ) |
Generate query parameter for a timestamp.
The database must store a 64-bit integer.
x | pointer to the query parameter to pass |
Definition at line 620 of file pq_query_helper.c.
References GNUNET_PQ_query_param_absolute_time().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_timestamp_nbo | ( | const struct GNUNET_TIME_TimestampNBO * | x | ) |
Generate query parameter for a timestamp in NBO.
The database must store a 64-bit integer.
x | pointer to the query parameter to pass |
Definition at line 627 of file pq_query_helper.c.
References GNUNET_PQ_query_param_absolute_time_nbo().
|
static |
Callback to cleanup a qconv_array_cls to be used during GNUNET_PQ_cleanup_query_params_closures.
Definition at line 679 of file pq_query_helper.c.
References GNUNET_free.
Referenced by query_param_array_generic().
|
static |
Function called to convert input argument into SQL parameters for arrays.
Note: the format for the encoding of arrays for libpq is not very well documented. We peeked into various sources (postgresql and libpqtypes) for guidance.
cls | Closure of type struct qconv_array_cls* | |
data | Pointer to first element in the array | |
data_len | Number of elements in array data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 704 of file pq_query_helper.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, array_of_abs_time, array_of_bool, array_of_byte, array_of_rel_time, array_of_string, array_of_timestamp, array_of_uint16, array_of_uint32, array_of_uint64, data, GNUNET_assert, GNUNET_free, GNUNET_htonll(), GNUNET_malloc, GNUNET_memcpy, GNUNET_new_array, h, INT_MAX, meta, GNUNET_TIME_Relative::rel_value_us, RETURN_UNLESS, and qconv_array_cls::sizes.
Referenced by query_param_array_generic().
|
static |
Function to generate a typ specific query parameter and corresponding closure.
num | Number of elements in elements |
continuous | If true, elements is an continuous array of data |
elements | Array of num elements, either continuous or pointers |
sizes | Array of num sizes, one per element, may be NULL |
same_size | If not 0, all elements in elements have this size |
typ | Supported internal type of each element in elements |
oid | Oid of the type to be used in Postgres |
Definition at line 996 of file pq_query_helper.c.
References qconv_array_cls::continuous, GNUNET_new, meta, oid, qconv_array(), qconv_array_cls_cleanup(), res, qconv_array_cls::same_size, GNUNET_PQ_QueryParam::size, qconv_array_cls::sizes, and qconv_array_cls::typ.
Referenced by GNUNET_PQ_query_param_array_abs_time(), GNUNET_PQ_query_param_array_bool(), GNUNET_PQ_query_param_array_bytes(), GNUNET_PQ_query_param_array_bytes_same_size(), GNUNET_PQ_query_param_array_ptrs_abs_time(), GNUNET_PQ_query_param_array_ptrs_bytes(), GNUNET_PQ_query_param_array_ptrs_bytes_same_size(), GNUNET_PQ_query_param_array_ptrs_rel_time(), GNUNET_PQ_query_param_array_ptrs_string(), GNUNET_PQ_query_param_array_ptrs_timestamp(), GNUNET_PQ_query_param_array_rel_time(), GNUNET_PQ_query_param_array_string(), GNUNET_PQ_query_param_array_timestamp(), GNUNET_PQ_query_param_array_uint16(), GNUNET_PQ_query_param_array_uint32(), and GNUNET_PQ_query_param_array_uint64().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_bool | ( | unsigned int | num, |
const bool * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of bool in host byte order.
num | Number of elements in elements |
elements | Continuous array of num boolean elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1029 of file pq_query_helper.c.
References array_of_bool, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_uint16 | ( | unsigned int | num, |
const uint16_t * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of uint16_t in host byte order.
Note that the (unsigned) elements are not checked to wrap over INT2_MAX
num | Number of elements in elements |
elements | Continuous array of num uint16 elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1051 of file pq_query_helper.c.
References array_of_uint16, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_uint32 | ( | unsigned int | num, |
const uint32_t * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of uint32_t in host byte order.
Note that the (unsigned) elements are not checked to wrap over INT4_MAX
num | Number of elements in elements |
elements | Continuous Array of num uint32_t elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1073 of file pq_query_helper.c.
References array_of_uint32, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_uint64 | ( | unsigned int | num, |
const uint64_t * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of uint64 in host byte order.
Note that the (unsigned) elements are not checked to wrap over INT8_MAX
num | Number of elements in elements |
elements | Continuous array of num uint64_t elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1095 of file pq_query_helper.c.
References array_of_uint64, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_bytes | ( | unsigned int | num, |
const void * | elements, | ||
const size_t * | sizes, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of buffers elements, each of corresponding size given in sizes.
num | Number of elements in elements |
elements | Continuous array of num buffers, each of corresponding size given in sizes. |
sizes | Pointer to sizes in bytes of each element in elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1117 of file pq_query_helper.c.
References array_of_byte, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_bytes | ( | unsigned int | num, |
const void * | elements[static num], | ||
const size_t * | sizes, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of buffers elements, with sizes sizes.
num | Number of elements in elements |
elements | Continuous array of num buffers, each with the same size same_size |
sizes | Sizes in bytes of each element in elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1140 of file pq_query_helper.c.
References array_of_byte, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_bytes_same_size | ( | unsigned int | num, |
const void * | elements, | ||
size_t | same_size, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of buffers elements, each of the same size size.
num | Number of elements in elements |
elements | Continuous array of num buffers, each with the same size same_size |
same_size | Size in bytes of each element in elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1163 of file pq_query_helper.c.
References array_of_byte, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_bytes_same_size | ( | unsigned int | num, |
const void * | elements[static num], | ||
size_t | same_size, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of pointers to buffers elements, each of the same size size.
num | Number of elements in elements |
elements | Array of num pointers to buffers, each with the same size same_size |
same_size | Size in bytes of each element in elements |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1186 of file pq_query_helper.c.
References array_of_byte, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_string | ( | unsigned int | num, |
const char * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of strings (continuous)
num | Number of elements in elements |
elements | Array of num continuous strings (zero-terminated each) |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1209 of file pq_query_helper.c.
References array_of_string, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_string | ( | unsigned int | num, |
const char * | elements[static num], | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of strings (pointers)
num | Number of elements in elements |
elements | Array of num pointer to strings |
db | Database context, needed for database-depending encoding of elements |
Definition at line 1231 of file pq_query_helper.c.
References array_of_string, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_abs_time | ( | unsigned int | num, |
const struct GNUNET_TIME_Absolute * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of absolute time stamps (continuous)
num | Number of elements in elements |
elements | Array of num absolute timestamps |
Definition at line 1253 of file pq_query_helper.c.
References array_of_abs_time, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_abs_time | ( | unsigned int | num, |
const struct GNUNET_TIME_Absolute * | elements[], | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of absolute time stamps (pointers)
num | Number of elements in elements |
elements | Array of num pointers to absolute timestamps |
Definition at line 1275 of file pq_query_helper.c.
References array_of_abs_time, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_rel_time | ( | unsigned int | num, |
const struct GNUNET_TIME_Relative * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of relative time stamps (continuous)
num | Number of elements in elements |
elements | Array of num relative timestamps |
Definition at line 1297 of file pq_query_helper.c.
References array_of_abs_time, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_rel_time | ( | unsigned int | num, |
const struct GNUNET_TIME_Relative * | elements[], | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of relative time stamps (pointers)
num | Number of elements in elements |
elements | Array of num pointers to relative timestamps |
Definition at line 1319 of file pq_query_helper.c.
References array_of_abs_time, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_timestamp | ( | unsigned int | num, |
const struct GNUNET_TIME_Timestamp * | elements, | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of time stamps (continuous)
num | Number of elements in elements |
elements | Array of num timestamps |
Definition at line 1341 of file pq_query_helper.c.
References array_of_timestamp, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_array_ptrs_timestamp | ( | unsigned int | num, |
const struct GNUNET_TIME_Timestamp * | elements[], | ||
struct GNUNET_PQ_Context * | db | ||
) |
Generate query parameter for an array of time stamps (pointers)
num | Number of elements in elements |
elements | Array of num pointers to relative timestamps |
Definition at line 1363 of file pq_query_helper.c.
References array_of_timestamp, db, GNUNET_assert, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), GNUNET_PQ_Context::num, oid, and query_param_array_generic().
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 1399 of file pq_query_helper.c.
References GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindSignPublicKey::cs_public_key, data, GNUNET_CRYPTO_BlindSignPublicKey::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, and GNUNET_CRYPTO_BlindSignPublicKey::rsa_public_key.
Referenced by GNUNET_PQ_query_param_blind_sign_pub().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_blind_sign_pub | ( | const struct GNUNET_CRYPTO_BlindSignPublicKey * | pub | ) |
Generate query parameter for a blind sign public key of variable size.
Generate query parameter for a blind sign public key.
pub | pointer to the query parameter to pass |
Definition at line 1471 of file pq_query_helper.c.
References pub, qconv_blind_sign_pub(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 1499 of file pq_query_helper.c.
References GNUNET_CRYPTO_BlindSignPrivateKey::cipher, GNUNET_CRYPTO_BlindSignPrivateKey::cs_private_key, data, GNUNET_CRYPTO_BlindSignPrivateKey::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_private_key_encode(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, and GNUNET_CRYPTO_BlindSignPrivateKey::rsa_private_key.
Referenced by GNUNET_PQ_query_param_blind_sign_priv().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_blind_sign_priv | ( | const struct GNUNET_CRYPTO_BlindSignPrivateKey * | priv | ) |
Generate query parameter for a blind sign private key of variable size.
priv | pointer to the query parameter to pass |
Definition at line 1571 of file pq_query_helper.c.
References qconv_blind_sign_priv(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 1599 of file pq_query_helper.c.
References GNUNET_CRYPTO_UnblindedSignature::cipher, GNUNET_CRYPTO_UnblindedSignature::cs_signature, data, GNUNET_CRYPTO_UnblindedSignature::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, and GNUNET_CRYPTO_UnblindedSignature::rsa_signature.
Referenced by GNUNET_PQ_query_param_unblinded_sig().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_unblinded_sig | ( | const struct GNUNET_CRYPTO_UnblindedSignature * | sig | ) |
Generate query parameter for an unblinded signature of variable size.
sig | pointer to the query parameter to pass |
Definition at line 1672 of file pq_query_helper.c.
References qconv_unblinded_sig(), and res.
|
static |
Function called to convert input argument into SQL parameters.
cls | closure | |
data | pointer to input argument | |
data_len | number of bytes in data (if applicable) | |
[out] | param_values | SQL data to set |
[out] | param_lengths | SQL length data to set |
[out] | param_formats | SQL format data to set |
param_length | number of entries available in the param_values, param_lengths and param_formats arrays | |
[out] | scratch | buffer for dynamic allocations (to be done via GNUNET_malloc() |
scratch_length | number of entries left in scratch |
Definition at line 1700 of file pq_query_helper.c.
References GNUNET_CRYPTO_BlindedSignature::blinded_cs_answer, GNUNET_CRYPTO_BlindedSignature::blinded_rsa_signature, GNUNET_CRYPTO_BlindedSignature::cipher, data, GNUNET_CRYPTO_BlindedSignature::details, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_free, GNUNET_malloc, and GNUNET_memcpy.
Referenced by GNUNET_PQ_query_param_blinded_sig().
struct GNUNET_PQ_QueryParam GNUNET_PQ_query_param_blinded_sig | ( | const struct GNUNET_CRYPTO_BlindedSignature * | b_sig | ) |
Generate query parameter for a blinded signature of variable size.
b_sig | pointer to the query parameter to pass |
Definition at line 1773 of file pq_query_helper.c.
References qconv_blinded_sig(), and res.