aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.astylerc15
-rw-r--r--brandt.h38
2 files changed, 34 insertions, 19 deletions
diff --git a/.astylerc b/.astylerc
new file mode 100644
index 0000000..58cc7e4
--- /dev/null
+++ b/.astylerc
@@ -0,0 +1,15 @@
1--mode=c
2
3--style=bsd # brackets on their own line
4
5--indent=tab # tabs for indentation, spaces for alignment
6
7--min-conditional-indent=0 # align continuation lines to the opening bracket
8
9--max-instatement-indent=80 # allow to use a lot of spaces for alignment
10
11--pad-oper # operators + have - spaces
12
13--pad-first-paren-out # space before (
14
15--align-pointer=name # char *name
diff --git a/brandt.h b/brandt.h
index 47afcfc..a8a2dff 100644
--- a/brandt.h
+++ b/brandt.h
@@ -37,7 +37,7 @@ struct brandt_auction;
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 */
40typedef int (*brandt_cb_broadcast)(void *auction_closure, const void *msg, size_t msg_len); 40typedef 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
@@ -51,7 +51,7 @@ typedef int (*brandt_cb_broadcast)(void *auction_closure, const void *msg, size_
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 */
54typedef int (*brandt_cb_unicast_seller)(void *auction_closure, const void *msg, size_t msg_len); 54typedef 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
@@ -65,7 +65,7 @@ typedef int (*brandt_cb_unicast_seller)(void *auction_closure, const void *msg,
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 */
68typedef void (*brandt_cb_report_result)(void *auction_closure, int won, uint16_t price); 68typedef 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.
@@ -82,12 +82,12 @@ typedef void (*brandt_cb_report_result)(void *auction_closure, int won, uint16_t
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 */
85const struct brandt_auction *brandt_join(brandt_cb_broadcast broadcast, 85const 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);
91 91
92/** 92/**
93 * Create a new auction described by the @a auction_data parameter. 93 * Create a new auction described by the @a auction_data parameter.
@@ -114,14 +114,14 @@ 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 */
117const struct brandt_auction *brandt_new(brandt_cb_broadcast broadcast, 117const 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,
122 uint16_t num_prices, 122 uint16_t num_prices,
123 uint16_t m, 123 uint16_t m,
124 int outcome_public); 124 int outcome_public);
125 125
126/** 126/**
127 * Receive a broadcast message related to a specific auction. 127 * Receive a broadcast message related to a specific auction.
@@ -130,7 +130,7 @@ const struct brandt_auction *brandt_new(brandt_cb_broadcast broadcast,
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 */
133void brandt_got_broadcast(struct brandt_auction *auction, void *msg, size_t msg_len); 133void 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.
@@ -140,7 +140,7 @@ void brandt_got_broadcast(struct brandt_auction *auction, void *msg, size_t msg_
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 */
143void brandt_got_unicast(struct brandt_auction *auction, void *msg, size_t msg_len); 143void 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