- checkin nbo conversion
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 6 Mar 2012 13:44:15 +0000 (13:44 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 6 Mar 2012 13:44:15 +0000 (13:44 +0000)
src/namestore/gnunet-service-namestore.c
src/namestore/namestore.h
src/namestore/namestore_api.c

index f7c5a320573b4278f536c6d2437e820947cb002b..5584884d85dfb47745c879eaf73e4a05fbbcc766 100644 (file)
@@ -310,13 +310,13 @@ handle_lookup_name_it (void *cls,
   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 @@ send:
   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 @@ static void handle_record_create (void *cls,
 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 @@ static void handle_record_remove (void *cls,
 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 @@ static void handle_iteration_start (void *cls,
 
   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);
 }
 
index ac59d9a119698ab548c3d3d72c22b57f64436a1a..e0550b499da6cd802ecda125da71c25a198d9ce8 100644 (file)
@@ -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
index f96fc88cf4c08ed9bc32c6c94a02240ac757872a..31de00c81d553c7baa363793751a50a132f4bcf0 100644 (file)
@@ -324,22 +324,22 @@ handle_record_put_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
 {
   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 @@ handle_record_create_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
 {
   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 @@ handle_record_remove_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
               "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 @@ void
 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 @@ GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *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);