functions to extract result values More...
#include "platform.h"
#include "gnunet_time_lib.h"
#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_pq_lib.h"
#include "pq.h"
Go to the source code of this file.
Data Structures | |
struct | array_result_cls |
Closure for the array result specifications. More... | |
Macros | |
#define | FAIL_IF(cond) |
Functions | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_allow_null (struct GNUNET_PQ_ResultSpec rs, bool *is_null) |
Allow NULL value to be found in the database for the given value. More... | |
static void | clean_varsize_blob (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
static enum GNUNET_GenericReturnValue | extract_varsize_blob (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_variable_size (const char *name, void **dst, size_t *sptr) |
Variable-size result expected. More... | |
static enum GNUNET_GenericReturnValue | extract_fixed_blob (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_fixed_size (const char *name, void *dst, size_t dst_size) |
Fixed-size result expected. More... | |
static enum GNUNET_GenericReturnValue | extract_rsa_public_key (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_rsa_public_key (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_rsa_public_key (const char *name, struct GNUNET_CRYPTO_RsaPublicKey **rsa) |
RSA public key expected. More... | |
static enum GNUNET_GenericReturnValue | extract_rsa_signature (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_rsa_signature (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_rsa_signature (const char *name, struct GNUNET_CRYPTO_RsaSignature **sig) |
RSA signature expected. More... | |
static enum GNUNET_GenericReturnValue | extract_string (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_string (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_string (const char *name, char **dst) |
0-terminated string expected. More... | |
static enum GNUNET_GenericReturnValue | extract_bool (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_bool (const char *name, bool *dst) |
boolean expected. More... | |
static enum GNUNET_GenericReturnValue | extract_rel_time (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_relative_time (const char *name, struct GNUNET_TIME_Relative *rt) |
Relative time expected. More... | |
static enum GNUNET_GenericReturnValue | extract_abs_time (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_absolute_time (const char *name, struct GNUNET_TIME_Absolute *at) |
Absolute time expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_absolute_time_nbo (const char *name, struct GNUNET_TIME_AbsoluteNBO *at) |
Absolute time expected. More... | |
static enum GNUNET_GenericReturnValue | extract_timestamp (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_timestamp (const char *name, struct GNUNET_TIME_Timestamp *at) |
Timestamp expected. More... | |
static enum GNUNET_GenericReturnValue | extract_timestamp_nbo (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_timestamp_nbo (const char *name, struct GNUNET_TIME_TimestampNBO *at) |
Timestamp expected. More... | |
static enum GNUNET_GenericReturnValue | extract_uint16 (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_uint16 (const char *name, uint16_t *u16) |
uint16_t expected. More... | |
static enum GNUNET_GenericReturnValue | extract_uint32 (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_uint32 (const char *name, uint32_t *u32) |
uint32_t expected. More... | |
static enum GNUNET_GenericReturnValue | extract_uint64 (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_uint64 (const char *name, uint64_t *u64) |
uint64_t expected. More... | |
static enum GNUNET_GenericReturnValue | extract_int64 (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_int64 (const char *name, int64_t *i64) |
int64_t expected. More... | |
static enum GNUNET_GenericReturnValue | extract_array_generic (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result as array of a specific type from row row. More... | |
static void | array_cleanup (void *cls, void *rd) |
Cleanup of the data and closure of an array spec. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_bool (struct GNUNET_PQ_Context *db, const char *name, size_t *num, bool **dst) |
array of bool expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_uint16 (struct GNUNET_PQ_Context *db, const char *name, size_t *num, uint16_t **dst) |
array of uint16_t expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_uint32 (struct GNUNET_PQ_Context *db, const char *name, size_t *num, uint32_t **dst) |
array of uint32_t expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_uint64 (struct GNUNET_PQ_Context *db, const char *name, size_t *num, uint64_t **dst) |
array of uint64_t expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_abs_time (struct GNUNET_PQ_Context *db, const char *name, size_t *num, struct GNUNET_TIME_Absolute **dst) |
array of absolute time expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_rel_time (struct GNUNET_PQ_Context *db, const char *name, size_t *num, struct GNUNET_TIME_Relative **dst) |
array of relative time expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_timestamp (struct GNUNET_PQ_Context *db, const char *name, size_t *num, struct GNUNET_TIME_Timestamp **dst) |
array of relative time expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_variable_size (struct GNUNET_PQ_Context *db, const char *name, size_t *num, size_t **sizes, void **dst) |
Array of variable-size result expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_fixed_size (struct GNUNET_PQ_Context *db, const char *name, size_t size, size_t *num, void **dst) |
Array of fixed-size result expected. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_array_string (struct GNUNET_PQ_Context *db, const char *name, size_t *num, char **dst) |
Array of 0-terminated strings expected. More... | |
static enum GNUNET_GenericReturnValue | extract_blind_sign_pub (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_blind_sign_pub (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_blind_sign_pub (const char *name, struct GNUNET_CRYPTO_BlindSignPublicKey **pub) |
Blind sign public key expected. More... | |
static enum GNUNET_GenericReturnValue | extract_blind_sign_priv (void *cls, PGresult *result, int row, const char *fname, size_t *dst_size, void *dst) |
Extract data from a Postgres database result at row row. More... | |
static void | clean_blind_sign_priv (void *cls, void *rd) |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter. More... | |
struct GNUNET_PQ_ResultSpec | GNUNET_PQ_result_spec_blind_sign_priv (const char *name, struct GNUNET_CRYPTO_BlindSignPrivateKey **priv) |
Blind sign private key expected. More... | |
functions to extract result values
Definition in file pq_result_helper.c.
#define FAIL_IF | ( | cond | ) |
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_allow_null | ( | struct GNUNET_PQ_ResultSpec | rs, |
bool * | is_null | ||
) |
Allow NULL value to be found in the database for the given value.
rs | result spec entry to modify | |
[out] | is_null | location set to 'true' if the value was indeed NULL, set to 'false' if the value was non-NULL |
Definition at line 35 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::is_null, and GNUNET_PQ_ResultSpec::is_nullable.
Referenced by handle_results().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 55 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_free, and rd.
Referenced by GNUNET_PQ_result_spec_variable_size().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 83 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_break, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_variable_size().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_variable_size | ( | const char * | name, |
void ** | dst, | ||
size_t * | sptr | ||
) |
Variable-size result expected.
name | name of the field in the table | |
[out] | dst | where to store the result, allocated |
[out] | sptr | where to store the size of dst |
Definition at line 130 of file pq_result_helper.c.
References clean_varsize_blob(), GNUNET_PQ_ResultSpec::dst, extract_varsize_blob(), name, and res.
Referenced by extract_result_cb(), handle_results(), namecache_postgres_lookup_block(), parse_result_call_iterator(), and process_result().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in] | dst_size | desired size, never NULL |
[out] | dst | where to store the result |
Definition at line 160 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_fixed_size().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_fixed_size | ( | const char * | name, |
void * | dst, | ||
size_t | dst_size | ||
) |
Fixed-size result expected.
name | name of the field in the table | |
[out] | dst | where to store the result |
dst_size | number of bytes in dst |
Definition at line 213 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, extract_fixed_blob(), GNUNET_PQ_ResultSpec::fname, name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 242 of file pq_result_helper.c.
References GNUNET_break, GNUNET_CRYPTO_rsa_public_key_decode(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, pk, res, and result.
Referenced by GNUNET_PQ_result_spec_rsa_public_key().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 295 of file pq_result_helper.c.
References GNUNET_CRYPTO_rsa_public_key_free(), pk, and rd.
Referenced by GNUNET_PQ_result_spec_rsa_public_key().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_public_key | ( | const char * | name, |
struct GNUNET_CRYPTO_RsaPublicKey ** | rsa | ||
) |
RSA public key expected.
name | name of the field in the table | |
[out] | rsa | where to store the result |
Definition at line 310 of file pq_result_helper.c.
References clean_rsa_public_key(), extract_rsa_public_key(), GNUNET_PQ_ResultSpec::fname, name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 338 of file pq_result_helper.c.
References GNUNET_break, GNUNET_CRYPTO_rsa_signature_decode(), GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_rsa_signature().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 390 of file pq_result_helper.c.
References GNUNET_CRYPTO_rsa_signature_free(), and rd.
Referenced by GNUNET_PQ_result_spec_rsa_signature().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_rsa_signature | ( | const char * | name, |
struct GNUNET_CRYPTO_RsaSignature ** | sig | ||
) |
RSA signature expected.
name | name of the field in the table | |
[out] | sig | where to store the result; |
Definition at line 405 of file pq_result_helper.c.
References clean_rsa_signature(), extract_rsa_signature(), GNUNET_PQ_ResultSpec::fname, name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 433 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::fname, GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_strndup, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_string().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 485 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_free, and rd.
Referenced by GNUNET_PQ_result_spec_string().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_string | ( | const char * | name, |
char ** | dst | ||
) |
0-terminated string expected.
name | name of the field in the table | |
[out] | dst | where to store the result, allocated |
Definition at line 500 of file pq_result_helper.c.
References clean_string(), GNUNET_PQ_ResultSpec::dst, extract_string(), GNUNET_PQ_ResultSpec::fname, name, and res.
Referenced by check_patch_applied(), and parse_result_call_iterator().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 528 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::fname, GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_bool().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_bool | ( | const char * | name, |
bool * | dst | ||
) |
boolean expected.
name | name of the field in the table | |
[out] | dst | where to store the result |
Definition at line 571 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst, extract_bool(), GNUNET_PQ_ResultSpec::fname, name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 598 of file pq_result_helper.c.
References GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_TIME_Relative::rel_value_us, res, and result.
Referenced by GNUNET_PQ_result_spec_relative_time().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_relative_time | ( | const char * | name, |
struct GNUNET_TIME_Relative * | rt | ||
) |
Relative time expected.
name | name of the field in the table | |
[out] | rt | where to store the result |
Definition at line 647 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_rel_time(), name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 675 of file pq_result_helper.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, res, and result.
Referenced by GNUNET_PQ_result_spec_absolute_time().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_absolute_time | ( | const char * | name, |
struct GNUNET_TIME_Absolute * | at | ||
) |
Absolute time expected.
name | name of the field in the table | |
[out] | at | where to store the result |
Definition at line 724 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_abs_time(), name, and res.
Referenced by extract_result_cb(), handle_results(), and process_result().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_absolute_time_nbo | ( | const char * | name, |
struct GNUNET_TIME_AbsoluteNBO * | at | ||
) |
Absolute time expected.
name | name of the field in the table | |
[out] | at | where to store the result |
Definition at line 739 of file pq_result_helper.c.
References GNUNET_PQ_result_spec_auto_from_type, name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 764 of file pq_result_helper.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_SECONDS, res, and result.
Referenced by extract_timestamp_nbo(), and GNUNET_PQ_result_spec_timestamp().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_timestamp | ( | const char * | name, |
struct GNUNET_TIME_Timestamp * | t | ||
) |
Timestamp expected.
name | name of the field in the table | |
[out] | t | where to store the result |
Definition at line 825 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_timestamp(), name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 853 of file pq_result_helper.c.
References extract_timestamp(), GNUNET_OK, GNUNET_TIME_timestamp_hton(), result, and t.
Referenced by GNUNET_PQ_result_spec_timestamp_nbo().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_timestamp_nbo | ( | const char * | name, |
struct GNUNET_TIME_TimestampNBO * | tn | ||
) |
Timestamp expected.
name | name of the field in the table | |
[out] | tn | where to store the result |
Definition at line 878 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_timestamp_nbo(), name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 906 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_uint16().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint16 | ( | const char * | name, |
uint16_t * | u16 | ||
) |
uint16_t expected.
name | name of the field in the table | |
[out] | u16 | where to store the result |
Definition at line 952 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_uint16(), name, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 980 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_uint32().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint32 | ( | const char * | name, |
uint32_t * | u32 | ||
) |
uint32_t expected.
name | name of the field in the table | |
[out] | u32 | where to store the result |
Definition at line 1026 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_uint32(), name, and res.
Referenced by extract_result_cb(), GNUNET_PQ_get_oid_by_name(), handle_results(), parse_result_call_iterator(), postgres_plugin_del(), and process_result().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 1054 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_uint64().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_uint64 | ( | const char * | name, |
uint64_t * | u64 | ||
) |
uint64_t expected.
name | name of the field in the table | |
[out] | u64 | where to store the result |
Definition at line 1110 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_uint64(), name, and res.
Referenced by parse_result_call_iterator(), postgres_plugin_del(), postgres_plugin_estimate_size(), and process_result().
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 1138 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::cls, GNUNET_PQ_ResultSpec::dst, GNUNET_PQ_ResultSpec::dst_size, GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, res, and result.
Referenced by GNUNET_PQ_result_spec_int64().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_int64 | ( | const char * | name, |
int64_t * | i64 | ||
) |
int64_t expected.
name | name of the field in the table | |
[out] | i64 | where to store the result |
Definition at line 1194 of file pq_result_helper.c.
References GNUNET_PQ_ResultSpec::dst_size, extract_int64(), name, and res.
|
static |
Extract data from a Postgres database result as array of a specific type from row row.
The type information and optionally additional out-parameters are given in cls which is of type array_result_cls.
cls | closure of type array_result_cls | |
result | where to extract data from | |
row | row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 1248 of file pq_result_helper.c.
References 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, pq_array_header::dim, FAIL, FAIL_IF, GNUNET_assert, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_new_array, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, h, pq_array_header::has_null, info, INT_MAX, pq_array_header::lbound, ndim, pq_array_header::ndim, pq_array_header::oid, and result.
Referenced by GNUNET_PQ_result_spec_array_abs_time(), GNUNET_PQ_result_spec_array_bool(), GNUNET_PQ_result_spec_array_fixed_size(), GNUNET_PQ_result_spec_array_rel_time(), GNUNET_PQ_result_spec_array_string(), GNUNET_PQ_result_spec_array_timestamp(), GNUNET_PQ_result_spec_array_uint16(), GNUNET_PQ_result_spec_array_uint32(), GNUNET_PQ_result_spec_array_uint64(), and GNUNET_PQ_result_spec_array_variable_size().
|
static |
Cleanup of the data and closure of an array spec.
Definition at line 1510 of file pq_result_helper.c.
References array_of_byte, GNUNET_free, info, and rd.
Referenced by GNUNET_PQ_result_spec_array_abs_time(), GNUNET_PQ_result_spec_array_bool(), GNUNET_PQ_result_spec_array_fixed_size(), GNUNET_PQ_result_spec_array_rel_time(), GNUNET_PQ_result_spec_array_string(), GNUNET_PQ_result_spec_array_timestamp(), GNUNET_PQ_result_spec_array_uint16(), GNUNET_PQ_result_spec_array_uint32(), GNUNET_PQ_result_spec_array_uint64(), and GNUNET_PQ_result_spec_array_variable_size().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_bool | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
bool ** | bools | ||
) |
array of bool expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array bools. |
[out] | bools | pointer to where to store the result, an array of num bool's. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1529 of file pq_result_helper.c.
References array_cleanup(), array_of_bool, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_uint16 | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
uint16_t ** | dst | ||
) |
array of uint16_t expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array u16s. |
[out] | dst | pointer to where to store the an array of num uint16_t's. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1559 of file pq_result_helper.c.
References array_cleanup(), array_of_uint16, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_uint32 | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
uint32_t ** | dst | ||
) |
array of uint32_t expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array u32s. |
[out] | dst | pointer to where to store the array of num uint32_t's. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1589 of file pq_result_helper.c.
References array_cleanup(), array_of_uint32, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_uint64 | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
uint64_t ** | dst | ||
) |
array of uint64_t expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array u64s. |
[out] | dst | pointer to where to store the array of num uint64_t's. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1619 of file pq_result_helper.c.
References array_cleanup(), array_of_uint64, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_abs_time | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
struct GNUNET_TIME_Absolute ** | dst | ||
) |
array of absolute time expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array u64s. |
[out] | dst | pointer to where to store the array of num absolute time. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1647 of file pq_result_helper.c.
References array_cleanup(), array_of_abs_time, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_rel_time | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
struct GNUNET_TIME_Relative ** | dst | ||
) |
array of relative time expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array u64s. |
[out] | dst | pointer to where to store the array of num relate time. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1675 of file pq_result_helper.c.
References array_cleanup(), array_of_rel_time, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_timestamp | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
struct GNUNET_TIME_Timestamp ** | dst | ||
) |
array of relative time expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements in the array u64s. |
[out] | dst | pointer to where to store the array of num timestamps. Allocated by the function, MUST be freed with GNUNET_free. |
Definition at line 1705 of file pq_result_helper.c.
References array_cleanup(), array_of_timestamp, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_variable_size | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
size_t ** | sizes, | ||
void ** | dst | ||
) |
Array of variable-size result expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements |
[out] | sizes | where to store the num size's of byte-buffers in dst |
[out] | dst | where to store the continuous array of num byte-buffers , allocated |
Definition at line 1735 of file pq_result_helper.c.
References array_cleanup(), array_of_byte, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, res, and array_result_cls::sizes.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_fixed_size | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t | size, | ||
size_t * | num, | ||
void ** | dst | ||
) |
Array of fixed-size result expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
size | number of bytes expected in each element of dst | |
[out] | num | where to store the number of elements |
[out] | dst | where to store the results, an continuous array of fixed-size elements |
Definition at line 1767 of file pq_result_helper.c.
References array_cleanup(), array_of_byte, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, res, and size.
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_array_string | ( | struct GNUNET_PQ_Context * | db, |
const char * | name, | ||
size_t * | num, | ||
char ** | dst | ||
) |
Array of 0-terminated strings expected.
db | Database context, needed for OID lookup for the correct type | |
name | name of the field in the table | |
[out] | num | where to store the number of elements |
[out] | dst | where to store the allocated continuous array of num 0-terminated strings |
Definition at line 1799 of file pq_result_helper.c.
References array_cleanup(), array_of_string, GNUNET_PQ_ResultSpec::cls, db, GNUNET_PQ_ResultSpec::dst, extract_array_generic(), GNUNET_PQ_ResultSpec::fname, GNUNET_assert, GNUNET_new, GNUNET_OK, GNUNET_PQ_get_oid_by_name(), info, name, array_result_cls::num, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | the row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 1842 of file pq_result_helper.c.
References GNUNET_CRYPTO_BlindSignPublicKey::cipher, GNUNET_CRYPTO_BlindSignPublicKey::cs_public_key, GNUNET_CRYPTO_BlindSignPublicKey::details, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_rsa_public_key_decode(), GNUNET_free, GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_CRYPTO_BlindSignPublicKey::pub_key_hash, GNUNET_CRYPTO_BlindSignPublicKey::rc, res, result, and GNUNET_CRYPTO_BlindSignPublicKey::rsa_public_key.
Referenced by GNUNET_PQ_result_spec_blind_sign_pub().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 1940 of file pq_result_helper.c.
References GNUNET_CRYPTO_blind_sign_pub_decref(), pub, and rd.
Referenced by GNUNET_PQ_result_spec_blind_sign_pub().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_blind_sign_pub | ( | const char * | name, |
struct GNUNET_CRYPTO_BlindSignPublicKey ** | public_key | ||
) |
Blind sign public key expected.
name | name of the field in the table | |
[out] | public_key | where to store the denomination signature |
Definition at line 1955 of file pq_result_helper.c.
References clean_blind_sign_pub(), extract_blind_sign_pub(), GNUNET_PQ_ResultSpec::fname, name, pub, and res.
|
static |
Extract data from a Postgres database result at row row.
cls | closure | |
result | where to extract data from | |
row | the row to extract data from | |
fname | name (or prefix) of the fields to extract from | |
[in,out] | dst_size | where to store size of result, may be NULL |
[out] | dst | where to store the result |
Definition at line 1984 of file pq_result_helper.c.
References GNUNET_CRYPTO_BlindSignPrivateKey::cipher, GNUNET_CRYPTO_BlindSignPrivateKey::cs_private_key, GNUNET_CRYPTO_BlindSignPrivateKey::details, GNUNET_break, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_CRYPTO_rsa_private_key_decode(), GNUNET_free, GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_CRYPTO_BlindSignPrivateKey::rc, res, result, and GNUNET_CRYPTO_BlindSignPrivateKey::rsa_private_key.
Referenced by GNUNET_PQ_result_spec_blind_sign_priv().
|
static |
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
cls | closure |
rd | result data to clean up |
Definition at line 2076 of file pq_result_helper.c.
References GNUNET_CRYPTO_blind_sign_priv_decref(), and rd.
Referenced by GNUNET_PQ_result_spec_blind_sign_priv().
struct GNUNET_PQ_ResultSpec GNUNET_PQ_result_spec_blind_sign_priv | ( | const char * | name, |
struct GNUNET_CRYPTO_BlindSignPrivateKey ** | private_key | ||
) |
Blind sign private key expected.
name | name of the field in the table | |
[out] | private_key | where to store the denomination signature |
Definition at line 2091 of file pq_result_helper.c.
References clean_blind_sign_priv(), extract_blind_sign_priv(), GNUNET_PQ_ResultSpec::fname, name, and res.