diff options
author | Gabor X Toth <*@tg-x.net> | 2013-06-26 17:12:59 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-06-26 17:12:59 +0000 |
commit | 2fc296b9df9bb7559f044a1769da8d2e43771b39 (patch) | |
tree | 6adb5c64011a15ca08e22eec3f5afc1ea6faad2c /src/include/gnunet_multicast_service.h | |
parent | d74bfc8a7987f457a1f4380108fd3296581bf52e (diff) | |
download | gnunet-2fc296b9df9bb7559f044a1769da8d2e43771b39.tar.gz gnunet-2fc296b9df9bb7559f044a1769da8d2e43771b39.zip |
psyc apis: use more doxygen syntax, added some missing docs
Diffstat (limited to 'src/include/gnunet_multicast_service.h')
-rw-r--r-- | src/include/gnunet_multicast_service.h | 416 |
1 files changed, 214 insertions, 202 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h index da0e09e2f..f58d38bab 100644 --- a/src/include/gnunet_multicast_service.h +++ b/src/include/gnunet_multicast_service.h | |||
@@ -18,7 +18,7 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_multicast_service.h | 22 | * @file include/gnunet_multicast_service.h |
23 | * @brief multicast service; establish tunnels to distant peers | 23 | * @brief multicast service; establish tunnels to distant peers |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
@@ -38,35 +38,35 @@ extern "C" | |||
38 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
39 | #include "gnunet_transport_service.h" | 39 | #include "gnunet_transport_service.h" |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Version number of GNUnet-multicast API. | 42 | * Version number of GNUnet-multicast API. |
43 | */ | 43 | */ |
44 | #define GNUNET_MULTICAST_VERSION 0x00000000 | 44 | #define GNUNET_MULTICAST_VERSION 0x00000000 |
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Opaque handle for a multicast group member. | 48 | * Opaque handle for a multicast group member. |
49 | */ | 49 | */ |
50 | struct GNUNET_MULTICAST_Member; | 50 | struct GNUNET_MULTICAST_Member; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Handle for the origin of a multicast group. | 53 | * Handle for the origin of a multicast group. |
54 | */ | 54 | */ |
55 | struct GNUNET_MULTICAST_Origin; | 55 | struct GNUNET_MULTICAST_Origin; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Group membership policies. | 58 | * Group membership policies. |
59 | */ | 59 | */ |
60 | enum GNUNET_MULTICAST_JoinPolicy | 60 | enum GNUNET_MULTICAST_JoinPolicy |
61 | { | 61 | { |
62 | /** | 62 | /** |
63 | * Anyone can join the group, without announcing his presence; all | 63 | * Anyone can join the group, without announcing his presence; |
64 | * messages are always public and can be distributed freely. Joins | 64 | * all messages are always public and can be distributed freely. |
65 | * may be announced, but this is not required. | 65 | * Joins may be announced, but this is not required. |
66 | */ | 66 | */ |
67 | GNUNET_MULTICAST_JP_ANONYMOUS = 0, | 67 | GNUNET_MULTICAST_JP_ANONYMOUS = 0, |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Origin must approve membership to the group, messages must only be | 70 | * Origin must approve membership to the group, messages must only be |
71 | * distributed to current group members. This includes the group | 71 | * distributed to current group members. This includes the group |
72 | * state as well as transient messages. | 72 | * state as well as transient messages. |
@@ -74,13 +74,13 @@ enum GNUNET_MULTICAST_JoinPolicy | |||
74 | GNUNET_MULTICAST_JP_PRIVATE = 1 | 74 | GNUNET_MULTICAST_JP_PRIVATE = 1 |
75 | 75 | ||
76 | #if IDEAS_FOR_FUTURE | 76 | #if IDEAS_FOR_FUTURE |
77 | /** | 77 | /** |
78 | * Anyone can freely join the group (no approval required); however, | 78 | * Anyone can freely join the group (no approval required); however, |
79 | * transient messages must only be distributed to current group | 79 | * transient messages must only be distributed to current group |
80 | * members, so the origin must still acknowledge that the member | 80 | * members, so the origin must still acknowledge that the member |
81 | * joined before transient messages are delivered. As approval is | 81 | * joined before transient messages are delivered. As approval is |
82 | * guaranteed, the presistent group state can de synchronized freely | 82 | * guaranteed, the presistent group state can be synchronized freely |
83 | * immediately, prior to origin confirmation | 83 | * immediately, prior to origin confirmation. |
84 | */ | 84 | */ |
85 | GNUNET_MULTICAST_JP_OPEN = 2 | 85 | GNUNET_MULTICAST_JP_OPEN = 2 |
86 | #endif | 86 | #endif |
@@ -88,45 +88,46 @@ enum GNUNET_MULTICAST_JoinPolicy | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Opaque handle to a replay request from the multicast service. | 92 | * Opaque handle to a replay request from the multicast service. |
93 | */ | 93 | */ |
94 | struct GNUNET_MULTICAST_ReplayHandle; | 94 | struct GNUNET_MULTICAST_ReplayHandle; |
95 | 95 | ||
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Functions with this signature are called whenever the multicast | 98 | * Functions with this signature are called whenever the multicast |
99 | * service needs a message to be replayed. Implementations of this | 99 | * service needs a message to be replayed. Implementations of this |
100 | * function MUST call 'GNUNET_MULTICAST_replay' ONCE (with a message | 100 | * function MUST call GNUNET_MULTICAST_replay() ONCE (with a message |
101 | * or an error); however, if the origin is destroyed or the group is | 101 | * or an error); however, if the origin is destroyed or the group is |
102 | * left, the replay handle must no longer be used. | 102 | * left, the replay handle must no longer be used. |
103 | * | 103 | * |
104 | * @param cls closure (set from GNUNET_MULTICAST_origin_start/join) | 104 | * @param cls Closure (set from GNUNET_MULTICAST_origin_start() |
105 | * @param message_id which message should be replayed | 105 | * or GNUNET_MULTICAST_member_join()). |
106 | * @param rh handle to pass to message transmit function | 106 | * @param message_id Which message should be replayed. |
107 | * @param rh Handle to pass to message transmit function. | ||
107 | */ | 108 | */ |
108 | typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls, | 109 | typedef void (*GNUNET_MULTICAST_ReplayCallback) (void *cls, |
109 | uint64_t message_id, | 110 | uint64_t message_id, |
110 | struct GNUNET_MULTICAST_ReplayHandle *rh); | 111 | struct GNUNET_MULTICAST_ReplayHandle *rh); |
111 | 112 | ||
112 | 113 | ||
113 | /** | 114 | /** |
114 | * Possible error codes during replay. | 115 | * Possible error codes during replay. |
115 | */ | 116 | */ |
116 | enum GNUNET_MULTICAST_ReplayErrorCode | 117 | enum GNUNET_MULTICAST_ReplayErrorCode |
117 | { | 118 | { |
118 | 119 | ||
119 | /** | 120 | /** |
120 | * Everything is fine. | 121 | * Everything is fine. |
121 | */ | 122 | */ |
122 | GNUNET_MULTICAST_REC_OK = 0, | 123 | GNUNET_MULTICAST_REC_OK = 0, |
123 | 124 | ||
124 | /** | 125 | /** |
125 | * Message has been discarded (likely transient message that was too old). | 126 | * Message has been discarded (likely transient message that was too old). |
126 | */ | 127 | */ |
127 | GNUNET_MULTICAST_REC_TRANSIENT_LOST = 1, | 128 | GNUNET_MULTICAST_REC_TRANSIENT_LOST = 1, |
128 | 129 | ||
129 | /** | 130 | /** |
130 | * Message ID counter was larger than the highest counter this | 131 | * Message ID counter was larger than the highest counter this |
131 | * replay function has ever encountered; thus it is likely the | 132 | * replay function has ever encountered; thus it is likely the |
132 | * origin never sent it and we're at the HEAD of the multicast | 133 | * origin never sent it and we're at the HEAD of the multicast |
@@ -134,7 +135,7 @@ enum GNUNET_MULTICAST_ReplayErrorCode | |||
134 | */ | 135 | */ |
135 | GNUNET_MULTICAST_REC_PAST_HEAD = 2, | 136 | GNUNET_MULTICAST_REC_PAST_HEAD = 2, |
136 | 137 | ||
137 | /** | 138 | /** |
138 | * Internal error (i.e. database error). Try some other peer. | 139 | * Internal error (i.e. database error). Try some other peer. |
139 | */ | 140 | */ |
140 | GNUNET_MULTICAST_REC_INTERNAL_ERROR = 3 | 141 | GNUNET_MULTICAST_REC_INTERNAL_ERROR = 3 |
@@ -144,80 +145,81 @@ enum GNUNET_MULTICAST_ReplayErrorCode | |||
144 | 145 | ||
145 | GNUNET_NETWORK_STRUCT_BEGIN | 146 | GNUNET_NETWORK_STRUCT_BEGIN |
146 | 147 | ||
147 | /** | 148 | /** |
148 | * Header of a multicast message. This format is public as the replay | 149 | * Header of a multicast message. |
149 | * mechanism must replay messages using the same format. This is | 150 | * |
150 | * needed as we want to integrity-check messages within the multicast | 151 | * This format is public as the replay mechanism must replay messages using the |
151 | * layer to avoid multicasting mal-formed messages. | 152 | * same format. This is needed as we want to integrity-check messages within |
153 | * the multicast layer to avoid multicasting mal-formed messages. | ||
152 | */ | 154 | */ |
153 | struct GNUNET_MULTICAST_MessageHeader | 155 | struct GNUNET_MULTICAST_MessageHeader |
154 | { | 156 | { |
155 | 157 | ||
156 | /** | 158 | /** |
157 | * Header for all multicast messages from the origin. | 159 | * Header for all multicast messages from the origin. |
158 | */ | 160 | */ |
159 | struct GNUNET_MessageHeader header; | 161 | struct GNUNET_MessageHeader header; |
160 | 162 | ||
161 | /** | 163 | /** |
162 | * How many hops has this message taken since the origin? | 164 | * Number of hops this message has taken since the origin. |
163 | * (helpful to determine shortest paths to the origin for responses | 165 | * |
164 | * among honest peers; updated at each hop and thus not signed | 166 | * Helpful to determine shortest paths to the origin for responses among |
165 | * and not secure) | 167 | * honest peers; updated at each hop and thus not signed and not secure. |
166 | */ | 168 | */ |
167 | uint32_t hop_counter GNUNET_PACKED; | 169 | uint32_t hop_counter GNUNET_PACKED; |
168 | 170 | ||
169 | /** | 171 | /** |
170 | * ECC signature of the message. Signature must match the public | 172 | * ECC signature of the message. |
171 | * key of the multicast group. | 173 | * |
174 | * Signature must match the public key of the multicast group. | ||
172 | */ | 175 | */ |
173 | struct GNUNET_CRYPTO_EccSignature signature; | 176 | struct GNUNET_CRYPTO_EccSignature signature; |
174 | 177 | ||
175 | /** | 178 | /** |
176 | * Signature of the multicast message. | 179 | * Signature of the multicast message. |
177 | */ | 180 | */ |
178 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; | 181 | struct GNUNET_CRYPTO_EccSignaturePurpose purpose; |
179 | 182 | ||
180 | /** | 183 | /** |
181 | * Number of the message, monotonically increasing. | 184 | * Number of the message, monotonically increasing. |
182 | */ | 185 | */ |
183 | uint64_t message_id GNUNET_PACKED; | 186 | uint64_t message_id GNUNET_PACKED; |
184 | 187 | ||
185 | /** | 188 | /** |
186 | * Counter that monotonically increases whenever a member | 189 | * Counter that monotonically increases whenever a member leaves the group. |
187 | * leaves the group. | ||
188 | */ | 190 | */ |
189 | uint64_t group_generation GNUNET_PACKED; | 191 | uint64_t group_generation GNUNET_PACKED; |
190 | 192 | ||
191 | /** | 193 | /** |
192 | * Difference between the current message_id and the message_id of | 194 | * Difference between the current @a message_id and the @a message_id of the |
193 | * the preceeding non-transient message. Zero for transient | 195 | * preceeding non-transient message. |
194 | * messages, UINT64_MAX for the first message, or any other message | 196 | * |
195 | * creating a full state reset by the origin. By subtracting | 197 | * Zero for transient messages, @c UINT64_MAX for the first message, or any |
196 | * 'state_delta' from 'message_id', it is possible to calculate the | 198 | * other message creating a full state reset by the origin. By subtracting |
197 | * message ID of the preceeding non-transient message and thus | 199 | * @a state_delta from @a message_id, it is possible to calculate the message |
198 | * quickly traverse all state changes up to the last full state | 200 | * ID of the preceeding non-transient message and thus quickly traverse all |
199 | * reset by the origin. This is useful as it allows joining clients | 201 | * state changes up to the last full state reset by the origin. This is |
200 | * to quickly reassemble the state while skipping over transient | 202 | * useful as it allows joining clients to quickly reassemble the state while |
201 | * messages (and doing so without having to trust intermediaries to | 203 | * skipping over transient messages (and doing so without having to trust |
202 | * do it right, as the indices in the chain are signed). If the | 204 | * intermediaries to do it right, as the indices in the chain are signed). If |
203 | * state chain is getting too long, the origin can choose to | 205 | * the state chain is getting too long, the origin can choose to originate a |
204 | * originate a state message with a state_delta of UINT64_MAX, | 206 | * state message with a state_delta of UINT64_MAX, thereby starting a new |
205 | * thereby starting a new chain. The origin will then have to | 207 | * chain. The origin will then have to re-create the full state with state |
206 | * re-create the full state with state update messages following the | 208 | * update messages following the state reset message. |
207 | * state reset message. | ||
208 | * | 209 | * |
209 | * Open question: needed in multicast, or just have this in PSYC; | 210 | * Open question: needed in multicast, or just have this in PSYC; still might |
210 | * still might be useful for selective fetching of messages. | 211 | * be useful for selective fetching of messages. Still, that again should |
211 | * Still, that again should that not be done by PSYC? | 212 | * that not be done by PSYC? |
212 | */ | 213 | */ |
213 | uint64_t state_delta GNUNET_PACKED; | 214 | uint64_t state_delta GNUNET_PACKED; |
214 | 215 | ||
215 | /** | 216 | /** |
216 | * Header for the message body. Three message types are | 217 | * Header for the message body. |
217 | * specifically understood by multicast, namely "peer join", "peer | 218 | * |
218 | * leave", and "group terminated". Multicast will use those | 219 | * Three message types are specifically understood by multicast, namely "peer |
219 | * messages to update its list of candidates for content | 220 | * join", "peer leave", and "group terminated". Multicast will use those |
220 | * distribution. All other message types are application-specific. | 221 | * messages to update its list of candidates for content distribution. All |
222 | * other message types are application-specific. | ||
221 | */ | 223 | */ |
222 | struct GNUNET_MessageHeader body; | 224 | struct GNUNET_MessageHeader body; |
223 | 225 | ||
@@ -227,12 +229,12 @@ struct GNUNET_MULTICAST_MessageHeader | |||
227 | GNUNET_NETWORK_STRUCT_END | 229 | GNUNET_NETWORK_STRUCT_END |
228 | 230 | ||
229 | 231 | ||
230 | /** | 232 | /** |
231 | * Replay a message from the multicast group. | 233 | * Replay a message from the multicast group. |
232 | * | 234 | * |
233 | * @param rh replay handle identifying which replay operation was requested | 235 | * @param rh Replay handle identifying which replay operation was requested. |
234 | * @param msg replayed message, NULL if unknown/error | 236 | * @param msg Replayed message, NULL if unknown/error. |
235 | * @param ec error code | 237 | * @param ec Error code. |
236 | */ | 238 | */ |
237 | void | 239 | void |
238 | GNUNET_MULTICAST_replay (struct GNUNET_MULTICAST_ReplayHandle *rh, | 240 | GNUNET_MULTICAST_replay (struct GNUNET_MULTICAST_ReplayHandle *rh, |
@@ -240,28 +242,31 @@ GNUNET_MULTICAST_replay (struct GNUNET_MULTICAST_ReplayHandle *rh, | |||
240 | enum GNUNET_MULTICAST_ReplayErrorCode ec); | 242 | enum GNUNET_MULTICAST_ReplayErrorCode ec); |
241 | 243 | ||
242 | 244 | ||
243 | /** | 245 | /** |
244 | * Handle that identifies a join request (to match calls to the | 246 | * Handle that identifies a join request. |
245 | * 'GNUNET_MULTICAST_MembershipChangeCallback' to the corresponding | 247 | * |
246 | * calls to 'GNUNET_MULTICAST_join_decision'). | 248 | * Used to match calls to #GNUNET_MULTICAST_MembershipChangeCallback to the |
249 | * corresponding calls to GNUNET_MULTICAST_join_decision(). | ||
247 | */ | 250 | */ |
248 | struct GNUNET_MULTICAST_JoinHande; | 251 | struct GNUNET_MULTICAST_JoinHande; |
249 | 252 | ||
250 | 253 | ||
251 | /** | 254 | /** |
252 | * Function to call with the decision made for a membership change | 255 | * Function to call with the decision made for a membership change request. |
253 | * request. Must be called once and only once in response to an | ||
254 | * invocation of the 'GNUNET_MULTICAST_MembershipChangeCallback'. | ||
255 | * | 256 | * |
256 | * @param jh join request handle | 257 | * Must be called once and only once in response to an invocation of the |
257 | * @param join_response message to send in response to the joining peer; | 258 | * #GNUNET_MULTICAST_MembershipChangeCallback. |
259 | * | ||
260 | * @param jh Join request handle. | ||
261 | * @param join_response Message to send in response to the joining peer; | ||
258 | * can also be used to redirect the peer to a different group at the | 262 | * can also be used to redirect the peer to a different group at the |
259 | * application layer; this response is to be transmitted to the | 263 | * application layer; this response is to be transmitted to the |
260 | * peer that issued the request even if admission is denied. | 264 | * peer that issued the request even if admission is denied. |
261 | * @param is_admitted GNUNET_OK if joining is approved, GNUNET_SYSERR if it is disapproved; | 265 | * @param is_admitted #GNUNET_OK if joining is approved, |
262 | * GNUNET_NO for peers leaving | 266 | * #GNUNET_SYSERR if it is disapproved; |
263 | * @param relay_count number of relays given | 267 | * #GNUNET_NO for peers leaving. |
264 | * @param relays array of suggested peers that might be useful relays to use | 268 | * @param relay_count Number of relays given. |
269 | * @param relays Array of suggested peers that might be useful relays to use | ||
265 | * when joining the multicast group (essentially a list of peers that | 270 | * when joining the multicast group (essentially a list of peers that |
266 | * are already part of the multicast group and might thus be willing | 271 | * are already part of the multicast group and might thus be willing |
267 | * to help with routing). If empty, only this local peer (which must | 272 | * to help with routing). If empty, only this local peer (which must |
@@ -277,19 +282,21 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh, | |||
277 | const struct GNUNET_PeerIdentity *relays); | 282 | const struct GNUNET_PeerIdentity *relays); |
278 | 283 | ||
279 | 284 | ||
280 | /** | 285 | /** |
281 | * Method called whenever another peer wants to join or has left a | 286 | * Method called whenever another peer wants to join or has left a multicast |
282 | * multicast group. Implementations of this function must call | 287 | * group. |
283 | * 'GNUNET_MULTICAST_join_decision' with the decision. | ||
284 | * | 288 | * |
285 | * @param cls closure | 289 | * Implementations of this function must call GNUNET_MULTICAST_join_decision() |
286 | * @param peer identity of the peer that wants to join or leave | 290 | * with the decision. |
287 | * @param join_req application-dependent join message from the new user | 291 | * |
288 | * (might, for example, contain a user | 292 | * @param cls Closure. |
293 | * @param peer Identity of the peer that wants to join or leave. | ||
294 | * @param join_req Application-dependent join message from the new user | ||
295 | * (might, for example, contain a user, | ||
289 | * bind user identity/pseudonym to peer identity, application-level | 296 | * bind user identity/pseudonym to peer identity, application-level |
290 | * message to origin, etc.) | 297 | * message to origin, etc.). |
291 | * @param is_joining GNUNET_YES if the peer wants to join, GNUNET_NO if the peer left | 298 | * @param is_joining #GNUNET_YES if the peer wants to join, #GNUNET_NO if the peer left. |
292 | * @param jh join handle to pass to 'GNUNET_MULTICAST_join_decison' | 299 | * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison(). |
293 | */ | 300 | */ |
294 | typedef void (*GNUNET_MULTICAST_MembershipChangeCallback)(void *cls, | 301 | typedef void (*GNUNET_MULTICAST_MembershipChangeCallback)(void *cls, |
295 | const struct GNUNET_PeerIdentity *peer, | 302 | const struct GNUNET_PeerIdentity *peer, |
@@ -298,31 +305,31 @@ typedef void (*GNUNET_MULTICAST_MembershipChangeCallback)(void *cls, | |||
298 | struct GNUNET_MULTICAST_JoinHandle *jh); | 305 | struct GNUNET_MULTICAST_JoinHandle *jh); |
299 | 306 | ||
300 | 307 | ||
301 | /** | 308 | /** |
302 | * Handle to pass back for the answer of a membership test. | 309 | * Handle to pass back for the answer of a membership test. |
303 | */ | 310 | */ |
304 | struct GNUNET_MULTICAST_MembershipTestHandle; | 311 | struct GNUNET_MULTICAST_MembershipTestHandle; |
305 | 312 | ||
306 | 313 | ||
307 | /** | 314 | /** |
308 | * Call informing multicast about the decision taken for membership test. | 315 | * Call informing multicast about the decision taken for membership test. |
309 | * | 316 | * |
310 | * @param mth handle that was given for the query | 317 | * @param mth Handle that was given for the query. |
311 | * @param decision GNUNET_YES if peer was a member, GNUNET_NO if peer was not a member, | 318 | * @param decision #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member, |
312 | * GNUNET_SYSERR if we cannot answer the membership test | 319 | * #GNUNET_SYSERR if we cannot answer the membership test. |
313 | */ | 320 | */ |
314 | void | 321 | void |
315 | GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestHandle *mth, | 322 | GNUNET_MULTICAST_membership_test_answer (struct GNUNET_MULTICAST_MembershipTestHandle *mth, |
316 | int decision); | 323 | int decision); |
317 | 324 | ||
318 | 325 | ||
319 | /** | 326 | /** |
320 | * Method called to test if a member was in the group at a particular time. | 327 | * Method called to test if a member was in the group at a particular time. |
321 | * | 328 | * |
322 | * @param cls closure | 329 | * @param cls Closure. |
323 | * @param peer identity of the peer that we want to test | 330 | * @param peer Identity of the peer that we want to test. |
324 | * @param message_id message ID for which we want to do the test | 331 | * @param message_id Message ID for which we want to do the test. |
325 | * @param mth handle to give to 'GNUNET_MULTICAST_membership_test_answer' | 332 | * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer(). |
326 | */ | 333 | */ |
327 | typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, | 334 | typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, |
328 | const struct GNUNET_PeerIdentity *peer, | 335 | const struct GNUNET_PeerIdentity *peer, |
@@ -330,14 +337,14 @@ typedef void (*GNUNET_MULTICAST_MembershipTestCallback)(void *cls, | |||
330 | struct GNUNET_MULTICAST_MembershipTestHandle *mth); | 337 | struct GNUNET_MULTICAST_MembershipTestHandle *mth); |
331 | 338 | ||
332 | 339 | ||
333 | /** | 340 | /** |
334 | * Function called whenever a group member has transmitted a message | 341 | * Function called whenever a group member has transmitted a message |
335 | * to the origin (other than joining or leaving). | 342 | * to the origin (other than joining or leaving). |
336 | * | 343 | * |
337 | * @param cls closure (set from GNUNET_MULTICAST_origin_start) | 344 | * @param cls Closure (set from GNUNET_MULTICAST_origin_start). |
338 | * @param sender identity of the sender | 345 | * @param sender Identity of the sender. |
339 | * @param response_id unique counter for the response from this sender to this origin | 346 | * @param response_id Unique counter for the response from this sender to this origin. |
340 | * @param msg message to the origin | 347 | * @param msg Message to the origin. |
341 | */ | 348 | */ |
342 | typedef void (*GNUNET_MULTICAST_ResponseCallback) (void *cls, | 349 | typedef void (*GNUNET_MULTICAST_ResponseCallback) (void *cls, |
343 | const struct GNUNET_PeerIdentity *sender, | 350 | const struct GNUNET_PeerIdentity *sender, |
@@ -345,48 +352,51 @@ typedef void (*GNUNET_MULTICAST_ResponseCallback) (void *cls, | |||
345 | const struct GNUNET_MessageHeader *msg); | 352 | const struct GNUNET_MessageHeader *msg); |
346 | 353 | ||
347 | 354 | ||
348 | /** | 355 | /** |
349 | * Function called whenever a group member is receiving a message from | 356 | * Function called whenever a group member is receiving a message from |
350 | * the origin. If admission to the group is denied, this function is | 357 | * the origin. If admission to the group is denied, this function is |
351 | * called once with the response of the 'origin' (as given to | 358 | * called once with the response of the @e origin (as given to |
352 | * 'GNUNET_MULTICAST_join_decision') and then a second time with "NULL" | 359 | * GNUNET_MULTICAST_join_decision()) and then a second time with NULL |
353 | * to indicate that the connection failed for good. | 360 | * to indicate that the connection failed for good. |
354 | * | 361 | * |
355 | * @param cls closure (set from GNUNET_MULTICAST_member_join) | 362 | * @param cls Closure (set from GNUNET_MULTICAST_member_join()) |
356 | * @param message_id unique number of the message, 0 for response to join request, | 363 | * @param message_id Unique number of the message, 0 for response to join request, |
357 | * normal message IDs in either direction start at 1. | 364 | * normal message IDs in either direction start at 1. |
358 | * @param msg message from the origin, NULL if the origin shut down | 365 | * @param msg Message from the origin, NULL if the origin shut down |
359 | * (or we were kicked out, and we should thus call GNUNET_MULTICAST_member_leave next) | 366 | * (or we were kicked out, and we should thus call |
367 | * GNUNET_MULTICAST_member_leave() next) | ||
360 | */ | 368 | */ |
361 | typedef void (*GNUNET_MULTICAST_MulticastMessageCallback) (void *cls, | 369 | typedef void (*GNUNET_MULTICAST_MulticastMessageCallback) (void *cls, |
362 | uint64_t message_id, | 370 | uint64_t message_id, |
363 | const struct GNUNET_MULTICAST_MessageHeader *msg); | 371 | const struct GNUNET_MULTICAST_MessageHeader *msg); |
364 | 372 | ||
365 | 373 | ||
366 | /** | 374 | /** |
367 | * Start a multicast group. Will advertise the origin in the P2P | 375 | * Start a multicast group. |
368 | * overlay network under the respective public key so that other peer | ||
369 | * can find this peer to join it. Peers that issue | ||
370 | * 'GNUNET_MULTICAST_member_join' can then transmit a join request to | ||
371 | * either an existing group member (if the 'join_policy' is | ||
372 | * permissive) or to the origin. If the joining is approved, the | ||
373 | * member is cleared for 'replay' and will begin to receive messages | ||
374 | * transmitted to the group. If joining is disapproved, the failed | ||
375 | * candidate will be given a response. Members in the group can send | ||
376 | * messages to the origin (one at a time). | ||
377 | * | 376 | * |
378 | * @param cfg configuration to use | 377 | * Will advertise the origin in the P2P overlay network under the respective |
379 | * @param cls closure for the various callbacks that follow | 378 | * public key so that other peer can find this peer to join it. Peers that |
379 | * issue GNUNET_MULTICAST_member_join() can then transmit a join request to | ||
380 | * either an existing group member (if the @a join_policy is permissive) or to | ||
381 | * the origin. If the joining is approved, the member is cleared for @e replay | ||
382 | * and will begin to receive messages transmitted to the group. If joining is | ||
383 | * disapproved, the failed candidate will be given a response. Members in the | ||
384 | * group can send messages to the origin (one at a time). | ||
385 | * | ||
386 | * @param cfg Configuration to use. | ||
387 | * @param cls Closure for the various callbacks that follow. | ||
380 | * @param priv_key ECC key that will be used to sign messages for this | 388 | * @param priv_key ECC key that will be used to sign messages for this |
381 | * multicast session; public key is used to identify the | 389 | * multicast session; public key is used to identify the |
382 | * multicast group; FIXME: we'll likely want to use | 390 | * multicast group; FIXME: we'll likely want to use |
383 | * NOT the p521 curve here, but a cheaper one in the future | 391 | * NOT the p521 curve here, but a cheaper one in the future. |
384 | * @param join_policy what is the membership policy of the group? | 392 | * @param join_policy What is the membership policy of the group? |
385 | * @param replay_cb function that can be called to replay a message | 393 | * @param replay_cb Function that can be called to replay a message. |
386 | * @param test_cb function multicast can use to test group membership | 394 | * @param test_cb Function multicast can use to test group membership. |
387 | * @param join_cb function called to approve / disapprove joining of a peer | 395 | * @param join_cb Function called to approve / disapprove joining of a peer, |
388 | * @param response_cb function called with messages from group members | 396 | * and to inform about a leaving member. |
389 | * @return handle for the origin, NULL on error | 397 | * @param leave_cb Function called to inform about a leaving member. |
398 | * @param response_cb Function called with messages from group members. | ||
399 | * @return Handle for the origin, NULL on error. | ||
390 | */ | 400 | */ |
391 | struct GNUNET_MULTICAST_Origin * | 401 | struct GNUNET_MULTICAST_Origin * |
392 | GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 402 | GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -399,21 +409,21 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
399 | GNUNET_MULTICAST_ResponseCallback response_cb); | 409 | GNUNET_MULTICAST_ResponseCallback response_cb); |
400 | 410 | ||
401 | 411 | ||
402 | /** | 412 | /** |
403 | * Handle for a request to send a message to all multicast group members | 413 | * Handle for a request to send a message to all multicast group members |
404 | * (from the origin). | 414 | * (from the origin). |
405 | */ | 415 | */ |
406 | struct GNUNET_MULTICAST_MulticastRequest; | 416 | struct GNUNET_MULTICAST_MulticastRequest; |
407 | 417 | ||
408 | 418 | ||
409 | /** | 419 | /** |
410 | * Send a message to the multicast group. | 420 | * Send a message to the multicast group. |
411 | * | 421 | * |
412 | * @param origin handle to the multicast group | 422 | * @param origin Handle to the multicast group. |
413 | * @param size number of bytes to transmit | 423 | * @param size Number of bytes to transmit. |
414 | * @param cb function to call to get the message | 424 | * @param cb Function to call to get the message. |
415 | * @param cb_cls closure for 'cb' | 425 | * @param cb_cls Closure for @a cb. |
416 | * @return NULL on error (i.e. request already pending) | 426 | * @return NULL on error (i.e. request already pending). |
417 | */ | 427 | */ |
418 | struct GNUNET_MULTICAST_MulticastRequest * | 428 | struct GNUNET_MULTICAST_MulticastRequest * |
419 | GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, | 429 | GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, |
@@ -422,16 +432,16 @@ GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, | |||
422 | void *cb_cls); | 432 | void *cb_cls); |
423 | 433 | ||
424 | 434 | ||
425 | /** | 435 | /** |
426 | * Cancel request for message transmission to multicast group. | 436 | * Cancel request for message transmission to multicast group. |
427 | * | 437 | * |
428 | * @param mr request to cancel | 438 | * @param mr Request to cancel. |
429 | */ | 439 | */ |
430 | void | 440 | void |
431 | GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_MulticastRequest *mr); | 441 | GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_MulticastRequest *mr); |
432 | 442 | ||
433 | 443 | ||
434 | /** | 444 | /** |
435 | * End a multicast group. | 445 | * End a multicast group. |
436 | * | 446 | * |
437 | * @param origin multicast group to terminate | 447 | * @param origin multicast group to terminate |
@@ -440,41 +450,42 @@ void | |||
440 | GNUNET_MULTICAST_origin_end (struct GNUNET_MULTICAST_Origin *origin); | 450 | GNUNET_MULTICAST_origin_end (struct GNUNET_MULTICAST_Origin *origin); |
441 | 451 | ||
442 | 452 | ||
443 | /** | 453 | /** |
444 | * Join a multicast group. The entity joining is always the local | 454 | * Join a multicast group. |
445 | * peer. Further information about the candidate can be provided in | 455 | * |
446 | * the 'join_req' message. If the join fails, the 'message_cb' is | 456 | * The entity joining is always the local peer. Further information about the |
447 | * invoked with a (failure) response and then with 'NULL'. If the | 457 | * candidate can be provided in the @a join_req message. If the join fails, the |
448 | * join succeeds, outstanding (state) messages and ongoing multicast | 458 | * @a message_cb is invoked with a (failure) response and then with NULL. If |
449 | * messages will be given to the 'message_cb' until the member decides | 459 | * the join succeeds, outstanding (state) messages and ongoing multicast |
450 | * to leave the group. The 'test_cb' and 'replay_cb' functions may be | 460 | * messages will be given to the @a message_cb until the member decides to leave |
451 | * called at anytime by the multicast service to support relaying | 461 | * the group. The @a test_cb and @a replay_cb functions may be called at |
452 | * messages to other members of the group. | 462 | * anytime by the multicast service to support relaying messages to other |
463 | * members of the group. | ||
453 | * | 464 | * |
454 | * @param cfg configuration to use | 465 | * @param cfg Configuration to use. |
455 | * @param cls closure for callbacks | 466 | * @param cls Closure for callbacks. |
456 | * @param pub_key ECC key that identifies the group | 467 | * @param pub_key ECC key that identifies the group. |
457 | * @param max_known_message_id largest known message ID to the replay service; | 468 | * @param max_known_message_id Largest known message ID to the replay service; |
458 | * all messages with IDs larger than this ID will be replayed if | 469 | * all messages with IDs larger than this ID will be replayed if |
459 | * possible (lower IDs will be considered known and thus only | 470 | * possible (lower IDs will be considered known and thus only |
460 | * be replayed upon explicit request) | 471 | * be replayed upon explicit request). |
461 | * @param max_known_state_message_id largest known message ID with a non-zero | 472 | * @param max_known_state_message_id Largest known message ID with a non-zero |
462 | * value for the 'state_delta'; state messages with | 473 | * value for the @e state_delta; state messages with |
463 | * larger IDs than this value will be replayed with high priority | 474 | * larger IDs than this value will be replayed with high priority |
464 | * (lower IDs will be considered known and thus only | 475 | * (lower IDs will be considered known and thus only |
465 | * be replayed upon explicit request) | 476 | * be replayed upon explicit request). |
466 | * @param replay_cb function that can be called to replay messages | 477 | * @param replay_cb Function that can be called to replay messages |
467 | * this peer already knows from this group; NULL if this | 478 | * this peer already knows from this group; NULL if this |
468 | * client is unable to support replay | 479 | * client is unable to support replay. |
469 | * @param test_cb function multicast can use to test group membership | 480 | * @param test_cb Function multicast can use to test group membership. |
470 | * @param message_cb function to be called for all messages we | 481 | * @param message_cb Function to be called for all messages we |
471 | * receive from the group, excluding those our replay_cb | 482 | * receive from the group, excluding those our @a replay_cb |
472 | * already has | 483 | * already has. |
473 | * @param join_req application-dependent join message to be passed to origin | 484 | * @param join_req Application-dependent join message to be passed to origin |
474 | * (might, for example, contain a user | 485 | * (might, for example, contain a user |
475 | * bind user identity/pseudonym to peer identity, application-level | 486 | * bind user identity/pseudonym to peer identity, application-level |
476 | * message to origin, etc.) | 487 | * message to origin, etc.). |
477 | * @return handle for the member, NULL on error | 488 | * @return Handle for the member, NULL on error. |
478 | */ | 489 | */ |
479 | struct GNUNET_MULTICAST_Member * | 490 | struct GNUNET_MULTICAST_Member * |
480 | GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | 491 | GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -488,22 +499,23 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
488 | const struct GNUNET_MessageHeader *join_req); | 499 | const struct GNUNET_MessageHeader *join_req); |
489 | 500 | ||
490 | 501 | ||
491 | /** | 502 | /** |
492 | * Handle for a replay request. | 503 | * Handle for a replay request. |
493 | */ | 504 | */ |
494 | struct GNUNET_MULTICAST_ReplayRequest; | 505 | struct GNUNET_MULTICAST_ReplayRequest; |
495 | 506 | ||
496 | 507 | ||
497 | /** | 508 | /** |
498 | * Request a message to be replayed. Useful if messages below | 509 | * Request a message to be replayed. |
499 | * the 'max_known_*_id's given when joining are needed and not | 510 | * |
500 | * known to the client. | 511 | * Useful if messages below the @e max_known_*_id's given when joining are |
512 | * needed and not known to the client. | ||
501 | * | 513 | * |
502 | * @param member membership handle | 514 | * @param member Membership handle. |
503 | * @param message_id ID of a message that this client would like to see replayed | 515 | * @param message_id ID of a message that this client would like to see replayed. |
504 | * @param message_cb function to be called for the replayed message | 516 | * @param message_cb Function to be called for the replayed message. |
505 | * @param message_cb_cls closure for 'message_cb' | 517 | * @param message_cb_cls Closure for @a message_cb. |
506 | * @return replay request handle, NULL on error | 518 | * @return Replay request handle, NULL on error. |
507 | */ | 519 | */ |
508 | struct GNUNET_MULTICAST_ReplayRequest * | 520 | struct GNUNET_MULTICAST_ReplayRequest * |
509 | GNUNET_MULTICAST_member_request_replay (struct GNUNET_MULTICAST_Member *member, | 521 | GNUNET_MULTICAST_member_request_replay (struct GNUNET_MULTICAST_Member *member, |
@@ -512,38 +524,38 @@ GNUNET_MULTICAST_member_request_replay (struct GNUNET_MULTICAST_Member *member, | |||
512 | void *message_cb_cls); | 524 | void *message_cb_cls); |
513 | 525 | ||
514 | 526 | ||
515 | /** | 527 | /** |
516 | * Cancel a replay request. | 528 | * Cancel a replay request. |
517 | * | 529 | * |
518 | * @param rr request to cancel | 530 | * @param rr Request to cancel. |
519 | */ | 531 | */ |
520 | void | 532 | void |
521 | GNUNET_MULTICAST_member_request_replay_cancel (struct GNUNET_MULTICAST_ReplayRequest *rr); | 533 | GNUNET_MULTICAST_member_request_replay_cancel (struct GNUNET_MULTICAST_ReplayRequest *rr); |
522 | 534 | ||
523 | 535 | ||
524 | /** | 536 | /** |
525 | * Leave a mutlicast group. | 537 | * Leave a multicast group. |
526 | * | 538 | * |
527 | * @param member membership handle | 539 | * @param member Membership handle. |
528 | */ | 540 | */ |
529 | void | 541 | void |
530 | GNUNET_MULTICAST_member_leave (struct GNUNET_MULTICAST_Member *member); | 542 | GNUNET_MULTICAST_member_leave (struct GNUNET_MULTICAST_Member *member); |
531 | 543 | ||
532 | 544 | ||
533 | /** | 545 | /** |
534 | * Handle for a message to be delivered to the origin. | 546 | * Handle for a message to be delivered to the origin. |
535 | */ | 547 | */ |
536 | struct GNUNET_MULTICAST_ResponseRequest; | 548 | struct GNUNET_MULTICAST_ResponseRequest; |
537 | 549 | ||
538 | 550 | ||
539 | /** | 551 | /** |
540 | * Send a message to the origin of the multicast group. | 552 | * Send a message to the origin of the multicast group. |
541 | * | 553 | * |
542 | * @param member membership handle | 554 | * @param member Membership handle. |
543 | * @param size number of bytes we want to send to origin | 555 | * @param size Number of bytes we want to send to origin. |
544 | * @param cb callback to call to get the message | 556 | * @param cb Callback to call to get the message. |
545 | * @param cb_cls closure for 'cb' | 557 | * @param cb_cls Closure for @a cb. |
546 | * @return handle to cancel request, NULL on error (i.e. request already pending) | 558 | * @return Handle to cancel request, NULL on error (i.e. request already pending). |
547 | */ | 559 | */ |
548 | struct GNUNET_MULTICAST_ResponseRequest * | 560 | struct GNUNET_MULTICAST_ResponseRequest * |
549 | GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, | 561 | GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, |
@@ -552,10 +564,10 @@ GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, | |||
552 | void *cb_cls); | 564 | void *cb_cls); |
553 | 565 | ||
554 | 566 | ||
555 | /** | 567 | /** |
556 | * Cancel request for message transmission to origin. | 568 | * Cancel request for message transmission to origin. |
557 | * | 569 | * |
558 | * @param rr request to cancel | 570 | * @param rr Request to cancel. |
559 | */ | 571 | */ |
560 | void | 572 | void |
561 | GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_ResponseRequest *rr); | 573 | GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_ResponseRequest *rr); |