diff options
author | Gabor X Toth <*@tg-x.net> | 2014-05-26 22:16:05 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-05-26 22:16:05 +0000 |
commit | 83495695331fcfa8824d7a6d407b82cfcfc8b13c (patch) | |
tree | 2d2a7717d81890f5142da9561bccf9e164b1deee /src/include/gnunet_multicast_service.h | |
parent | 1cfab01aaea932539c39dcb2118ec4d6c6d44381 (diff) | |
download | gnunet-83495695331fcfa8824d7a6d407b82cfcfc8b13c.tar.gz gnunet-83495695331fcfa8824d7a6d407b82cfcfc8b13c.zip |
psyc, multicast: join decision, tests
Diffstat (limited to 'src/include/gnunet_multicast_service.h')
-rw-r--r-- | src/include/gnunet_multicast_service.h | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h index 7ceb2e352..5079a087b 100644 --- a/src/include/gnunet_multicast_service.h +++ b/src/include/gnunet_multicast_service.h | |||
@@ -230,7 +230,7 @@ GNUNET_NETWORK_STRUCT_END | |||
230 | /** | 230 | /** |
231 | * Handle that identifies a join request. | 231 | * Handle that identifies a join request. |
232 | * | 232 | * |
233 | * Used to match calls to #GNUNET_MULTICAST_JoinCallback to the | 233 | * Used to match calls to #GNUNET_MULTICAST_JoinRequestCallback to the |
234 | * corresponding calls to #GNUNET_MULTICAST_join_decision(). | 234 | * corresponding calls to #GNUNET_MULTICAST_join_decision(). |
235 | */ | 235 | */ |
236 | struct GNUNET_MULTICAST_JoinHandle; | 236 | struct GNUNET_MULTICAST_JoinHandle; |
@@ -240,11 +240,12 @@ struct GNUNET_MULTICAST_JoinHandle; | |||
240 | * Function to call with the decision made for a join request. | 240 | * Function to call with the decision made for a join request. |
241 | * | 241 | * |
242 | * Must be called once and only once in response to an invocation of the | 242 | * Must be called once and only once in response to an invocation of the |
243 | * #GNUNET_MULTICAST_JoinCallback. | 243 | * #GNUNET_MULTICAST_JoinRequestCallback. |
244 | * | 244 | * |
245 | * @param jh Join request handle. | 245 | * @param jh Join request handle. |
246 | * @param is_admitted #GNUNET_YES if joining is approved, | 246 | * @param is_admitted #GNUNET_YES if the join is approved, |
247 | * #GNUNET_NO if it is disapproved | 247 | * #GNUNET_NO if it is disapproved, |
248 | * #GNUNET_SYSERR if we cannot answer the request. | ||
248 | * @param relay_count Number of relays given. | 249 | * @param relay_count Number of relays given. |
249 | * @param relays Array of suggested peers that might be useful relays to use | 250 | * @param relays Array of suggested peers that might be useful relays to use |
250 | * when joining the multicast group (essentially a list of peers that | 251 | * when joining the multicast group (essentially a list of peers that |
@@ -261,7 +262,7 @@ struct GNUNET_MULTICAST_JoinHandle; | |||
261 | struct GNUNET_MULTICAST_ReplayHandle * | 262 | struct GNUNET_MULTICAST_ReplayHandle * |
262 | GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh, | 263 | GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh, |
263 | int is_admitted, | 264 | int is_admitted, |
264 | unsigned int relay_count, | 265 | uint16_t relay_count, |
265 | const struct GNUNET_PeerIdentity *relays, | 266 | const struct GNUNET_PeerIdentity *relays, |
266 | const struct GNUNET_MessageHeader *join_resp); | 267 | const struct GNUNET_MessageHeader *join_resp); |
267 | 268 | ||
@@ -273,16 +274,40 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh, | |||
273 | * with the decision. | 274 | * with the decision. |
274 | * | 275 | * |
275 | * @param cls Closure. | 276 | * @param cls Closure. |
276 | * @param peer Identity of the member that wants to join. | 277 | * @param member_key Public key of the member requesting join. |
277 | * @param member_key Requesting member's public key. | ||
278 | * @param join_msg Application-dependent join message from the new member. | 278 | * @param join_msg Application-dependent join message from the new member. |
279 | * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison(). | 279 | * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison(). |
280 | */ | 280 | */ |
281 | typedef void | 281 | typedef void |
282 | (*GNUNET_MULTICAST_JoinCallback) (void *cls, | 282 | (*GNUNET_MULTICAST_JoinRequestCallback) (void *cls, |
283 | const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, | 283 | const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, |
284 | const struct GNUNET_MessageHeader *join_msg, | 284 | const struct GNUNET_MessageHeader *join_msg, |
285 | struct GNUNET_MULTICAST_JoinHandle *jh); | 285 | struct GNUNET_MULTICAST_JoinHandle *jh); |
286 | |||
287 | |||
288 | /** | ||
289 | * Method called to inform about the decision in response to a join request. | ||
290 | * | ||
291 | * If @a is_admitted is not #GNUNET_YES, then the multicast service disconnects | ||
292 | * the client and the multicast member handle returned by | ||
293 | * GNUNET_MULTICAST_member_join() is invalidated. | ||
294 | * | ||
295 | * @param cls Closure. | ||
296 | * @param is_admitted #GNUNET_YES or #GNUNET_NO or #GNUNET_SYSERR | ||
297 | * @param peer The peer we are connected to and the join decision is from. | ||
298 | * @param relay_count Number of peers in the @a relays array. | ||
299 | * @param relays Peer identities of members of the group, which serve as relays | ||
300 | * and can be used to join the group at. If empty, only the origin can | ||
301 | * be used to connect to the group. | ||
302 | * @param join_msg Application-dependent join message from the origin. | ||
303 | */ | ||
304 | typedef void | ||
305 | (*GNUNET_MULTICAST_JoinDecisionCallback) (void *cls, | ||
306 | int is_admitted, | ||
307 | const struct GNUNET_PeerIdentity *peer, | ||
308 | uint16_t relay_count, | ||
309 | const struct GNUNET_PeerIdentity *relays, | ||
310 | const struct GNUNET_MessageHeader *join_msg); | ||
286 | 311 | ||
287 | 312 | ||
288 | /** | 313 | /** |
@@ -542,9 +567,9 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh, | |||
542 | * @param cfg Configuration to use. | 567 | * @param cfg Configuration to use. |
543 | * @param priv_key ECC key that will be used to sign messages for this | 568 | * @param priv_key ECC key that will be used to sign messages for this |
544 | * multicast session; public key is used to identify the multicast group; | 569 | * multicast session; public key is used to identify the multicast group; |
545 | * @param next_fragment_id Next fragment ID to continue counting fragments from | 570 | * @param max_fragment_id Maximum fragment ID already sent to the group. |
546 | * when restarting the origin. 1 for a new group. | 571 | * 0 for a new group. |
547 | * @param join_cb Function called to approve / disapprove joining of a peer. | 572 | * @param join_request_cb Function called to approve / disapprove joining of a peer. |
548 | * @param member_test_cb Function multicast can use to test group membership. | 573 | * @param member_test_cb Function multicast can use to test group membership. |
549 | * @param replay_frag_cb Function that can be called to replay a message fragment. | 574 | * @param replay_frag_cb Function that can be called to replay a message fragment. |
550 | * @param replay_msg_cb Function that can be called to replay a message. | 575 | * @param replay_msg_cb Function that can be called to replay a message. |
@@ -558,8 +583,8 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh, | |||
558 | struct GNUNET_MULTICAST_Origin * | 583 | struct GNUNET_MULTICAST_Origin * |
559 | GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 584 | GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
560 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key, | 585 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key, |
561 | uint64_t next_fragment_id, | 586 | uint64_t max_fragment_id, |
562 | GNUNET_MULTICAST_JoinCallback join_cb, | 587 | GNUNET_MULTICAST_JoinRequestCallback join_request_cb, |
563 | GNUNET_MULTICAST_MembershipTestCallback member_test_cb, | 588 | GNUNET_MULTICAST_MembershipTestCallback member_test_cb, |
564 | GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, | 589 | GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, |
565 | GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, | 590 | GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, |
@@ -667,11 +692,12 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); | |||
667 | * of multicast messages. | 692 | * of multicast messages. |
668 | * @param relay_count Number of peers in the @a relays array. | 693 | * @param relay_count Number of peers in the @a relays array. |
669 | * @param relays Peer identities of members of the group, which serve as relays | 694 | * @param relays Peer identities of members of the group, which serve as relays |
670 | * and can be used to join the group at. and send the @a join_request to. | 695 | * and can be used to join the group at and send the @a join_request to. |
671 | * If empty, the @a join_request is sent directly to the @a origin. | 696 | * If empty, the @a join_request is sent directly to the @a origin. |
672 | * @param join_msg Application-dependent join message to be passed to the | 697 | * @param join_msg Application-dependent join message to be passed to the |
673 | * @a origin. | 698 | * @a origin. |
674 | * @param join_cb Function called to approve / disapprove joining of a peer. | 699 | * @param join_request_cb Function called to approve / disapprove joining of a peer. |
700 | * @param join_decision_cb Function called to inform about the join decision. | ||
675 | * @param mem_test_cb Function multicast can use to test group membership. | 701 | * @param mem_test_cb Function multicast can use to test group membership. |
676 | * @param replay_frag_cb Function that can be called to replay message fragments | 702 | * @param replay_frag_cb Function that can be called to replay message fragments |
677 | * this peer already knows from this group. NULL if this | 703 | * this peer already knows from this group. NULL if this |
@@ -690,10 +716,11 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
690 | const struct GNUNET_CRYPTO_EddsaPublicKey *group_key, | 716 | const struct GNUNET_CRYPTO_EddsaPublicKey *group_key, |
691 | const struct GNUNET_CRYPTO_EddsaPrivateKey *member_key, | 717 | const struct GNUNET_CRYPTO_EddsaPrivateKey *member_key, |
692 | const struct GNUNET_PeerIdentity *origin, | 718 | const struct GNUNET_PeerIdentity *origin, |
693 | uint32_t relay_count, | 719 | uint16_t relay_count, |
694 | const struct GNUNET_PeerIdentity *relays, | 720 | const struct GNUNET_PeerIdentity *relays, |
695 | const struct GNUNET_MessageHeader *join_request, | 721 | const struct GNUNET_MessageHeader *join_request, |
696 | GNUNET_MULTICAST_JoinCallback join_cb, | 722 | GNUNET_MULTICAST_JoinRequestCallback join_request_cb, |
723 | GNUNET_MULTICAST_JoinDecisionCallback join_decision_cb, | ||
697 | GNUNET_MULTICAST_MembershipTestCallback mem_test_cb, | 724 | GNUNET_MULTICAST_MembershipTestCallback mem_test_cb, |
698 | GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, | 725 | GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, |
699 | GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, | 726 | GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, |