diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-06 13:44:15 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-06 13:44:15 +0000 |
commit | c7c6d105dfed910ddb4fa3465137b425999a3928 (patch) | |
tree | 8677e1fbef55d2ebf3776667ef164825d55a089c /src | |
parent | 0a6ac36c18891cbff721def0f66dee9991c7c220 (diff) | |
download | gnunet-c7c6d105dfed910ddb4fa3465137b425999a3928.tar.gz gnunet-c7c6d105dfed910ddb4fa3465137b425999a3928.zip |
- checkin nbo conversion
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 22 | ||||
-rw-r--r-- | src/namestore/namestore.h | 2 | ||||
-rw-r--r-- | src/namestore/namestore_api.c | 26 |
3 files changed, 24 insertions, 26 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index f7c5a3205..5584884d8 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -310,13 +310,13 @@ handle_lookup_name_it (void *cls, | |||
310 | lnr_msg->rd_count = htons (copied_elements); | 310 | lnr_msg->rd_count = htons (copied_elements); |
311 | lnr_msg->rd_len = htons (rd_ser_len); | 311 | lnr_msg->rd_len = htons (rd_ser_len); |
312 | lnr_msg->name_len = htons (name_len); | 312 | lnr_msg->name_len = htons (name_len); |
313 | lnr_msg->contains_sig = htons (contains_signature); | ||
313 | lnr_msg->expire = GNUNET_TIME_absolute_hton(expire); | 314 | lnr_msg->expire = GNUNET_TIME_absolute_hton(expire); |
315 | |||
314 | if (zone_key != NULL) | 316 | if (zone_key != NULL) |
315 | lnr_msg->public_key = (*zone_key); | 317 | lnr_msg->public_key = (*zone_key); |
316 | else | 318 | else |
317 | memset(&lnr_msg->public_key, '\0', sizeof (lnr_msg->public_key)); | 319 | memset(&lnr_msg->public_key, '\0', sizeof (lnr_msg->public_key)); |
318 | |||
319 | lnr_msg->contains_sig = htons (contains_signature); | ||
320 | if (GNUNET_YES == contains_signature) | 320 | if (GNUNET_YES == contains_signature) |
321 | lnr_msg->signature = *signature; | 321 | lnr_msg->signature = *signature; |
322 | else | 322 | else |
@@ -511,7 +511,7 @@ send: | |||
511 | rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE); | 511 | rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE); |
512 | rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage)); | 512 | rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage)); |
513 | rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; | 513 | rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; |
514 | rpr_msg.op_result = htons (res); | 514 | rpr_msg.op_result = htonl (res); |
515 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rpr_msg, GNUNET_NO); | 515 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rpr_msg, GNUNET_NO); |
516 | 516 | ||
517 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 517 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -752,14 +752,14 @@ static void handle_record_create (void *cls, | |||
752 | send: | 752 | send: |
753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_CREATE_RESPONSE"); | 753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_CREATE_RESPONSE"); |
754 | rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE); | 754 | rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE); |
755 | rcr_msg.gns_header.r_id = htonl (rid); | ||
756 | rcr_msg.gns_header.header.size = htons (sizeof (struct RecordCreateResponseMessage)); | 755 | rcr_msg.gns_header.header.size = htons (sizeof (struct RecordCreateResponseMessage)); |
756 | rcr_msg.gns_header.r_id = htonl (rid); | ||
757 | if ((GNUNET_OK == res) && (crc.res == GNUNET_YES)) | 757 | if ((GNUNET_OK == res) && (crc.res == GNUNET_YES)) |
758 | rcr_msg.op_result = htons (GNUNET_YES); | 758 | rcr_msg.op_result = htonl (GNUNET_YES); |
759 | else if ((GNUNET_OK == res) && (crc.res == GNUNET_NO)) | 759 | else if ((GNUNET_OK == res) && (crc.res == GNUNET_NO)) |
760 | rcr_msg.op_result = htons (GNUNET_NO); | 760 | rcr_msg.op_result = htonl (GNUNET_NO); |
761 | else | 761 | else |
762 | rcr_msg.op_result = htons (GNUNET_SYSERR); | 762 | rcr_msg.op_result = htonl (GNUNET_SYSERR); |
763 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rcr_msg, GNUNET_NO); | 763 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rcr_msg, GNUNET_NO); |
764 | 764 | ||
765 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 765 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -986,9 +986,9 @@ static void handle_record_remove (void *cls, | |||
986 | send: | 986 | send: |
987 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_REMOVE_RESPONSE"); | 987 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_REMOVE_RESPONSE"); |
988 | rrr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE); | 988 | rrr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE); |
989 | rrr_msg.gns_header.r_id = rr_msg->gns_header.r_id; | ||
990 | rrr_msg.gns_header.header.size = htons (sizeof (struct RecordRemoveResponseMessage)); | 989 | rrr_msg.gns_header.header.size = htons (sizeof (struct RecordRemoveResponseMessage)); |
991 | rrr_msg.op_result = htons (res); | 990 | rrr_msg.gns_header.r_id = rr_msg->gns_header.r_id; |
991 | rrr_msg.op_result = htonl (res); | ||
992 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rrr_msg, GNUNET_NO); | 992 | GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rrr_msg, GNUNET_NO); |
993 | 993 | ||
994 | GNUNET_CRYPTO_rsa_key_free (pkey); | 994 | GNUNET_CRYPTO_rsa_key_free (pkey); |
@@ -1252,13 +1252,11 @@ static void handle_iteration_start (void *cls, | |||
1252 | 1252 | ||
1253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "ZONE_ITERATION_RESPONSE"); | 1253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "ZONE_ITERATION_RESPONSE"); |
1254 | zir_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE); | 1254 | zir_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE); |
1255 | zir_msg.gns_header.r_id = htonl(zi->request_id); | ||
1256 | zir_msg.gns_header.header.size = htons (sizeof (struct ZoneIterationResponseMessage)); | 1255 | zir_msg.gns_header.header.size = htons (sizeof (struct ZoneIterationResponseMessage)); |
1257 | 1256 | zir_msg.gns_header.r_id = htonl(zi->request_id); | |
1258 | 1257 | ||
1259 | GNUNET_SERVER_notification_context_unicast (snc, zi->client->client, (const struct GNUNET_MessageHeader *) &zir_msg, GNUNET_NO); | 1258 | GNUNET_SERVER_notification_context_unicast (snc, zi->client->client, (const struct GNUNET_MessageHeader *) &zir_msg, GNUNET_NO); |
1260 | 1259 | ||
1261 | |||
1262 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1260 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1263 | } | 1261 | } |
1264 | 1262 | ||
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index ac59d9a11..e0550b499 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -29,6 +29,7 @@ | |||
29 | /* | 29 | /* |
30 | * Collect message types here, move to protocols later | 30 | * Collect message types here, move to protocols later |
31 | */ | 31 | */ |
32 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 | ||
32 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME 431 | 33 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME 431 |
33 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE 432 | 34 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE 432 |
34 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT 433 | 35 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT 433 |
@@ -44,7 +45,6 @@ | |||
44 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 446 | 45 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 446 |
45 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447 | 46 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447 |
46 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448 | 47 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448 |
47 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT 449 | ||
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Create a signature based on name and records | 50 | * Create a signature based on name and records |
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index f96fc88cf..31de00c81 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -324,22 +324,22 @@ handle_record_put_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
324 | { | 324 | { |
325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", | 325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", |
326 | "RECORD_PUT_RESPONSE"); | 326 | "RECORD_PUT_RESPONSE"); |
327 | |||
328 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 327 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
328 | int res = ntohl (msg->op_result); | ||
329 | 329 | ||
330 | if (ntohs (msg->op_result) == GNUNET_OK) | 330 | if (res == GNUNET_OK) |
331 | { | 331 | { |
332 | if (qe->cont != NULL) | 332 | if (qe->cont != NULL) |
333 | { | 333 | { |
334 | qe->cont (qe->cont_cls, GNUNET_OK, _("Namestore added record successfully")); | 334 | qe->cont (qe->cont_cls, res, _("Namestore added record successfully")); |
335 | } | 335 | } |
336 | 336 | ||
337 | } | 337 | } |
338 | else if (ntohs (msg->op_result) == GNUNET_SYSERR) | 338 | else if (res == GNUNET_SYSERR) |
339 | { | 339 | { |
340 | if (qe->cont != NULL) | 340 | if (qe->cont != NULL) |
341 | { | 341 | { |
342 | qe->cont (qe->cont_cls, GNUNET_SYSERR, _("Namestore failed to add record")); | 342 | qe->cont (qe->cont_cls, res, _("Namestore failed to add record")); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | else | 345 | else |
@@ -362,24 +362,24 @@ handle_record_create_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
362 | { | 362 | { |
363 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", | 363 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", |
364 | "RECORD_CREATE_RESPONSE"); | 364 | "RECORD_CREATE_RESPONSE"); |
365 | |||
366 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 365 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
366 | int res = ntohl (msg->op_result); | ||
367 | 367 | ||
368 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' %i\n", | 368 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' %i\n", |
369 | "RECORD_CREATE_RESPONSE", ntohs (msg->op_result)); | 369 | "RECORD_CREATE_RESPONSE", ntohs (msg->op_result)); |
370 | if (ntohs (msg->op_result) == GNUNET_YES) | 370 | if (res == GNUNET_YES) |
371 | { | 371 | { |
372 | if (qe->cont != NULL) | 372 | if (qe->cont != NULL) |
373 | { | 373 | { |
374 | qe->cont (qe->cont_cls, GNUNET_YES, _("Namestore added record successfully")); | 374 | qe->cont (qe->cont_cls, res, _("Namestore added record successfully")); |
375 | } | 375 | } |
376 | 376 | ||
377 | } | 377 | } |
378 | else if (ntohs (msg->op_result) == GNUNET_NO) | 378 | else if (res == GNUNET_NO) |
379 | { | 379 | { |
380 | if (qe->cont != NULL) | 380 | if (qe->cont != NULL) |
381 | { | 381 | { |
382 | qe->cont (qe->cont_cls, GNUNET_NO, _("Namestore record already existed")); | 382 | qe->cont (qe->cont_cls, res, _("Namestore record already existed")); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | else | 385 | else |
@@ -406,7 +406,7 @@ handle_record_remove_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
406 | "RECORD_REMOVE_RESPONSE"); | 406 | "RECORD_REMOVE_RESPONSE"); |
407 | 407 | ||
408 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 408 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
409 | int res = ntohs (msg->op_result); | 409 | int res = ntohl (msg->op_result); |
410 | 410 | ||
411 | /** | 411 | /** |
412 | * result: | 412 | * result: |
@@ -909,7 +909,7 @@ void | |||
909 | GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop) | 909 | GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop) |
910 | { | 910 | { |
911 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Disconnecting from namestore service\n"); | 911 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Disconnecting from namestore service\n"); |
912 | GNUNET_SCHEDULER_add_now (&clean_up_task, h); | 912 | GNUNET_SCHEDULER_add_now (&clean_up_task, h); |
913 | } | 913 | } |
914 | 914 | ||
915 | 915 | ||
@@ -1312,8 +1312,8 @@ GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | |||
1312 | msg->gns_header.header.size = htons (msg_size); | 1312 | msg->gns_header.header.size = htons (msg_size); |
1313 | msg->gns_header.r_id = htonl (rid); | 1313 | msg->gns_header.r_id = htonl (rid); |
1314 | msg->record_type = htonl (record_type); | 1314 | msg->record_type = htonl (record_type); |
1315 | msg->zone = *zone; | ||
1316 | msg->name_len = htonl (name_len); | 1315 | msg->name_len = htonl (name_len); |
1316 | msg->zone = *zone; | ||
1317 | memcpy (&msg[1], name, name_len); | 1317 | memcpy (&msg[1], name, name_len); |
1318 | 1318 | ||
1319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for name `%s'\n", "NAMESTORE_LOOKUP_NAME", name); | 1319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for name `%s'\n", "NAMESTORE_LOOKUP_NAME", name); |