aboutsummaryrefslogtreecommitdiff
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)
downloadlibbrandt-01c2b8d710ff5a526d1ae2ed2a7fafdec0b1f973.tar.gz
libbrandt-01c2b8d710ff5a526d1ae2ed2a7fafdec0b1f973.zip
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
90void 90void
91BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx); 91BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx);
92 92
93
94/**
95 * Verify an auction description blob and parse it's fields. See BRANDT_new()
96 * for an explanation of the different auction description fields.
97 *
98 * @param[in] auction_desc The auction description blob published by the seller.
99 * @param[in] auction_desc_len Length of @a auction_desc in bytes.
100 * @param[in] description The description text in application choosen format.
101 * @param[in] description_len Length of @a description in bytes.
102 * @param[out] time_start Starting time of the auction. May be NULL.
103 * @param[out] time_round Maximum round time of the auction. May be NULL.
104 * @param[out] num_prices Amount of possible prices. May be NULL.
105 * @param[out] m Auction mode. May be NULL.
106 * @param[out] outcome_public Outcome setting. May be NULL.
107 */
108int
109BRANDT_verify_desc (const void *auction_desc,
110 size_t auction_desc_len,
111 const void *description,
112 uint32_t description_len,
113 struct GNUNET_TIME_Absolute *time_start,
114 struct GNUNET_TIME_Relative *time_round,
115 uint16_t *num_prices,
116 uint16_t *m,
117 uint16_t *outcome_public);
118
119
93/** 120/**
94 * Join an auction described by the @a auction_data parameter. 121 * Join an auction described by the @a auction_desc parameter.
95 * 122 *
96 * @param[in] broadcast Pointer to the broadcast callback function 123 * @param[in] broadcast Pointer to the broadcast callback function
97 * @param[in] unicast Pointer to the unicast callback function 124 * @param[in] unicast Pointer to the unicast callback function
98 * @param[in] result Pointer to the result callback function 125 * @param[in] result Pointer to the result callback function
99 * @param[in] auction_closure Closure pointer representing the auction. This 126 * @param[in] auction_closure Closure pointer representing the auction. This
100 * will not be touched by libbrandt itself. It is only passed to the callbacks. 127 * will not be touched by libbrandt itself. It is only passed to the callbacks.
101 * @param[in] auction_data The auction information data published by the seller. 128 * @param[in] auction_desc The auction information data published by the seller.
102 * This is an opaque data structure. It will be parsed and checked by 129 * This is an opaque data structure. It will be parsed and checked by
103 * BRANDT_join(). 130 * BRANDT_join().
104 * @param[in] auction_data_len The length in bytes of the @a auction_data 131 * @param[in] auction_desc_len The length in bytes of the @a auction_desc
105 * structure. 132 * structure.
106 * @return A pointer, which should only be remembered and passed to 133 * @return A pointer, which should only be remembered and passed to
107 * libbrandt functions when the client needs to refer to this auction. This is a 134 * libbrandt functions when the client needs to refer to this auction. This is a
@@ -112,8 +139,10 @@ BRANDT_join (BRANDT_CbBroadcast broadcast,
112 BRANDT_CbUnicast unicast, 139 BRANDT_CbUnicast unicast,
113 BRANDT_CbResult result, 140 BRANDT_CbResult result,
114 void *auction_closure, 141 void *auction_closure,
115 const void *auction_data, 142 const void *auction_desc,
116 size_t auction_data_len); 143 size_t auction_desc_len,
144 const void *description,
145 uint32_t description_len);
117/* \todo: where do I specify my bid? */ 146/* \todo: where do I specify my bid? */
118 147
119 148
@@ -127,16 +156,16 @@ BRANDT_join (BRANDT_CbBroadcast broadcast,
127/* setup needs more auction proposal details (hash, timeout, */ 156/* setup needs more auction proposal details (hash, timeout, */
128/* bid structure), later we need to know # participants */ 157/* bid structure), later we need to know # participants */
129/** 158/**
130 * Create a new auction described by the @a auction_data parameter. 159 * Create a new auction described by the @a auction_desc parameter.
131 * 160 *
132 * @param[in] broadcast Pointer to the broadcast callback function 161 * @param[in] broadcast Pointer to the broadcast callback function
133 * @param[in] result Pointer to the result callback function 162 * @param[in] result Pointer to the result callback function
134 * @param[in] auction_closure Closure pointer representing the auction. This 163 * @param[in] auction_closure Closure pointer representing the auction. This
135 * will not be touched by libbrandt. It is only passed to the callbacks. 164 * will not be touched by libbrandt. It is only passed to the callbacks.
136 * @param[out] auction_data The auction information data a an opaque data 165 * @param[out] auction_desc The auction information data a an opaque data
137 * structure. It will be generated by BRANDT_new() and should be distributed to 166 * structure. It will be generated by BRANDT_new() and should be distributed to
138 * all possibly interested bidders. 167 * all possibly interested bidders.
139 * @param[out] auction_data_len The length in bytes of the @a auction_data 168 * @param[out] auction_desc_len The length in bytes of the @a auction_desc
140 * structure. Will be filled by BRANDT_new(). 169 * structure. Will be filled by BRANDT_new().
141 * @param[in] num_prices The amount of possible valuations for the sold item(s). 170 * @param[in] num_prices The amount of possible valuations for the sold item(s).
142 * If 0, a default of 256 will be used. \todo: what about 1, does it work with 171 * If 0, a default of 256 will be used. \todo: what about 1, does it work with
@@ -156,8 +185,8 @@ struct BRANDT_Auction *
156BRANDT_new (BRANDT_CbBroadcast broadcast, 185BRANDT_new (BRANDT_CbBroadcast broadcast,
157 BRANDT_CbResult result, 186 BRANDT_CbResult result,
158 void *auction_closure, 187 void *auction_closure,
159 void **auction_data, 188 void **auction_desc,
160 size_t *auction_data_len, 189 size_t *auction_desc_len,
161 struct GNUNET_TIME_Absolute time_start, 190 struct GNUNET_TIME_Absolute time_start,
162 struct GNUNET_TIME_Relative time_round, 191 struct GNUNET_TIME_Relative time_round,
163 void *description, 192 void *description,