diff options
author | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-05-20 15:29:50 +0000 |
---|---|---|
committer | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-05-20 15:29:50 +0000 |
commit | bbd7f90332fa9df514cb14bb24f2187c78db432a (patch) | |
tree | 56b40d3e810c61e7aecb325109bf80ed64e8a808 /src/include/gnunet_my_lib.h | |
parent | 81224501b6a9483907571508460e41617643050f (diff) | |
download | gnunet-bbd7f90332fa9df514cb14bb24f2187c78db432a.tar.gz gnunet-bbd7f90332fa9df514cb14bb24f2187c78db432a.zip |
libgnunetmy query helper
Diffstat (limited to 'src/include/gnunet_my_lib.h')
-rw-r--r-- | src/include/gnunet_my_lib.h | 79 |
1 files changed, 78 insertions, 1 deletions
diff --git a/src/include/gnunet_my_lib.h b/src/include/gnunet_my_lib.h index 9a26022c8..8d60bf78c 100644 --- a/src/include/gnunet_my_lib.h +++ b/src/include/gnunet_my_lib.h | |||
@@ -120,7 +120,6 @@ struct GNUNET_MY_QueryParam | |||
120 | GNUNET_MY_query_param_fixed_size (const void *ptr, | 120 | GNUNET_MY_query_param_fixed_size (const void *ptr, |
121 | size_t ptr_size); | 121 | size_t ptr_size); |
122 | 122 | ||
123 | |||
124 | /** | 123 | /** |
125 | * Run a prepared SELECT statement. | 124 | * Run a prepared SELECT statement. |
126 | * | 125 | * |
@@ -212,6 +211,84 @@ struct GNUNET_MY_ResultSpec | |||
212 | GNUNET_MY_result_spec_fixed_size (void *ptr, | 211 | GNUNET_MY_result_spec_fixed_size (void *ptr, |
213 | size_t ptr_size); | 212 | size_t ptr_size); |
214 | 213 | ||
214 | /** | ||
215 | * Generate query parameter for a string | ||
216 | * | ||
217 | *@param ptr pointer to the string query parameter to pass | ||
218 | */ | ||
219 | struct GNUNET_MY_QueryParam | ||
220 | GNUNET_MY_query_param_string (const char *ptr); | ||
221 | |||
222 | /** | ||
223 | * Generate fixed-size query parameter with size determined | ||
224 | * by variable type. | ||
225 | * | ||
226 | * @param x pointer to the query parameter to pass | ||
227 | */ | ||
228 | #define GNUNET_MY_query_param_auto_from_type(x) GNUNET_MY_query_param_fixed_size ((x), sizeof (*(x))) | ||
229 | |||
230 | /** | ||
231 | * Generate query parameter for an RSA public key. The | ||
232 | * database must contain a BLOB type in the respective position. | ||
233 | * | ||
234 | * @param x the query parameter to pass | ||
235 | * @return array entry for the query parameters to use | ||
236 | */ | ||
237 | struct GNUNET_MY_QueryParam | ||
238 | GNUNET_MY_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x); | ||
239 | |||
240 | /** | ||
241 | * Generate query parameter for an RSA signature. The | ||
242 | * database must contain a BLOB type in the respective position | ||
243 | * | ||
244 | *@param x the query parameter to pass | ||
245 | *@return array entry for the query parameters to use | ||
246 | */ | ||
247 | struct GNUNET_MY_QueryParam | ||
248 | GNUNET_MY_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x); | ||
249 | |||
250 | /** | ||
251 | * Generate query parameter for an absolute time value. | ||
252 | * The database must store a 64-bit integer. | ||
253 | * | ||
254 | *@param x pointer to the query parameter to pass | ||
255 | *@return array entry for the query parameters to use | ||
256 | */ | ||
257 | struct GNUNET_MY_QueryParam | ||
258 | GNUNET_MY_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x); | ||
259 | |||
260 | /** | ||
261 | * Generate query parameter for an absolute time value. | ||
262 | * The database must store a 64-bit integer. | ||
263 | * | ||
264 | *@param x pointer to the query parameter to pass | ||
265 | */ | ||
266 | struct GNUNET_MY_QueryParam | ||
267 | GNUNET_MY_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x); | ||
268 | |||
269 | /** | ||
270 | * Generate query parameter for an uint16_t in host byte order. | ||
271 | * | ||
272 | * @param x pointer to the query parameter to pass | ||
273 | */ | ||
274 | struct GNUNET_MY_QueryParam | ||
275 | GNUNET_MY_query_param_uint16 (const uint16_t *x); | ||
276 | |||
277 | /** | ||
278 | * Generate query parameter for an uint32_t in host byte order | ||
279 | * | ||
280 | *@param x pointer to the query parameter to pass | ||
281 | */ | ||
282 | struct GNUNET_MY_QueryParam | ||
283 | GNUNET_MY_query_param_uint32 (const uint32_t *x); | ||
284 | |||
285 | /** | ||
286 | * Generate query parameter for an uint64_t in host byte order | ||
287 | * | ||
288 | *@param x pointer to the query parameter to pass | ||
289 | */ | ||
290 | struct GNUNET_MY_QueryParam | ||
291 | GNUNET_MY_query_param_uint64 (const uint64_t *x); | ||
215 | 292 | ||
216 | /** | 293 | /** |
217 | * We expect a fixed-size result, with size determined by the type of `* dst` | 294 | * We expect a fixed-size result, with size determined by the type of `* dst` |