* Convert double to network byte order.
*
* @param d
- * The value in network byte order.
+ * The value in host byte order.
*
- * @return The same value in host byte order.
+ * @return The same value in network byte order.
*/
double
GNUNET_hton_double (double d);
GNUNET_ntoh_double (double d);
-/**
- * Convert signed 64-bit integer to network byte order.
- *
- * @param n
- * The value in host byte order.
- *
- * @return The same value in network byte order.
- */
-uint64_t
-GNUNET_htonll_signed (int64_t n);
-
-
-/**
- * Convert signed 64-bit integer to host byte order.
- *
- * @param n
- * The value in network byte order.
- *
- * @return The same value in host byte order.
- */
-int64_t
-GNUNET_ntohll_signed (uint64_t n);
-
-
-/**
- * Convert signed 32-bit integer to network byte order.
- *
- * @param n
- * The value in host byte order.
- *
- * @return The same value in network byte order.
- */
-uint32_t
-GNUNET_htonl_signed (int32_t n);
-
-
-/**
- * Convert signed 32-bit integer to host byte order.
- *
- * @param n
- * The value in network byte order.
- *
- * @return The same value in host byte order.
- */
-int32_t
-GNUNET_ntohl_signed (uint32_t n);
-
-
-/**
- * Convert signed 16-bit integer to network byte order.
- *
- * @param n
- * The value in host byte order.
- *
- * @return The same value in network byte order.
- */
-uint16_t
-GNUNET_htons_signed (int16_t n);
-
-
-/**
- * Convert signed 16-bit integer to host byte order.
- *
- * @param n
- * The value in network byte order.
- *
- * @return The same value in host byte order.
- */
-int16_t
-GNUNET_ntohs_signed (uint16_t n);
-
-
/* ************************* allocation functions ****************** */
/**
res = GNUNET_malloc (sizeof (*res) + data_size);
res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE);
res->header.size = htons (sizeof (*res) + data_size);
- res->result_code = GNUNET_htonll_signed (result_code);
+ res->result_code = GNUNET_htonll (result_code);
res->op_id = op_id;
if (0 < data_size)
memcpy (&res[1], data, data_size);
struct GNUNET_PSYC_CountersResultMessage res;
res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MASTER_START_ACK);
res.header.size = htons (sizeof (res));
- res.result_code = GNUNET_htonl_signed (result);
+ res.result_code = htonl (result);
res.max_message_id = GNUNET_htonll (max_message_id);
if (GNUNET_OK == result || GNUNET_NO == result)
struct GNUNET_PSYC_CountersResultMessage res;
res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN_ACK);
res.header.size = htons (sizeof (res));
- res.result_code = GNUNET_htonl_signed (result);
+ res.result_code = htonl (result);
res.max_message_id = GNUNET_htonll (max_message_id);
if (GNUNET_OK == result || GNUNET_NO == result)
struct GNUNET_PSYC_CountersResultMessage res;
res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MASTER_START_ACK);
res.header.size = htons (sizeof (res));
- res.result_code = GNUNET_htonl_signed (GNUNET_OK);
+ res.result_code = htonl (GNUNET_OK);
res.max_message_id = GNUNET_htonll (mst->max_message_id);
GNUNET_SERVER_notification_context_add (nc, client);
struct GNUNET_PSYC_CountersResultMessage res;
res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN_ACK);
res.header.size = htons (sizeof (res));
- res.result_code = GNUNET_htonl_signed (GNUNET_OK);
+ res.result_code = htonl (GNUNET_OK);
res.max_message_id = GNUNET_htonll (chn->max_message_id);
GNUNET_SERVER_notification_context_add (nc, client);
res->header.size = htons (sizeof (*res) + psize);
res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_HISTORY_RESULT);
res->op_id = op->op_id;
- res->result_code = GNUNET_htonll_signed (GNUNET_OK);
+ res->result_code = GNUNET_htonll (GNUNET_OK);
pmsg = (struct GNUNET_PSYC_MessageHeader *) &res[1];
psyc_msg_init (pmsg, mmsg, flags | GNUNET_PSYC_MESSAGE_HISTORIC);
uint16_t data_size = size - sizeof (*res);
const char *data = (0 < data_size) ? (void *) &res[1] : NULL;
GNUNET_CLIENT_MANAGER_op_result (chn->client, GNUNET_ntohll (res->op_id),
- GNUNET_ntohll_signed (res->result_code),
+ GNUNET_ntohll (res->result_code),
data, data_size);
}
struct GNUNET_PSYC_CountersResultMessage *
cres = (struct GNUNET_PSYC_CountersResultMessage *) msg;
- int32_t result = GNUNET_ntohl_signed (cres->result_code);
+ int32_t result = ntohl (cres->result_code);
if (GNUNET_OK != result && GNUNET_NO != result)
{
LOG (GNUNET_ERROR_TYPE_ERROR, "Could not start master: %ld\n", result);
sizeof (struct GNUNET_PSYC_Channel));
struct GNUNET_PSYC_CountersResultMessage *
cres = (struct GNUNET_PSYC_CountersResultMessage *) msg;
- int32_t result = GNUNET_ntohl_signed (cres->result_code);
+ int32_t result = ntohl (cres->result_code);
if (GNUNET_YES != result && GNUNET_NO != result)
{
LOG (GNUNET_ERROR_TYPE_ERROR, "Could not join slave.\n");
res = GNUNET_malloc (sizeof (*res) + data_size);
res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE);
res->header.size = htons (sizeof (*res) + data_size);
- res->result_code = GNUNET_htonll_signed (result_code);
+ res->result_code = GNUNET_htonll (result_code);
res->op_id = op_id;
if (0 < data_size)
memcpy (&res[1], data, data_size);
res->header.size = htons (sizeof (*res) + size);
res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_HISTORY_RESULT);
res->op_id = opcls->op_id;
- res->result_code = GNUNET_htonll_signed (GNUNET_OK);
+ res->result_code = GNUNET_htonll (GNUNET_OK);
memcpy (&res[1], msg, size);
uint16_t data_size = size - sizeof (*res);
const char *data = (0 < data_size) ? (const char *) &res[1] : NULL;
GNUNET_CLIENT_MANAGER_op_result (plc->client, GNUNET_ntohll (res->op_id),
- GNUNET_ntohll_signed (res->result_code),
+ GNUNET_ntohll (res->result_code),
data, data_size);
}
}
-uint64_t
-GNUNET_htonll_signed (int64_t n)
-{
- return GNUNET_htonll (n - INT64_MIN);
-}
-
-
-int64_t
-GNUNET_ntohll_signed (uint64_t n)
-{
- return GNUNET_ntohll (n) + INT64_MIN;
-}
-
-
-uint32_t
-GNUNET_htonl_signed (int32_t n)
-{
- return htonl (n - INT32_MIN);
-}
-
-
-int32_t
-GNUNET_ntohl_signed (uint32_t n)
-{
- return ntohl (n) + INT32_MIN;
-}
-
-
-uint16_t
-GNUNET_htons_signed (int16_t n)
-{
- return htons (n - INT16_MIN);
-}
-
-
-int16_t
-GNUNET_ntohs_signed (uint16_t n)
-{
- return ntohs (n) + INT16_MIN;
-}
-
-
-
/* end of common_endian.c */