summaryrefslogtreecommitdiff
path: root/brandt.h
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-08-16 13:25:03 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-08-16 13:25:03 +0200
commit01c2b8d710ff5a526d1ae2ed2a7fafdec0b1f973 (patch)
treebff04b124e4e1eae762d618c53640f7255cc3d29 /brandt.h
parent3a074a3d29ca7b05c79057f9e69d71eae5cb5722 (diff)
add descr struct verification
Diffstat (limited to 'brandt.h')
-rw-r--r--brandt.h49
1 files changed, 39 insertions, 10 deletions
diff --git a/brandt.h b/brandt.h
index 108e082..ad98663 100644
--- a/brandt.h
+++ b/brandt.h
@@ -90,18 +90,45 @@ typedef void
void
BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx);
+
+/**
+ * Verify an auction description blob and parse it's fields. See BRANDT_new()
+ * for an explanation of the different auction description fields.
+ *
+ * @param[in] auction_desc The auction description blob published by the seller.
+ * @param[in] auction_desc_len Length of @a auction_desc in bytes.
+ * @param[in] description The description text in application choosen format.
+ * @param[in] description_len Length of @a description in bytes.
+ * @param[out] time_start Starting time of the auction. May be NULL.
+ * @param[out] time_round Maximum round time of the auction. May be NULL.
+ * @param[out] num_prices Amount of possible prices. May be NULL.
+ * @param[out] m Auction mode. May be NULL.
+ * @param[out] outcome_public Outcome setting. May be NULL.
+ */
+int
+BRANDT_verify_desc (const void *auction_desc,
+ size_t auction_desc_len,
+ const void *description,
+ uint32_t description_len,
+ struct GNUNET_TIME_Absolute *time_start,
+ struct GNUNET_TIME_Relative *time_round,
+ uint16_t *num_prices,
+ uint16_t *m,
+ uint16_t *outcome_public);
+
+
/**
- * Join an auction described by the @a auction_data parameter.
+ * Join an auction described by the @a auction_desc parameter.
*
* @param[in] broadcast Pointer to the broadcast callback function
* @param[in] unicast Pointer to the unicast callback function
* @param[in] result Pointer to the result callback function
* @param[in] auction_closure Closure pointer representing the auction. This
* will not be touched by libbrandt itself. It is only passed to the callbacks.
- * @param[in] auction_data The auction information data published by the seller.
+ * @param[in] auction_desc The auction information data published by the seller.
* This is an opaque data structure. It will be parsed and checked by
* BRANDT_join().
- * @param[in] auction_data_len The length in bytes of the @a auction_data
+ * @param[in] auction_desc_len The length in bytes of the @a auction_desc
* structure.
* @return A pointer, which should only be remembered and passed to
* libbrandt functions when the client needs to refer to this auction. This is a
@@ -112,8 +139,10 @@ BRANDT_join (BRANDT_CbBroadcast broadcast,
BRANDT_CbUnicast unicast,
BRANDT_CbResult result,
void *auction_closure,
- const void *auction_data,
- size_t auction_data_len);
+ const void *auction_desc,
+ size_t auction_desc_len,
+ const void *description,
+ uint32_t description_len);
/* \todo: where do I specify my bid? */
@@ -127,16 +156,16 @@ BRANDT_join (BRANDT_CbBroadcast broadcast,
/* setup needs more auction proposal details (hash, timeout, */
/* bid structure), later we need to know # participants */
/**
- * Create a new auction described by the @a auction_data parameter.
+ * Create a new auction described by the @a auction_desc parameter.
*
* @param[in] broadcast Pointer to the broadcast callback function
* @param[in] result Pointer to the result callback function
* @param[in] auction_closure Closure pointer representing the auction. This
* will not be touched by libbrandt. It is only passed to the callbacks.
- * @param[out] auction_data The auction information data a an opaque data
+ * @param[out] auction_desc The auction information data a an opaque data
* structure. It will be generated by BRANDT_new() and should be distributed to
* all possibly interested bidders.
- * @param[out] auction_data_len The length in bytes of the @a auction_data
+ * @param[out] auction_desc_len The length in bytes of the @a auction_desc
* structure. Will be filled by BRANDT_new().
* @param[in] num_prices The amount of possible valuations for the sold item(s).
* If 0, a default of 256 will be used. \todo: what about 1, does it work with
@@ -156,8 +185,8 @@ struct BRANDT_Auction *
BRANDT_new (BRANDT_CbBroadcast broadcast,
BRANDT_CbResult result,
void *auction_closure,
- void **auction_data,
- size_t *auction_data_len,
+ void **auction_desc,
+ size_t *auction_desc_len,
struct GNUNET_TIME_Absolute time_start,
struct GNUNET_TIME_Relative time_round,
void *description,