+
+/**
+ * Cancel a store request
+ *
+ * @param sc Store request context
+ */
+void
+GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc)
+{
+ struct GNUNET_PEERSTORE_Handle *h = sc->h;
+
+ GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc);
+ GNUNET_free (sc->sub_system);
+ GNUNET_free (sc->value);
+ GNUNET_free (sc->key);
+ GNUNET_free (sc);
+ if ((GNUNET_YES == h->disconnecting) && (NULL == h->store_head))
+ do_disconnect (h);
+}
+
+
+/**
+ * Store a new entry in the PEERSTORE.
+ * Note that stored entries can be lost in some cases
+ * such as power failure.
+ *
+ * @param h Handle to the PEERSTORE service
+ * @param sub_system name of the sub system
+ * @param peer Peer Identity
+ * @param key entry key
+ * @param value entry value BLOB
+ * @param size size of @e value
+ * @param expiry absolute time after which the entry is (possibly) deleted
+ * @param options options specific to the storage operation
+ * @param cont Continuation function after the store request is sent
+ * @param cont_cls Closure for @a cont
+ */
+struct GNUNET_PEERSTORE_StoreContext *
+GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h,
+ const char *sub_system,
+ const struct GNUNET_PeerIdentity *peer, const char *key,
+ const void *value, size_t size,
+ struct GNUNET_TIME_Absolute expiry,
+ enum GNUNET_PEERSTORE_StoreOption options,
+ GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
+{
+ struct GNUNET_MQ_Envelope *ev;
+ struct GNUNET_PEERSTORE_StoreContext *sc;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Storing value (size: %lu) for subsytem `%s', peer `%s', key `%s'\n",
+ size, sub_system, GNUNET_i2s (peer), key);
+ ev = PEERSTORE_create_record_mq_envelope (sub_system, peer, key, value, size,
+ &expiry, options,
+ GNUNET_MESSAGE_TYPE_PEERSTORE_STORE);
+ sc = GNUNET_new (struct GNUNET_PEERSTORE_StoreContext);
+
+ sc->sub_system = GNUNET_strdup (sub_system);
+ sc->peer = *peer;
+ sc->key = GNUNET_strdup (key);
+ sc->value = GNUNET_memdup (value, size);
+ sc->size = size;
+ sc->expiry = expiry;
+ sc->options = options;
+ sc->cont = cont;
+ sc->cont_cls = cont_cls;
+ sc->h = h;
+
+ GNUNET_CONTAINER_DLL_insert_tail (h->store_head, h->store_tail, sc);
+ GNUNET_MQ_notify_sent (ev, &store_request_sent, sc);
+ GNUNET_MQ_send (h->mq, ev);
+ return sc;
+
+}
+
+
+/******************************************************************************/
+/******************* ITERATE FUNCTIONS *********************/
+/******************************************************************************/
+