diff options
Diffstat (limited to 'brandt.h')
-rw-r--r-- | brandt.h | 50 |
1 files changed, 36 insertions, 14 deletions
@@ -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); |