aboutsummaryrefslogtreecommitdiff
path: root/src/chat/gnunet-service-chat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chat/gnunet-service-chat.c')
-rw-r--r--src/chat/gnunet-service-chat.c56
1 files changed, 28 insertions, 28 deletions
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