+/**
+ * Cancel a store request
+ *
+ * @param sc Store request context
+ */
+void
+GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc)
+{
+ struct GNUNET_PEERSTORE_Handle *h;
+
+ h = sc->h;
+ sc->cont = NULL;
+ if (GNUNET_YES == sc->request_transmitted)
+ return; /* need to finish processing */
+ GNUNET_CONTAINER_DLL_remove (h->sc_head,
+ h->sc_tail,
+ sc);
+ if (NULL != sc->rc)
+ {
+ GNUNET_CONTAINER_DLL_remove (h->rc_head, h->rc_tail, sc->rc);
+ GNUNET_free (sc->rc);
+ }
+ GNUNET_free (sc);
+}
+
+/**
+ * Called after store request is sent
+ * Waits for response from service
+ *
+ * @param cls a 'struct GNUNET_PEERSTORE_StoreContext'
+ * @parma emsg error message (or NULL)
+ */
+void store_receive_result(void *cls, const char *emsg)
+{
+ struct GNUNET_PEERSTORE_StoreContext *sc = cls;
+ struct GNUNET_PEERSTORE_Handle *h = sc->h;
+
+ sc->rc = NULL;
+ if(NULL != emsg)
+ {
+ GNUNET_PEERSTORE_store_cancel (sc);
+ reconnect (h);
+ if (NULL != sc->cont)
+ sc->cont (sc->cont_cls, emsg);
+ return;
+ }
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Waiting for response from `%s' service.\n",
+ "PEERSTORE");
+ sc->request_transmitted = GNUNET_YES;
+ if (GNUNET_NO == h->in_receive)
+ {
+ h->in_receive = GNUNET_YES;
+ GNUNET_CLIENT_receive (h->client,
+ &peerstore_handler,
+ h,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ }
+}
+
+/**
+ * Store a new entry in the PEERSTORE
+ *
+ * @param h Handle to the PEERSTORE service
+ * @param peer Peer Identity
+ * @param sub_system name of the sub system
+ * @param value entry value BLOB
+ * @param size size of 'value'
+ * @param lifetime relative time after which the entry is (possibly) deleted
+ * @param cont Continuation function after the store request is processed
+ * @param cont_cls Closure for 'cont'
+ */
+struct GNUNET_PEERSTORE_StoreContext *
+GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h,