unify msg delivery callback
This commit is contained in:
parent
1bf5fbff77
commit
0ba8f80bc1
6
brandt.c
6
brandt.c
@ -185,7 +185,7 @@ seller_start (void *arg)
|
|||||||
|
|
||||||
struct BRANDT_Auction *
|
struct BRANDT_Auction *
|
||||||
BRANDT_new (BRANDT_CbResult result,
|
BRANDT_new (BRANDT_CbResult result,
|
||||||
BRANDT_CbBroadcast broadcast,
|
BRANDT_CbDeliver broadcast,
|
||||||
BRANDT_CbStart start,
|
BRANDT_CbStart start,
|
||||||
void *auction_closure,
|
void *auction_closure,
|
||||||
void **auction_desc,
|
void **auction_desc,
|
||||||
@ -284,8 +284,8 @@ BRANDT_parse_desc (const void *auction_desc,
|
|||||||
|
|
||||||
struct BRANDT_Auction *
|
struct BRANDT_Auction *
|
||||||
BRANDT_join (BRANDT_CbResult result,
|
BRANDT_join (BRANDT_CbResult result,
|
||||||
BRANDT_CbBroadcast broadcast,
|
BRANDT_CbDeliver broadcast,
|
||||||
BRANDT_CbUnicast unicast,
|
BRANDT_CbDeliver unicast,
|
||||||
void *auction_closure,
|
void *auction_closure,
|
||||||
const void *auction_desc,
|
const void *auction_desc,
|
||||||
size_t auction_desc_len,
|
size_t auction_desc_len,
|
||||||
|
40
brandt.h
40
brandt.h
@ -68,36 +68,22 @@ typedef uint16_t
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions of this type are called by libbrandt to broadcast messages to the
|
* Functions of this type are called by libbrandt to deliver messages to other
|
||||||
* blackboard of a specific auction. They have to be sent using authenticated
|
* participants of an auction. There are two variants how this Callback needs to
|
||||||
* encryption.
|
* be implemented. The first is delivering messages as unicast directly to the
|
||||||
|
* seller, the second is delivering messages as broadcast to all participants
|
||||||
|
* (bidders + seller). All messages need to be authenticated and encrypted
|
||||||
|
* before sending and the signature needs to be checked immediately after
|
||||||
|
* receipt.
|
||||||
*
|
*
|
||||||
* @param[in] auction_closure Closure pointer representing the respective
|
* @param[in] auction_closure Closure pointer representing the respective
|
||||||
* auction. This is the Pointer given to BRANDT_join().
|
* auction. This is the Pointer given to BRANDT_join() / BRANDT_new().
|
||||||
* @param[in] msg The message to be broadcast to all participants of
|
* @param[in] msg The message to be delivered
|
||||||
* @a auction_closure.
|
|
||||||
* @param[in] msg_len The length of the message @a msg in bytes.
|
* @param[in] msg_len The length of the message @a msg in bytes.
|
||||||
* @return 0 on success, -1 on failure.
|
* @return 0 on success, -1 on failure.
|
||||||
*/
|
*/
|
||||||
typedef int
|
typedef int
|
||||||
(*BRANDT_CbBroadcast)(void *auction_closure,
|
(*BRANDT_CbDeliver)(void *auction_closure,
|
||||||
const void *msg,
|
|
||||||
size_t msg_len);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Functions of this type are called by libbrandt to unicast messages to the
|
|
||||||
* seller of a specific auction. They have to be sent using authenticated
|
|
||||||
* encryption.
|
|
||||||
*
|
|
||||||
* @param[in] auction_closure Closure pointer representing the respective
|
|
||||||
* auction. This is the Pointer given to BRANDT_join().
|
|
||||||
* @param[in] msg The message to be sent to the seller of @a auction_closure.
|
|
||||||
* @param[in] msg_len The length of the message @a msg in bytes.
|
|
||||||
* @return 0 on success, -1 on failure.
|
|
||||||
*/
|
|
||||||
typedef int
|
|
||||||
(*BRANDT_CbUnicast)(void *auction_closure,
|
|
||||||
const void *msg,
|
const void *msg,
|
||||||
size_t msg_len);
|
size_t msg_len);
|
||||||
|
|
||||||
@ -167,8 +153,8 @@ BRANDT_parse_desc (const void *auction_desc,
|
|||||||
*/
|
*/
|
||||||
struct BRANDT_Auction *
|
struct BRANDT_Auction *
|
||||||
BRANDT_join (BRANDT_CbResult result,
|
BRANDT_join (BRANDT_CbResult result,
|
||||||
BRANDT_CbBroadcast broadcast,
|
BRANDT_CbDeliver broadcast,
|
||||||
BRANDT_CbUnicast unicast,
|
BRANDT_CbDeliver unicast,
|
||||||
void *auction_closure,
|
void *auction_closure,
|
||||||
const void *auction_desc,
|
const void *auction_desc,
|
||||||
size_t auction_desc_len,
|
size_t auction_desc_len,
|
||||||
@ -208,7 +194,7 @@ BRANDT_join (BRANDT_CbResult result,
|
|||||||
*/
|
*/
|
||||||
struct BRANDT_Auction *
|
struct BRANDT_Auction *
|
||||||
BRANDT_new (BRANDT_CbResult result,
|
BRANDT_new (BRANDT_CbResult result,
|
||||||
BRANDT_CbBroadcast broadcast,
|
BRANDT_CbDeliver broadcast,
|
||||||
BRANDT_CbStart start,
|
BRANDT_CbStart start,
|
||||||
void *auction_closure,
|
void *auction_closure,
|
||||||
void **auction_desc,
|
void **auction_desc,
|
||||||
|
@ -111,8 +111,8 @@ struct BRANDT_Auction {
|
|||||||
void *closure; /** auction closure given by the user */
|
void *closure; /** auction closure given by the user */
|
||||||
|
|
||||||
BRANDT_CbResult result; /** result reporting callback */
|
BRANDT_CbResult result; /** result reporting callback */
|
||||||
BRANDT_CbBroadcast bcast; /** broadcast callback */
|
BRANDT_CbDeliver bcast; /** broadcast callback */
|
||||||
BRANDT_CbUnicast ucast; /** unicast callback */
|
BRANDT_CbDeliver ucast; /** unicast callback */
|
||||||
BRANDT_CbStart start; /** start callback */
|
BRANDT_CbStart start; /** start callback */
|
||||||
|
|
||||||
int seller_mode; /** If 0 we are bidding, selling otherwise */
|
int seller_mode; /** If 0 we are bidding, selling otherwise */
|
||||||
|
Loading…
Reference in New Issue
Block a user