+/**
+ * Handle response to our revocation query.
+ *
+ * @param cls our `struct GNUNET_REVOCATION_Handle` handle
+ * @param msg response we got, NULL on disconnect
+ */
+static void
+handle_revocation_response (void *cls,
+ const struct GNUNET_MessageHeader *msg)
+{
+ struct GNUNET_REVOCATION_Handle *h = cls;
+ const struct RevocationResponseMessage *rrm;
+
+ if ( (NULL == msg) ||
+ (sizeof (struct RevocationResponseMessage) != ntohs (msg->size)) ||
+ (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE != ntohs (msg->type)) )
+ {
+ GNUNET_break (NULL == msg);
+ h->func (h->func_cls, GNUNET_SYSERR);
+ GNUNET_REVOCATION_revoke_cancel (h);
+ return;
+ }
+ rrm = (const struct RevocationResponseMessage *) msg;
+ h->func (h->func_cls, ntohl (rrm->is_valid));
+ GNUNET_REVOCATION_revoke_cancel (h);
+
+}
+
+
+/**
+ * Transmit our revocation to the service.
+ *
+ * @param cls our `struct GNUNET_REVOCATION_Handle` handle
+ * @param size number of bytes available in @a buf
+ * @param buf where to copy the query
+ * @return number of bytes copied to @a buf
+ */
+static size_t
+send_revoke (void *cls,
+ size_t size,
+ void *buf)
+{
+ struct GNUNET_REVOCATION_Handle *h = cls;
+ struct RevokeMessage rm;
+
+ h->th = NULL;
+ if ( (NULL == buf) ||
+ (sizeof (struct RevokeMessage) > size) )
+ {
+ GNUNET_break (0);
+ h->func (h->func_cls, GNUNET_SYSERR);
+ GNUNET_REVOCATION_revoke_cancel (h);
+ return 0;
+ }
+ rm.header.size = htons (sizeof (struct RevokeMessage));
+ rm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
+ rm.reserved = htonl (0);
+ rm.proof_of_work = h->pow;
+ rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
+ rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
+ rm.public_key = h->key;
+ rm.signature = h->sig;
+ memcpy (buf, &rm, sizeof (struct RevokeMessage));
+ GNUNET_CLIENT_receive (h->client,
+ &handle_revocation_response,
+ h,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ return sizeof (struct RevokeMessage);
+}
+
+