+ pp.target = *kx->peer;
+ do_encrypt (kx,
+ &iv,
+ &pp.target,
+ &pm->target,
+ sizeof(struct PingMessage)
+ - ((void *) &pm->target - (void *) pm));
+}
+
+
+/**
+ * Deliver P2P message to interested clients. Invokes send twice,
+ * once for clients that want the full message, and once for clients
+ * that only want the header
+ *
+ * @param cls the `struct GSC_KeyExchangeInfo`
+ * @param m the message
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
+ */
+static int
+deliver_message (void *cls, const struct GNUNET_MessageHeader *m)
+{
+ struct GSC_KeyExchangeInfo *kx = cls;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Decrypted message of type %d from %s\n",
+ ntohs (m->type),
+ GNUNET_i2s (kx->peer));
+ if (GNUNET_CORE_KX_STATE_UP != kx->status)
+ {
+ GNUNET_STATISTICS_update (GSC_stats,
+ gettext_noop ("# PAYLOAD dropped (out of order)"),
+ 1,
+ GNUNET_NO);
+ return GNUNET_OK;
+ }
+ switch (ntohs (m->type))
+ {
+ case GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP:
+ case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP:
+ GSC_SESSIONS_set_typemap (kx->peer, m);
+ return GNUNET_OK;
+
+ case GNUNET_MESSAGE_TYPE_CORE_CONFIRM_TYPE_MAP:
+ GSC_SESSIONS_confirm_typemap (kx->peer, m);
+ return GNUNET_OK;
+
+ default:
+ GSC_CLIENTS_deliver_message (kx->peer,
+ m,
+ ntohs (m->size),
+ GNUNET_CORE_OPTION_SEND_FULL_INBOUND);
+ GSC_CLIENTS_deliver_message (kx->peer,
+ m,
+ sizeof(struct GNUNET_MessageHeader),
+ GNUNET_CORE_OPTION_SEND_HDR_INBOUND);
+ }
+ return GNUNET_OK;