- GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_stop, pc);
- if (GNUNET_YES == pc->in_network_wait)
- {
- pc->in_network_wait = GNUNET_SYSERR;
- return;
- }
- publish_cleanup (pc, NULL);
-}
-
-
-/**
- * Context for the KSK publication.
- */
-struct PublishKskContext
-{
-
- /**
- * Keywords to use.
- */
- struct GNUNET_FS_Uri *ksk_uri;
-
- /**
- * Global FS context.
- */
- struct GNUNET_FS_Handle *h;
-
- /**
- * The master block that we are sending
- * (in plaintext), has "mdsize+slen" more
- * bytes than the struct would suggest.
- */
- struct KBlock *kb;
-
- /**
- * Buffer of the same size as "kb" for
- * the encrypted version.
- */
- struct KBlock *cpy;
-
- /**
- * Handle to the datastore, NULL if we are just
- * simulating.
- */
- struct GNUNET_DATASTORE_Handle *dsh;
-
- /**
- * Handle to datastore PUT request.
- */
- struct GNUNET_DATASTORE_QueueEntry *qre;
-
- /**
- * Function to call once we're done.
- */
- GNUNET_FS_PublishContinuation cont;
-
- /**
- * Closure for cont.
- */
- void *cont_cls;
-
- /**
- * When should the KBlocks expire?
- */
- struct GNUNET_FS_BlockOptions bo;
-
- /**
- * Size of the serialized metadata.
- */
- ssize_t mdsize;
-
- /**
- * Size of the (CHK) URI as a string.
- */
- size_t slen;
-
- /**
- * Keyword that we are currently processing.
- */
- unsigned int i;
-
-};
-
-
-/**
- * Continuation of "GNUNET_FS_publish_ksk" that performs
- * the actual publishing operation (iterating over all
- * of the keywords).
- *
- * @param cls closure of type "struct PublishKskContext*"
- * @param tc unused
- */
-static void
-publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-
-/**
- * Function called by the datastore API with
- * the result from the PUT request.
- *
- * @param cls closure of type "struct PublishKskContext*"
- * @param success GNUNET_OK on success
- * @param msg error message (or NULL)
- */
-static void
-kb_put_cont (void *cls, int success, const char *msg)
-{
- struct PublishKskContext *pkc = cls;
-
- pkc->qre = NULL;
- if (GNUNET_OK != success)
- {
-#if DEBUG_PUBLISH
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "KB PUT operation complete\n");
-#endif
- if (NULL != pkc->dsh)
- {
- GNUNET_DATASTORE_disconnect (pkc->dsh, GNUNET_NO);
- pkc->dsh = NULL;
- }
- GNUNET_free (pkc->cpy);
- GNUNET_free (pkc->kb);
- pkc->cont (pkc->cont_cls, NULL, msg);
- GNUNET_FS_uri_destroy (pkc->ksk_uri);
- GNUNET_free (pkc);
- return;
- }
- GNUNET_SCHEDULER_add_continuation (&publish_ksk_cont, pkc,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
-}
-
-
-/**
- * Continuation of "GNUNET_FS_publish_ksk" that performs the actual
- * publishing operation (iterating over all of the keywords).
- *
- * @param cls closure of type "struct PublishKskContext*"
- * @param tc unused
- */
-static void
-publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct PublishKskContext *pkc = cls;
- const char *keyword;
- GNUNET_HashCode key;
- GNUNET_HashCode query;
- struct GNUNET_CRYPTO_AesSessionKey skey;
- struct GNUNET_CRYPTO_AesInitializationVector iv;
- struct GNUNET_CRYPTO_RsaPrivateKey *pk;
-
-
- if ((pkc->i == pkc->ksk_uri->data.ksk.keywordCount) || (NULL == pkc->dsh))