+static void
+transport_notify_receive_cb (void *cls,
+ const struct
+ GNUNET_PeerIdentity * peer,
+ const struct
+ GNUNET_MessageHeader *
+ message,
+ const struct
+ GNUNET_ATS_Information * ats,
+ uint32_t ats_count)
+{
+
+
+ struct PeerContainer *pc = NULL;
+
+ pc = GNUNET_CONTAINER_multihashmap_get(peers, &peer->hashPubKey);
+
+ if (NULL == pc)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ if ((message->size == ntohs (sizeof (struct PING))) && (message->type == ntohs (1234)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s %s from peer `%s'\n",
+ "TRANSPORT",
+ "PING",
+ GNUNET_i2s (peer)) ;
+ if (GNUNET_YES == ping)
+ {
+ if (NULL == pc->th_pong)
+ pc->th_pong = GNUNET_TRANSPORT_notify_transmit_ready(th,
+ peer, sizeof (struct PONG),
+ UINT_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
+ &send_transport_pong_cb, pc);
+ else
+ GNUNET_break (0);
+ }
+
+ }
+ if ((message->size == ntohs (sizeof (struct PONG))) && (message->type == ntohs (4321)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received %s %s from peer `%s'\n",
+ "TRANSPORT",
+ "PONG",
+ GNUNET_i2s (peer));
+ }
+}
+
+static int
+core_notify_receive_cb (void *cls,
+ const struct GNUNET_PeerIdentity * peer,
+ const struct GNUNET_MessageHeader * message,
+ const struct GNUNET_ATS_Information* atsi,
+ unsigned int atsi_count)
+{
+ struct PeerContainer *pc = NULL;
+
+ pc = GNUNET_CONTAINER_multihashmap_get(peers, &peer->hashPubKey);
+
+ if (NULL == pc)
+ {
+ if (0 == memcmp (peer, &my_peer_id, sizeof (my_peer_id)))
+ return GNUNET_OK;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received unexpected message type %u from unknown peer `%s'\n",
+ ntohs (message->type),
+ GNUNET_i2s (peer));
+
+ GNUNET_break (0);
+ return GNUNET_OK;
+ }
+
+ if ((message->size == ntohs (sizeof (struct PING))) && (message->type == ntohs (1234)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received %s %s from peer `%s'\n",
+ "CORE",
+ "PING",
+ GNUNET_i2s (peer));
+ if (GNUNET_YES == ping)
+ {
+ if (NULL == pc->ch_pong)
+ pc->ch_pong = GNUNET_CORE_notify_transmit_ready(ch,
+ GNUNET_NO, UINT_MAX,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ peer,
+ sizeof (struct PONG),
+ send_core_pong_cb, pc);
+ else
+ GNUNET_break (0);
+ }
+ }
+
+ if ((message->size == ntohs (sizeof (struct PONG))) && (message->type == ntohs (4321)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s %s from peer `%s'\n",
+ "CORE",
+ "PONG",
+ GNUNET_i2s (peer));
+
+ }
+
+ return GNUNET_OK;
+}