diff options
Diffstat (limited to 'src/include/gnunet_my_lib.h')
-rw-r--r-- | src/include/gnunet_my_lib.h | 75 |
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 | ||
84 | struct GNUNET_MY_QueryParam { | 84 | struct 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 | */ |
131 | struct GNUNET_MY_QueryParam | 132 | struct GNUNET_MY_QueryParam |
132 | GNUNET_MY_query_param_fixed_size(const void *ptr, | 133 | GNUNET_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 | */ |
144 | int | 145 | int |
145 | GNUNET_MY_exec_prepared(struct GNUNET_MYSQL_Context *mc, | 146 | GNUNET_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 | */ |
194 | struct GNUNET_MY_ResultSpec { | 195 | struct 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 | */ |
267 | struct GNUNET_MY_ResultSpec | 269 | struct GNUNET_MY_ResultSpec |
268 | GNUNET_MY_result_spec_fixed_size(void *ptr, | 270 | GNUNET_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 | */ |
276 | struct GNUNET_MY_QueryParam | 278 | struct GNUNET_MY_QueryParam |
277 | GNUNET_MY_query_param_string(const char *ptr); | 279 | GNUNET_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 | */ |
294 | struct GNUNET_MY_QueryParam | 297 | struct GNUNET_MY_QueryParam |
295 | GNUNET_MY_query_param_rsa_public_key(const struct GNUNET_CRYPTO_RsaPublicKey *x); | 298 | GNUNET_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 | */ |
304 | struct GNUNET_MY_QueryParam | 308 | struct GNUNET_MY_QueryParam |
305 | GNUNET_MY_query_param_rsa_signature(const struct GNUNET_CRYPTO_RsaSignature *x); | 309 | GNUNET_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 | */ |
314 | struct GNUNET_MY_QueryParam | 319 | struct GNUNET_MY_QueryParam |
315 | GNUNET_MY_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x); | 320 | GNUNET_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 | */ |
324 | struct GNUNET_MY_QueryParam | 329 | struct GNUNET_MY_QueryParam |
325 | GNUNET_MY_query_param_absolute_time_nbo(const struct GNUNET_TIME_AbsoluteNBO *x); | 330 | GNUNET_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 | */ |
332 | struct GNUNET_MY_QueryParam | 338 | struct GNUNET_MY_QueryParam |
333 | GNUNET_MY_query_param_uint16(const uint16_t *x); | 339 | GNUNET_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 | */ |
340 | struct GNUNET_MY_QueryParam | 346 | struct GNUNET_MY_QueryParam |
341 | GNUNET_MY_query_param_uint32(const uint32_t *x); | 347 | GNUNET_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 | */ |
348 | struct GNUNET_MY_QueryParam | 354 | struct GNUNET_MY_QueryParam |
349 | GNUNET_MY_query_param_uint64(const uint64_t *x); | 355 | GNUNET_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 | */ |
368 | struct GNUNET_MY_ResultSpec | 375 | struct GNUNET_MY_ResultSpec |
369 | GNUNET_MY_result_spec_variable_size(void **dst, | 376 | GNUNET_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 | */ |
379 | struct GNUNET_MY_ResultSpec | 386 | struct GNUNET_MY_ResultSpec |
380 | GNUNET_MY_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa); | 387 | GNUNET_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 | */ |
389 | struct GNUNET_MY_ResultSpec | 396 | struct GNUNET_MY_ResultSpec |
390 | GNUNET_MY_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig); | 397 | GNUNET_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 | */ |
398 | struct GNUNET_MY_ResultSpec | 405 | struct GNUNET_MY_ResultSpec |
399 | GNUNET_MY_result_spec_string(char **dst); | 406 | GNUNET_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 | */ |
408 | struct GNUNET_MY_ResultSpec | 415 | struct GNUNET_MY_ResultSpec |
409 | GNUNET_MY_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at); | 416 | GNUNET_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 | */ |
417 | struct GNUNET_MY_ResultSpec | 424 | struct GNUNET_MY_ResultSpec |
418 | GNUNET_MY_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at); | 425 | GNUNET_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 | */ |
426 | struct GNUNET_MY_ResultSpec | 433 | struct GNUNET_MY_ResultSpec |
427 | GNUNET_MY_result_spec_uint16(uint16_t *u16); | 434 | GNUNET_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 | */ |
435 | struct GNUNET_MY_ResultSpec | 442 | struct GNUNET_MY_ResultSpec |
436 | GNUNET_MY_result_spec_uint32(uint32_t *u32); | 443 | GNUNET_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 | */ |
444 | struct GNUNET_MY_ResultSpec | 451 | struct GNUNET_MY_ResultSpec |
445 | GNUNET_MY_result_spec_uint64(uint64_t *u64); | 452 | GNUNET_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 | */ |
459 | int | 466 | int |
460 | GNUNET_MY_extract_result(struct GNUNET_MYSQL_StatementHandle *sh, | 467 | GNUNET_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 | */ |
471 | void | 478 | void |
472 | GNUNET_MY_cleanup_query(struct GNUNET_MY_QueryParam *qp, | 479 | GNUNET_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 | */ |
482 | void | 489 | void |
483 | GNUNET_MY_cleanup_result(struct GNUNET_MY_ResultSpec *rs); | 490 | GNUNET_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 */ |