gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20310 - gnunet/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r20310 - gnunet/src/namestore
Date: Tue, 6 Mar 2012 14:44:15 +0100

Author: wachs
Date: 2012-03-06 14:44:15 +0100 (Tue, 06 Mar 2012)
New Revision: 20310

Modified:
   gnunet/src/namestore/gnunet-service-namestore.c
   gnunet/src/namestore/namestore.h
   gnunet/src/namestore/namestore_api.c
Log:
- checkin nbo conversion


Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c     2012-03-06 13:16:33 UTC 
(rev 20309)
+++ gnunet/src/namestore/gnunet-service-namestore.c     2012-03-06 13:44:15 UTC 
(rev 20310)
@@ -310,13 +310,13 @@
   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
@@ -511,7 +511,7 @@
   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);
@@ -752,14 +752,14 @@
 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);
@@ -986,9 +986,9 @@
 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);
@@ -1252,13 +1252,11 @@
 
   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);
 }
 

Modified: gnunet/src/namestore/namestore.h
===================================================================
--- gnunet/src/namestore/namestore.h    2012-03-06 13:16:33 UTC (rev 20309)
+++ gnunet/src/namestore/namestore.h    2012-03-06 13:44:15 UTC (rev 20310)
@@ -29,6 +29,7 @@
 /*
  * 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
@@ -44,7 +45,6 @@
 #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

Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c        2012-03-06 13:16:33 UTC (rev 
20309)
+++ gnunet/src/namestore/namestore_api.c        2012-03-06 13:44:15 UTC (rev 
20310)
@@ -324,22 +324,22 @@
 {
   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
@@ -362,24 +362,24 @@
 {
   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
@@ -406,7 +406,7 @@
               "RECORD_REMOVE_RESPONSE");
 
   struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
-  int res = ntohs (msg->op_result);
+  int res = ntohl (msg->op_result);
 
   /**
    *  result:
@@ -909,7 +909,7 @@
 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);
 }
 
 
@@ -1312,8 +1312,8 @@
   msg->gns_header.header.size = htons (msg_size);
   msg->gns_header.r_id = htonl (rid);
   msg->record_type = htonl (record_type);
+  msg->name_len = htonl (name_len);
   msg->zone = *zone;
-  msg->name_len = htonl (name_len);
   memcpy (&msg[1], name, name_len);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for name `%s'\n", 
"NAMESTORE_LOOKUP_NAME", name);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]