+
+
+static int
+comm_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other,
+ const struct GNUNET_MessageHeader *message)
+{
+ struct BenchmarkPeer *me = cls;
+ struct BenchmarkPartner *p = NULL;
+
+ if (NULL == (p = find_partner (me, other)))
+ {
+ GNUNET_break(0);
+ return GNUNET_SYSERR;
+ }
+
+ GNUNET_ATS_TEST_traffic_handle_pong (p);
+
+ return GNUNET_OK;
+}
+
+static int
+comm_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other,
+ const struct GNUNET_MessageHeader *message)
+{
+ struct BenchmarkPeer *me = cls;
+ struct BenchmarkPartner *p = NULL;
+
+ if (NULL == (p = find_partner(me, other)))
+ {
+ GNUNET_break(0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_ATS_TEST_traffic_handle_ping (p);
+ return GNUNET_OK;
+}
+
+static void
+test_recv_cb (void *cls,
+ const struct GNUNET_PeerIdentity * peer,
+ const struct GNUNET_MessageHeader * message)
+{
+ if (TEST_MESSAGE_SIZE != ntohs (message->size) ||
+ (TEST_MESSAGE_TYPE_PING != ntohs (message->type) &&
+ TEST_MESSAGE_TYPE_PONG != ntohs (message->type)))
+ {
+ return;
+ }
+ if (TEST_MESSAGE_TYPE_PING == ntohs (message->type))
+ comm_handle_ping (cls, peer, message);
+ if (TEST_MESSAGE_TYPE_PONG == ntohs (message->type))
+ comm_handle_pong (cls, peer, message);
+}
+
+