2 This file is part of GNUnet.
3 Copyright (C) 2012, 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file include/gnunet_multicast_service.h
23 * @brief multicast service; establish tunnels to distant peers
24 * @author Christian Grothoff
25 * @author Gabor X Toth
28 #ifndef GNUNET_MULTICAST_SERVICE_H
29 #define GNUNET_MULTICAST_SERVICE_H
34 #if 0 /* keep Emacsens' auto-indent happy */
39 #include "gnunet_util_lib.h"
40 #include "gnunet_transport_service.h"
43 * Version number of GNUnet-multicast API.
45 #define GNUNET_MULTICAST_VERSION 0x00000000
48 * Opaque handle for a multicast group member.
50 struct GNUNET_MULTICAST_Member;
53 * Handle for the origin of a multicast group.
55 struct GNUNET_MULTICAST_Origin;
58 enum GNUNET_MULTICAST_MessageFlags
61 * First fragment of a message.
63 GNUNET_MULTICAST_MESSAGE_FIRST_FRAGMENT = 1 << 0,
66 * Last fragment of a message.
68 GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT = 1 << 1,
71 * OR'ed flags if message is not fragmented.
73 GNUNET_MULTICAST_MESSAGE_NOT_FRAGMENTED
74 = GNUNET_MULTICAST_MESSAGE_FIRST_FRAGMENT
75 | GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT,
78 * Historic message, used only locally when replaying messages from local
81 GNUNET_MULTICAST_MESSAGE_HISTORIC = 1 << 30
86 GNUNET_NETWORK_STRUCT_BEGIN
89 * Header of a multicast message fragment.
91 * This format is public as the replay mechanism must replay message fragments using the
92 * same format. This is needed as we want to integrity-check message fragments within
93 * the multicast layer to avoid multicasting mal-formed messages.
95 struct GNUNET_MULTICAST_MessageHeader
99 * Header for all multicast message fragments from the origin.
101 struct GNUNET_MessageHeader header;
104 * Number of hops this message fragment has taken since the origin.
106 * Helpful to determine shortest paths to the origin among honest peers for
107 * unicast requests from members. Updated at each hop and thus not signed and
110 uint32_t hop_counter GNUNET_PACKED;
113 * ECC signature of the message fragment.
115 * Signature must match the public key of the multicast group.
117 struct GNUNET_CRYPTO_EddsaSignature signature;
120 * Purpose for the signature and size of the signed data.
122 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
125 * Number of the message fragment, monotonically increasing starting from 1.
127 uint64_t fragment_id GNUNET_PACKED;
130 * Byte offset of this @e fragment of the @e message.
132 uint64_t fragment_offset GNUNET_PACKED;
135 * Number of the message this fragment belongs to.
137 * Set in GNUNET_MULTICAST_origin_to_all().
139 uint64_t message_id GNUNET_PACKED;
142 * Counter that monotonically increases whenever a member parts the group.
144 * Set in GNUNET_MULTICAST_origin_to_all().
146 * It has significance in case of replay requests: when a member has missed
147 * messages and gets a replay request: in this case if the @a group_generation
148 * is still the same before and after the missed messages, it means that no
149 * @e join or @e part operations happened during the missed messages.
151 uint64_t group_generation GNUNET_PACKED;
154 * Flags for this message fragment.
156 * @see enum GNUNET_MULTICAST_MessageFlags
158 uint32_t flags GNUNET_PACKED;
160 /* Followed by message body. */
165 * Header of a request from a member to the origin.
167 struct GNUNET_MULTICAST_RequestHeader
170 * Header for all requests from a member to the origin.
172 struct GNUNET_MessageHeader header;
175 * Public key of the sending member.
177 struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
180 * ECC signature of the request fragment.
182 * Signature must match the public key of the multicast group.
184 struct GNUNET_CRYPTO_EcdsaSignature signature;
187 * Purpose for the signature and size of the signed data.
189 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
192 * Number of the request fragment.
193 * Monotonically increasing from 1.
195 uint64_t fragment_id GNUNET_PACKED;
198 * Byte offset of this @e fragment of the @e request.
200 uint64_t fragment_offset GNUNET_PACKED;
203 * Number of the request this fragment belongs to.
205 * Set in GNUNET_MULTICAST_origin_to_all().
207 uint64_t request_id GNUNET_PACKED;
210 * Flags for this request.
212 enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED;
214 /* Followed by request body. */
217 GNUNET_NETWORK_STRUCT_END
221 * Maximum size of a multicast message fragment.
223 #define GNUNET_MULTICAST_FRAGMENT_MAX_SIZE 63 * 1024
225 #define GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD \
226 GNUNET_MULTICAST_FRAGMENT_MAX_SIZE \
227 - sizeof (struct GNUNET_MULTICAST_MessageHeader)
231 * Handle that identifies a join request.
233 * Used to match calls to #GNUNET_MULTICAST_JoinRequestCallback to the
234 * corresponding calls to #GNUNET_MULTICAST_join_decision().
236 struct GNUNET_MULTICAST_JoinHandle;
240 * Function to call with the decision made for a join request.
242 * Must be called once and only once in response to an invocation of the
243 * #GNUNET_MULTICAST_JoinRequestCallback.
246 * Join request handle.
248 * #GNUNET_YES if the join is approved,
249 * #GNUNET_NO if it is disapproved,
250 * #GNUNET_SYSERR if we cannot answer the request.
252 * Number of relays given.
254 * Array of suggested peers that might be useful relays to use
255 * when joining the multicast group (essentially a list of peers that
256 * are already part of the multicast group and might thus be willing
257 * to help with routing). If empty, only this local peer (which must
258 * be the multicast origin) is a good candidate for building the
259 * multicast tree. Note that it is unnecessary to specify our own
260 * peer identity in this array.
262 * Message to send in response to the joining peer;
263 * can also be used to redirect the peer to a different group at the
264 * application layer; this response is to be transmitted to the
265 * peer that issued the request even if admission is denied.
267 struct GNUNET_MULTICAST_ReplayHandle *
268 GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh,
270 uint16_t relay_count,
271 const struct GNUNET_PeerIdentity *relays,
272 const struct GNUNET_MessageHeader *join_resp);
276 * Method called whenever another peer wants to join the multicast group.
278 * Implementations of this function must call GNUNET_MULTICAST_join_decision()
284 * Public key of the member requesting join.
286 * Application-dependent join message from the new member.
288 * Join handle to pass to GNUNET_MULTICAST_join_decison().
291 (*GNUNET_MULTICAST_JoinRequestCallback) (void *cls,
292 const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
293 const struct GNUNET_MessageHeader *join_msg,
294 struct GNUNET_MULTICAST_JoinHandle *jh);
298 * Method called to inform about the decision in response to a join request.
300 * If @a is_admitted is not #GNUNET_YES, then the multicast service disconnects
301 * the client and the multicast member handle returned by
302 * GNUNET_MULTICAST_member_join() is invalidated.
307 * #GNUNET_YES or #GNUNET_NO or #GNUNET_SYSERR
309 * The peer we are connected to and the join decision is from.
311 * Number of peers in the @a relays array.
313 * Peer identities of members of the group, which serve as relays
314 * and can be used to join the group at. If empty, only the origin can
315 * be used to connect to the group.
317 * Application-dependent join message from the origin.
320 (*GNUNET_MULTICAST_JoinDecisionCallback) (void *cls,
322 const struct GNUNET_PeerIdentity *peer,
323 uint16_t relay_count,
324 const struct GNUNET_PeerIdentity *relays,
325 const struct GNUNET_MessageHeader *join_msg);
329 * Handle to pass back for the answer of a membership test.
331 struct GNUNET_MULTICAST_MembershipTestHandle;
335 * Call informing multicast about the decision taken for a membership test.
338 * Handle that was given for the query.
340 * #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member,
341 * #GNUNET_SYSERR if we cannot answer the membership test.
344 GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestHandle *mth,
349 * Method called to test if a member was in the group at a particular time.
351 * It is called when a replay request is received to determine if the requested
352 * message can be replayed.
357 * Identity of the member that we want to test.
359 * Message ID for which to perform the test.
360 * @param group_generation
361 * Group generation of the message. It has relevance if
362 * the message consists of multiple fragments with different group
365 * Handle to give to GNUNET_MULTICAST_membership_test_answer().
368 (*GNUNET_MULTICAST_MembershipTestCallback) (void *cls,
369 const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
371 uint64_t group_generation,
372 struct GNUNET_MULTICAST_MembershipTestHandle *mth);
376 * Function called whenever a group member has transmitted a request
377 * to the origin (other than joining or leaving).
379 * FIXME: need to distinguish between origin cancelling a message (some fragments
380 * were sent, then the rest 'discarded') and the case where we got disconnected;
381 * right now, both would mean 'msg' is NULL, but they could be quite different...
382 * So the semantics from the receiver side of
383 * GNUNET_MULTICAST_member_to_origin_cancel() are not clear here. Maybe we
384 * should do something with the flags in this case?
387 * Closure (set from GNUNET_MULTICAST_origin_start).
389 * Identity of the sender.
391 * Request to the origin.
393 * Flags for the request.
396 (*GNUNET_MULTICAST_RequestCallback) (void *cls,
397 const struct GNUNET_MULTICAST_RequestHeader *req);
401 * Function called whenever a group member is receiving a message fragment from
404 * If admission to the group is denied, this function is called once with the
405 * response of the @e origin (as given to GNUNET_MULTICAST_join_decision()) and
406 * then a second time with NULL to indicate that the connection failed for good.
408 * FIXME: need to distinguish between origin cancelling a message (some fragments
409 * were sent, then the rest 'discarded') and the case where we got disconnected;
410 * right now, both would mean 'msg' is NULL, but they could be quite different...
411 * So the semantics from the receiver side of
412 * GNUNET_MULTICAST_origin_to_all_cancel() are not clear here.
415 * Closure (set from GNUNET_MULTICAST_member_join())
417 * Message from the origin, NULL if the origin shut down
418 * (or we were kicked out, and we should thus call
419 * GNUNET_MULTICAST_member_part() next)
422 (*GNUNET_MULTICAST_MessageCallback) (void *cls,
423 const struct GNUNET_MULTICAST_MessageHeader *msg);
427 * Function called with the result of an asynchronous operation.
429 * @see GNUNET_MULTICAST_replay_fragment()
432 * Result of the operation.
435 (*GNUNET_MULTICAST_ResultCallback) (void *cls,
440 * Opaque handle to a replay request from the multicast service.
442 struct GNUNET_MULTICAST_ReplayHandle;
446 * Functions with this signature are called whenever the multicast service needs
447 * a message fragment to be replayed by fragment_id.
449 * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE
450 * (with a message or an error); however, if the origin is destroyed or the
451 * group is left, the replay handle must no longer be used.
454 * Closure (set from GNUNET_MULTICAST_origin_start()
455 * or GNUNET_MULTICAST_member_join()).
457 * The member requesting replay.
459 * Which message fragment should be replayed.
461 * Flags for the replay.
463 * Handle to pass to message transmit function.
466 (*GNUNET_MULTICAST_ReplayFragmentCallback) (void *cls,
467 const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
468 uint64_t fragment_id,
470 struct GNUNET_MULTICAST_ReplayHandle *rh);
473 * Functions with this signature are called whenever the multicast service needs
474 * a message fragment to be replayed by message_id and fragment_offset.
476 * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE
477 * (with a message or an error); however, if the origin is destroyed or the
478 * group is left, the replay handle must no longer be used.
481 * Closure (set from GNUNET_MULTICAST_origin_start()
482 * or GNUNET_MULTICAST_member_join()).
484 * The member requesting replay.
486 * Which message should be replayed.
487 * @param fragment_offset
488 * Offset of the fragment within of @a message_id to be replayed.
490 * Flags for the replay.
492 * Handle to pass to message transmit function.
495 (*GNUNET_MULTICAST_ReplayMessageCallback) (void *cls,
496 const struct GNUNET_CRYPTO_EcdsaPublicKey *member_key,
498 uint64_t fragment_offset,
500 struct GNUNET_MULTICAST_ReplayHandle *rh);
504 * Possible error codes during replay.
506 enum GNUNET_MULTICAST_ReplayErrorCode
510 * Everything is fine.
512 GNUNET_MULTICAST_REC_OK = 0,
515 * Message fragment not found in the message store.
517 * Either discarded if it is too old, or not arrived yet if this member has
518 * missed some messages.
520 GNUNET_MULTICAST_REC_NOT_FOUND = 1,
523 * Fragment ID counter was larger than the highest counter this
524 * replay function has ever encountered; thus it is likely the
525 * origin never sent it and we're at the HEAD of the multicast
526 * stream as far as this node is concerned.
530 GNUNET_MULTICAST_REC_PAST_HEAD = 2,
533 * Access is denied to the requested fragment, membership test did not pass.
535 GNUNET_MULTICAST_REC_ACCESS_DENIED = 3,
538 * Internal error (i.e. database error). Try some other peer.
540 GNUNET_MULTICAST_REC_INTERNAL_ERROR = 4
546 * Replay a message fragment for the multicast group.
549 * Replay handle identifying which replay operation was requested.
551 * Replayed message fragment, NULL if not found / an error occurred.
553 * Error code. See enum GNUNET_MULTICAST_ReplayErrorCode
554 * If not #GNUNET_MULTICAST_REC_OK, the replay handle is invalidated.
557 GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
558 const struct GNUNET_MessageHeader *msg,
559 enum GNUNET_MULTICAST_ReplayErrorCode ec);
563 * Indicate the end of the replay session.
565 * Invalidates the replay handle.
567 * @param rh Replay session to end.
570 GNUNET_MULTICAST_replay_response_end (struct GNUNET_MULTICAST_ReplayHandle *rh);
574 * Function called to provide data for a transmission for a replay.
576 * @see GNUNET_MULTICAST_replay2()
579 (*GNUNET_MULTICAST_ReplayTransmitNotify) (void *cls,
585 * Replay a message for the multicast group.
588 * Replay handle identifying which replay operation was requested.
590 * Function to call to get the message.
592 * Closure for @a notify.
595 GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
596 GNUNET_MULTICAST_ReplayTransmitNotify notify,
601 * Start a multicast group.
603 * Will advertise the origin in the P2P overlay network under the respective
604 * public key so that other peer can find this peer to join it. Peers that
605 * issue GNUNET_MULTICAST_member_join() can then transmit a join request to
606 * either an existing group member or to the origin. If the joining is
607 * approved, the member is cleared for @e replay and will begin to receive
608 * messages transmitted to the group. If joining is disapproved, the failed
609 * candidate will be given a response. Members in the group can send messages
610 * to the origin (one at a time).
613 * Configuration to use.
615 * ECC key that will be used to sign messages for this
616 * multicast session; public key is used to identify the multicast group;
617 * @param max_fragment_id
618 * Maximum fragment ID already sent to the group.
620 * @param join_request_cb
621 * Function called to approve / disapprove joining of a peer.
622 * @param member_test_cb
623 * Function multicast can use to test group membership.
624 * @param replay_frag_cb
625 * Function that can be called to replay a message fragment.
626 * @param replay_msg_cb
627 * Function that can be called to replay a message.
629 * Function called with message fragments from group members.
631 * Function called with the message fragments sent to the
632 * network by GNUNET_MULTICAST_origin_to_all(). These message fragments
633 * should be stored for answering replay requests later.
635 * Closure for the various callbacks that follow.
637 * @return Handle for the origin, NULL on error.
639 struct GNUNET_MULTICAST_Origin *
640 GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
641 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key,
642 uint64_t max_fragment_id,
643 GNUNET_MULTICAST_JoinRequestCallback join_request_cb,
644 GNUNET_MULTICAST_MembershipTestCallback member_test_cb,
645 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
646 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
647 GNUNET_MULTICAST_RequestCallback request_cb,
648 GNUNET_MULTICAST_MessageCallback message_cb,
652 * Function called to provide data for a transmission from the origin to all
655 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
656 * invalidates the respective transmission handle.
660 * @param[in,out] data_size
661 * Initially set to the number of bytes available in
662 * @a data, should be set to the number of bytes written to data.
664 * Where to write the body of the message to give to the
665 * method. The function must copy at most @a data_size bytes to @a data.
667 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
668 * #GNUNET_NO on success, if more data is to be transmitted later.
669 * Should be used if @a data_size was not big enough to take all the
670 * data. If 0 is returned in @a data_size the transmission is paused,
671 * and can be resumed with GNUNET_MULTICAST_origin_to_all_resume().
672 * #GNUNET_YES if this completes the transmission (all data supplied)
675 (*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls,
681 * Handle for a request to send a message to all multicast group members
684 struct GNUNET_MULTICAST_OriginTransmitHandle;
688 * Send a message to the multicast group.
691 * Handle to the multicast group.
693 * Application layer ID for the message. Opaque to multicast.
694 * @param group_generation
695 * Group generation of the message. Documented in
696 * struct GNUNET_MULTICAST_MessageHeader.
698 * Function to call to get the message.
700 * Closure for @a notify.
702 * @return NULL on error (i.e. request already pending).
704 struct GNUNET_MULTICAST_OriginTransmitHandle *
705 GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
707 uint64_t group_generation,
708 GNUNET_MULTICAST_OriginTransmitNotify notify,
714 * Resume message transmission to multicast group.
716 * @param th Transmission to cancel.
719 GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginTransmitHandle *th);
723 * Cancel request for message transmission to multicast group.
725 * @param th Transmission to cancel.
728 GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginTransmitHandle *th);
732 * Stop a multicast group.
734 * @param origin Multicast group to stop.
737 GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin,
738 GNUNET_ContinuationCallback stop_cb,
743 * Join a multicast group.
745 * The entity joining is always the local peer. Further information about the
746 * candidate can be provided in @a join_msg. If the join fails, the
747 * @a message_cb is invoked with a (failure) response and then with NULL. If
748 * the join succeeds, outstanding (state) messages and ongoing multicast
749 * messages will be given to the @a message_cb until the member decides to part
750 * the group. The @a mem_test_cb and @a replay_cb functions may be called at
751 * anytime by the multicast service to support relaying messages to other
752 * members of the group.
755 * Configuration to use.
757 * ECC public key that identifies the group to join.
759 * ECC key that identifies the member
760 * and used to sign requests sent to the origin.
762 * Peer ID of the origin to send unicast requsets to. If NULL,
763 * unicast requests are sent back via multiple hops on the reverse path
764 * of multicast messages.
766 * Number of peers in the @a relays array.
768 * Peer identities of members of the group, which serve as relays
769 * and can be used to join the group at. and send the @a join_request to.
770 * If empty, the @a join_request is sent directly to the @a origin.
772 * Application-dependent join message to be passed to the peer @a origin.
773 * @param join_request_cb
774 * Function called to approve / disapprove joining of a peer.
775 * @param join_decision_cb
776 * Function called to inform about the join decision.
777 * @param member_test_cb
778 * Function multicast can use to test group membership.
779 * @param replay_frag_cb
780 * Function that can be called to replay message fragments
781 * this peer already knows from this group. NULL if this
782 * client is unable to support replay.
783 * @param replay_msg_cb
784 * Function that can be called to replay message fragments
785 * this peer already knows from this group. NULL if this
786 * client is unable to support replay.
788 * Function to be called for all message fragments we
789 * receive from the group, excluding those our @a replay_cb
792 * Closure for callbacks.
794 * @return Handle for the member, NULL on error.
796 struct GNUNET_MULTICAST_Member *
797 GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
798 const struct GNUNET_CRYPTO_EddsaPublicKey *group_key,
799 const struct GNUNET_CRYPTO_EcdsaPrivateKey *member_key,
800 const struct GNUNET_PeerIdentity *origin,
801 uint16_t relay_count,
802 const struct GNUNET_PeerIdentity *relays,
803 const struct GNUNET_MessageHeader *join_request,
804 GNUNET_MULTICAST_JoinRequestCallback join_request_cb,
805 GNUNET_MULTICAST_JoinDecisionCallback join_decision_cb,
806 GNUNET_MULTICAST_MembershipTestCallback mem_test_cb,
807 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
808 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
809 GNUNET_MULTICAST_MessageCallback message_cb,
813 * Handle for a replay request.
815 struct GNUNET_MULTICAST_MemberReplayHandle;
819 * Request a fragment to be replayed by fragment ID.
821 * Useful if messages below the @e max_known_fragment_id given when joining are
822 * needed and not known to the client.
827 * ID of a message fragment that this client would like to see replayed.
829 * Additional flags for the replay request.
830 * It is used and defined by GNUNET_MULTICAST_ReplayFragmentCallback
832 * Function to call when the replayed message fragment arrives.
834 * Closure for @a result_cb.
836 * @return Replay request handle, NULL on error.
838 struct GNUNET_MULTICAST_MemberReplayHandle *
839 GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member,
840 uint64_t fragment_id,
842 GNUNET_MULTICAST_ResultCallback result_cb,
843 void *result_cb_cls);
847 * Request a message fr to be replayed.
849 * Useful if messages below the @e max_known_fragment_id given when joining are
850 * needed and not known to the client.
855 * ID of the message this client would like to see replayed.
856 * @param fragment_offset
857 * Offset of the fragment within the message to replay.
859 * Additional flags for the replay request.
860 * It is used & defined by GNUNET_MULTICAST_ReplayMessageCallback
862 * Function to call for each replayed message fragment.
864 * Closure for @a result_cb.
866 * @return Replay request handle, NULL on error.
868 struct GNUNET_MULTICAST_MemberReplayHandle *
869 GNUNET_MULTICAST_member_replay_message (struct GNUNET_MULTICAST_Member *member,
871 uint64_t fragment_offset,
873 GNUNET_MULTICAST_ResultCallback result_cb,
874 void *result_cb_cls);
878 * Cancel a replay request.
884 GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandle *rh);
888 * Part a multicast group.
890 * Disconnects from all group members and invalidates the @a member handle.
892 * An application-dependent part message can be transmitted beforehand using
893 * #GNUNET_MULTICAST_member_to_origin())
899 GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member,
900 GNUNET_ContinuationCallback part_cb,
905 * Function called to provide data for a transmission from a member to the origin.
907 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
908 * invalidates the respective transmission handle.
912 * @param[in,out] data_size
913 * Initially set to the number of bytes available in
914 * @a data, should be set to the number of bytes written to data.
916 * Where to write the body of the message to give to the
917 * method. The function must copy at most @a data_size bytes to @a data.
919 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
920 * #GNUNET_NO on success, if more data is to be transmitted later.
921 * Should be used if @a data_size was not big enough to take all the
922 * data. If 0 is returned in @a data_size the transmission is paused,
923 * and can be resumed with GNUNET_MULTICAST_member_to_origin_resume().
924 * #GNUNET_YES if this completes the transmission (all data supplied)
927 (*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls,
933 * Handle for a message to be delivered from a member to the origin.
935 struct GNUNET_MULTICAST_MemberTransmitHandle;
939 * Send a message to the origin of the multicast group.
944 * Application layer ID for the request. Opaque to multicast.
946 * Callback to call to get the message.
948 * Closure for @a notify.
950 * @return Handle to cancel request, NULL on error (i.e. request already pending).
952 struct GNUNET_MULTICAST_MemberTransmitHandle *
953 GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
955 GNUNET_MULTICAST_MemberTransmitNotify notify,
960 * Resume message transmission to origin.
963 * Transmission to cancel.
966 GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberTransmitHandle *th);
970 * Cancel request for message transmission to origin.
973 * Transmission to cancel.
976 GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberTransmitHandle *th);
979 #if 0 /* keep Emacsens' auto-indent happy */
986 /* ifndef GNUNET_MULTICAST_SERVICE_H */
988 /* end of gnunet_multicast_service.h */