aboutsummaryrefslogtreecommitdiff
path: root/src/chat
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-12 19:07:40 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-12 19:07:40 +0000
commit6c471eeb15e27f8226492b4860a3c2acb94c5f25 (patch)
treea3a9dcba12ee5356c03056c10b7aba5367b2ef34 /src/chat
parent16bcbbea7133fd2265d46bd2ae1dc70e8c9ba96f (diff)
downloadgnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.tar.gz
gnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.zip
-consistently use struct GNUNET_HashCode
Diffstat (limited to 'src/chat')
-rw-r--r--src/chat/chat.c14
-rw-r--r--src/chat/chat.h20
-rw-r--r--src/chat/gnunet-chat.c20
-rw-r--r--src/chat/gnunet-service-chat.c56
-rw-r--r--src/chat/test_chat.c18
-rw-r--r--src/chat/test_chat_private.c24
6 files changed, 76 insertions, 76 deletions
diff --git a/src/chat/chat.c b/src/chat/chat.c
index 72c49a063..d7ebd79b8 100644
--- a/src/chat/chat.c
+++ b/src/chat/chat.c
@@ -92,7 +92,7 @@ struct MemberList
92 /** 92 /**
93 * Member ID (pseudonym). 93 * Member ID (pseudonym).
94 */ 94 */
95 GNUNET_HashCode id; 95 struct GNUNET_HashCode id;
96 96
97}; 97};
98 98
@@ -224,8 +224,8 @@ process_result (struct GNUNET_CHAT_Room *room,
224 struct ReceiveNotificationMessage *received_msg; 224 struct ReceiveNotificationMessage *received_msg;
225 struct ConfirmationReceiptMessage *receipt; 225 struct ConfirmationReceiptMessage *receipt;
226 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; 226 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
227 GNUNET_HashCode id; 227 struct GNUNET_HashCode id;
228 const GNUNET_HashCode *sender; 228 const struct GNUNET_HashCode *sender;
229 struct GNUNET_CONTAINER_MetaData *meta; 229 struct GNUNET_CONTAINER_MetaData *meta;
230 struct GNUNET_CHAT_SendReceiptContext *src; 230 struct GNUNET_CHAT_SendReceiptContext *src;
231 struct MemberList *pos; 231 struct MemberList *pos;
@@ -308,7 +308,7 @@ process_result (struct GNUNET_CHAT_Room *room,
308 prev = NULL; 308 prev = NULL;
309 pos = room->members; 309 pos = room->members;
310 while ((NULL != pos) && 310 while ((NULL != pos) &&
311 (0 != memcmp (&pos->id, &id, sizeof (GNUNET_HashCode)))) 311 (0 != memcmp (&pos->id, &id, sizeof (struct GNUNET_HashCode))))
312 { 312 {
313 prev = pos; 313 prev = pos;
314 pos = pos->next; 314 pos = pos->next;
@@ -379,7 +379,7 @@ process_result (struct GNUNET_CHAT_Room *room,
379 while ((NULL != pos) && 379 while ((NULL != pos) &&
380 (0 != 380 (0 !=
381 memcmp (&pos->id, &received_msg->sender, 381 memcmp (&pos->id, &received_msg->sender,
382 sizeof (GNUNET_HashCode)))) 382 sizeof (struct GNUNET_HashCode))))
383 pos = pos->next; 383 pos = pos->next;
384 GNUNET_assert (NULL != pos); 384 GNUNET_assert (NULL != pos);
385 sender = &received_msg->sender; 385 sender = &received_msg->sender;
@@ -649,7 +649,7 @@ GNUNET_CHAT_join_room (const struct GNUNET_CONFIGURATION_Handle *cfg,
649 GNUNET_CHAT_MemberListCallback memberCallback, 649 GNUNET_CHAT_MemberListCallback memberCallback,
650 void *member_cls, 650 void *member_cls,
651 GNUNET_CHAT_MessageConfirmation confirmationCallback, 651 GNUNET_CHAT_MessageConfirmation confirmationCallback,
652 void *confirmation_cls, GNUNET_HashCode * me) 652 void *confirmation_cls, struct GNUNET_HashCode * me)
653{ 653{
654 struct GNUNET_CHAT_Room *chat_room; 654 struct GNUNET_CHAT_Room *chat_room;
655 struct GNUNET_CRYPTO_RsaPrivateKey *priv_key; 655 struct GNUNET_CRYPTO_RsaPrivateKey *priv_key;
@@ -755,7 +755,7 @@ transmit_send_request (void *cls, size_t size, void *buf)
755 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 755 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
756 msg_to_send->reserved = htonl (0); 756 msg_to_send->reserved = htonl (0);
757 if (NULL == smc->receiver) 757 if (NULL == smc->receiver)
758 memset (&msg_to_send->target, 0, sizeof (GNUNET_HashCode)); 758 memset (&msg_to_send->target, 0, sizeof (struct GNUNET_HashCode));
759 else 759 else
760 GNUNET_CRYPTO_hash (smc->receiver, 760 GNUNET_CRYPTO_hash (smc->receiver,
761 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 761 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
diff --git a/src/chat/chat.h b/src/chat/chat.h
index 5df7773a7..c65b75de9 100644
--- a/src/chat/chat.h
+++ b/src/chat/chat.h
@@ -80,7 +80,7 @@ struct ReceiveNotificationMessage
80 * Hash of the public key of the pseudonym of the sender of the message. 80 * Hash of the public key of the pseudonym of the sender of the message.
81 * Should be all zeros for anonymous. 81 * Should be all zeros for anonymous.
82 */ 82 */
83 GNUNET_HashCode sender; 83 struct GNUNET_HashCode sender;
84 84
85 /** 85 /**
86 * The encrypted session key. 86 * The encrypted session key.
@@ -136,7 +136,7 @@ struct TransmitRequestMessage
136 /** 136 /**
137 * Who should receive this message? Set to all zeros for "everyone". 137 * Who should receive this message? Set to all zeros for "everyone".
138 */ 138 */
139 GNUNET_HashCode target; 139 struct GNUNET_HashCode target;
140 140
141}; 141};
142 142
@@ -189,17 +189,17 @@ struct ConfirmationReceiptMessage
189 /** 189 /**
190 * Who is confirming the receipt? 190 * Who is confirming the receipt?
191 */ 191 */
192 GNUNET_HashCode target; 192 struct GNUNET_HashCode target;
193 193
194 /** 194 /**
195 * Who is the author of the chat message? 195 * Who is the author of the chat message?
196 */ 196 */
197 GNUNET_HashCode author; 197 struct GNUNET_HashCode author;
198 198
199 /** 199 /**
200 * Hash of the (possibly encrypted) content. 200 * Hash of the (possibly encrypted) content.
201 */ 201 */
202 GNUNET_HashCode content; 202 struct GNUNET_HashCode content;
203 203
204}; 204};
205 205
@@ -406,12 +406,12 @@ struct P2PReceiveNotificationMessage
406 * Hash of the public key of the pseudonym of the sender of the message 406 * Hash of the public key of the pseudonym of the sender of the message
407 * Should be all zeros for anonymous. 407 * Should be all zeros for anonymous.
408 */ 408 */
409 GNUNET_HashCode sender; 409 struct GNUNET_HashCode sender;
410 410
411 /** 411 /**
412 * Who should receive this message? Set to all zeros for "everyone". 412 * Who should receive this message? Set to all zeros for "everyone".
413 */ 413 */
414 GNUNET_HashCode target; 414 struct GNUNET_HashCode target;
415 415
416 /** 416 /**
417 * The encrypted session key. 417 * The encrypted session key.
@@ -465,17 +465,17 @@ struct P2PConfirmationReceiptMessage
465 /** 465 /**
466 * Who is confirming the receipt? 466 * Who is confirming the receipt?
467 */ 467 */
468 GNUNET_HashCode target; 468 struct GNUNET_HashCode target;
469 469
470 /** 470 /**
471 * Who is the author of the chat message? 471 * Who is the author of the chat message?
472 */ 472 */
473 GNUNET_HashCode author; 473 struct GNUNET_HashCode author;
474 474
475 /** 475 /**
476 * Hash of the (possibly encrypted) content. 476 * Hash of the (possibly encrypted) content.
477 */ 477 */
478 GNUNET_HashCode content; 478 struct GNUNET_HashCode content;
479 479
480}; 480};
481GNUNET_NETWORK_STRUCT_END 481GNUNET_NETWORK_STRUCT_END
diff --git a/src/chat/gnunet-chat.c b/src/chat/gnunet-chat.c
index 012f78ed9..d41d59062 100644
--- a/src/chat/gnunet-chat.c
+++ b/src/chat/gnunet-chat.c
@@ -110,7 +110,7 @@ join_cb (void *cls)
110 */ 110 */
111static int 111static int
112receive_cb (void *cls, struct GNUNET_CHAT_Room *room, 112receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
113 const GNUNET_HashCode * sender, 113 const struct GNUNET_HashCode * sender,
114 const struct GNUNET_CONTAINER_MetaData *member_info, 114 const struct GNUNET_CONTAINER_MetaData *member_info,
115 const char *message, struct GNUNET_TIME_Absolute timestamp, 115 const char *message, struct GNUNET_TIME_Absolute timestamp,
116 enum GNUNET_CHAT_MsgOptions options) 116 enum GNUNET_CHAT_MsgOptions options)
@@ -199,7 +199,7 @@ static int
199confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room, 199confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
200 uint32_t orig_seq_number, 200 uint32_t orig_seq_number,
201 struct GNUNET_TIME_Absolute timestamp, 201 struct GNUNET_TIME_Absolute timestamp,
202 const GNUNET_HashCode * receiver) 202 const struct GNUNET_HashCode * receiver)
203{ 203{
204 char *nick; 204 char *nick;
205 char *unique_nick; 205 char *unique_nick;
@@ -238,7 +238,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
238 char *nick; 238 char *nick;
239 char *non_unique_nick; 239 char *non_unique_nick;
240 int nick_is_a_dup; 240 int nick_is_a_dup;
241 GNUNET_HashCode id; 241 struct GNUNET_HashCode id;
242 struct UserList *pos; 242 struct UserList *pos;
243 struct UserList *prev; 243 struct UserList *prev;
244 244
@@ -304,7 +304,7 @@ do_join (const char *arg, const void *xtra)
304{ 304{
305 char *my_name; 305 char *my_name;
306 int my_name_is_a_dup; 306 int my_name_is_a_dup;
307 GNUNET_HashCode me; 307 struct GNUNET_HashCode me;
308 308
309 if (arg[0] == '#') 309 if (arg[0] == '#')
310 arg++; /* ignore first hash */ 310 arg++; /* ignore first hash */
@@ -343,7 +343,7 @@ do_nick (const char *msg, const void *xtra)
343{ 343{
344 char *my_name; 344 char *my_name;
345 int my_name_is_a_dup; 345 int my_name_is_a_dup;
346 GNUNET_HashCode me; 346 struct GNUNET_HashCode me;
347 347
348 GNUNET_CHAT_leave_room (room); 348 GNUNET_CHAT_leave_room (room);
349 free_user_list (); 349 free_user_list ();
@@ -383,7 +383,7 @@ do_names (const char *msg, const void *xtra)
383 char *unique_name; 383 char *unique_name;
384 int name_is_a_dup; 384 int name_is_a_dup;
385 struct UserList *pos; 385 struct UserList *pos;
386 GNUNET_HashCode pid; 386 struct GNUNET_HashCode pid;
387 387
388 FPRINTF (stdout, _("Users in room `%s': "), room_name); 388 FPRINTF (stdout, _("Users in room `%s': "), room_name);
389 pos = users; 389 pos = users;
@@ -424,8 +424,8 @@ static int
424do_send_pm (const char *msg, const void *xtra) 424do_send_pm (const char *msg, const void *xtra)
425{ 425{
426 char *user; 426 char *user;
427 GNUNET_HashCode uid; 427 struct GNUNET_HashCode uid;
428 GNUNET_HashCode pid; 428 struct GNUNET_HashCode pid;
429 uint32_t seq; 429 uint32_t seq;
430 struct UserList *pos; 430 struct UserList *pos;
431 431
@@ -451,7 +451,7 @@ do_send_pm (const char *msg, const void *xtra)
451 GNUNET_CRYPTO_hash (&pos->pkey, 451 GNUNET_CRYPTO_hash (&pos->pkey,
452 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 452 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
453 &pid); 453 &pid);
454 if (0 == memcmp (&pid, &uid, sizeof (GNUNET_HashCode))) 454 if (0 == memcmp (&pid, &uid, sizeof (struct GNUNET_HashCode)))
455 break; 455 break;
456 pos = pos->next; 456 pos = pos->next;
457 } 457 }
@@ -661,7 +661,7 @@ static void
661run (void *cls, char *const *args, const char *cfgfile, 661run (void *cls, char *const *args, const char *cfgfile,
662 const struct GNUNET_CONFIGURATION_Handle *c) 662 const struct GNUNET_CONFIGURATION_Handle *c)
663{ 663{
664 GNUNET_HashCode me; 664 struct GNUNET_HashCode me;
665 char *my_name; 665 char *my_name;
666 int my_name_is_a_dup; 666 int my_name_is_a_dup;
667 667
diff --git a/src/chat/gnunet-service-chat.c b/src/chat/gnunet-service-chat.c
index 3405659a9..a20c8cf32 100644
--- a/src/chat/gnunet-service-chat.c
+++ b/src/chat/gnunet-service-chat.c
@@ -69,7 +69,7 @@ struct ChatClient
69 /** 69 /**
70 * Hash of the public key (for convenience). 70 * Hash of the public key (for convenience).
71 */ 71 */
72 GNUNET_HashCode id; 72 struct GNUNET_HashCode id;
73 73
74 /** 74 /**
75 * Options which the client is willing to receive. 75 * Options which the client is willing to receive.
@@ -117,7 +117,7 @@ struct AnonymousMessage
117 /** 117 /**
118 * Hash of the message. 118 * Hash of the message.
119 */ 119 */
120 GNUNET_HashCode hash; 120 struct GNUNET_HashCode hash;
121 121
122}; 122};
123 123
@@ -162,7 +162,7 @@ static void
162remember_anonymous_message (const struct P2PReceiveNotificationMessage 162remember_anonymous_message (const struct P2PReceiveNotificationMessage
163 *p2p_rnmsg) 163 *p2p_rnmsg)
164{ 164{
165 static GNUNET_HashCode hash; 165 static struct GNUNET_HashCode hash;
166 struct AnonymousMessage *anon_msg; 166 struct AnonymousMessage *anon_msg;
167 struct AnonymousMessage *prev; 167 struct AnonymousMessage *prev;
168 int anon_list_len; 168 int anon_list_len;
@@ -192,13 +192,13 @@ remember_anonymous_message (const struct P2PReceiveNotificationMessage
192static int 192static int
193lookup_anonymous_message (const struct P2PReceiveNotificationMessage *p2p_rnmsg) 193lookup_anonymous_message (const struct P2PReceiveNotificationMessage *p2p_rnmsg)
194{ 194{
195 static GNUNET_HashCode hash; 195 static struct GNUNET_HashCode hash;
196 struct AnonymousMessage *anon_msg; 196 struct AnonymousMessage *anon_msg;
197 197
198 GNUNET_CRYPTO_hash (p2p_rnmsg, ntohs (p2p_rnmsg->header.size), &hash); 198 GNUNET_CRYPTO_hash (p2p_rnmsg, ntohs (p2p_rnmsg->header.size), &hash);
199 anon_msg = anonymous_list_head; 199 anon_msg = anonymous_list_head;
200 while ((NULL != anon_msg) && 200 while ((NULL != anon_msg) &&
201 (0 != memcmp (&anon_msg->hash, &hash, sizeof (GNUNET_HashCode)))) 201 (0 != memcmp (&anon_msg->hash, &hash, sizeof (struct GNUNET_HashCode))))
202 anon_msg = anon_msg->next; 202 anon_msg = anon_msg->next;
203 return (NULL != anon_msg); 203 return (NULL != anon_msg);
204} 204}
@@ -244,7 +244,7 @@ transmit_message_notification_to_peer (void *cls, size_t size, void *buf)
244 * Ask to send a message notification to the peer. 244 * Ask to send a message notification to the peer.
245 */ 245 */
246static int 246static int
247send_message_noficiation (void *cls, const GNUNET_HashCode * key, void *value) 247send_message_noficiation (void *cls, const struct GNUNET_HashCode * key, void *value)
248{ 248{
249 struct P2PReceiveNotificationMessage *msg = cls; 249 struct P2PReceiveNotificationMessage *msg = cls;
250 struct ConnectedPeer *cp = value; 250 struct ConnectedPeer *cp = value;
@@ -280,7 +280,7 @@ static void
280handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client, 280handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client,
281 const struct GNUNET_MessageHeader *message) 281 const struct GNUNET_MessageHeader *message)
282{ 282{
283 static GNUNET_HashCode all_zeros; 283 static struct GNUNET_HashCode all_zeros;
284 const struct TransmitRequestMessage *trmsg; 284 const struct TransmitRequestMessage *trmsg;
285 struct ReceiveNotificationMessage *rnmsg; 285 struct ReceiveNotificationMessage *rnmsg;
286 struct P2PReceiveNotificationMessage *p2p_rnmsg; 286 struct P2PReceiveNotificationMessage *p2p_rnmsg;
@@ -349,7 +349,7 @@ handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client,
349 is_anon = (0 != (ntohl (trmsg->msg_options) & GNUNET_CHAT_MSG_ANONYMOUS)); 349 is_anon = (0 != (ntohl (trmsg->msg_options) & GNUNET_CHAT_MSG_ANONYMOUS));
350 if (is_anon) 350 if (is_anon)
351 { 351 {
352 memset (&rnmsg->sender, 0, sizeof (GNUNET_HashCode)); 352 memset (&rnmsg->sender, 0, sizeof (struct GNUNET_HashCode));
353 rnmsg->sequence_number = 0; 353 rnmsg->sequence_number = 0;
354 } 354 }
355 else 355 else
@@ -364,7 +364,7 @@ handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client,
364 "Encrypting the session key using the public key of '%s'\n", 364 "Encrypting the session key using the public key of '%s'\n",
365 GNUNET_h2s (&trmsg->target)); 365 GNUNET_h2s (&trmsg->target));
366#endif 366#endif
367 if (0 == memcmp (&all_zeros, &trmsg->target, sizeof (GNUNET_HashCode))) 367 if (0 == memcmp (&all_zeros, &trmsg->target, sizeof (struct GNUNET_HashCode)))
368 { 368 {
369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
370 "Malformed message: private, but no target\n"); 370 "Malformed message: private, but no target\n");
@@ -377,7 +377,7 @@ handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client,
377 target = client_list_head; 377 target = client_list_head;
378 while ((NULL != target) && 378 while ((NULL != target) &&
379 (0 != 379 (0 !=
380 memcmp (&target->id, &trmsg->target, sizeof (GNUNET_HashCode)))) 380 memcmp (&target->id, &trmsg->target, sizeof (struct GNUNET_HashCode))))
381 target = target->next; 381 target = target->next;
382 if (NULL == target) 382 if (NULL == target)
383 { 383 {
@@ -416,7 +416,7 @@ handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client,
416 (pos->client != client)) 416 (pos->client != client))
417 { 417 {
418 if (((!is_priv) || 418 if (((!is_priv) ||
419 (0 == memcmp (&trmsg->target, &pos->id, sizeof (GNUNET_HashCode)))) 419 (0 == memcmp (&trmsg->target, &pos->id, sizeof (struct GNUNET_HashCode))))
420 && (0 == (ntohl (trmsg->msg_options) & (~pos->msg_options)))) 420 && (0 == (ntohl (trmsg->msg_options) & (~pos->msg_options))))
421 { 421 {
422 GNUNET_SERVER_notification_context_unicast (nc, pos->client, 422 GNUNET_SERVER_notification_context_unicast (nc, pos->client,
@@ -521,7 +521,7 @@ transmit_join_notification_to_peer (void *cls, size_t size, void *buf)
521 * Ask to send a join notification to the peer. 521 * Ask to send a join notification to the peer.
522 */ 522 */
523static int 523static int
524send_join_noficiation (void *cls, const GNUNET_HashCode * key, void *value) 524send_join_noficiation (void *cls, const struct GNUNET_HashCode * key, void *value)
525{ 525{
526 struct ChatClient *entry = cls; 526 struct ChatClient *entry = cls;
527 struct ConnectedPeer *cp = value; 527 struct ConnectedPeer *cp = value;
@@ -703,7 +703,7 @@ transmit_confirmation_receipt_to_peer (void *cls, size_t size, void *buf)
703 * Ask to send a confirmation receipt to the peer. 703 * Ask to send a confirmation receipt to the peer.
704 */ 704 */
705static int 705static int
706send_confirmation_receipt (void *cls, const GNUNET_HashCode * key, void *value) 706send_confirmation_receipt (void *cls, const struct GNUNET_HashCode * key, void *value)
707{ 707{
708 struct P2PConfirmationReceiptMessage *receipt = cls; 708 struct P2PConfirmationReceiptMessage *receipt = cls;
709 struct ConnectedPeer *cp = value; 709 struct ConnectedPeer *cp = value;
@@ -754,7 +754,7 @@ handle_acknowledge_request (void *cls, struct GNUNET_SERVER_Client *client,
754 author = client_list_head; 754 author = client_list_head;
755 while ((NULL != author) && 755 while ((NULL != author) &&
756 (0 != 756 (0 !=
757 memcmp (&receipt->author, &author->id, sizeof (GNUNET_HashCode)))) 757 memcmp (&receipt->author, &author->id, sizeof (struct GNUNET_HashCode))))
758 author = author->next; 758 author = author->next;
759 if (NULL == author) 759 if (NULL == author)
760 { 760 {
@@ -767,7 +767,7 @@ handle_acknowledge_request (void *cls, struct GNUNET_SERVER_Client *client,
767 target = client_list_head; 767 target = client_list_head;
768 while ((NULL != target) && 768 while ((NULL != target) &&
769 (0 != 769 (0 !=
770 memcmp (&receipt->target, &target->id, sizeof (GNUNET_HashCode)))) 770 memcmp (&receipt->target, &target->id, sizeof (struct GNUNET_HashCode))))
771 target = target->next; 771 target = target->next;
772 if (NULL == target) 772 if (NULL == target)
773 { 773 {
@@ -880,7 +880,7 @@ transmit_leave_notification_to_peer (void *cls, size_t size, void *buf)
880 * Ask to send a leave notification to the peer. 880 * Ask to send a leave notification to the peer.
881 */ 881 */
882static int 882static int
883send_leave_noficiation (void *cls, const GNUNET_HashCode * key, void *value) 883send_leave_noficiation (void *cls, const struct GNUNET_HashCode * key, void *value)
884{ 884{
885 struct ChatClient *entry = cls; 885 struct ChatClient *entry = cls;
886 struct ConnectedPeer *cp = value; 886 struct ConnectedPeer *cp = value;
@@ -1000,7 +1000,7 @@ handle_p2p_join_notification (void *cls,
1000 struct ChatClient *new_entry; 1000 struct ChatClient *new_entry;
1001 struct ChatClient *entry; 1001 struct ChatClient *entry;
1002 struct JoinNotificationMessage *jnmsg; 1002 struct JoinNotificationMessage *jnmsg;
1003 GNUNET_HashCode id; 1003 struct GNUNET_HashCode id;
1004 1004
1005 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got P2P join notification\n"); 1005 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got P2P join notification\n");
1006 if (ntohs (message->size) <= sizeof (struct P2PJoinNotificationMessage)) 1006 if (ntohs (message->size) <= sizeof (struct P2PJoinNotificationMessage))
@@ -1025,7 +1025,7 @@ handle_p2p_join_notification (void *cls,
1025 entry = client_list_head; 1025 entry = client_list_head;
1026 while (NULL != entry) 1026 while (NULL != entry)
1027 { 1027 {
1028 if (0 == memcmp (&entry->id, &id, sizeof (GNUNET_HashCode))) 1028 if (0 == memcmp (&entry->id, &id, sizeof (struct GNUNET_HashCode)))
1029 { 1029 {
1030#if DEBUG_CHAT_SERVICE 1030#if DEBUG_CHAT_SERVICE
1031 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1031 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1109,7 +1109,7 @@ handle_p2p_leave_notification (void *cls,
1109 unsigned int atsi_count) 1109 unsigned int atsi_count)
1110{ 1110{
1111 const struct P2PLeaveNotificationMessage *p2p_lnmsg; 1111 const struct P2PLeaveNotificationMessage *p2p_lnmsg;
1112 GNUNET_HashCode id; 1112 struct GNUNET_HashCode id;
1113 struct ChatClient *pos; 1113 struct ChatClient *pos;
1114 struct ChatClient *prev; 1114 struct ChatClient *prev;
1115 struct ChatClient *entry; 1115 struct ChatClient *entry;
@@ -1124,7 +1124,7 @@ handle_p2p_leave_notification (void *cls,
1124 prev = NULL; 1124 prev = NULL;
1125 while (NULL != pos) 1125 while (NULL != pos)
1126 { 1126 {
1127 if (0 == memcmp (&pos->id, &id, sizeof (GNUNET_HashCode))) 1127 if (0 == memcmp (&pos->id, &id, sizeof (struct GNUNET_HashCode)))
1128 break; 1128 break;
1129 prev = pos; 1129 prev = pos;
1130 pos = pos->next; 1130 pos = pos->next;
@@ -1195,7 +1195,7 @@ handle_p2p_message_notification (void *cls,
1195 struct ReceiveNotificationMessage *rnmsg; 1195 struct ReceiveNotificationMessage *rnmsg;
1196 struct ChatClient *sender; 1196 struct ChatClient *sender;
1197 struct ChatClient *pos; 1197 struct ChatClient *pos;
1198 static GNUNET_HashCode all_zeros; 1198 static struct GNUNET_HashCode all_zeros;
1199 int is_priv; 1199 int is_priv;
1200 int is_anon; 1200 int is_anon;
1201 uint16_t msg_len; 1201 uint16_t msg_len;
@@ -1246,7 +1246,7 @@ handle_p2p_message_notification (void *cls,
1246 sender = client_list_head; 1246 sender = client_list_head;
1247 while ((NULL != sender) && 1247 while ((NULL != sender) &&
1248 (0 != 1248 (0 !=
1249 memcmp (&sender->id, &p2p_rnmsg->sender, sizeof (GNUNET_HashCode)))) 1249 memcmp (&sender->id, &p2p_rnmsg->sender, sizeof (struct GNUNET_HashCode))))
1250 sender = sender->next; 1250 sender = sender->next;
1251 if (NULL == sender) 1251 if (NULL == sender)
1252 { 1252 {
@@ -1287,7 +1287,7 @@ handle_p2p_message_notification (void *cls,
1287 rnmsg->reserved = htonl (0); 1287 rnmsg->reserved = htonl (0);
1288 rnmsg->timestamp = p2p_rnmsg->timestamp; 1288 rnmsg->timestamp = p2p_rnmsg->timestamp;
1289 is_priv = 1289 is_priv =
1290 (0 != memcmp (&all_zeros, &p2p_rnmsg->target, sizeof (GNUNET_HashCode))); 1290 (0 != memcmp (&all_zeros, &p2p_rnmsg->target, sizeof (struct GNUNET_HashCode)));
1291 if (is_priv) 1291 if (is_priv)
1292 memcpy (&rnmsg->encrypted_key, &p2p_rnmsg->encrypted_key, 1292 memcpy (&rnmsg->encrypted_key, &p2p_rnmsg->encrypted_key,
1293 sizeof (struct GNUNET_CRYPTO_RsaEncryptedData)); 1293 sizeof (struct GNUNET_CRYPTO_RsaEncryptedData));
@@ -1300,7 +1300,7 @@ handle_p2p_message_notification (void *cls,
1300 { 1300 {
1301 if (((!is_priv) || 1301 if (((!is_priv) ||
1302 (0 == 1302 (0 ==
1303 memcmp (&p2p_rnmsg->target, &pos->id, sizeof (GNUNET_HashCode)))) && 1303 memcmp (&p2p_rnmsg->target, &pos->id, sizeof (struct GNUNET_HashCode)))) &&
1304 (0 == (ntohl (p2p_rnmsg->msg_options) & (~pos->msg_options)))) 1304 (0 == (ntohl (p2p_rnmsg->msg_options) & (~pos->msg_options))))
1305 { 1305 {
1306 GNUNET_SERVER_notification_context_unicast (nc, pos->client, 1306 GNUNET_SERVER_notification_context_unicast (nc, pos->client,
@@ -1396,7 +1396,7 @@ handle_p2p_confirmation_receipt (void *cls,
1396 target = client_list_head; 1396 target = client_list_head;
1397 while ((NULL != target) && 1397 while ((NULL != target) &&
1398 (0 != 1398 (0 !=
1399 memcmp (&target->id, &p2p_crmsg->target, sizeof (GNUNET_HashCode)))) 1399 memcmp (&target->id, &p2p_crmsg->target, sizeof (struct GNUNET_HashCode))))
1400 target = target->next; 1400 target = target->next;
1401 if (NULL == target) 1401 if (NULL == target)
1402 { 1402 {
@@ -1420,7 +1420,7 @@ handle_p2p_confirmation_receipt (void *cls,
1420 author = client_list_head; 1420 author = client_list_head;
1421 while ((NULL != author) && 1421 while ((NULL != author) &&
1422 (0 != 1422 (0 !=
1423 memcmp (&author->id, &p2p_crmsg->author, sizeof (GNUNET_HashCode)))) 1423 memcmp (&author->id, &p2p_crmsg->author, sizeof (struct GNUNET_HashCode))))
1424 author = author->next; 1424 author = author->next;
1425 if (NULL == author) 1425 if (NULL == author)
1426 { 1426 {
@@ -1563,7 +1563,7 @@ peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
1563 * @return GNUNET_YES (we should continue to iterate) 1563 * @return GNUNET_YES (we should continue to iterate)
1564 */ 1564 */
1565static int 1565static int
1566clean_peer (void *cls, const GNUNET_HashCode * key, void *value) 1566clean_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
1567{ 1567{
1568 struct ConnectedPeer *cp; 1568 struct ConnectedPeer *cp;
1569 const struct GNUNET_PeerIdentity *peer = 1569 const struct GNUNET_PeerIdentity *peer =
@@ -1595,7 +1595,7 @@ peer_disconnect_handler (void *cls, const struct GNUNET_PeerIdentity *peer)
1595 return; 1595 return;
1596 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer disconnected: %s\n", 1596 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer disconnected: %s\n",
1597 GNUNET_i2s (peer)); 1597 GNUNET_i2s (peer));
1598 clean_peer (NULL, (const GNUNET_HashCode *) peer, NULL); 1598 clean_peer (NULL, (const struct GNUNET_HashCode *) peer, NULL);
1599} 1599}
1600 1600
1601 1601
diff --git a/src/chat/test_chat.c b/src/chat/test_chat.c
index 2e8272def..370cb04ee 100644
--- a/src/chat/test_chat.c
+++ b/src/chat/test_chat.c
@@ -58,7 +58,7 @@ struct Wanted
58{ 58{
59 struct GNUNET_CONTAINER_MetaData *meta; 59 struct GNUNET_CONTAINER_MetaData *meta;
60 60
61 GNUNET_HashCode *sender; 61 struct GNUNET_HashCode *sender;
62 62
63 char *msg; 63 char *msg;
64 64
@@ -80,9 +80,9 @@ static struct PeerContext p1;
80 80
81static struct PeerContext p2; 81static struct PeerContext p2;
82 82
83static GNUNET_HashCode alice; 83static struct GNUNET_HashCode alice;
84 84
85static GNUNET_HashCode bob; 85static struct GNUNET_HashCode bob;
86 86
87static struct GNUNET_CHAT_Room *alice_room; 87static struct GNUNET_CHAT_Room *alice_room;
88 88
@@ -201,7 +201,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
201 enum GNUNET_CHAT_MsgOptions options) 201 enum GNUNET_CHAT_MsgOptions options)
202{ 202{
203 struct Wanted *want = cls; 203 struct Wanted *want = cls;
204 GNUNET_HashCode sender; 204 struct GNUNET_HashCode sender;
205 205
206#if VERBOSE 206#if VERBOSE
207 printf ("%s - told that %s has %s\n", want->me, 207 printf ("%s - told that %s has %s\n", want->me,
@@ -213,7 +213,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
213 GNUNET_CRYPTO_hash (member_id, 213 GNUNET_CRYPTO_hash (member_id,
214 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 214 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
215 &sender); 215 &sender);
216 if ((0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) && 216 if ((0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode))) &&
217 (((member_info == NULL) && (want->meta == NULL)) || 217 (((member_info == NULL) && (want->meta == NULL)) ||
218 ((member_info != NULL) && (want->meta != NULL) && 218 ((member_info != NULL) && (want->meta != NULL) &&
219 (GNUNET_CONTAINER_meta_data_test_equal (member_info, want->meta)))) && 219 (GNUNET_CONTAINER_meta_data_test_equal (member_info, want->meta)))) &&
@@ -234,7 +234,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
234 234
235static int 235static int
236receive_cb (void *cls, struct GNUNET_CHAT_Room *room, 236receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
237 const GNUNET_HashCode * sender, 237 const struct GNUNET_HashCode * sender,
238 const struct GNUNET_CONTAINER_MetaData *meta, const char *message, 238 const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
239 struct GNUNET_TIME_Absolute timestamp, 239 struct GNUNET_TIME_Absolute timestamp,
240 enum GNUNET_CHAT_MsgOptions options) 240 enum GNUNET_CHAT_MsgOptions options)
@@ -250,7 +250,7 @@ receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
250 if ((0 == strcmp (message, want->msg)) && 250 if ((0 == strcmp (message, want->msg)) &&
251 (((sender == NULL) && (want->sender == NULL)) || 251 (((sender == NULL) && (want->sender == NULL)) ||
252 ((sender != NULL) && (want->sender != NULL) && 252 ((sender != NULL) && (want->sender != NULL) &&
253 (0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) && 253 (0 == memcmp (sender, want->sender, sizeof (struct GNUNET_HashCode))))) &&
254 (GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) && 254 (GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
255 (options == want->opt) && 255 (options == want->opt) &&
256 /* Not == since the library sets the actual timestamp, so it may be 256 /* Not == since the library sets the actual timestamp, so it may be
@@ -275,7 +275,7 @@ static int
275confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room, 275confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
276 uint32_t orig_seq_number, 276 uint32_t orig_seq_number,
277 struct GNUNET_TIME_Absolute timestamp, 277 struct GNUNET_TIME_Absolute timestamp,
278 const GNUNET_HashCode * receiver) 278 const struct GNUNET_HashCode * receiver)
279{ 279{
280 struct Wanted *want = cls; 280 struct Wanted *want = cls;
281 281
@@ -285,7 +285,7 @@ confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
285 EXTRACTOR_METATYPE_TITLE), 285 EXTRACTOR_METATYPE_TITLE),
286 orig_seq_number); 286 orig_seq_number);
287#endif 287#endif
288 if ((0 == memcmp (receiver, want->sender, sizeof (GNUNET_HashCode))) && 288 if ((0 == memcmp (receiver, want->sender, sizeof (struct GNUNET_HashCode))) &&
289 (orig_seq_number == want->sequence_number) && 289 (orig_seq_number == want->sequence_number) &&
290 (timestamp.abs_value >= want->timestamp.abs_value)) 290 (timestamp.abs_value >= want->timestamp.abs_value))
291 { 291 {
diff --git a/src/chat/test_chat_private.c b/src/chat/test_chat_private.c
index 8b61392ca..0aebd8f8b 100644
--- a/src/chat/test_chat_private.c
+++ b/src/chat/test_chat_private.c
@@ -56,7 +56,7 @@ struct Wanted
56{ 56{
57 struct GNUNET_CONTAINER_MetaData *meta; 57 struct GNUNET_CONTAINER_MetaData *meta;
58 58
59 GNUNET_HashCode *sender; 59 struct GNUNET_HashCode *sender;
60 60
61 /** 61 /**
62 * Alternative meta/sender is used when we expect join/leave notification 62 * Alternative meta/sender is used when we expect join/leave notification
@@ -64,7 +64,7 @@ struct Wanted
64 */ 64 */
65 struct GNUNET_CONTAINER_MetaData *meta2; 65 struct GNUNET_CONTAINER_MetaData *meta2;
66 66
67 GNUNET_HashCode *sender2; 67 struct GNUNET_HashCode *sender2;
68 68
69 char *msg; 69 char *msg;
70 70
@@ -86,11 +86,11 @@ static struct PeerContext p2;
86 86
87static struct PeerContext p3; 87static struct PeerContext p3;
88 88
89static GNUNET_HashCode alice; 89static struct GNUNET_HashCode alice;
90 90
91static GNUNET_HashCode bob; 91static struct GNUNET_HashCode bob;
92 92
93static GNUNET_HashCode carol; 93static struct GNUNET_HashCode carol;
94 94
95static struct GNUNET_CHAT_Room *alice_room; 95static struct GNUNET_CHAT_Room *alice_room;
96 96
@@ -220,7 +220,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
220 enum GNUNET_CHAT_MsgOptions options) 220 enum GNUNET_CHAT_MsgOptions options)
221{ 221{
222 struct Wanted *want = cls; 222 struct Wanted *want = cls;
223 GNUNET_HashCode sender; 223 struct GNUNET_HashCode sender;
224 224
225#if VERBOSE 225#if VERBOSE
226 printf ("%s - told that %s has %s\n", want->me, 226 printf ("%s - told that %s has %s\n", want->me,
@@ -233,9 +233,9 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
233 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 233 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
234 &sender); 234 &sender);
235 /* entertain both primary and an alternative sender/meta */ 235 /* entertain both primary and an alternative sender/meta */
236 if (((0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) || 236 if (((0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode))) ||
237 ((want->sender2 != NULL) && 237 ((want->sender2 != NULL) &&
238 (0 == memcmp (&sender, want->sender2, sizeof (GNUNET_HashCode))))) && 238 (0 == memcmp (&sender, want->sender2, sizeof (struct GNUNET_HashCode))))) &&
239 (((member_info == NULL) && (want->meta == NULL)) || 239 (((member_info == NULL) && (want->meta == NULL)) ||
240 ((member_info != NULL) && 240 ((member_info != NULL) &&
241 (((want->meta != NULL) && 241 (((want->meta != NULL) &&
@@ -246,7 +246,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
246 { 246 {
247 /* remember Bob's public key, we need it to send private message */ 247 /* remember Bob's public key, we need it to send private message */
248 if (NULL == bob_public_key && 248 if (NULL == bob_public_key &&
249 (0 == memcmp (&bob, want->sender, sizeof (GNUNET_HashCode)))) 249 (0 == memcmp (&bob, want->sender, sizeof (struct GNUNET_HashCode))))
250 bob_public_key = 250 bob_public_key =
251 GNUNET_memdup (member_id, 251 GNUNET_memdup (member_id,
252 sizeof (struct 252 sizeof (struct
@@ -254,7 +254,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
254 if (want->sender2 != NULL) 254 if (want->sender2 != NULL)
255 { 255 {
256 /* flush alternative sender */ 256 /* flush alternative sender */
257 if (0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) 257 if (0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode)))
258 { 258 {
259 want->sender = want->sender2; 259 want->sender = want->sender2;
260 want->meta = want->meta2; 260 want->meta = want->meta2;
@@ -277,7 +277,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
277 277
278static int 278static int
279receive_cb (void *cls, struct GNUNET_CHAT_Room *room, 279receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
280 const GNUNET_HashCode * sender, 280 const struct GNUNET_HashCode * sender,
281 const struct GNUNET_CONTAINER_MetaData *meta, const char *message, 281 const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
282 struct GNUNET_TIME_Absolute timestamp, 282 struct GNUNET_TIME_Absolute timestamp,
283 enum GNUNET_CHAT_MsgOptions options) 283 enum GNUNET_CHAT_MsgOptions options)
@@ -294,7 +294,7 @@ receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
294 if ((want->msg != NULL) && (0 == strcmp (message, want->msg)) && 294 if ((want->msg != NULL) && (0 == strcmp (message, want->msg)) &&
295 (((sender == NULL) && (want->sender == NULL)) || 295 (((sender == NULL) && (want->sender == NULL)) ||
296 ((sender != NULL) && (want->sender != NULL) && 296 ((sender != NULL) && (want->sender != NULL) &&
297 (0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) && 297 (0 == memcmp (sender, want->sender, sizeof (struct GNUNET_HashCode))))) &&
298 (GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) && 298 (GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
299 (options == want->opt) && 299 (options == want->opt) &&
300 /* Not == since the library sets the actual timestamp, so it may be 300 /* Not == since the library sets the actual timestamp, so it may be