/*
This file is part of GNUnet.
- Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
- * @file include/gnunet_client_manager_lib.h
- * @brief Client manager; higher level client API with transmission queue
- * and message handler registration.
* @author Gabor X Toth
- * @defgroup client_manager Higher level client-side communication with services.
+ *
+ * @file
+ * Client manager; higher level client API with transmission queue
+ * and message handler registration.
+ *
+ * @defgroup client-manager Client manager library
+ * Higher level client-side communication with services.
+ *
+ * Provides a higher level client API
+ * with transmission queue and message handler registration.
* @{
*/
#ifndef GNUNET_CLIENT_MANAGER_LIB_H
*
* @param mgr
* Client manager connection.
+ * @param ctx
+ * User context.
* @param size
* Number of bytes in user context struct (for verification only).
*/
*
* @param mgr
* Client manager connection.
- * @param ctx
- * User context.
- * @param size
- * Number of bytes in user context struct (for verification only).
+ * @param type
+ * Type of context (for size verification).
*/
#define GNUNET_CLIENT_MANAGER_get_user_context(mgr, type) \
(type *) GNUNET_CLIENT_MANAGER_get_user_context_ (mgr, sizeof (type))
GNUNET_CLIENT_MANAGER_set_user_context_ (mgr, ctx, sizeof (*ctx))
+/**
+ * Get a unique operation ID to distinguish between asynchronous requests.
+ *
+ * @param mgr
+ * Client manager connection.
+ *
+ * @return Operation ID to use.
+ */
+uint64_t
+GNUNET_CLIENT_MANAGER_op_get_next_id (struct GNUNET_CLIENT_MANAGER_Connection *mgr);
+
+
+/**
+ * Find operation by ID.
+ *
+ * @param mgr
+ * Client manager connection.
+ * @param op_id
+ * Operation ID to look up.
+ * @param[out] result_cb
+ * If an operation was found, its result callback is returned here.
+ * @param[out] cls
+ * If an operation was found, its closure is returned here.
+ *
+ * @return #GNUNET_YES if an operation was found,
+ * #GNUNET_NO if not found.
+ */
+int
+GNUNET_CLIENT_MANAGER_op_find (struct GNUNET_CLIENT_MANAGER_Connection *mgr,
+ uint64_t op_id,
+ GNUNET_ResultCallback *result_cb,
+ void **cls);
+
+
+/**
+ * Add a new operation.
+ *
+ * @param mgr
+ * Client manager connection.
+ * @param result_cb
+ * Function to call with the result of the operation.
+ * @param cls
+ * Closure for @a result_cb.
+ *
+ * @return ID of the new operation.
+ */
+uint64_t
+GNUNET_CLIENT_MANAGER_op_add (struct GNUNET_CLIENT_MANAGER_Connection *mgr,
+ GNUNET_ResultCallback result_cb,
+ void *cls);
+
+
+/**
+ * Call the result callback and remove the operation.
+ *
+ * @param mgr
+ * Client manager connection.
+ * @param op_id
+ * Operation ID.
+ * @param result_code
+ * Result of the operation.
+ * @param data
+ * Data result of the operation.
+ * @param data_size
+ * Size of @a data.
+ *
+ * @return #GNUNET_YES if the operation was found and removed,
+ * #GNUNET_NO if the operation was not found.
+ */
+int
+GNUNET_CLIENT_MANAGER_op_result (struct GNUNET_CLIENT_MANAGER_Connection *mgr,
+ uint64_t op_id, int64_t result_code,
+ const void *data, uint16_t data_size);
+
+
+/**
+ * Cancel an operation.
+ *
+ * @param mgr
+ * Client manager connection.
+ * @param op_id
+ * Operation ID.
+ *
+ * @return #GNUNET_YES if the operation was found and removed,
+ * #GNUNET_NO if the operation was not found.
+ */
+int
+GNUNET_CLIENT_MANAGER_op_cancel (struct GNUNET_CLIENT_MANAGER_Connection *mgr,
+ uint64_t op_id);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
}
#endif
-/** @} */ /* end of group client_manager */
-
/* ifndef GNUNET_CLIENT_MANAGER_LIB_H */
#endif
-/* end of gnunet_client_manager_lib.h */
+
+/** @} */ /* end of group */