diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-01 16:23:32 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-01 16:23:38 +0200 |
commit | 372516f77ac66e86663a61604bcdb776bcb6de9d (patch) | |
tree | f466ea4397b32c6bae3fd2a07adb6b06f33c084e /src/include | |
parent | af249ea5cef757a1e2b34cd2754febdb24a34416 (diff) | |
download | gnunet-372516f77ac66e86663a61604bcdb776bcb6de9d.tar.gz gnunet-372516f77ac66e86663a61604bcdb776bcb6de9d.zip |
0 for absolute time is special, and should be treated as such in JSON generation
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_json_lib.h | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 144ddb64a..92f696e08 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h | |||
@@ -556,7 +556,7 @@ struct GNUNET_JSON_PackSpec | |||
556 | * Object to pack. | 556 | * Object to pack. |
557 | */ | 557 | */ |
558 | json_t *object; | 558 | json_t *object; |
559 | 559 | ||
560 | /** | 560 | /** |
561 | * True if a NULL (or 0) argument is allowed. In this | 561 | * True if a NULL (or 0) argument is allowed. In this |
562 | * case, if the argument is NULL the @e packer should | 562 | * case, if the argument is NULL the @e packer should |
@@ -586,7 +586,8 @@ GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]); | |||
586 | * @return JSON object | 586 | * @return JSON object |
587 | */ | 587 | */ |
588 | #define GNUNET_JSON_PACK(...) \ | 588 | #define GNUNET_JSON_PACK(...) \ |
589 | GNUNET_JSON_pack_ ((struct GNUNET_JSON_PackSpec[]) {__VA_ARGS__, GNUNET_JSON_pack_end_ ()}) | 589 | GNUNET_JSON_pack_ ((struct GNUNET_JSON_PackSpec[]) {__VA_ARGS__, \ |
590 | GNUNET_JSON_pack_end_ ()}) | ||
590 | 591 | ||
591 | 592 | ||
592 | /** | 593 | /** |
@@ -595,12 +596,12 @@ GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]); | |||
595 | * @return array terminator | 596 | * @return array terminator |
596 | */ | 597 | */ |
597 | struct GNUNET_JSON_PackSpec | 598 | struct GNUNET_JSON_PackSpec |
598 | GNUNET_JSON_pack_end_(void); | 599 | GNUNET_JSON_pack_end_ (void); |
599 | 600 | ||
600 | 601 | ||
601 | /** | 602 | /** |
602 | * Modify packer instruction to allow NULL as a value. | 603 | * Modify packer instruction to allow NULL as a value. |
603 | * | 604 | * |
604 | * @param in json pack specification to modify | 605 | * @param in json pack specification to modify |
605 | * @return json pack specification | 606 | * @return json pack specification |
606 | */ | 607 | */ |
@@ -611,7 +612,7 @@ GNUNET_JSON_pack_allow_null (struct GNUNET_JSON_PackSpec in); | |||
611 | /** | 612 | /** |
612 | * Generate packer instruction for a JSON field of type | 613 | * Generate packer instruction for a JSON field of type |
613 | * bool. | 614 | * bool. |
614 | * | 615 | * |
615 | * @param name name of the field to add to the object | 616 | * @param name name of the field to add to the object |
616 | * @param b boolean value | 617 | * @param b boolean value |
617 | * @return json pack specification | 618 | * @return json pack specification |
@@ -624,7 +625,7 @@ GNUNET_JSON_pack_bool (const char *name, | |||
624 | /** | 625 | /** |
625 | * Generate packer instruction for a JSON field of type | 626 | * Generate packer instruction for a JSON field of type |
626 | * string. | 627 | * string. |
627 | * | 628 | * |
628 | * @param name name of the field to add to the object | 629 | * @param name name of the field to add to the object |
629 | * @param s string value | 630 | * @param s string value |
630 | * @return json pack specification | 631 | * @return json pack specification |
@@ -636,9 +637,9 @@ GNUNET_JSON_pack_string (const char *name, | |||
636 | 637 | ||
637 | /** | 638 | /** |
638 | * Generate packer instruction for a JSON field of type | 639 | * Generate packer instruction for a JSON field of type |
639 | * unsigned integer. Note that the maximum allowed | 640 | * unsigned integer. Note that the maximum allowed |
640 | * value is still limited by JSON and not UINT64_MAX. | 641 | * value is still limited by JSON and not UINT64_MAX. |
641 | * | 642 | * |
642 | * @param name name of the field to add to the object | 643 | * @param name name of the field to add to the object |
643 | * @param num numeric value | 644 | * @param num numeric value |
644 | * @return json pack specification | 645 | * @return json pack specification |
@@ -651,21 +652,21 @@ GNUNET_JSON_pack_uint64 (const char *name, | |||
651 | /** | 652 | /** |
652 | * Generate packer instruction for a JSON field of type | 653 | * Generate packer instruction for a JSON field of type |
653 | * signed integer. | 654 | * signed integer. |
654 | * | 655 | * |
655 | * @param name name of the field to add to the object | 656 | * @param name name of the field to add to the object |
656 | * @param num numeric value | 657 | * @param num numeric value |
657 | * @return json pack specification | 658 | * @return json pack specification |
658 | */ | 659 | */ |
659 | struct GNUNET_JSON_PackSpec | 660 | struct GNUNET_JSON_PackSpec |
660 | GNUNET_JSON_pack_int64 (const char *name, | 661 | GNUNET_JSON_pack_int64 (const char *name, |
661 | int64_t num); | 662 | int64_t num); |
662 | 663 | ||
663 | 664 | ||
664 | /** | 665 | /** |
665 | * Generate packer instruction for a JSON field of type | 666 | * Generate packer instruction for a JSON field of type |
666 | * JSON object where the reference is taken over by | 667 | * JSON object where the reference is taken over by |
667 | * the packer. | 668 | * the packer. |
668 | * | 669 | * |
669 | * @param name name of the field to add to the object | 670 | * @param name name of the field to add to the object |
670 | * @param o object to steal | 671 | * @param o object to steal |
671 | * @return json pack specification | 672 | * @return json pack specification |
@@ -679,7 +680,7 @@ GNUNET_JSON_pack_object_steal (const char *name, | |||
679 | * Generate packer instruction for a JSON field of type JSON object where the | 680 | * Generate packer instruction for a JSON field of type JSON object where the |
680 | * reference counter is incremented by the packer. Note that a deep copy is | 681 | * reference counter is incremented by the packer. Note that a deep copy is |
681 | * not performed. | 682 | * not performed. |
682 | * | 683 | * |
683 | * @param name name of the field to add to the object | 684 | * @param name name of the field to add to the object |
684 | * @param o object to increment reference counter of | 685 | * @param o object to increment reference counter of |
685 | * @return json pack specification | 686 | * @return json pack specification |
@@ -693,7 +694,7 @@ GNUNET_JSON_pack_object_incref (const char *name, | |||
693 | * Generate packer instruction for a JSON field of type | 694 | * Generate packer instruction for a JSON field of type |
694 | * JSON array where the reference is taken over by | 695 | * JSON array where the reference is taken over by |
695 | * the packer. | 696 | * the packer. |
696 | * | 697 | * |
697 | * @param name name of the field to add to the object | 698 | * @param name name of the field to add to the object |
698 | * @param a array to steal | 699 | * @param a array to steal |
699 | * @return json pack specification | 700 | * @return json pack specification |
@@ -707,7 +708,7 @@ GNUNET_JSON_pack_array_steal (const char *name, | |||
707 | * Generate packer instruction for a JSON field of type JSON array where the | 708 | * Generate packer instruction for a JSON field of type JSON array where the |
708 | * reference counter is incremented by the packer. Note that a deep copy is | 709 | * reference counter is incremented by the packer. Note that a deep copy is |
709 | * not performed. | 710 | * not performed. |
710 | * | 711 | * |
711 | * @param name name of the field to add to the object | 712 | * @param name name of the field to add to the object |
712 | * @param a array to increment reference counter of | 713 | * @param a array to increment reference counter of |
713 | * @return json pack specification | 714 | * @return json pack specification |
@@ -720,7 +721,7 @@ GNUNET_JSON_pack_array_incref (const char *name, | |||
720 | /** | 721 | /** |
721 | * Generate packer instruction for a JSON field of type | 722 | * Generate packer instruction for a JSON field of type |
722 | * variable size binary blob. | 723 | * variable size binary blob. |
723 | * | 724 | * |
724 | * @param name name of the field to add to the object | 725 | * @param name name of the field to add to the object |
725 | * @param blob binary data to pack | 726 | * @param blob binary data to pack |
726 | * @param blob_size number of bytes in @a blob | 727 | * @param blob_size number of bytes in @a blob |
@@ -735,7 +736,7 @@ GNUNET_JSON_pack_data_varsize (const char *name, | |||
735 | /** | 736 | /** |
736 | * Generate packer instruction for a JSON field where the | 737 | * Generate packer instruction for a JSON field where the |
737 | * size is automatically determined from the argument. | 738 | * size is automatically determined from the argument. |
738 | * | 739 | * |
739 | * @param name name of the field to add to the object | 740 | * @param name name of the field to add to the object |
740 | * @param blob data to pack, must not be an array | 741 | * @param blob data to pack, must not be an array |
741 | * @return json pack specification | 742 | * @return json pack specification |
@@ -749,7 +750,8 @@ GNUNET_JSON_pack_data_varsize (const char *name, | |||
749 | * absolute time. | 750 | * absolute time. |
750 | * | 751 | * |
751 | * @param name name of the field to add to the object | 752 | * @param name name of the field to add to the object |
752 | * @param at absolute time to pack | 753 | * @param at absolute time to pack, a value of 0 is only |
754 | * allowed with #GNUNET_JSON_pack_allow_null()! | ||
753 | * @return json pack specification | 755 | * @return json pack specification |
754 | */ | 756 | */ |
755 | struct GNUNET_JSON_PackSpec | 757 | struct GNUNET_JSON_PackSpec |
@@ -762,7 +764,8 @@ GNUNET_JSON_pack_time_abs (const char *name, | |||
762 | * absolute time in network byte order. | 764 | * absolute time in network byte order. |
763 | * | 765 | * |
764 | * @param name name of the field to add to the object | 766 | * @param name name of the field to add to the object |
765 | * @param at absolute time to pack | 767 | * @param at absolute time to pack, a value of 0 is only |
768 | * allowed with #GNUNET_JSON_pack_allow_null()! | ||
766 | * @return json pack specification | 769 | * @return json pack specification |
767 | */ | 770 | */ |
768 | struct GNUNET_JSON_PackSpec | 771 | struct GNUNET_JSON_PackSpec |
@@ -799,7 +802,7 @@ GNUNET_JSON_pack_time_rel_nbo (const char *name, | |||
799 | /** | 802 | /** |
800 | * Generate packer instruction for a JSON field of type | 803 | * Generate packer instruction for a JSON field of type |
801 | * RSA public key. | 804 | * RSA public key. |
802 | * | 805 | * |
803 | * @param name name of the field to add to the object | 806 | * @param name name of the field to add to the object |
804 | * @param pk RSA public key | 807 | * @param pk RSA public key |
805 | * @return json pack specification | 808 | * @return json pack specification |
@@ -812,7 +815,7 @@ GNUNET_JSON_pack_rsa_public_key (const char *name, | |||
812 | /** | 815 | /** |
813 | * Generate packer instruction for a JSON field of type | 816 | * Generate packer instruction for a JSON field of type |
814 | * RSA signature. | 817 | * RSA signature. |
815 | * | 818 | * |
816 | * @param name name of the field to add to the object | 819 | * @param name name of the field to add to the object |
817 | * @param sig RSA signature | 820 | * @param sig RSA signature |
818 | * @return json pack specification | 821 | * @return json pack specification |