diff options
Diffstat (limited to 'brandt.h')
-rw-r--r-- | brandt.h | 50 |
1 files changed, 18 insertions, 32 deletions
@@ -68,36 +68,22 @@ typedef uint16_t | |||
68 | 68 | ||
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Functions of this type are called by libbrandt to broadcast messages to the | 71 | * Functions of this type are called by libbrandt to deliver messages to other |
72 | * blackboard of a specific auction. They have to be sent using authenticated | 72 | * participants of an auction. There are two variants how this Callback needs to |
73 | * encryption. | 73 | * be implemented. The first is delivering messages as unicast directly to the |
74 | * seller, the second is delivering messages as broadcast to all participants | ||
75 | * (bidders + seller). All messages need to be authenticated and encrypted | ||
76 | * before sending and the signature needs to be checked immediately after | ||
77 | * receipt. | ||
74 | * | 78 | * |
75 | * @param[in] auction_closure Closure pointer representing the respective | 79 | * @param[in] auction_closure Closure pointer representing the respective |
76 | * auction. This is the Pointer given to BRANDT_join(). | 80 | * auction. This is the Pointer given to BRANDT_join() / BRANDT_new(). |
77 | * @param[in] msg The message to be broadcast to all participants of | 81 | * @param[in] msg The message to be delivered |
78 | * @a auction_closure. | ||
79 | * @param[in] msg_len The length of the message @a msg in bytes. | ||
80 | * @return 0 on success, -1 on failure. | ||
81 | */ | ||
82 | typedef int | ||
83 | (*BRANDT_CbBroadcast)(void *auction_closure, | ||
84 | const void *msg, | ||
85 | size_t msg_len); | ||
86 | |||
87 | |||
88 | /** | ||
89 | * Functions of this type are called by libbrandt to unicast messages to the | ||
90 | * seller of a specific auction. They have to be sent using authenticated | ||
91 | * encryption. | ||
92 | * | ||
93 | * @param[in] auction_closure Closure pointer representing the respective | ||
94 | * auction. This is the Pointer given to BRANDT_join(). | ||
95 | * @param[in] msg The message to be sent to the seller of @a auction_closure. | ||
96 | * @param[in] msg_len The length of the message @a msg in bytes. | 82 | * @param[in] msg_len The length of the message @a msg in bytes. |
97 | * @return 0 on success, -1 on failure. | 83 | * @return 0 on success, -1 on failure. |
98 | */ | 84 | */ |
99 | typedef int | 85 | typedef int |
100 | (*BRANDT_CbUnicast)(void *auction_closure, | 86 | (*BRANDT_CbDeliver)(void *auction_closure, |
101 | const void *msg, | 87 | const void *msg, |
102 | size_t msg_len); | 88 | size_t msg_len); |
103 | 89 | ||
@@ -166,13 +152,13 @@ BRANDT_parse_desc (const void *auction_desc, | |||
166 | * black-box pointer, do NOT dereference/change it or the data it points to! | 152 | * black-box pointer, do NOT dereference/change it or the data it points to! |
167 | */ | 153 | */ |
168 | struct BRANDT_Auction * | 154 | struct BRANDT_Auction * |
169 | BRANDT_join (BRANDT_CbResult result, | 155 | BRANDT_join (BRANDT_CbResult result, |
170 | BRANDT_CbBroadcast broadcast, | 156 | BRANDT_CbDeliver broadcast, |
171 | BRANDT_CbUnicast unicast, | 157 | BRANDT_CbDeliver unicast, |
172 | void *auction_closure, | 158 | void *auction_closure, |
173 | const void *auction_desc, | 159 | const void *auction_desc, |
174 | size_t auction_desc_len, | 160 | size_t auction_desc_len, |
175 | uint16_t bid); | 161 | uint16_t bid); |
176 | 162 | ||
177 | 163 | ||
178 | /* \todo: have cancellation (BRANDT_join_cancel()) */ | 164 | /* \todo: have cancellation (BRANDT_join_cancel()) */ |
@@ -208,7 +194,7 @@ BRANDT_join (BRANDT_CbResult result, | |||
208 | */ | 194 | */ |
209 | struct BRANDT_Auction * | 195 | struct BRANDT_Auction * |
210 | BRANDT_new (BRANDT_CbResult result, | 196 | BRANDT_new (BRANDT_CbResult result, |
211 | BRANDT_CbBroadcast broadcast, | 197 | BRANDT_CbDeliver broadcast, |
212 | BRANDT_CbStart start, | 198 | BRANDT_CbStart start, |
213 | void *auction_closure, | 199 | void *auction_closure, |
214 | void **auction_desc, | 200 | void **auction_desc, |