summaryrefslogtreecommitdiff
path: root/brandt.h
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-08-31 14:37:22 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-08-31 14:37:22 +0200
commit9f0e72f1e8615c9c03222372b2c579471bcce602 (patch)
treea7fd357b79a9f939de5d5f67de1a030b59ff4418 /brandt.h
parent0d3b32b24881cb9ce89d0b6689ada53f88d0008e (diff)
temporary dump for discussion
Diffstat (limited to 'brandt.h')
-rw-r--r--brandt.h50
1 files changed, 36 insertions, 14 deletions
diff --git a/brandt.h b/brandt.h
index 569db11..3ed48b6 100644
--- a/brandt.h
+++ b/brandt.h
@@ -28,9 +28,31 @@
#include <gnunet/gnunet_util_lib.h>
-/** defined in internals.h */
+/** Enumeration of all possible status reports for a single bidder */
+enum BRANDT_BidderStatus
+{
+ BRANDT_bidder_won,
+};
+
+/** opaque, defined in internals.h */
struct BRANDT_Auction;
+/**
+ * An array of this struct is given to the application by the BRANDT_CbResult()
+ * callback. One instance represents the status of a single bidder.
+ */
+struct BRANDT_Result
+{
+ /** Id of the bidder this instance refers to */
+ uint16_t bidder;
+
+ /** The price the bidder has to pay. This value is only set if the #status
+ * indicates the bidder has won. */
+ uint16_t price;
+
+ /** Status of the bidder */
+ enum BRANDT_BidderStatus status;
+};
/**
* Functions of this type are called by libbrandt when the auction should be
@@ -86,22 +108,19 @@ typedef int
* Functions of this type are called by libbrandt to report the auction outcome
* or malicious/erroneous participants.
*
- * \todo: export proof of erroneous behaviour / outcome.
+ * \todo: export *proof* of erroneous behaviour / outcome.
*
* @param[in] auction_closure Closure pointer representing the respective
* auction. This is the Pointer given to BRANDT_join() / BRANDT_new().
- * @param[in] bidder_id The numeric Id of the bidder this report refers to.
- * @param[in] status 1 if the user @a bidder_id has won the auction, 0 if he has
- * lost, negative if erroneous behaviour was detected. Check the result_code
- * enum for more information.
- * @param[in] price The price, the winner has to pay or 0 if the auction result
- * is private and the user did not win.
+ * @param[in] results An array of results for one or more bidders. Each bidder
+ * will only be listed once. Misbehaving bidder results and auction completion
+ * results are not mixed.
+ * @param[in] results_len Amount of items in @a results.
*/
typedef void
-(*BRANDT_CbResult)(void *auction_closure,
- int32_t bidder_id,
- int status,
- uint16_t price);
+(*BRANDT_CbResult)(void *auction_closure,
+ struct BRANDT_Result results[],
+ uint16_t results_len);
void
@@ -159,8 +178,8 @@ BRANDT_join (BRANDT_CbResult result,
const void *auction_desc,
size_t auction_desc_len,
const void *description,
- uint32_t description_len);
-/* \todo: where do I specify my bid? */
+ uint32_t description_len,
+ uint16_t bid);
/* \todo: Distinguish handles for seller/buyers */
@@ -219,10 +238,13 @@ BRANDT_new (BRANDT_CbResult result,
* notification from the seller.
*
* @param[in] auction The pointer returned by BRANDT_join().
+ * @param[in] i The index of this bidder assigned by the seller (from the start
+ * announcement message).
* @param[in] n The amount of bidders (from the start announcement message).
*/
void
BRANDT_bidder_start (struct BRANDT_Auction *auction,
+ uint16_t i,
uint16_t n);