summaryrefslogtreecommitdiff
path: root/src/include/gnunet_my_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_my_lib.h')
-rw-r--r--src/include/gnunet_my_lib.h75
1 files changed, 41 insertions, 34 deletions
diff --git a/src/include/gnunet_my_lib.h b/src/include/gnunet_my_lib.h
index 1805c2795..04dddeb92 100644
--- a/src/include/gnunet_my_lib.h
+++ b/src/include/gnunet_my_lib.h
@@ -81,7 +81,8 @@ typedef void
81 */ 81 */
82 82
83 83
84struct GNUNET_MY_QueryParam { 84struct GNUNET_MY_QueryParam
85{
85 /** 86 /**
86 * Function to call for the type conversion. 87 * Function to call for the type conversion.
87 */ 88 */
@@ -129,8 +130,8 @@ struct GNUNET_MY_QueryParam {
129 * @oaran ptr_size number of bytes in @a ptr 130 * @oaran ptr_size number of bytes in @a ptr
130 */ 131 */
131struct GNUNET_MY_QueryParam 132struct GNUNET_MY_QueryParam
132GNUNET_MY_query_param_fixed_size(const void *ptr, 133GNUNET_MY_query_param_fixed_size (const void *ptr,
133 size_t ptr_size); 134 size_t ptr_size);
134 135
135 136
136/** 137/**
@@ -142,9 +143,9 @@ GNUNET_MY_query_param_fixed_size(const void *ptr,
142 * @return TBD 143 * @return TBD
143 */ 144 */
144int 145int
145GNUNET_MY_exec_prepared(struct GNUNET_MYSQL_Context *mc, 146GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc,
146 struct GNUNET_MYSQL_StatementHandle *sh, 147 struct GNUNET_MYSQL_StatementHandle *sh,
147 struct GNUNET_MY_QueryParam *params); 148 struct GNUNET_MY_QueryParam *params);
148 149
149 150
150/** 151/**
@@ -191,7 +192,8 @@ typedef void
191 * Information we pass to #GNUNET_MY_extract_result() to 192 * Information we pass to #GNUNET_MY_extract_result() to
192 * initialize the arguments of the prepared statement. 193 * initialize the arguments of the prepared statement.
193 */ 194 */
194struct GNUNET_MY_ResultSpec { 195struct GNUNET_MY_ResultSpec
196{
195 /** 197 /**
196 * Function to call to initialize the MYSQL_BIND array. 198 * Function to call to initialize the MYSQL_BIND array.
197 */ 199 */
@@ -265,8 +267,8 @@ struct GNUNET_MY_ResultSpec {
265 * @oaran ptr_size number of bytes available at @a ptr 267 * @oaran ptr_size number of bytes available at @a ptr
266 */ 268 */
267struct GNUNET_MY_ResultSpec 269struct GNUNET_MY_ResultSpec
268GNUNET_MY_result_spec_fixed_size(void *ptr, 270GNUNET_MY_result_spec_fixed_size (void *ptr,
269 size_t ptr_size); 271 size_t ptr_size);
270 272
271/** 273/**
272 * Generate query parameter for a string 274 * Generate query parameter for a string
@@ -274,7 +276,7 @@ GNUNET_MY_result_spec_fixed_size(void *ptr,
274 *@param ptr pointer to the string query parameter to pass 276 *@param ptr pointer to the string query parameter to pass
275 */ 277 */
276struct GNUNET_MY_QueryParam 278struct GNUNET_MY_QueryParam
277GNUNET_MY_query_param_string(const char *ptr); 279GNUNET_MY_query_param_string (const char *ptr);
278 280
279/** 281/**
280 * Generate fixed-size query parameter with size determined 282 * Generate fixed-size query parameter with size determined
@@ -282,7 +284,8 @@ GNUNET_MY_query_param_string(const char *ptr);
282 * 284 *
283 * @param x pointer to the query parameter to pass 285 * @param x pointer to the query parameter to pass
284 */ 286 */
285#define GNUNET_MY_query_param_auto_from_type(x) GNUNET_MY_query_param_fixed_size((x), sizeof(*(x))) 287#define GNUNET_MY_query_param_auto_from_type( \
288 x) GNUNET_MY_query_param_fixed_size ((x), sizeof(*(x)))
286 289
287/** 290/**
288 * Generate query parameter for an RSA public key. The 291 * Generate query parameter for an RSA public key. The
@@ -292,7 +295,8 @@ GNUNET_MY_query_param_string(const char *ptr);
292 * @return array entry for the query parameters to use 295 * @return array entry for the query parameters to use
293 */ 296 */
294struct GNUNET_MY_QueryParam 297struct GNUNET_MY_QueryParam
295GNUNET_MY_query_param_rsa_public_key(const struct GNUNET_CRYPTO_RsaPublicKey *x); 298GNUNET_MY_query_param_rsa_public_key (const struct
299 GNUNET_CRYPTO_RsaPublicKey *x);
296 300
297/** 301/**
298 * Generate query parameter for an RSA signature. The 302 * Generate query parameter for an RSA signature. The
@@ -302,7 +306,8 @@ GNUNET_MY_query_param_rsa_public_key(const struct GNUNET_CRYPTO_RsaPublicKey *x)
302 *@return array entry for the query parameters to use 306 *@return array entry for the query parameters to use
303 */ 307 */
304struct GNUNET_MY_QueryParam 308struct GNUNET_MY_QueryParam
305GNUNET_MY_query_param_rsa_signature(const struct GNUNET_CRYPTO_RsaSignature *x); 309GNUNET_MY_query_param_rsa_signature (const struct
310 GNUNET_CRYPTO_RsaSignature *x);
306 311
307/** 312/**
308 * Generate query parameter for an absolute time value. 313 * Generate query parameter for an absolute time value.
@@ -312,7 +317,7 @@ GNUNET_MY_query_param_rsa_signature(const struct GNUNET_CRYPTO_RsaSignature *x);
312 *@return array entry for the query parameters to use 317 *@return array entry for the query parameters to use
313 */ 318 */
314struct GNUNET_MY_QueryParam 319struct GNUNET_MY_QueryParam
315GNUNET_MY_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x); 320GNUNET_MY_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x);
316 321
317 322
318/** 323/**
@@ -322,7 +327,8 @@ GNUNET_MY_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x);
322 *@param x pointer to the query parameter to pass 327 *@param x pointer to the query parameter to pass
323 */ 328 */
324struct GNUNET_MY_QueryParam 329struct GNUNET_MY_QueryParam
325GNUNET_MY_query_param_absolute_time_nbo(const struct GNUNET_TIME_AbsoluteNBO *x); 330GNUNET_MY_query_param_absolute_time_nbo (const struct
331 GNUNET_TIME_AbsoluteNBO *x);
326 332
327/** 333/**
328 * Generate query parameter for an uint16_t in host byte order. 334 * Generate query parameter for an uint16_t in host byte order.
@@ -330,7 +336,7 @@ GNUNET_MY_query_param_absolute_time_nbo(const struct GNUNET_TIME_AbsoluteNBO *x)
330 * @param x pointer to the query parameter to pass 336 * @param x pointer to the query parameter to pass
331 */ 337 */
332struct GNUNET_MY_QueryParam 338struct GNUNET_MY_QueryParam
333GNUNET_MY_query_param_uint16(const uint16_t *x); 339GNUNET_MY_query_param_uint16 (const uint16_t *x);
334 340
335/** 341/**
336 * Generate query parameter for an uint32_t in host byte order 342 * Generate query parameter for an uint32_t in host byte order
@@ -338,7 +344,7 @@ GNUNET_MY_query_param_uint16(const uint16_t *x);
338 *@param x pointer to the query parameter to pass 344 *@param x pointer to the query parameter to pass
339 */ 345 */
340struct GNUNET_MY_QueryParam 346struct GNUNET_MY_QueryParam
341GNUNET_MY_query_param_uint32(const uint32_t *x); 347GNUNET_MY_query_param_uint32 (const uint32_t *x);
342 348
343/** 349/**
344 * Generate query parameter for an uint64_t in host byte order 350 * Generate query parameter for an uint64_t in host byte order
@@ -346,7 +352,7 @@ GNUNET_MY_query_param_uint32(const uint32_t *x);
346 *@param x pointer to the query parameter to pass 352 *@param x pointer to the query parameter to pass
347 */ 353 */
348struct GNUNET_MY_QueryParam 354struct GNUNET_MY_QueryParam
349GNUNET_MY_query_param_uint64(const uint64_t *x); 355GNUNET_MY_query_param_uint64 (const uint64_t *x);
350 356
351/** 357/**
352 * We expect a fixed-size result, with size determined by the type of `* dst` 358 * We expect a fixed-size result, with size determined by the type of `* dst`
@@ -355,7 +361,8 @@ GNUNET_MY_query_param_uint64(const uint64_t *x);
355 * @spec dst point to where to store the result, type fits expected result size 361 * @spec dst point to where to store the result, type fits expected result size
356 * @return array entry for the result specification to use 362 * @return array entry for the result specification to use
357 */ 363 */
358#define GNUNET_MY_result_spec_auto_from_type(dst) GNUNET_MY_result_spec_fixed_size((dst), sizeof(*(dst))) 364#define GNUNET_MY_result_spec_auto_from_type( \
365 dst) GNUNET_MY_result_spec_fixed_size ((dst), sizeof(*(dst)))
359 366
360 367
361/** 368/**
@@ -366,8 +373,8 @@ GNUNET_MY_query_param_uint64(const uint64_t *x);
366 * @return array entru for the result specification to use 373 * @return array entru for the result specification to use
367 */ 374 */
368struct GNUNET_MY_ResultSpec 375struct GNUNET_MY_ResultSpec
369GNUNET_MY_result_spec_variable_size(void **dst, 376GNUNET_MY_result_spec_variable_size (void **dst,
370 size_t *ptr_size); 377 size_t *ptr_size);
371 378
372/** 379/**
373 * RSA public key expected 380 * RSA public key expected
@@ -377,7 +384,7 @@ GNUNET_MY_result_spec_variable_size(void **dst,
377 * @return array entry for the result specification to use 384 * @return array entry for the result specification to use
378 */ 385 */
379struct GNUNET_MY_ResultSpec 386struct GNUNET_MY_ResultSpec
380GNUNET_MY_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa); 387GNUNET_MY_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa);
381 388
382 389
383/** 390/**
@@ -387,7 +394,7 @@ GNUNET_MY_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa);
387 * @return array entry for the result specification to use 394 * @return array entry for the result specification to use
388 */ 395 */
389struct GNUNET_MY_ResultSpec 396struct GNUNET_MY_ResultSpec
390GNUNET_MY_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig); 397GNUNET_MY_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig);
391 398
392/** 399/**
393 * 0- terminated string exprected. 400 * 0- terminated string exprected.
@@ -396,7 +403,7 @@ GNUNET_MY_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig);
396 * @return array entry for the result specification to use 403 * @return array entry for the result specification to use
397 */ 404 */
398struct GNUNET_MY_ResultSpec 405struct GNUNET_MY_ResultSpec
399GNUNET_MY_result_spec_string(char **dst); 406GNUNET_MY_result_spec_string (char **dst);
400 407
401/** 408/**
402 * Absolute time expected 409 * Absolute time expected
@@ -406,7 +413,7 @@ GNUNET_MY_result_spec_string(char **dst);
406 * @return array entry for the result specification to use 413 * @return array entry for the result specification to use
407 */ 414 */
408struct GNUNET_MY_ResultSpec 415struct GNUNET_MY_ResultSpec
409GNUNET_MY_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at); 416GNUNET_MY_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at);
410 417
411/** 418/**
412 * Absolute time in network byte order expected 419 * Absolute time in network byte order expected
@@ -415,7 +422,7 @@ GNUNET_MY_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at);
415 * @return array entry for the result specification to use 422 * @return array entry for the result specification to use
416 */ 423 */
417struct GNUNET_MY_ResultSpec 424struct GNUNET_MY_ResultSpec
418GNUNET_MY_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at); 425GNUNET_MY_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at);
419 426
420/** 427/**
421 * uint16_t expected 428 * uint16_t expected
@@ -424,7 +431,7 @@ GNUNET_MY_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at);
424 * @return array entry for the result specification to use 431 * @return array entry for the result specification to use
425 */ 432 */
426struct GNUNET_MY_ResultSpec 433struct GNUNET_MY_ResultSpec
427GNUNET_MY_result_spec_uint16(uint16_t *u16); 434GNUNET_MY_result_spec_uint16 (uint16_t *u16);
428 435
429/** 436/**
430 * uint32_t expected 437 * uint32_t expected
@@ -433,7 +440,7 @@ GNUNET_MY_result_spec_uint16(uint16_t *u16);
433 * @return array entry for the result specification to use 440 * @return array entry for the result specification to use
434 */ 441 */
435struct GNUNET_MY_ResultSpec 442struct GNUNET_MY_ResultSpec
436GNUNET_MY_result_spec_uint32(uint32_t *u32); 443GNUNET_MY_result_spec_uint32 (uint32_t *u32);
437 444
438/** 445/**
439 * uint64_t expected. 446 * uint64_t expected.
@@ -442,7 +449,7 @@ GNUNET_MY_result_spec_uint32(uint32_t *u32);
442 * @return array entry for the result specification to use 449 * @return array entry for the result specification to use
443 */ 450 */
444struct GNUNET_MY_ResultSpec 451struct GNUNET_MY_ResultSpec
445GNUNET_MY_result_spec_uint64(uint64_t *u64); 452GNUNET_MY_result_spec_uint64 (uint64_t *u64);
446 453
447 454
448/** 455/**
@@ -457,8 +464,8 @@ GNUNET_MY_result_spec_uint64(uint64_t *u64);
457 * #GNUNET_SYSERR if a result was invalid 464 * #GNUNET_SYSERR if a result was invalid
458 */ 465 */
459int 466int
460GNUNET_MY_extract_result(struct GNUNET_MYSQL_StatementHandle *sh, 467GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh,
461 struct GNUNET_MY_ResultSpec *specs); 468 struct GNUNET_MY_ResultSpec *specs);
462 469
463 470
464/** 471/**
@@ -469,8 +476,8 @@ GNUNET_MY_extract_result(struct GNUNET_MYSQL_StatementHandle *sh,
469 * @param qbind mysql query 476 * @param qbind mysql query
470 */ 477 */
471void 478void
472GNUNET_MY_cleanup_query(struct GNUNET_MY_QueryParam *qp, 479GNUNET_MY_cleanup_query (struct GNUNET_MY_QueryParam *qp,
473 MYSQL_BIND *qbind); 480 MYSQL_BIND *qbind);
474 481
475 482
476/** 483/**
@@ -480,7 +487,7 @@ GNUNET_MY_cleanup_query(struct GNUNET_MY_QueryParam *qp,
480 * @param rs reult specification to clean up 487 * @param rs reult specification to clean up
481 */ 488 */
482void 489void
483GNUNET_MY_cleanup_result(struct GNUNET_MY_ResultSpec *rs); 490GNUNET_MY_cleanup_result (struct GNUNET_MY_ResultSpec *rs);
484 491
485 492
486#if 0 /* keep Emacsens' auto-indent happy */ 493#if 0 /* keep Emacsens' auto-indent happy */