+ static struct GNUNET_IDENTITY_Ego *my_ego;
+ static int round;
+
+ switch (round)
+ {
+ case 0: /* end of initial iteration */
+ GNUNET_assert (NULL == ego);
+ GNUNET_assert (NULL == identifier);
+ break;
+ case 1: /* create */
+ GNUNET_assert (NULL != ego);
+ GNUNET_assert (0 == strcmp (identifier,
+ "test-id"));
+ my_ego = ego;
+ *ctx = &round;
+ break;
+ case 2: /* rename */
+ GNUNET_assert (my_ego == ego);
+ GNUNET_assert (0 == strcmp (identifier,
+ "test"));
+ GNUNET_assert (*ctx == &round);
+ break;
+ case 3: /* reconnect-down */
+ GNUNET_assert (my_ego == ego);
+ GNUNET_assert (NULL == identifier);
+ GNUNET_assert (*ctx == &round);
+ *ctx = NULL;
+ break;
+ case 4: /* reconnect-up */
+ GNUNET_assert (0 == strcmp (identifier,
+ "test"));
+ my_ego = ego;
+ *ctx = &round;
+ break;
+ case 5: /* end of iteration after reconnect */
+ GNUNET_assert (NULL == ego);
+ GNUNET_assert (NULL == identifier);
+ break;
+ case 6: /* delete */
+ GNUNET_assert (my_ego == ego);
+ GNUNET_assert (*ctx == &round);
+ *ctx = NULL;
+ break;
+ default:
+ GNUNET_break (0);
+ }
+ round++;
+}
+
+
+/**
+ * Continuation called from successful delete operation.
+ *
+ * @param cls NULL
+ * @param emsg (should also be NULL)
+ */
+static void
+delete_cont (void *cls,
+ const char *emsg)
+{
+ op = NULL;
+ GNUNET_assert (NULL == emsg);
+ end ();
+}
+
+
+/**
+ * Continue by deleting the "test" identity.
+ *
+ * @param cls NULL
+ */
+static void
+finally_delete (void *cls)
+{
+ op = GNUNET_IDENTITY_delete (h,
+ "test",
+ &delete_cont,
+ NULL);
+}
+
+
+/**
+ * Continuation called from expected-to-fail rename operation.
+ *
+ * @param cls NULL
+ * @param emsg (should also be NULL)
+ */
+static void
+fail_rename_cont (void *cls,
+ const char *emsg)
+{
+ GNUNET_assert (NULL != emsg);
+ op = NULL;
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &finally_delete,
+ NULL);
+}
+
+
+/**
+ * Continuation called from successful rename operation.
+ *
+ * @param cls NULL
+ * @param emsg (should also be NULL)
+ */
+static void
+success_rename_cont (void *cls,
+ const char *emsg)
+{
+ GNUNET_assert (NULL == emsg);
+ op = GNUNET_IDENTITY_rename (h,
+ "test-id",
+ "test",
+ &fail_rename_cont,
+ NULL);