50 results[0].buffer = NULL;
51 results[0].buffer_length = 0;
53 results[0].is_null = &rs->
is_null;
82 if (*results->is_null)
91 results[0].buffer =
buf;
92 results[0].buffer_length =
size;
93 results[0].buffer_type = MYSQL_TYPE_BLOB;
96 mysql_stmt_fetch_column (stmt,
105 *(
void **) rs->
dst = buf;
122 void **ptr = (
void **) rs->
dst;
147 .dst = (
void *) (dst),
148 .result_size = ptr_size,
175 results[0].buffer = rs->
dst;
176 results[0].buffer_length = rs->
dst_size;
178 results[0].buffer_type = MYSQL_TYPE_BLOB;
179 results[0].is_null = &rs->
is_null;
206 if (*results->is_null)
230 .dst = (
void *) (ptr),
231 .dst_size = ptr_size,
258 results[0].buffer = NULL;
259 results[0].buffer_length = 0;
261 results[0].buffer_type = MYSQL_TYPE_BLOB;
262 results[0].is_null = &rs->
is_null;
294 if (*results->is_null)
302 results[0].buffer =
buf;
303 results[0].buffer_length =
size;
304 results[0].buffer_type = MYSQL_TYPE_BLOB;
306 mysql_stmt_fetch_column (stmt,
321 "Results contains bogus public key value (fail to decode)\n");
392 results[0].buffer = 0;
393 results[0].buffer_length = 0;
395 results[0].buffer_type = MYSQL_TYPE_BLOB;
396 results[0].is_null = &rs->
is_null;
426 if (*results->is_null)
434 results[0].buffer =
buf;
435 results[0].buffer_length =
size;
436 results[0].buffer_type = MYSQL_TYPE_BLOB;
438 mysql_stmt_fetch_column (stmt,
453 "Resuls contains bogus signature value (fails to decode)\n");
522 results[0].buffer = NULL;
523 results[0].buffer_length = 0;
525 results[0].buffer_type = MYSQL_TYPE_BLOB;
526 results[0].is_null = &rs->
is_null;
557 if (*results->is_null)
559 *(
void **) rs->
dst = NULL;
564 results[0].buffer =
buf;
565 results[0].buffer_length =
size;
566 results[0].buffer_type = MYSQL_TYPE_BLOB;
569 mysql_stmt_fetch_column (stmt,
654 results[0].buffer = rs->
dst;
655 results[0].buffer_length = rs->
dst_size;
657 results[0].buffer_type = MYSQL_TYPE_SHORT;
658 results[0].is_null = &rs->
is_null;
686 if (*results->is_null)
734 results[0].buffer = rs->
dst;
735 results[0].buffer_length = rs->
dst_size;
737 results[0].buffer_type = MYSQL_TYPE_LONG;
738 results[0].is_null = &rs->
is_null;
767 if (*results->is_null)
814 if (
sizeof(uint64_t) != rs->
dst_size)
816 results[0].buffer = rs->
dst;
817 results[0].buffer_length = rs->
dst_size;
819 results[0].buffer_type = MYSQL_TYPE_LONGLONG;
820 results[0].is_null = &rs->
is_null;
846 if (
sizeof(uint64_t) != rs->
dst_size)
848 if (*results->is_null)
static int pre_extract_string(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a Mysql database result at row row.
static void cleanup_varsize_blob(void *cls, struct GNUNET_MY_ResultSpec *rs)
extract data from a Mysql database result at row row
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_uint64(uint64_t *u64)
uint64_t expected.
size_t * result_size
Where to store actual size of the result.
static int post_extract_uint16(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Check size of extracted fixed size data from a Mysql datbase.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at)
Absolute time expected.
static int pre_extract_rsa_public_key(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a Mysql database result at row row.
void * dst
Destination for the data.
unsigned long mysql_bind_output_length
Location where we temporarily store the output buffer length from MySQL.
Time for absolute time used by GNUnet, in microseconds and in network byte order. ...
The public information of an RSA key pair.
static int post_extract_fixed_blob(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Check size of extracted fixed size data from a Mysql database result at row row.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode(const void *buf, size_t buf_size)
Decode the signature from the data-format back to the "normal", internal format.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at)
Absolute time in network byte order expected.
Information we pass to GNUNET_MY_extract_result() to initialize the arguments of the prepared stateme...
static void clean_rsa_signature(void *cls, struct GNUNET_MY_ResultSpec *rs)
Function called to clean up memory allocated by a GNUNET_MY_ResultConverter.
static int pre_extract_fixed_blob(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a Mysql database result at row row.
static int post_extract_string(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Check size of extracted fixed size data from a Mysql database .
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len)
Decode the public key from the data-format back to the "normal", internal format. ...
static int post_extract_rsa_signature(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a Mysql database result at row row.
static int pre_extract_rsa_signature(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a Mysql database result at row row.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_fixed_size(void *ptr, size_t ptr_size)
Fixed-size result expected.
static int pre_extract_uint32(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extrac data from a MYSQL database result at row row.
#define GNUNET_MY_result_spec_auto_from_type(dst)
We expect a fixed-size result, with size determined by the type of * dst
static unsigned int size
Size of the "table".
static int pre_extract_uint16(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a Postgres database result at row row.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_string(char **dst)
0- terminated string exprected.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_uint32(uint32_t *u32)
uint32_t expected
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig)
RSA signature expected.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa)
RSA public key expected.
static int pre_extract_varsize_blob(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
extract data from a Mysql database result at row row
GNUNET_MY_ResultConverter pre_conv
Function to call to initialize the MYSQL_BIND array.
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
static int post_extract_uint64(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Check size of extracted fixe size data from a Mysql database.
static unsigned int results
#define GNUNET_log(kind,...)
size_t dst_size
Allowed size for the data, 0 for variable-size (in this case, the type of dst is a void ** and we nee...
static int post_extract_rsa_public_key(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Check size of extracted fixed size data from a Mysql database result at row row.
static int post_extract_uint32(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extrac data from a MYSQL database result at row row.
void GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key)
Free memory occupied by the public key.
Time for absolute times used by GNUnet, in microseconds.
unsigned int num_fields
How many fields does this result specification occupy in the result returned by MySQL.
static int post_extract_varsize_blob(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
extract data from a Mysql database result at row row
static void clean_rsa_public_key(void *cls, struct GNUNET_MY_ResultSpec *rs)
Function called to clean up memory allocated by a GNUNET_MY_ResultConverter.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_uint16(uint16_t *u16)
uint16_t expected
static int pre_extract_uint64(void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
Extract data from a MYSQL database result at row row.
MYSQL_BOOL is_null
Memory for MySQL to notify us about NULL values.
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_variable_size(void **dst, size_t *ptr_size)
Variable-size result expected.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.