lnr_msg->rd_count = htons (copied_elements);
lnr_msg->rd_len = htons (rd_ser_len);
lnr_msg->name_len = htons (name_len);
+ lnr_msg->contains_sig = htons (contains_signature);
lnr_msg->expire = GNUNET_TIME_absolute_hton(expire);
+
if (zone_key != NULL)
lnr_msg->public_key = (*zone_key);
else
memset(&lnr_msg->public_key, '\0', sizeof (lnr_msg->public_key));
-
- lnr_msg->contains_sig = htons (contains_signature);
if (GNUNET_YES == contains_signature)
lnr_msg->signature = *signature;
else
rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE);
rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage));
rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id;
- rpr_msg.op_result = htons (res);
+ rpr_msg.op_result = htonl (res);
GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rpr_msg, GNUNET_NO);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
send:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_CREATE_RESPONSE");
rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE);
- rcr_msg.gns_header.r_id = htonl (rid);
rcr_msg.gns_header.header.size = htons (sizeof (struct RecordCreateResponseMessage));
+ rcr_msg.gns_header.r_id = htonl (rid);
if ((GNUNET_OK == res) && (crc.res == GNUNET_YES))
- rcr_msg.op_result = htons (GNUNET_YES);
+ rcr_msg.op_result = htonl (GNUNET_YES);
else if ((GNUNET_OK == res) && (crc.res == GNUNET_NO))
- rcr_msg.op_result = htons (GNUNET_NO);
+ rcr_msg.op_result = htonl (GNUNET_NO);
else
- rcr_msg.op_result = htons (GNUNET_SYSERR);
+ rcr_msg.op_result = htonl (GNUNET_SYSERR);
GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rcr_msg, GNUNET_NO);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
send:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_REMOVE_RESPONSE");
rrr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE);
- rrr_msg.gns_header.r_id = rr_msg->gns_header.r_id;
rrr_msg.gns_header.header.size = htons (sizeof (struct RecordRemoveResponseMessage));
- rrr_msg.op_result = htons (res);
+ rrr_msg.gns_header.r_id = rr_msg->gns_header.r_id;
+ rrr_msg.op_result = htonl (res);
GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rrr_msg, GNUNET_NO);
GNUNET_CRYPTO_rsa_key_free (pkey);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "ZONE_ITERATION_RESPONSE");
zir_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE);
- zir_msg.gns_header.r_id = htonl(zi->request_id);
zir_msg.gns_header.header.size = htons (sizeof (struct ZoneIterationResponseMessage));
-
+ zir_msg.gns_header.r_id = htonl(zi->request_id);
GNUNET_SERVER_notification_context_unicast (snc, zi->client->client, (const struct GNUNET_MessageHeader *) &zir_msg, GNUNET_NO);
-
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
/*
* Collect message types here, move to protocols later
*/
+#define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430
#define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME 431
#define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE 432
#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT 433
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 446
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448
-#define GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT 449
/**
* Create a signature based on name and records
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n",
"RECORD_PUT_RESPONSE");
-
struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
+ int res = ntohl (msg->op_result);
- if (ntohs (msg->op_result) == GNUNET_OK)
+ if (res == GNUNET_OK)
{
if (qe->cont != NULL)
{
- qe->cont (qe->cont_cls, GNUNET_OK, _("Namestore added record successfully"));
+ qe->cont (qe->cont_cls, res, _("Namestore added record successfully"));
}
}
- else if (ntohs (msg->op_result) == GNUNET_SYSERR)
+ else if (res == GNUNET_SYSERR)
{
if (qe->cont != NULL)
{
- qe->cont (qe->cont_cls, GNUNET_SYSERR, _("Namestore failed to add record"));
+ qe->cont (qe->cont_cls, res, _("Namestore failed to add record"));
}
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n",
"RECORD_CREATE_RESPONSE");
-
struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
+ int res = ntohl (msg->op_result);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' %i\n",
"RECORD_CREATE_RESPONSE", ntohs (msg->op_result));
- if (ntohs (msg->op_result) == GNUNET_YES)
+ if (res == GNUNET_YES)
{
if (qe->cont != NULL)
{
- qe->cont (qe->cont_cls, GNUNET_YES, _("Namestore added record successfully"));
+ qe->cont (qe->cont_cls, res, _("Namestore added record successfully"));
}
}
- else if (ntohs (msg->op_result) == GNUNET_NO)
+ else if (res == GNUNET_NO)
{
if (qe->cont != NULL)
{
- qe->cont (qe->cont_cls, GNUNET_NO, _("Namestore record already existed"));
+ qe->cont (qe->cont_cls, res, _("Namestore record already existed"));
}
}
else
"RECORD_REMOVE_RESPONSE");
struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
- int res = ntohs (msg->op_result);
+ int res = ntohl (msg->op_result);
/**
* result:
GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Disconnecting from namestore service\n");
- GNUNET_SCHEDULER_add_now (&clean_up_task, h);
+ GNUNET_SCHEDULER_add_now (&clean_up_task, h);
}
msg->gns_header.header.size = htons (msg_size);
msg->gns_header.r_id = htonl (rid);
msg->record_type = htonl (record_type);
- msg->zone = *zone;
msg->name_len = htonl (name_len);
+ msg->zone = *zone;
memcpy (&msg[1], name, name_len);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for name `%s'\n", "NAMESTORE_LOOKUP_NAME", name);