diff options
Diffstat (limited to 'src/include/gnunet_gnsrecord_lib.h')
-rw-r--r-- | src/include/gnunet_gnsrecord_lib.h | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 8b3a6b720..a92cdc2e7 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -100,7 +100,7 @@ extern "C" { | |||
100 | /** | 100 | /** |
101 | * Record type for local ticket references | 101 | * Record type for local ticket references |
102 | */ | 102 | */ |
103 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKETREF 65545 | 103 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET 65545 |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * 65546 reserved | 106 | * 65546 reserved |
@@ -358,8 +358,9 @@ typedef void (*GNUNET_GNSRECORD_RecordCallback) ( | |||
358 | * @param data_size number of bytes in @a data | 358 | * @param data_size number of bytes in @a data |
359 | * @return NULL on error, otherwise human-readable representation of the value | 359 | * @return NULL on error, otherwise human-readable representation of the value |
360 | */ | 360 | */ |
361 | char *GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data, | 361 | char * |
362 | size_t data_size); | 362 | GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data, |
363 | size_t data_size); | ||
363 | 364 | ||
364 | 365 | ||
365 | /** | 366 | /** |
@@ -372,8 +373,9 @@ char *GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data, | |||
372 | * @param data_size set to number of bytes in @a data | 373 | * @param data_size set to number of bytes in @a data |
373 | * @return #GNUNET_OK on success | 374 | * @return #GNUNET_OK on success |
374 | */ | 375 | */ |
375 | int GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data, | 376 | int |
376 | size_t *data_size); | 377 | GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data, |
378 | size_t *data_size); | ||
377 | 379 | ||
378 | 380 | ||
379 | /** | 381 | /** |
@@ -382,7 +384,8 @@ int GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data, | |||
382 | * @param dns_typename name to convert | 384 | * @param dns_typename name to convert |
383 | * @return corresponding number, UINT32_MAX on error | 385 | * @return corresponding number, UINT32_MAX on error |
384 | */ | 386 | */ |
385 | uint32_t GNUNET_GNSRECORD_typename_to_number (const char *dns_typename); | 387 | uint32_t |
388 | GNUNET_GNSRECORD_typename_to_number (const char *dns_typename); | ||
386 | 389 | ||
387 | 390 | ||
388 | /** | 391 | /** |
@@ -391,7 +394,8 @@ uint32_t GNUNET_GNSRECORD_typename_to_number (const char *dns_typename); | |||
391 | * @param type number of a type to convert | 394 | * @param type number of a type to convert |
392 | * @return corresponding typestring, NULL on error | 395 | * @return corresponding typestring, NULL on error |
393 | */ | 396 | */ |
394 | const char *GNUNET_GNSRECORD_number_to_typename (uint32_t type); | 397 | const char * |
398 | GNUNET_GNSRECORD_number_to_typename (uint32_t type); | ||
395 | 399 | ||
396 | 400 | ||
397 | /* convenience APIs for serializing / deserializing GNS records */ | 401 | /* convenience APIs for serializing / deserializing GNS records */ |
@@ -433,9 +437,10 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count, | |||
433 | * @param dest where to put the data | 437 | * @param dest where to put the data |
434 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 438 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
435 | */ | 439 | */ |
436 | int GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src, | 440 | int |
437 | unsigned int rd_count, | 441 | GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src, |
438 | struct GNUNET_GNSRECORD_Data *dest); | 442 | unsigned int rd_count, |
443 | struct GNUNET_GNSRECORD_Data *dest); | ||
439 | 444 | ||
440 | 445 | ||
441 | /* ******* general APIs relating to blocks, records and labels ******** */ | 446 | /* ******* general APIs relating to blocks, records and labels ******** */ |
@@ -448,7 +453,8 @@ int GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src, | |||
448 | * @return #GNUNET_YES if the record is expired, | 453 | * @return #GNUNET_YES if the record is expired, |
449 | * #GNUNET_NO if not | 454 | * #GNUNET_NO if not |
450 | */ | 455 | */ |
451 | int GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd); | 456 | int |
457 | GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd); | ||
452 | 458 | ||
453 | 459 | ||
454 | /** | 460 | /** |
@@ -456,7 +462,8 @@ int GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd); | |||
456 | * @param src source string | 462 | * @param src source string |
457 | * @return converted result | 463 | * @return converted result |
458 | */ | 464 | */ |
459 | char *GNUNET_GNSRECORD_string_to_lowercase (const char *src); | 465 | char * |
466 | GNUNET_GNSRECORD_string_to_lowercase (const char *src); | ||
460 | 467 | ||
461 | 468 | ||
462 | /** | 469 | /** |
@@ -468,7 +475,8 @@ char *GNUNET_GNSRECORD_string_to_lowercase (const char *src); | |||
468 | * @return string form; will be overwritten by next call to | 475 | * @return string form; will be overwritten by next call to |
469 | * #GNUNET_GNSRECORD_z2s. | 476 | * #GNUNET_GNSRECORD_z2s. |
470 | */ | 477 | */ |
471 | const char *GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); | 478 | const char * |
479 | GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); | ||
472 | 480 | ||
473 | 481 | ||
474 | /** | 482 | /** |
@@ -494,8 +502,9 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | |||
494 | * @param pkey set to a public key on the eliptic curve | 502 | * @param pkey set to a public key on the eliptic curve |
495 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax | 503 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax |
496 | */ | 504 | */ |
497 | int GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | 505 | int |
498 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 506 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, |
507 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | ||
499 | 508 | ||
500 | 509 | ||
501 | /** | 510 | /** |
@@ -505,7 +514,8 @@ int GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | |||
505 | * @param label label of the record | 514 | * @param label label of the record |
506 | * @param query hash to use for the query | 515 | * @param query hash to use for the query |
507 | */ | 516 | */ |
508 | void GNUNET_GNSRECORD_query_from_private_key ( | 517 | void |
518 | GNUNET_GNSRECORD_query_from_private_key ( | ||
509 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, | 519 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, |
510 | struct GNUNET_HashCode *query); | 520 | struct GNUNET_HashCode *query); |
511 | 521 | ||
@@ -517,7 +527,8 @@ void GNUNET_GNSRECORD_query_from_private_key ( | |||
517 | * @param label label of the record | 527 | * @param label label of the record |
518 | * @param query hash to use for the query | 528 | * @param query hash to use for the query |
519 | */ | 529 | */ |
520 | void GNUNET_GNSRECORD_query_from_public_key ( | 530 | void |
531 | GNUNET_GNSRECORD_query_from_public_key ( | ||
521 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, | 532 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, |
522 | struct GNUNET_HashCode *query); | 533 | struct GNUNET_HashCode *query); |
523 | 534 | ||
@@ -531,10 +542,12 @@ void GNUNET_GNSRECORD_query_from_public_key ( | |||
531 | * @param rd record data | 542 | * @param rd record data |
532 | * @param rd_count number of records in @a rd | 543 | * @param rd_count number of records in @a rd |
533 | */ | 544 | */ |
534 | struct GNUNET_GNSRECORD_Block *GNUNET_GNSRECORD_block_create ( | 545 | struct GNUNET_GNSRECORD_Block * |
535 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 546 | GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
536 | struct GNUNET_TIME_Absolute expire, const char *label, | 547 | struct GNUNET_TIME_Absolute expire, |
537 | const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count); | 548 | const char *label, |
549 | const struct GNUNET_GNSRECORD_Data *rd, | ||
550 | unsigned int rd_count); | ||
538 | 551 | ||
539 | 552 | ||
540 | /** | 553 | /** |
@@ -548,10 +561,12 @@ struct GNUNET_GNSRECORD_Block *GNUNET_GNSRECORD_block_create ( | |||
548 | * @param rd record data | 561 | * @param rd record data |
549 | * @param rd_count number of records in @a rd | 562 | * @param rd_count number of records in @a rd |
550 | */ | 563 | */ |
551 | struct GNUNET_GNSRECORD_Block *GNUNET_GNSRECORD_block_create2 ( | 564 | struct GNUNET_GNSRECORD_Block * |
552 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 565 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
553 | struct GNUNET_TIME_Absolute expire, const char *label, | 566 | struct GNUNET_TIME_Absolute expire, |
554 | const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count); | 567 | const char *label, |
568 | const struct GNUNET_GNSRECORD_Data *rd, | ||
569 | unsigned int rd_count); | ||
555 | 570 | ||
556 | 571 | ||
557 | /** | 572 | /** |
@@ -561,7 +576,8 @@ struct GNUNET_GNSRECORD_Block *GNUNET_GNSRECORD_block_create2 ( | |||
561 | * @param block block to verify | 576 | * @param block block to verify |
562 | * @return #GNUNET_OK if the signature is valid | 577 | * @return #GNUNET_OK if the signature is valid |
563 | */ | 578 | */ |
564 | int GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); | 579 | int |
580 | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); | ||
565 | 581 | ||
566 | 582 | ||
567 | /** | 583 | /** |
@@ -575,7 +591,8 @@ int GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); | |||
575 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was | 591 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was |
576 | * not well-formed | 592 | * not well-formed |
577 | */ | 593 | */ |
578 | int GNUNET_GNSRECORD_block_decrypt ( | 594 | int |
595 | GNUNET_GNSRECORD_block_decrypt ( | ||
579 | const struct GNUNET_GNSRECORD_Block *block, | 596 | const struct GNUNET_GNSRECORD_Block *block, |
580 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, | 597 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, |
581 | GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); | 598 | GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); |
@@ -588,8 +605,9 @@ int GNUNET_GNSRECORD_block_decrypt ( | |||
588 | * @param b another record | 605 | * @param b another record |
589 | * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not. | 606 | * @return #GNUNET_YES if the records are equal, or #GNUNET_NO if not. |
590 | */ | 607 | */ |
591 | int GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | 608 | int |
592 | const struct GNUNET_GNSRECORD_Data *b); | 609 | GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, |
610 | const struct GNUNET_GNSRECORD_Data *b); | ||
593 | 611 | ||
594 | 612 | ||
595 | /** | 613 | /** |
@@ -601,7 +619,8 @@ int GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | |||
601 | * @param rd array of records | 619 | * @param rd array of records |
602 | * @return absolute expiration time | 620 | * @return absolute expiration time |
603 | */ | 621 | */ |
604 | struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_record_get_expiration_time ( | 622 | struct GNUNET_TIME_Absolute |
623 | GNUNET_GNSRECORD_record_get_expiration_time ( | ||
605 | unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); | 624 | unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd); |
606 | 625 | ||
607 | 626 | ||