+static void
+master_message_cb (void *cls, const struct GNUNET_PSYC_MessageHeader *msg)
+{
+ GNUNET_assert (NULL != msg);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%d: Master got PSYC message fragment of size %u "
+ "belonging to message ID %" PRIu64 " with flags %x\n",
+ test, ntohs (msg->header.size),
+ GNUNET_ntohll (msg->message_id), ntohl (msg->flags));
+ // FIXME
+}
+
+
+static void
+master_message_part_cb (void *cls, const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg)
+{
+ GNUNET_assert (NULL != msg && NULL != pmsg);
+
+ uint64_t message_id = GNUNET_ntohll (msg->message_id);
+ uint32_t flags = ntohl (msg->flags);
+
+ uint16_t type = ntohs (pmsg->type);
+ uint16_t size = ntohs (pmsg->size);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%d: Master got message part of type %u and size %u "
+ "belonging to message ID %" PRIu64 " with flags %x\n",
+ test, type, size, message_id, flags);
+
+ switch (test)
+ {
+ case TEST_SLAVE_TRANSMIT:
+ if (GNUNET_PSYC_MESSAGE_REQUEST != flags)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Test #%d: Unexpected request flags: %x" PRIu32 "\n",
+ test, flags);
+ GNUNET_assert (0);
+ return;
+ }
+ // FIXME: check rest of message
+
+ if (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END == type)
+ master_transmit ();
+ break;
+
+ case TEST_MASTER_TRANSMIT:
+ if (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END == type && 2 == ++end_count)
+ master_history_replay_latest ();
+ break;
+
+ case TEST_MASTER_HISTORY_REPLAY:
+ case TEST_MASTER_HISTORY_REPLAY_LATEST:
+ if (GNUNET_PSYC_MESSAGE_HISTORIC != flags)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Test #%d: Unexpected flags for historic message: %x" PRIu32 "\n",
+ test, flags);
+ GNUNET_assert (0);
+ return;
+ }
+ break;
+
+ default:
+ GNUNET_assert (0);
+ }
+}
+
+
+static void
+slave_message_cb (void *cls, const struct GNUNET_PSYC_MessageHeader *msg)
+{
+ GNUNET_assert (NULL != msg);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%d: Slave got PSYC message fragment of size %u "
+ "belonging to message ID %" PRIu64 " with flags %x\n",
+ test, ntohs (msg->header.size),
+ GNUNET_ntohll (msg->message_id), ntohl (msg->flags));
+ // FIXME
+}
+
+
+static void
+slave_message_part_cb (void *cls,
+ const struct GNUNET_PSYC_MessageHeader *msg,
+ const struct GNUNET_MessageHeader *pmsg)
+{
+ GNUNET_assert (NULL != msg && NULL != pmsg);
+
+ uint64_t message_id = GNUNET_ntohll (msg->message_id);
+ uint32_t flags = ntohl (msg->flags);
+
+ uint16_t type = ntohs (pmsg->type);
+ uint16_t size = ntohs (pmsg->size);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%d: Slave got message part of type %u and size %u "
+ "belonging to message ID %" PRIu64 " with flags %x\n",
+ test, type, size, message_id, flags);
+
+ switch (test)
+ {
+ case TEST_MASTER_TRANSMIT:
+ if (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END == type && 2 == ++end_count)
+ master_history_replay_latest ();
+ break;
+
+ case TEST_SLAVE_HISTORY_REPLAY:
+ case TEST_SLAVE_HISTORY_REPLAY_LATEST:
+ if (GNUNET_PSYC_MESSAGE_HISTORIC != flags)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Test #%d: Unexpected flags for historic message: %x" PRIu32 "\n",
+ test, flags);
+ GNUNET_assert (0);
+ return;
+ }
+ break;
+
+ default:
+ GNUNET_assert (0);
+ }
+}
+
+
+static void
+state_get_var (void *cls, const struct GNUNET_MessageHeader *mod,
+ const char *name, const void *value,
+ uint32_t value_size, uint32_t full_value_size)