diff options
-rw-r--r-- | src/include/gnunet_common.h | 14 | ||||
-rw-r--r-- | src/transport/transport_api2_communication.c | 6 | ||||
-rw-r--r-- | src/util/common_endian.c | 8 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 3ac186e0b..36f9eee4a 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -997,6 +997,11 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
997 | 997 | ||
998 | /* ************************* endianess conversion ****************** */ | 998 | /* ************************* endianess conversion ****************** */ |
999 | 999 | ||
1000 | #ifdef htonbe64 | ||
1001 | |||
1002 | #define GNUNET_htonll(n) htobe64 (n) | ||
1003 | |||
1004 | #else | ||
1000 | /** | 1005 | /** |
1001 | * Convert unsigned 64-bit integer to network byte order. | 1006 | * Convert unsigned 64-bit integer to network byte order. |
1002 | * | 1007 | * |
@@ -1008,7 +1013,14 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
1008 | uint64_t | 1013 | uint64_t |
1009 | GNUNET_htonll (uint64_t n); | 1014 | GNUNET_htonll (uint64_t n); |
1010 | 1015 | ||
1016 | #endif | ||
1017 | |||
1011 | 1018 | ||
1019 | #ifdef be64toh | ||
1020 | |||
1021 | #define GNUNET_ntohll(n) be64toh (n) | ||
1022 | |||
1023 | #else | ||
1012 | /** | 1024 | /** |
1013 | * Convert unsigned 64-bit integer to host byte order. | 1025 | * Convert unsigned 64-bit integer to host byte order. |
1014 | * | 1026 | * |
@@ -1020,6 +1032,8 @@ GNUNET_htonll (uint64_t n); | |||
1020 | uint64_t | 1032 | uint64_t |
1021 | GNUNET_ntohll (uint64_t n); | 1033 | GNUNET_ntohll (uint64_t n); |
1022 | 1034 | ||
1035 | #endif | ||
1036 | |||
1023 | 1037 | ||
1024 | /** | 1038 | /** |
1025 | * Convert double to network byte order. | 1039 | * Convert double to network byte order. |
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index de5b42c3f..9df9424da 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c | |||
@@ -872,7 +872,7 @@ GNUNET_TRANSPORT_communicator_receive ( | |||
872 | { | 872 | { |
873 | GNUNET_log ( | 873 | GNUNET_log ( |
874 | GNUNET_ERROR_TYPE_WARNING, | 874 | GNUNET_ERROR_TYPE_WARNING, |
875 | "Dropping message: transprot is too slow, queue length %llu exceeded\n", | 875 | "Dropping message: transport is too slow, queue length %llu exceeded\n", |
876 | ch->max_queue_length); | 876 | ch->max_queue_length); |
877 | return GNUNET_NO; | 877 | return GNUNET_NO; |
878 | } | 878 | } |
@@ -888,6 +888,10 @@ GNUNET_TRANSPORT_communicator_receive ( | |||
888 | im->expected_address_validity = | 888 | im->expected_address_validity = |
889 | GNUNET_TIME_relative_hton (expected_addr_validity); | 889 | GNUNET_TIME_relative_hton (expected_addr_validity); |
890 | im->sender = *sender; | 890 | im->sender = *sender; |
891 | // FIXME: this is expensive, would be better if we would | ||
892 | // re-design the API to allow us to create the envelope first, | ||
893 | // and then have the application fill in the body so we do | ||
894 | // not have to memcpy() | ||
891 | memcpy (&im[1], msg, msize); | 895 | memcpy (&im[1], msg, msize); |
892 | if (NULL != cb) | 896 | if (NULL != cb) |
893 | { | 897 | { |
diff --git a/src/util/common_endian.c b/src/util/common_endian.c index fa7d99d85..d69cc1da5 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #define LOG(kind, ...) GNUNET_log_from (kind, "util-common-endian", __VA_ARGS__) | 31 | #define LOG(kind, ...) GNUNET_log_from (kind, "util-common-endian", __VA_ARGS__) |
32 | 32 | ||
33 | 33 | ||
34 | #ifndef htonbe64 | ||
34 | uint64_t | 35 | uint64_t |
35 | GNUNET_htonll (uint64_t n) | 36 | GNUNET_htonll (uint64_t n) |
36 | { | 37 | { |
@@ -44,6 +45,10 @@ GNUNET_htonll (uint64_t n) | |||
44 | } | 45 | } |
45 | 46 | ||
46 | 47 | ||
48 | #endif | ||
49 | |||
50 | |||
51 | #ifndef be64toh | ||
47 | uint64_t | 52 | uint64_t |
48 | GNUNET_ntohll (uint64_t n) | 53 | GNUNET_ntohll (uint64_t n) |
49 | { | 54 | { |
@@ -57,6 +62,9 @@ GNUNET_ntohll (uint64_t n) | |||
57 | } | 62 | } |
58 | 63 | ||
59 | 64 | ||
65 | #endif | ||
66 | |||
67 | |||
60 | /** | 68 | /** |
61 | * Convert double to network-byte-order. | 69 | * Convert double to network-byte-order. |
62 | * @param d the value in network byte order | 70 | * @param d the value in network byte order |