GNUnet  0.10.x
Data Structures | Macros | Typedefs | Functions
gnunet_sq_lib.h File Reference

helper functions for Sqlite3 DB interactions More...

#include <sqlite3.h>
#include "gnunet_util_lib.h"
Include dependency graph for gnunet_sq_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_SQ_QueryParam
 Description of a DB query parameter. More...
 
struct  GNUNET_SQ_ResultSpec
 Description of a DB result cell. More...
 
struct  GNUNET_SQ_PrepareStatement
 Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements(). More...
 
struct  GNUNET_SQ_ExecuteStatement
 Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements(). More...
 

Macros

#define GNUNET_SQ_query_param_end   { NULL, NULL, NULL, 0, 0 }
 End of query parameter specification. More...
 
#define GNUNET_SQ_query_param_auto_from_type(x)   GNUNET_SQ_query_param_fixed_size ((x), sizeof (*(x)))
 Generate fixed-size query parameter with size determined by variable type. More...
 
#define GNUNET_SQ_result_spec_end   { NULL, NULL, NULL, NULL, 0, NULL, 0 }
 End of result parameter specification. More...
 
#define GNUNET_SQ_result_spec_auto_from_type(dst)   GNUNET_SQ_result_spec_fixed_size ((dst), sizeof (*(dst)))
 We expect a fixed-size result, with size determined by the type of * dst More...
 
#define GNUNET_SQ_PREPARE_END   { NULL, NULL }
 Terminator for executable statement list. More...
 
#define GNUNET_SQ_EXECUTE_STATEMENT_END   { NULL, GNUNET_SYSERR }
 Terminator for executable statement list. More...
 

Typedefs

typedef int(* GNUNET_SQ_QueryConverter) (void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
 Function called to convert input argument into SQL parameters. More...
 
typedef int(* GNUNET_SQ_ResultConverter) (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
 Extract data from a Postgres database result at row row. More...
 
typedef void(* GNUNET_SQ_ResultCleanup) (void *cls)
 Function called to clean up memory allocated by a GNUNET_SQ_ResultConverter. More...
 

Functions

struct GNUNET_SQ_QueryParam GNUNET_SQ_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_SQ_QueryParam GNUNET_SQ_query_param_string (const char *ptr)
 Generate query parameter for a string. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x)
 Generate query parameter for an RSA public key. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x)
 Generate query parameter for an RSA signature. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
 Generate query parameter for an absolute time value. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x)
 Generate query parameter for an absolute time value. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint16 (const uint16_t *x)
 Generate query parameter for an uint16_t in host byte order. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint32 (const uint32_t *x)
 Generate query parameter for an uint32_t in host byte order. More...
 
struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint64 (const uint64_t *x)
 Generate query parameter for an uint16_t in host byte order. More...
 
int GNUNET_SQ_bind (sqlite3_stmt *stmt, const struct GNUNET_SQ_QueryParam *params)
 Execute binding operations for a prepared statement. More...
 
void GNUNET_SQ_reset (sqlite3 *dbh, sqlite3_stmt *stmt)
 Reset stmt and log error. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_variable_size (void **dst, size_t *sptr)
 Variable-size result expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_fixed_size (void *dst, size_t dst_size)
 Fixed-size result expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_string (char **dst)
 0-terminated string expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa)
 RSA public key expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig)
 RSA signature expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
 Absolute time expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
 Absolute time expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint16 (uint16_t *u16)
 uint16_t expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint32 (uint32_t *u32)
 uint32_t expected. More...
 
struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint64 (uint64_t *u64)
 uint64_t expected. More...
 
int GNUNET_SQ_extract_result (sqlite3_stmt *result, struct GNUNET_SQ_ResultSpec *rs)
 Extract results from a query result according to the given specification. More...
 
void GNUNET_SQ_cleanup_result (struct GNUNET_SQ_ResultSpec *rs)
 Free all memory that was allocated in rs during GNUNET_SQ_extract_result(). More...
 
struct GNUNET_SQ_PrepareStatement GNUNET_SQ_make_prepare (const char *sql, sqlite3_stmt **pstmt)
 Create a struct GNUNET_SQ_PrepareStatement More...
 
int GNUNET_SQ_prepare (sqlite3 *dbh, const struct GNUNET_SQ_PrepareStatement *ps)
 Prepare all statements given in the (NULL,NULL)-terminated array at ps. More...
 
struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_execute (const char *sql)
 Create a struct GNUNET_SQ_ExecuteStatement where errors are fatal. More...
 
struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_try_execute (const char *sql)
 Create a struct GNUNET_SQ_ExecuteStatement where errors should be tolerated. More...
 
int GNUNET_SQ_exec_statements (sqlite3 *dbh, const struct GNUNET_SQ_ExecuteStatement *es)
 Request execution of an array of statements es from Postgres. More...
 

Detailed Description

helper functions for Sqlite3 DB interactions

Author
Christian Grothoff

Definition in file gnunet_sq_lib.h.

Macro Definition Documentation

◆ GNUNET_SQ_query_param_end

#define GNUNET_SQ_query_param_end   { NULL, NULL, NULL, 0, 0 }

◆ GNUNET_SQ_query_param_auto_from_type

#define GNUNET_SQ_query_param_auto_from_type (   x)    GNUNET_SQ_query_param_fixed_size ((x), sizeof (*(x)))

◆ GNUNET_SQ_result_spec_end

#define GNUNET_SQ_result_spec_end   { NULL, NULL, NULL, NULL, 0, NULL, 0 }

End of result parameter specification.

Returns
array last entry for the result specification to use

Definition at line 301 of file gnunet_sq_lib.h.

Referenced by execute_get(), get_records_and_call_iterator(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_keys(), and sqlite_plugin_get_random().

◆ GNUNET_SQ_result_spec_auto_from_type

#define GNUNET_SQ_result_spec_auto_from_type (   dst)    GNUNET_SQ_result_spec_fixed_size ((dst), sizeof (*(dst)))

We expect a fixed-size result, with size determined by the type of * dst

Parameters
dstpoint to where to store the result, type fits expected result size
Returns
array entry for the result specification to use

Definition at line 334 of file gnunet_sq_lib.h.

Referenced by execute_get(), get_records_and_call_iterator(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get_closest(), sqlite_plugin_get_keys(), and sqlite_plugin_get_random().

◆ GNUNET_SQ_PREPARE_END

#define GNUNET_SQ_PREPARE_END   { NULL, NULL }

Terminator for executable statement list.

Definition at line 479 of file gnunet_sq_lib.h.

Referenced by database_setup().

◆ GNUNET_SQ_EXECUTE_STATEMENT_END

#define GNUNET_SQ_EXECUTE_STATEMENT_END   { NULL, GNUNET_SYSERR }

Terminator for executable statement list.

Definition at line 533 of file gnunet_sq_lib.h.

Referenced by database_setup().

Typedef Documentation

◆ GNUNET_SQ_QueryConverter

typedef int(* GNUNET_SQ_QueryConverter) (void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)

Function called to convert input argument into SQL parameters.

Parameters
clsclosure
datapointer to input argument
data_lennumber of bytes in data (if applicable)
stmtsqlite statement to bind parameters for
offoffset of the argument to bind in stmt, numbered from 1, so immediately suitable for passing to sqlite3_bind-functions.
Returns
GNUNET_SYSERR on error, GNUNET_OK on success

Definition at line 44 of file gnunet_sq_lib.h.

◆ GNUNET_SQ_ResultConverter

typedef int(* GNUNET_SQ_ResultConverter) (void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)

Extract data from a Postgres database result at row row.

Parameters
clsclosure
resultwhere to extract data from
columncolumn to extract data from
[in,out]dst_sizewhere to store size of result, may be NULL
[out]dstwhere to store the result
Returns
GNUNET_YES if all results could be extracted GNUNET_SYSERR if a result was invalid (non-existing field or NULL)

Definition at line 224 of file gnunet_sq_lib.h.

◆ GNUNET_SQ_ResultCleanup

typedef void(* GNUNET_SQ_ResultCleanup) (void *cls)

Function called to clean up memory allocated by a GNUNET_SQ_ResultConverter.

Parameters
clsclosure

Definition at line 244 of file gnunet_sq_lib.h.

Function Documentation

◆ GNUNET_SQ_query_param_fixed_size()

struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_fixed_size ( const void *  ptr,
size_t  ptr_size 
)

Generate query parameter for a buffer ptr of ptr_size bytes.

Parameters
ptrpointer to the query parameter to pass ptr_size number of bytes in ptr

Definition at line 66 of file sq_query_helper.c.

References bind_fixed_blob(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::size.

Referenced by namecache_sqlite_cache_block(), namestore_sqlite_store_records(), peerstore_sqlite_store_record(), sqlite_plugin_put(), and sqlite_plugin_remove_key().

68 {
69  struct GNUNET_SQ_QueryParam qp = {
71  .data = ptr,
72  .size = ptr_size,
73  .num_params = 1
74  };
75  return qp;
76 }
static int bind_fixed_blob(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_query_param_string()

struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_string ( const char *  ptr)

Generate query parameter for a string.

Parameters
ptrpointer to the string query parameter to pass

Definition at line 122 of file sq_query_helper.c.

References bind_string(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.

Referenced by namestore_sqlite_lookup_records(), namestore_sqlite_store_records(), peerstore_sqlite_delete_records(), peerstore_sqlite_iterate_records(), and peerstore_sqlite_store_record().

123 {
124  struct GNUNET_SQ_QueryParam qp = {
125  .conv = &bind_string,
126  .data = ptr,
127  .num_params = 1
128  };
129  return qp;
130 }
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
static int bind_string(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_query_param_rsa_public_key()

struct GNUNET_SQ_QueryParam GNUNET_SQ_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.

Parameters
xthe query parameter to pass.

Definition at line 180 of file sq_query_helper.c.

References bind_rsa_pub(), and GNUNET_SQ_QueryParam::conv.

181 {
182  struct GNUNET_SQ_QueryParam qp = {
183  .conv = &bind_rsa_pub,
184  .data = x,
185  .num_params = 1
186  };
187  return qp;
188 }
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
static int bind_rsa_pub(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:

◆ GNUNET_SQ_query_param_rsa_signature()

struct GNUNET_SQ_QueryParam GNUNET_SQ_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.

Parameters
xthe query parameter to pass

Definition at line 238 of file sq_query_helper.c.

References bind_rsa_sig(), and GNUNET_SQ_QueryParam::conv.

239 {
240  struct GNUNET_SQ_QueryParam qp = {
241  .conv = &bind_rsa_sig,
242  .data = x,
243  .num_params = 1
244  };
245  return qp;
246 }
static int bind_rsa_sig(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:

◆ GNUNET_SQ_query_param_absolute_time()

struct GNUNET_SQ_QueryParam GNUNET_SQ_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.

Parameters
xpointer to the query parameter to pass

Definition at line 290 of file sq_query_helper.c.

References bind_abstime(), and GNUNET_SQ_QueryParam::conv.

Referenced by namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), peerstore_sqlite_expire_records(), peerstore_sqlite_store_record(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), and sqlite_plugin_put().

291 {
292  struct GNUNET_SQ_QueryParam qp = {
293  .conv = &bind_abstime,
294  .data = x,
295  .size = sizeof (struct GNUNET_TIME_Absolute),
296  .num_params = 1
297  };
298  return qp;
299 }
static int bind_abstime(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Time for absolute times used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_query_param_absolute_time_nbo()

struct GNUNET_SQ_QueryParam GNUNET_SQ_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.

Parameters
xpointer to the query parameter to pass

Definition at line 343 of file sq_query_helper.c.

References bind_nbotime(), and GNUNET_SQ_QueryParam::conv.

344 {
345  struct GNUNET_SQ_QueryParam qp = {
346  .conv = &bind_nbotime,
347  .data = x,
348  .size = sizeof (struct GNUNET_TIME_AbsoluteNBO),
349  .num_params = 1
350  };
351  return qp;
352 }
Time for absolute time used by GNUnet, in microseconds and in network byte order. ...
static int bind_nbotime(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:

◆ GNUNET_SQ_query_param_uint16()

struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint16 ( const uint16_t *  x)

Generate query parameter for an uint16_t in host byte order.

Parameters
xpointer to the query parameter to pass

Definition at line 391 of file sq_query_helper.c.

References bind_u16(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.

392 {
393  struct GNUNET_SQ_QueryParam qp = {
394  .conv = &bind_u16,
395  .data = x,
396  .size = sizeof (uint16_t),
397  .num_params = 1
398  };
399  return qp;
400 }
static int bind_u16(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
unsigned int num_params
Number of parameters eaten by this operation.
Definition: gnunet_sq_lib.h:80
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:

◆ GNUNET_SQ_query_param_uint32()

struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint32 ( const uint32_t *  x)

Generate query parameter for an uint32_t in host byte order.

Parameters
xpointer to the query parameter to pass

Definition at line 438 of file sq_query_helper.c.

References bind_u32(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.

Referenced by namestore_sqlite_store_records(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_key(), sqlite_plugin_get_random(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), and sqlite_plugin_put().

439 {
440  struct GNUNET_SQ_QueryParam qp = {
441  .conv = &bind_u32,
442  .data = x,
443  .size = sizeof (uint32_t),
444  .num_params = 1
445  };
446  return qp;
447 }
unsigned int num_params
Number of parameters eaten by this operation.
Definition: gnunet_sq_lib.h:80
static int bind_u32(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_query_param_uint64()

struct GNUNET_SQ_QueryParam GNUNET_SQ_query_param_uint64 ( const uint64_t *  x)

Generate query parameter for an uint16_t in host byte order.

Parameters
xpointer to the query parameter to pass

Definition at line 486 of file sq_query_helper.c.

References bind_u64(), GNUNET_SQ_QueryParam::conv, and GNUNET_SQ_QueryParam::num_params.

Referenced by delete_by_rowid(), namestore_sqlite_iterate_records(), namestore_sqlite_store_records(), sqlite_plugin_del(), sqlite_plugin_get_key(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), and sqlite_plugin_put().

487 {
488  struct GNUNET_SQ_QueryParam qp = {
489  .conv = &bind_u64,
490  .data = x,
491  .size = sizeof (uint64_t),
492  .num_params = 1
493  };
494  return qp;
495 }
unsigned int num_params
Number of parameters eaten by this operation.
Definition: gnunet_sq_lib.h:80
static int bind_u64(void *cls, const void *data, size_t data_len, sqlite3_stmt *stmt, unsigned int off)
Function called to convert input argument into SQL parameters.
Description of a DB query parameter.
Definition: gnunet_sq_lib.h:54
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_bind()

int GNUNET_SQ_bind ( sqlite3_stmt *  stmt,
const struct GNUNET_SQ_QueryParam params 
)

Execute binding operations for a prepared statement.

Parameters
db_conndatabase connection
paramsparameters to the statement
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Execute binding operations for a prepared statement.

Parameters
db_conndatabase connection
paramsparameters to the statement
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 37 of file sq.c.

References _, GNUNET_SQ_QueryParam::conv, conv, data, GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log_from, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_QueryParam::num_params, and size.

Referenced by delete_by_rowid(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namecache_sqlite_lookup_block(), namestore_sqlite_iterate_records(), namestore_sqlite_lookup_records(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), peerstore_sqlite_delete_records(), peerstore_sqlite_expire_records(), peerstore_sqlite_iterate_records(), peerstore_sqlite_store_record(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), sqlite_plugin_get_key(), sqlite_plugin_get_random(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), sqlite_plugin_put(), and sqlite_plugin_remove_key().

39 {
40  unsigned int j;
41 
42  j = 1;
43  for (unsigned int i=0;NULL != params[i].conv; i++)
44  {
45  if (GNUNET_OK !=
46  params[i].conv (params[i].conv_cls,
47  params[i].data,
48  params[i].size,
49  stmt,
50  j))
51  {
53  "sq",
54  _("Failure to bind %u-th SQL parameter\n"),
55  i);
56  if (SQLITE_OK !=
57  sqlite3_reset (stmt))
58  {
60  "sq",
61  _("Failure in sqlite3_reset (!)\n"));
62  return GNUNET_SYSERR;
63  }
64  }
65  GNUNET_assert (0 != params[i].num_params);
66  j += params[i].num_params;
67  }
68  return GNUNET_OK;
69 }
static GstElement * conv
unsigned int num_params
Number of parameters eaten by this operation.
Definition: gnunet_sq_lib.h:80
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
void * conv_cls
Closure for conv.
Definition: gnunet_sq_lib.h:65
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static unsigned int size
Size of the "table".
Definition: peer.c:67
GNUNET_SQ_QueryConverter conv
Function for how to handle this type of entry.
Definition: gnunet_sq_lib.h:60
#define GNUNET_log_from(kind, comp,...)
uint32_t data
The data value.
Here is the caller graph for this function:

◆ GNUNET_SQ_reset()

void GNUNET_SQ_reset ( sqlite3 *  dbh,
sqlite3_stmt *  stmt 
)

Reset stmt and log error.

Parameters
dbhdatabase handle
stmtstatement to reset

Definition at line 132 of file sq.c.

References _, GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_ERROR, and GNUNET_log_from.

Referenced by delete_by_rowid(), execute_get(), get_records_and_call_iterator(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namecache_sqlite_lookup_block(), namestore_sqlite_iterate_records(), namestore_sqlite_lookup_records(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), peerstore_sqlite_delete_records(), peerstore_sqlite_expire_records(), peerstore_sqlite_iterate_records(), peerstore_sqlite_store_record(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_random(), sqlite_plugin_get_replication(), sqlite_plugin_put(), and sqlite_plugin_remove_key().

134 {
135  if (SQLITE_OK !=
136  sqlite3_reset (stmt))
138  "sqlite",
139  _("Failed to reset sqlite statement with error: %s\n"),
140  sqlite3_errmsg (dbh));
141 }
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
#define GNUNET_log_from(kind, comp,...)
Here is the caller graph for this function:

◆ GNUNET_SQ_result_spec_variable_size()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_variable_size ( void **  dst,
size_t *  sptr 
)

Variable-size result expected.

Parameters
[out]dstwhere to store the result, allocated
[out]sptrwhere to store the size of dst
Returns
array entry for the result specification to use

Definition at line 120 of file sq_result_helper.c.

References clean_var_blob(), GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, and extract_var_blob().

Referenced by execute_get(), get_records_and_call_iterator(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), and sqlite_plugin_get_random().

122 {
123  struct GNUNET_SQ_ResultSpec rs = {
125  .cleaner = &clean_var_blob,
126  .dst = dst,
127  .cls = dst,
128  .result_size = sptr,
129  .num_params = 1
130  };
131 
132  return rs;
133 }
static void clean_var_blob(void *cls)
Cleanup memory allocated by extract_var_blob().
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
static int extract_var_blob(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract variable-sized binary data from a Postgres database result at row row.
void * dst
Destination for the data.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_result_spec_fixed_size()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_fixed_size ( void *  dst,
size_t  dst_size 
)

Fixed-size result expected.

Parameters
[out]dstwhere to store the result
dst_sizenumber of bytes in dst
Returns
array entry for the result specification to use

Definition at line 199 of file sq_result_helper.c.

References GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, GNUNET_SQ_ResultSpec::dst_size, and extract_fixed_blob().

201 {
202  struct GNUNET_SQ_ResultSpec rs = {
204  .dst = dst,
205  .dst_size = dst_size,
206  .num_params = 1
207  };
208 
209  return rs;
210 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
void * dst
Destination for the data.
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 extract_fixed_blob(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract fixed-sized binary data from a Postgres database result at row row.
Here is the call graph for this function:

◆ GNUNET_SQ_result_spec_string()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_string ( char **  dst)

0-terminated string expected.

Parameters
[out]dstwhere to store the result, allocated
Returns
array entry for the result specification to use

Definition at line 289 of file sq_result_helper.c.

References clean_utf8_string(), GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst, and extract_utf8_string().

Referenced by get_records_and_call_iterator(), and peerstore_sqlite_iterate_records().

290 {
291  struct GNUNET_SQ_ResultSpec rs = {
293  .cleaner = &clean_utf8_string,
294  .cls = dst,
295  .dst = dst,
296  .num_params = 1
297  };
298 
299  return rs;
300 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
void * dst
Destination for the data.
static void clean_utf8_string(void *cls)
Cleanup memory allocated by extract_var_blob().
static int extract_utf8_string(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract fixed-sized binary data from a Postgres database result at row row.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_result_spec_rsa_public_key()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_public_key ( struct GNUNET_CRYPTO_RsaPublicKey **  rsa)

RSA public key expected.

Parameters
[out]rsawhere to store the result
Returns
array entry for the result specification to use

Definition at line 382 of file sq_result_helper.c.

References clean_rsa_pub(), GNUNET_SQ_ResultSpec::conv, and extract_rsa_pub().

383 {
384  struct GNUNET_SQ_ResultSpec rs = {
385  .conv = &extract_rsa_pub,
386  .cleaner = &clean_rsa_pub,
387  .dst = rsa,
388  .cls = rsa,
389  .num_params = 1
390  };
391 
392  return rs;
393 }
static void clean_rsa_pub(void *cls)
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
static int extract_rsa_pub(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract data from a Postgres database result at row row.
Here is the call graph for this function:

◆ GNUNET_SQ_result_spec_rsa_signature()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_rsa_signature ( struct GNUNET_CRYPTO_RsaSignature **  sig)

RSA signature expected.

Parameters
[out]sigwhere to store the result;
Returns
array entry for the result specification to use

Definition at line 475 of file sq_result_helper.c.

References clean_rsa_sig(), GNUNET_SQ_ResultSpec::conv, and extract_rsa_sig().

476 {
477  struct GNUNET_SQ_ResultSpec rs = {
478  .conv = &extract_rsa_sig,
479  .cleaner = &clean_rsa_sig,
480  .dst = sig,
481  .cls = sig,
482  .num_params = 1
483  };
484 
485  return rs;
486 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
static void clean_rsa_sig(void *cls)
Function called to clean up memory allocated by a GNUNET_PQ_ResultConverter.
static int extract_rsa_sig(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract data from a Postgres database result at row row.
Here is the call graph for this function:

◆ GNUNET_SQ_result_spec_absolute_time()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time ( struct GNUNET_TIME_Absolute at)

Absolute time expected.

Parameters
[out]atwhere to store the result
Returns
array entry for the result specification to use

Definition at line 535 of file sq_result_helper.c.

References GNUNET_SQ_ResultSpec::conv, and extract_abs_time().

Referenced by execute_get(), peerstore_sqlite_iterate_records(), sqlite_plugin_get(), sqlite_plugin_get_closest(), and sqlite_plugin_get_random().

536 {
537  struct GNUNET_SQ_ResultSpec rs = {
539  .dst = at,
540  .dst_size = sizeof (struct GNUNET_TIME_Absolute),
541  .num_params = 1
542  };
543 
544  return rs;
545 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
static int extract_abs_time(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract absolute time value from a Postgres database result at row row.
Time for absolute times used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_result_spec_absolute_time_nbo()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_absolute_time_nbo ( struct GNUNET_TIME_AbsoluteNBO at)

Absolute time expected.

Parameters
[out]atwhere to store the result
Returns
array entry for the result specification to use

Definition at line 594 of file sq_result_helper.c.

References GNUNET_SQ_ResultSpec::conv, and extract_abs_time_nbo().

595 {
596  struct GNUNET_SQ_ResultSpec rs = {
598  .dst = at,
599  .dst_size = sizeof (struct GNUNET_TIME_AbsoluteNBO),
600  .num_params = 1
601  };
602 
603  return rs;
604 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
Time for absolute time used by GNUnet, in microseconds and in network byte order. ...
static int extract_abs_time_nbo(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract absolute time value in NBO from a Postgres database result at row row.
Here is the call graph for this function:

◆ GNUNET_SQ_result_spec_uint16()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint16 ( uint16_t *  u16)

uint16_t expected.

Parameters
[out]u16where to store the result
Returns
array entry for the result specification to use

Definition at line 656 of file sq_result_helper.c.

References GNUNET_SQ_ResultSpec::conv, extract_uint16(), and GNUNET_SQ_ResultSpec::num_params.

657 {
658  struct GNUNET_SQ_ResultSpec rs = {
659  .conv = &extract_uint16,
660  .dst = u16,
661  .dst_size = sizeof (uint16_t),
662  .num_params = 1
663  };
664 
665  return rs;
666 }
static int extract_uint16(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract 16-bit integer from a Postgres database result at row row.
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
unsigned int num_params
Number of parameters (columns) eaten by this operation.
Here is the call graph for this function:

◆ GNUNET_SQ_result_spec_uint32()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint32 ( uint32_t *  u32)

uint32_t expected.

Parameters
[out]u32where to store the result
Returns
array entry for the result specification to use

Definition at line 718 of file sq_result_helper.c.

References GNUNET_SQ_ResultSpec::conv, extract_uint32(), and GNUNET_SQ_ResultSpec::num_params.

Referenced by execute_get(), get_records_and_call_iterator(), sqlite_plugin_get_closest(), and sqlite_plugin_get_random().

719 {
720  struct GNUNET_SQ_ResultSpec rs = {
721  .conv = &extract_uint32,
722  .dst = u32,
723  .dst_size = sizeof (uint32_t),
724  .num_params = 1
725  };
726 
727  return rs;
728 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
unsigned int num_params
Number of parameters (columns) eaten by this operation.
static int extract_uint32(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract 32-bit integer from a Postgres database result at row row.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_result_spec_uint64()

struct GNUNET_SQ_ResultSpec GNUNET_SQ_result_spec_uint64 ( uint64_t *  u64)

uint64_t expected.

Parameters
[out]u64where to store the result
Returns
array entry for the result specification to use

Definition at line 773 of file sq_result_helper.c.

References GNUNET_SQ_ResultSpec::conv, extract_uint64(), and GNUNET_SQ_ResultSpec::num_params.

Referenced by execute_get(), get_records_and_call_iterator(), and sqlite_plugin_del().

774 {
775  struct GNUNET_SQ_ResultSpec rs = {
776  .conv = &extract_uint64,
777  .dst = u64,
778  .dst_size = sizeof (uint64_t),
779  .num_params = 1
780  };
781 
782  return rs;
783 }
Description of a DB result cell.
GNUNET_SQ_ResultConverter conv
What is the format of the result?
static int extract_uint64(void *cls, sqlite3_stmt *result, unsigned int column, size_t *dst_size, void *dst)
Extract 64-bit integer from a Postgres database result at row row.
unsigned int num_params
Number of parameters (columns) eaten by this operation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SQ_extract_result()

int GNUNET_SQ_extract_result ( sqlite3_stmt *  result,
struct GNUNET_SQ_ResultSpec rs 
)

Extract results from a query result according to the given specification.

Parameters
resultresult to process
[in,out]rsresult specification to extract for
Returns
GNUNET_OK if all results could be extracted GNUNET_SYSERR if a result was invalid (non-existing field)

Definition at line 82 of file sq.c.

References GNUNET_SQ_ResultSpec::cleaner, conv, GNUNET_SQ_ResultSpec::conv, GNUNET_SQ_ResultSpec::dst_size, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_ResultSpec::num_params, and GNUNET_SQ_ResultSpec::result_size.

Referenced by execute_get(), get_records_and_call_iterator(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), sqlite_plugin_get_keys(), and sqlite_plugin_get_random().

84 {
85  unsigned int j = 0;
86 
87  for (unsigned int i=0;NULL != rs[i].conv; i++)
88  {
89  if (NULL == rs[i].result_size)
90  rs[i].result_size = &rs[i].dst_size;
91  if (GNUNET_OK !=
92  rs[i].conv (rs[i].cls,
93  result,
94  j,
95  rs[i].result_size,
96  rs[i].dst))
97  {
98  for (unsigned int k=0;k<i;k++)
99  if (NULL != rs[k].cleaner)
100  rs[k].cleaner (rs[k].cls);
101  return GNUNET_SYSERR;
102  }
103  GNUNET_assert (0 != rs[i].num_params);
104  j += rs[i].num_params;
105  }
106  return GNUNET_OK;
107 }
static GstElement * conv
GNUNET_SQ_ResultConverter conv
What is the format of the result?
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void * cls
Closure for conv and cleaner.
GNUNET_SQ_ResultCleanup cleaner
Function to clean up result data, NULL if cleanup is not necessary.
unsigned int num_params
Number of parameters (columns) eaten by this operation.
static int result
Global testing status.
void * dst
Destination for the data.
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...
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
size_t * result_size
Where to store actual size of the result.
Here is the caller graph for this function:

◆ GNUNET_SQ_cleanup_result()

void GNUNET_SQ_cleanup_result ( struct GNUNET_SQ_ResultSpec rs)

Free all memory that was allocated in rs during GNUNET_SQ_extract_result().

Parameters
rsreult specification to clean up

Definition at line 117 of file sq.c.

References GNUNET_SQ_ResultSpec::cleaner, and GNUNET_SQ_ResultSpec::conv.

Referenced by execute_get(), get_records_and_call_iterator(), namecache_sqlite_lookup_block(), peerstore_sqlite_iterate_records(), sqlite_plugin_del(), sqlite_plugin_get(), sqlite_plugin_get_closest(), and sqlite_plugin_get_random().

118 {
119  for (unsigned int i=0;NULL != rs[i].conv; i++)
120  if (NULL != rs[i].cleaner)
121  rs[i].cleaner (rs[i].cls);
122 }
GNUNET_SQ_ResultConverter conv
What is the format of the result?
void * cls
Closure for conv and cleaner.
GNUNET_SQ_ResultCleanup cleaner
Function to clean up result data, NULL if cleanup is not necessary.
Here is the caller graph for this function:

◆ GNUNET_SQ_make_prepare()

struct GNUNET_SQ_PrepareStatement GNUNET_SQ_make_prepare ( const char *  sql,
sqlite3_stmt **  pstmt 
)

Create a struct GNUNET_SQ_PrepareStatement

Parameters
sqlactual SQL statement
pstmtwhere to store the handle
Returns
initialized struct

Definition at line 37 of file sq_prepare.c.

References GNUNET_SQ_PrepareStatement::pstmt, and GNUNET_SQ_PrepareStatement::sql.

Referenced by database_setup().

39 {
40  struct GNUNET_SQ_PrepareStatement ps = {
41  .sql = sql,
42  .pstmt = pstmt
43  };
44 
45  return ps;
46 }
Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements().
const char * sql
Actual SQL statement.
sqlite3_stmt ** pstmt
Where to store handle?
Here is the caller graph for this function:

◆ GNUNET_SQ_prepare()

int GNUNET_SQ_prepare ( sqlite3 *  dbh,
const struct GNUNET_SQ_PrepareStatement ps 
)

Prepare all statements given in the (NULL,NULL)-terminated array at ps.

Parameters
dbhdatabase handle
psarray of statements to prepare
Returns
GNUNET_OK on success
Parameters
dbhdatabase to use
psarray of statements to prepare
Returns
GNUNET_OK on success

Definition at line 59 of file sq_prepare.c.

References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_PrepareStatement::pstmt, ret, and GNUNET_SQ_PrepareStatement::sql.

Referenced by database_setup().

61 {
62  for (unsigned int i=0;NULL != ps[i].sql;i++)
63  {
64  const char *epos = NULL;
65  int ret;
66 
67  if (SQLITE_OK !=
68  (ret = sqlite3_prepare_v2 (dbh,
69  ps[i].sql,
70  strlen (ps[i].sql),
71  ps[i].pstmt,
72  &epos)))
73  {
75  "Failed to prepare SQL `%s': error %d at %s\n",
76  ps[i].sql,
77  ret,
78  epos);
79  return GNUNET_SYSERR;
80  }
81  }
82  return GNUNET_OK;
83 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static int ret
Final status code.
Definition: gnunet-arm.c:89
const char * sql
Actual SQL statement.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#define GNUNET_log(kind,...)
sqlite3_stmt ** pstmt
Where to store handle?
Here is the caller graph for this function:

◆ GNUNET_SQ_make_execute()

struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_execute ( const char *  sql)

Create a struct GNUNET_SQ_ExecuteStatement where errors are fatal.

Parameters
sqlactual SQL statement
Returns
initialized struct

Definition at line 36 of file sq_exec.c.

References GNUNET_NO, and GNUNET_SQ_ExecuteStatement::sql.

Referenced by database_setup().

37  {
38  struct GNUNET_SQ_ExecuteStatement es = {
39  .sql = sql,
40  .ignore_errors = GNUNET_NO
41  };
42 
43  return es;
44 }
#define GNUNET_NO
Definition: gnunet_common.h:81
Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements().
const char * sql
Actual SQL statement.
Here is the caller graph for this function:

◆ GNUNET_SQ_make_try_execute()

struct GNUNET_SQ_ExecuteStatement GNUNET_SQ_make_try_execute ( const char *  sql)

Create a struct GNUNET_SQ_ExecuteStatement where errors should be tolerated.

Parameters
sqlactual SQL statement
Returns
initialized struct

Definition at line 56 of file sq_exec.c.

References GNUNET_YES, and GNUNET_SQ_ExecuteStatement::sql.

Referenced by database_setup().

57 {
58  struct GNUNET_SQ_ExecuteStatement es = {
59  .sql = sql,
60  .ignore_errors = GNUNET_YES
61  };
62 
63  return es;
64 }
Information needed to run a list of SQL statements using GNUNET_SQ_exec_statements().
const char * sql
Actual SQL statement.
#define GNUNET_YES
Definition: gnunet_common.h:80
Here is the caller graph for this function:

◆ GNUNET_SQ_exec_statements()

int GNUNET_SQ_exec_statements ( sqlite3 *  dbh,
const struct GNUNET_SQ_ExecuteStatement es 
)

Request execution of an array of statements es from Postgres.

Parameters
dbhdatabase to execute the statements over
esGNUNET_PQ_PREPARED_STATEMENT_END-terminated array of prepared statements.
Returns
GNUNET_OK on success (modulo statements where errors can be ignored) GNUNET_SYSERR on error

Definition at line 77 of file sq_exec.c.

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, GNUNET_SQ_ExecuteStatement::ignore_errors, and GNUNET_SQ_ExecuteStatement::sql.

Referenced by database_setup().

79 {
80  for (unsigned int i=0;NULL != es[i].sql;i++)
81  {
82  char *emsg = NULL;
83 
84  if (SQLITE_OK !=
85  sqlite3_exec (dbh,
86  es[i].sql,
87  NULL,
88  NULL,
89  &emsg))
90  {
91  if (es[i].ignore_errors)
92  {
94  "Failed to run SQL `%s': %s\n",
95  es[i].sql,
96  emsg);
97  }
98  else
99  {
101  "Failed to run SQL `%s': %s\n",
102  es[i].sql,
103  emsg);
104  sqlite3_free (emsg);
105  return GNUNET_SYSERR;
106  }
107  sqlite3_free (emsg);
108  }
109  }
110  return GNUNET_OK;
111 }
int ignore_errors
Should we ignore errors?
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
const char * sql
Actual SQL statement.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#define GNUNET_log(kind,...)
Here is the caller graph for this function: