-void
-GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_MessageHeader *m)
-{
- struct Neighbour *sender = client;
- size_t msize = ntohs (m->size);
- char buf[256];
- struct Client *cpos;
- uint16_t type;
- unsigned int tpos;
- int deliver_full;
- int dropped;
-
- GNUNET_break (sender->status == PEER_STATE_KEY_CONFIRMED);
- type = ntohs (m->type);
-#if DEBUG_CORE > 1
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received encapsulated message of type %u and size %u from `%4s'\n",
- (unsigned int) type, ntohs (m->size), GNUNET_i2s (&sender->peer));
-#endif
- GNUNET_snprintf (buf, sizeof (buf),
- gettext_noop ("# bytes of messages of type %u received"),
- (unsigned int) type);
- GNUNET_STATISTICS_update (stats, buf, msize, GNUNET_NO);
- if ((GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP == type) ||
- (GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP == type))
- {
- /* FIXME: update message type map for 'Neighbour' */
- return;
- }
- dropped = GNUNET_YES;
- cpos = clients;
- while (cpos != NULL)
- {
- deliver_full = GNUNET_NO;
- if (0 != (cpos->options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND))
- deliver_full = GNUNET_YES;
- else
- {
- for (tpos = 0; tpos < cpos->tcnt; tpos++)
- {
- if (type != cpos->types[tpos])
- continue;
- deliver_full = GNUNET_YES;
- break;
- }
- }
- if (GNUNET_YES == deliver_full)
- {
- send_p2p_message_to_client (sender, cpos, m, msize);
- dropped = GNUNET_NO;
- }
- else if (cpos->options & GNUNET_CORE_OPTION_SEND_HDR_INBOUND)
- {
- send_p2p_message_to_client (sender, cpos, m,
- sizeof (struct GNUNET_MessageHeader));
- }
- cpos = cpos->next;
- }
- if (dropped == GNUNET_YES)
- {
-#if DEBUG_CORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Message of type %u from `%4s' not delivered to any client.\n",
- (unsigned int) type, GNUNET_i2s (&sender->peer));
-#endif
- GNUNET_STATISTICS_update (stats,
- gettext_noop
- ("# messages not delivered to any client"), 1,
- GNUNET_NO);
- }
-}
-
-
-