GNUnet  0.10.x
Data Structures | Macros | Typedefs | Functions
gnunet_my_lib.h File Reference
#include "gnunet_util_lib.h"
#include "gnunet_mysql_lib.h"
#include <mysql/mysql.h>
Include dependency graph for gnunet_my_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_MY_QueryParam
 Information we pass to GNUNET_MY_exec_prepared() to initialize the arguments of the prepared statement. More...
 
struct  GNUNET_MY_ResultSpec
 Information we pass to GNUNET_MY_extract_result() to initialize the arguments of the prepared statement. More...
 

Macros

#define GNUNET_MY_query_param_end   { NULL, NULL, NULL, 0, NULL, 0 }
 End of query parameter specification. More...
 
#define GNUNET_MY_result_spec_end   { NULL, NULL, NULL, 0, NULL, 0, 0 }
 End of result speceter specification. More...
 
#define GNUNET_MY_query_param_auto_from_type(x)   GNUNET_MY_query_param_fixed_size ((x), sizeof (*(x)))
 Generate fixed-size query parameter with size determined by variable type. More...
 
#define GNUNET_MY_result_spec_auto_from_type(dst)   GNUNET_MY_result_spec_fixed_size ((dst), sizeof (*(dst)))
 We expect a fixed-size result, with size determined by the type of * dst More...
 

Typedefs

typedef int(* GNUNET_MY_QueryConverter) (void *cls, const struct GNUNET_MY_QueryParam *qp, MYSQL_BIND *qbind)
 Function called to convert input argument into SQL parameters. More...
 
typedef void(* GNUNET_MY_QueryCleanup) (void *cls, MYSQL_BIND *qbind)
 Function called to cleanup result data. More...
 
typedef int(* GNUNET_MY_ResultConverter) (void *cls, struct GNUNET_MY_ResultSpec *rs, MYSQL_STMT *stmt, unsigned int column, MYSQL_BIND *results)
 Function called to convert input argument into SQL parameters. More...
 
typedef void(* GNUNET_MY_ResultCleanup) (void *cls, struct GNUNET_MY_ResultSpec *rs)
 Function called to cleanup result data. More...
 

Functions

struct GNUNET_MY_QueryParam GNUNET_MY_query_param_fixed_size (const void *ptr, size_t ptr_size)
 Generate query parameter for a buffer ptr of ptr_size bytes.FG. More...
 
int GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, struct GNUNET_MYSQL_StatementHandle *sh, struct GNUNET_MY_QueryParam *params)
 Run a prepared SELECT statement. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_fixed_size (void *ptr, size_t ptr_size)
 Obtain fixed size result of ptr_size bytes from MySQL, store in already allocated buffer at ptr. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_string (const char *ptr)
 Generate query parameter for a string. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x)
 Generate query parameter for an RSA public key. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x)
 Generate query parameter for an RSA signature. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
 Generate query parameter for an absolute time value. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x)
 Generate query parameter for an absolute time value. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_uint16 (const uint16_t *x)
 Generate query parameter for an uint16_t in host byte order. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_uint32 (const uint32_t *x)
 Generate query parameter for an uint32_t in host byte order. More...
 
struct GNUNET_MY_QueryParam GNUNET_MY_query_param_uint64 (const uint64_t *x)
 Generate query parameter for an uint64_t in host byte order. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_variable_size (void **dst, size_t *ptr_size)
 Variable-size result expected. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa)
 RSA public key expected. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig)
 RSA signature expected. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_string (char **dst)
 0- terminated string exprected. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
 Absolute time expected. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
 Absolute time in network byte order expected. More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_uint16 (uint16_t *u16)
 uint16_t expected More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_uint32 (uint32_t *u32)
 uint32_t expected More...
 
struct GNUNET_MY_ResultSpec GNUNET_MY_result_spec_uint64 (uint64_t *u64)
 uint64_t expected. More...
 
int GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, struct GNUNET_MY_ResultSpec *specs)
 Extract results from a query result according to the given specification. More...
 
void GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp, MYSQL_BIND *qbind)
 Free all memory that was allocated in qp during #GNUNET_MY_exect_prepared(). More...
 
void GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs)
 Free all memory that was allocated in rs during GNUNET_MY_extract_result(). More...
 

Detailed Description

Author
Christian Grothoff
Christophe Genevey

Helper library to access a MySQL database

Definition in file gnunet_my_lib.h.