+/**
+ * This is a callback function that checks for key revocation
+ *
+ * @param cls the pending query
+ * @param key the key of the zone we did the lookup
+ * @param expiration expiration date of the record data set in the namestore
+ * @param name the name for which we need an authority
+ * @param rd_count the number of records with 'name'
+ * @param rd the record data
+ * @param signature the signature of the authority for the record data
+ */
+static void
+process_pkey_revocation_result_ns (void *cls,
+ const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key,
+ struct GNUNET_TIME_Absolute expiration,
+ const char *name,
+ unsigned int rd_count,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
+ const struct GNUNET_CRYPTO_RsaSignature *signature)
+{
+ struct ResolverHandle *rh = cls;
+ struct GNUNET_TIME_Relative remaining_time;
+ int i;
+
+ rh->namestore_task = NULL;
+ remaining_time = GNUNET_TIME_absolute_get_remaining (expiration);
+
+ for (i = 0; i < rd_count; i++)
+ {
+ if (rd[i].record_type == GNUNET_GNS_RECORD_REV)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_DELEGATE_REV-%llu: Zone has been revoked.\n",
+ rh->id);
+ rh->status |= RSL_PKEY_REVOKED;
+ rh->proc (rh->proc_cls, rh, 0, NULL);
+ return;
+ }
+ }
+
+ if ((name == NULL) ||
+ (remaining_time.rel_value == 0))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_DELEGATE_REV-%llu: + Records don't exist or are expired.\n",
+ rh->id, name);
+
+ if (rh->timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_DELEGATE_REV-%llu: Starting background lookup for %s type %d\n",
+ rh->id, "+.gnunet", GNUNET_GNS_RECORD_REV);
+
+ gns_resolver_lookup_record(rh->authority,
+ rh->private_local_zone,
+ GNUNET_GNS_RECORD_REV,
+ GNUNET_GNS_TLD,
+ NULL,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_NO,
+ &background_lookup_result_processor,
+ NULL);
+ }
+ }
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_DELEGATE_REV-%llu: Revocation check passed\n",
+ rh->id);
+ /**
+ * We are done with PKEY resolution if name is empty
+ * else resolve again with new authority
+ */
+ if (strcmp (rh->name, "") == 0)
+ rh->proc (rh->proc_cls, rh, rh->rd_count, &rh->rd);
+ else
+ resolve_delegation_ns (rh);
+
+ return;
+}
+
+
+/**
+ * Callback when record data is put into namestore
+ *
+ * @param cls the closure
+ * @param success GNUNET_OK on success
+ * @param emsg the error message. NULL if SUCCESS==GNUNET_OK
+ */
+void
+on_namestore_delegation_put_result(void *cls,
+ int32_t success,
+ const char *emsg)
+{
+ struct NamestoreBGTask *nbg = cls;
+
+ GNUNET_CONTAINER_heap_remove_node (nbg->node);
+ GNUNET_free (nbg);
+
+ if (GNUNET_NO == success)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_NS: records already in namestore\n");
+ return;
+ }
+ else if (GNUNET_YES == success)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_NS: records successfully put in namestore\n");
+ return;
+ }
+
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+ "GNS_NS: Error putting records into namestore: %s\n", emsg);
+}
+