diff options
-rw-r--r-- | brandt.h | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -22,7 +22,7 @@ | |||
22 | #ifndef _BRANDT_BRANDT_H | 22 | #ifndef _BRANDT_BRANDT_H |
23 | #define _BRANDT_BRANDT_H | 23 | #define _BRANDT_BRANDT_H |
24 | 24 | ||
25 | struct brandt_auction; | 25 | struct BRANDT_auction; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Functions of this type are called by libbrandt to broadcast messages to the | 28 | * Functions of this type are called by libbrandt to broadcast messages to the |
@@ -31,13 +31,13 @@ struct brandt_auction; | |||
31 | * TODO: how must the message be handled? (encryption, auth, reliability, …) | 31 | * TODO: how must the message be handled? (encryption, auth, reliability, …) |
32 | * | 32 | * |
33 | * @param[in] auction_closure Closure pointer representing the respective | 33 | * @param[in] auction_closure Closure pointer representing the respective |
34 | * auction. This is the Pointer given to brandt_join(). | 34 | * auction. This is the Pointer given to BRANDT_join(). |
35 | * @param[in] msg The message to be broadcast to all participants of | 35 | * @param[in] msg The message to be broadcast to all participants of |
36 | * @a auction_closure. | 36 | * @a auction_closure. |
37 | * @param[in] msg_len The length of the message @a msg in bytes. | 37 | * @param[in] msg_len The length of the message @a msg in bytes. |
38 | * @return 1 on success, 0 on failure. | 38 | * @return 1 on success, 0 on failure. |
39 | */ | 39 | */ |
40 | typedef int (*brandt_cb_broadcast) (void *auction_closure, const void *msg, size_t msg_len); | 40 | typedef int (*BRANDT_cb_broadcast) (void *auction_closure, const void *msg, size_t msg_len); |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Functions of this type are called by libbrandt to unicast messages to the | 43 | * Functions of this type are called by libbrandt to unicast messages to the |
@@ -46,12 +46,12 @@ typedef int (*brandt_cb_broadcast) (void *auction_closure, const void *msg, size | |||
46 | * TODO: how must the message be handled? (encryption, auth, reliability, …) | 46 | * TODO: how must the message be handled? (encryption, auth, reliability, …) |
47 | * | 47 | * |
48 | * @param[in] auction_closure Closure pointer representing the respective | 48 | * @param[in] auction_closure Closure pointer representing the respective |
49 | * auction. This is the Pointer given to brandt_join(). | 49 | * auction. This is the Pointer given to BRANDT_join(). |
50 | * @param[in] msg The message to be sent to the seller of @a auction_closure. | 50 | * @param[in] msg The message to be sent to the seller of @a auction_closure. |
51 | * @param[in] msg_len The length of the message @a msg in bytes. | 51 | * @param[in] msg_len The length of the message @a msg in bytes. |
52 | * @return 1 on success, 0 on failure. | 52 | * @return 1 on success, 0 on failure. |
53 | */ | 53 | */ |
54 | typedef int (*brandt_cb_unicast_seller) (void *auction_closure, const void *msg, size_t msg_len); | 54 | typedef int (*BRANDT_cb_unicast_seller) (void *auction_closure, const void *msg, size_t msg_len); |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Functions of this type are called by libbrandt to report the auction outcome | 57 | * Functions of this type are called by libbrandt to report the auction outcome |
@@ -60,12 +60,12 @@ typedef int (*brandt_cb_unicast_seller) (void *auction_closure, const void *msg, | |||
60 | * TODO: update price type. Don't do this notification as a callback? | 60 | * TODO: update price type. Don't do this notification as a callback? |
61 | * | 61 | * |
62 | * @param[in] auction_closure Closure pointer representing the respective | 62 | * @param[in] auction_closure Closure pointer representing the respective |
63 | * auction. This is the Pointer given to brandt_join(). | 63 | * auction. This is the Pointer given to BRANDT_join(). |
64 | * @param[in] won 1 if the user has won the auction, 0 otherwise. | 64 | * @param[in] won 1 if the user has won the auction, 0 otherwise. |
65 | * @param[in] price The price, the winner has to pay or 0 if the auction result | 65 | * @param[in] price The price, the winner has to pay or 0 if the auction result |
66 | * is private and the user did not win. | 66 | * is private and the user did not win. |
67 | */ | 67 | */ |
68 | typedef void (*brandt_cb_report_result) (void *auction_closure, int won, uint16_t price); | 68 | typedef void (*BRANDT_cb_report_result) (void *auction_closure, int won, uint16_t price); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Join an auction described by the @a auction_data parameter. | 71 | * Join an auction described by the @a auction_data parameter. |
@@ -75,16 +75,16 @@ typedef void (*brandt_cb_report_result) (void *auction_closure, int won, uint16_ | |||
75 | * @param[in] auction_closure Closure pointer representing the auction. This | 75 | * @param[in] auction_closure Closure pointer representing the auction. This |
76 | * will not be touched by libbrandt. It is only passed to the callbacks. | 76 | * will not be touched by libbrandt. It is only passed to the callbacks. |
77 | * @param[in] auction_data The auction information data a an opaque data | 77 | * @param[in] auction_data The auction information data a an opaque data |
78 | * structure. It will be parsed and checked by brandt_join. | 78 | * structure. It will be parsed and checked by BRANDT_join(). |
79 | * @param[in] auction_data_len The length in bytes of the @a auction_data | 79 | * @param[in] auction_data_len The length in bytes of the @a auction_data |
80 | * structure. | 80 | * structure. |
81 | * @return A pointer, which should only be remembered and passed to | 81 | * @return A pointer, which should only be remembered and passed to |
82 | * libbrandt functions when the client needs to refer to this auction. This is a | 82 | * libbrandt functions when the client needs to refer to this auction. This is a |
83 | * black-box pointer, do NOT access/change it or the data it points to! | 83 | * black-box pointer, do NOT access/change it or the data it points to! |
84 | */ | 84 | */ |
85 | const struct brandt_auction *brandt_join (brandt_cb_broadcast broadcast, | 85 | const struct BRANDT_auction *BRANDT_join (BRANDT_cb_broadcast broadcast, |
86 | brandt_cb_unicast_seller unicast, | 86 | BRANDT_cb_unicast_seller unicast, |
87 | brandt_cb_report_result report, | 87 | BRANDT_cb_report_result report, |
88 | const void *auction_closure, | 88 | const void *auction_closure, |
89 | const void *auction_data, | 89 | const void *auction_data, |
90 | size_t auction_data_len); | 90 | size_t auction_data_len); |
@@ -96,10 +96,10 @@ const struct brandt_auction *brandt_join (brandt_cb_broadcast broadcast, | |||
96 | * @param[in] auction_closure Closure pointer representing the auction. This | 96 | * @param[in] auction_closure Closure pointer representing the auction. This |
97 | * will not be touched by libbrandt. It is only passed to the callbacks. | 97 | * will not be touched by libbrandt. It is only passed to the callbacks. |
98 | * @param[out] auction_data The auction information data a an opaque data | 98 | * @param[out] auction_data The auction information data a an opaque data |
99 | * structure. It will be generated by brandt_new and should be distributed to | 99 | * structure. It will be generated by BRANDT_new() and should be distributed to |
100 | * all possibly interested bidders. | 100 | * all possibly interested bidders. |
101 | * @param[out] auction_data_len The length in bytes of the @a auction_data | 101 | * @param[out] auction_data_len The length in bytes of the @a auction_data |
102 | * structure. Will be filled by brandt_new. | 102 | * structure. Will be filled by BRANDT_new(). |
103 | * @param[in] num_prices The amount of possible valuations for the sold item(s). | 103 | * @param[in] num_prices The amount of possible valuations for the sold item(s). |
104 | * If 0, a default of 256 will be used. TODO: what about 1, does it work with | 104 | * If 0, a default of 256 will be used. TODO: what about 1, does it work with |
105 | * second price auctions? | 105 | * second price auctions? |
@@ -114,8 +114,8 @@ const struct brandt_auction *brandt_join (brandt_cb_broadcast broadcast, | |||
114 | * libbrandt functions when the client needs to refer to this auction. This is a | 114 | * libbrandt functions when the client needs to refer to this auction. This is a |
115 | * black-box pointer, do NOT access/change it or the data it points to! | 115 | * black-box pointer, do NOT access/change it or the data it points to! |
116 | */ | 116 | */ |
117 | const struct brandt_auction *brandt_new (brandt_cb_broadcast broadcast, | 117 | const struct BRANDT_auction *BRANDT_new (BRANDT_cb_broadcast broadcast, |
118 | brandt_cb_report_result report, | 118 | BRANDT_cb_report_result report, |
119 | const void *auction_closure, | 119 | const void *auction_closure, |
120 | const void **auction_data, | 120 | const void **auction_data, |
121 | size_t *auction_data_len, | 121 | size_t *auction_data_len, |
@@ -125,22 +125,22 @@ const struct brandt_auction *brandt_new (brandt_cb_broadcast broadcast, | |||
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Receive a broadcast message related to a specific auction. | 127 | * Receive a broadcast message related to a specific auction. |
128 | * @param[in] auction The pointer returned by brandt_join() or brandt_new() from | 128 | * @param[in] auction The pointer returned by BRANDT_join() or BRANDT_new() from |
129 | * which message @a msg was received. | 129 | * which message @a msg was received. |
130 | * @param[in] msg The message that was received. | 130 | * @param[in] msg The message that was received. |
131 | * @param[in] msg_len The length in bytes of @a msg. | 131 | * @param[in] msg_len The length in bytes of @a msg. |
132 | */ | 132 | */ |
133 | void brandt_got_broadcast (struct brandt_auction *auction, void *msg, size_t msg_len); | 133 | void BRANDT_got_broadcast (struct BRANDT_auction *auction, void *msg, size_t msg_len); |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Receive a unicast message from a bidder related to a specific auction. | 136 | * Receive a unicast message from a bidder related to a specific auction. |
137 | * @param[in] auction The pointer returned by brandt_new() from which message | 137 | * @param[in] auction The pointer returned by BRANDT_new() from which message |
138 | * @a msg was received. | 138 | * @a msg was received. |
139 | * @param[in] msg The message that was received. | 139 | * @param[in] msg The message that was received. |
140 | * @param[in] msg_len The length in bytes of @a msg. | 140 | * @param[in] msg_len The length in bytes of @a msg. |
141 | * TODO: how to link message to sender id within auction? | 141 | * TODO: how to link message to sender id within auction? |
142 | */ | 142 | */ |
143 | void brandt_got_unicast (struct brandt_auction *auction, void *msg, size_t msg_len); | 143 | void BRANDT_got_unicast (struct BRANDT_auction *auction, void *msg, size_t msg_len); |
144 | 144 | ||
145 | ///TODO: Error handling functions? | 145 | ///TODO: Error handling functions? |
146 | 146 | ||