aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_common.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2015-05-07 12:15:24 +0000
committerGabor X Toth <*@tg-x.net>2015-05-07 12:15:24 +0000
commit26dbd65eff8dc627697a1ee5c3b755c2951ac013 (patch)
tree386c078b0fda7d71867dff43f7711123d53c6428 /src/include/gnunet_common.h
parent229083a5e71624479fdc44a14a264fe07077e699 (diff)
downloadgnunet-26dbd65eff8dc627697a1ee5c3b755c2951ac013.tar.gz
gnunet-26dbd65eff8dc627697a1ee5c3b755c2951ac013.zip
add GNUNET_(hton|ntoh).*_signed() functions
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r--src/include/gnunet_common.h116
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 */
662uint64_t 665uint64_t
663GNUNET_ntohll (uint64_t n); 666GNUNET_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 */
670uint64_t 677uint64_t
671GNUNET_htonll (uint64_t n); 678GNUNET_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 */
678double 689double
679GNUNET_hton_double (double d); 690GNUNET_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 */
686double 701double
687GNUNET_ntoh_double (double d); 702GNUNET_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 */
713uint64_t
714GNUNET_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 */
725int64_t
726GNUNET_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 */
737uint32_t
738GNUNET_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 */
749int32_t
750GNUNET_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 */
761uint16_t
762GNUNET_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 */
773int16_t
774GNUNET_ntohs_signed (uint16_t n);
775
776
689/* ************************* allocation functions ****************** */ 777/* ************************* allocation functions ****************** */
690 778
691/** 779/**