diff options
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r-- | src/include/gnunet_common.h | 116 |
1 files changed, 102 insertions, 14 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index fc5cb80d9..880fc1fee 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -655,37 +655,125 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
655 | /* ************************* endianess conversion ****************** */ | 655 | /* ************************* endianess conversion ****************** */ |
656 | 656 | ||
657 | /** | 657 | /** |
658 | * Convert unsigned 64-bit integer to host-byte-order. | 658 | * Convert unsigned 64-bit integer to network byte order. |
659 | * @param n the value in network byte order | 659 | * |
660 | * @return the same value in host byte order | 660 | * @param n |
661 | * The value in host byte order. | ||
662 | * | ||
663 | * @return The same value in network byte order. | ||
661 | */ | 664 | */ |
662 | uint64_t | 665 | uint64_t |
663 | GNUNET_ntohll (uint64_t n); | 666 | GNUNET_htonll (uint64_t n); |
667 | |||
664 | 668 | ||
665 | /** | 669 | /** |
666 | * Convert unsigned 64-bit integer to network-byte-order. | 670 | * Convert unsigned 64-bit integer to host byte order. |
667 | * @param n the value in host byte order | 671 | * |
668 | * @return the same value in network byte order | 672 | * @param n |
673 | * The value in network byte order. | ||
674 | * | ||
675 | * @return The same value in host byte order. | ||
669 | */ | 676 | */ |
670 | uint64_t | 677 | uint64_t |
671 | GNUNET_htonll (uint64_t n); | 678 | GNUNET_ntohll (uint64_t n); |
679 | |||
672 | 680 | ||
673 | /** | 681 | /** |
674 | * Convert double to network-byte-order. | 682 | * Convert double to network byte order. |
675 | * @param d the value in network byte order | 683 | * |
676 | * @return the same value in host byte order | 684 | * @param d |
685 | * The value in network byte order. | ||
686 | * | ||
687 | * @return The same value in host byte order. | ||
677 | */ | 688 | */ |
678 | double | 689 | double |
679 | GNUNET_hton_double (double d); | 690 | GNUNET_hton_double (double d); |
680 | 691 | ||
692 | |||
681 | /** | 693 | /** |
682 | * Convert double to host-byte-order | 694 | * Convert double to host byte order |
683 | * @param d the value in network byte order | 695 | * |
684 | * @return the same value in host byte order | 696 | * @param d |
697 | * The value in network byte order. | ||
698 | * | ||
699 | * @return The same value in host byte order. | ||
685 | */ | 700 | */ |
686 | double | 701 | double |
687 | GNUNET_ntoh_double (double d); | 702 | GNUNET_ntoh_double (double d); |
688 | 703 | ||
704 | |||
705 | /** | ||
706 | * Convert signed 64-bit integer to network byte order. | ||
707 | * | ||
708 | * @param n | ||
709 | * The value in host byte order. | ||
710 | * | ||
711 | * @return The same value in network byte order. | ||
712 | */ | ||
713 | uint64_t | ||
714 | GNUNET_htonll_signed (int64_t n); | ||
715 | |||
716 | |||
717 | /** | ||
718 | * Convert signed 64-bit integer to host byte order. | ||
719 | * | ||
720 | * @param n | ||
721 | * The value in network byte order. | ||
722 | * | ||
723 | * @return The same value in host byte order. | ||
724 | */ | ||
725 | int64_t | ||
726 | GNUNET_ntohll_signed (uint64_t n); | ||
727 | |||
728 | |||
729 | /** | ||
730 | * Convert signed 32-bit integer to network byte order. | ||
731 | * | ||
732 | * @param n | ||
733 | * The value in host byte order. | ||
734 | * | ||
735 | * @return The same value in network byte order. | ||
736 | */ | ||
737 | uint32_t | ||
738 | GNUNET_htonl_signed (int32_t n); | ||
739 | |||
740 | |||
741 | /** | ||
742 | * Convert signed 32-bit integer to host byte order. | ||
743 | * | ||
744 | * @param n | ||
745 | * The value in network byte order. | ||
746 | * | ||
747 | * @return The same value in host byte order. | ||
748 | */ | ||
749 | int32_t | ||
750 | GNUNET_ntohl_signed (uint32_t n); | ||
751 | |||
752 | |||
753 | /** | ||
754 | * Convert signed 16-bit integer to network byte order. | ||
755 | * | ||
756 | * @param n | ||
757 | * The value in host byte order. | ||
758 | * | ||
759 | * @return The same value in network byte order. | ||
760 | */ | ||
761 | uint16_t | ||
762 | GNUNET_htons_signed (int16_t n); | ||
763 | |||
764 | |||
765 | /** | ||
766 | * Convert signed 16-bit integer to host byte order. | ||
767 | * | ||
768 | * @param n | ||
769 | * The value in network byte order. | ||
770 | * | ||
771 | * @return The same value in host byte order. | ||
772 | */ | ||
773 | int16_t | ||
774 | GNUNET_ntohs_signed (uint16_t n); | ||
775 | |||
776 | |||
689 | /* ************************* allocation functions ****************** */ | 777 | /* ************************* allocation functions ****************** */ |
690 | 778 | ||
691 | /** | 779 | /** |