2 This file is part of GNUnet.
3 (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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, 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_EddsaPublicKey member_key;
180 * ECC signature of the request fragment.
182 * Signature must match the public key of the multicast group.
184 struct GNUNET_CRYPTO_EddsaSignature 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.
245 * @param jh Join request handle.
246 * @param is_admitted #GNUNET_YES if the join is approved,
247 * #GNUNET_NO if it is disapproved,
248 * #GNUNET_SYSERR if we cannot answer the request.
249 * @param relay_count Number of relays given.
250 * @param relays Array of suggested peers that might be useful relays to use
251 * when joining the multicast group (essentially a list of peers that
252 * are already part of the multicast group and might thus be willing
253 * to help with routing). If empty, only this local peer (which must
254 * be the multicast origin) is a good candidate for building the
255 * multicast tree. Note that it is unnecessary to specify our own
256 * peer identity in this array.
257 * @param join_resp Message to send in response to the joining peer;
258 * 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
260 * peer that issued the request even if admission is denied.
262 struct GNUNET_MULTICAST_ReplayHandle *
263 GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh,
265 uint16_t relay_count,
266 const struct GNUNET_PeerIdentity *relays,
267 const struct GNUNET_MessageHeader *join_resp);
271 * Method called whenever another peer wants to join the multicast group.
273 * Implementations of this function must call GNUNET_MULTICAST_join_decision()
276 * @param cls Closure.
277 * @param member_key Public key of the member requesting join.
278 * @param join_msg Application-dependent join message from the new member.
279 * @param jh Join handle to pass to GNUNET_MULTICAST_join_decison().
282 (*GNUNET_MULTICAST_JoinRequestCallback) (void *cls,
283 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
284 const struct GNUNET_MessageHeader *join_msg,
285 struct GNUNET_MULTICAST_JoinHandle *jh);
289 * Method called to inform about the decision in response to a join request.
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.
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.
305 (*GNUNET_MULTICAST_JoinDecisionCallback) (void *cls,
307 const struct GNUNET_PeerIdentity *peer,
308 uint16_t relay_count,
309 const struct GNUNET_PeerIdentity *relays,
310 const struct GNUNET_MessageHeader *join_msg);
314 * Handle to pass back for the answer of a membership test.
316 struct GNUNET_MULTICAST_MembershipTestHandle;
320 * Call informing multicast about the decision taken for a membership test.
322 * @param mth Handle that was given for the query.
323 * @param result #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member,
324 * #GNUNET_SYSERR if we cannot answer the membership test.
327 GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestHandle *mth,
332 * Method called to test if a member was in the group at a particular time.
334 * It is called when a replay request is received to determine if the requested
335 * message can be replayed.
337 * @param cls Closure.
338 * @param member_key Identity of the member that we want to test.
339 * @param message_id Message ID for which to perform the test.
340 * @param group_generation Group generation of the message. It has relevance if
341 * the message consists of multiple fragments with different group
343 * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer().
346 (*GNUNET_MULTICAST_MembershipTestCallback) (void *cls,
347 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
349 uint64_t group_generation,
350 struct GNUNET_MULTICAST_MembershipTestHandle *mth);
354 * Function called whenever a group member has transmitted a request
355 * to the origin (other than joining or leaving).
357 * FIXME: need to distinguish between origin cancelling a message (some fragments
358 * were sent, then the rest 'discarded') and the case where we got disconnected;
359 * right now, both would mean 'msg' is NULL, but they could be quite different...
360 * So the semantics from the receiver side of
361 * GNUNET_MULTICAST_member_to_origin_cancel() are not clear here. Maybe we
362 * should do something with the flags in this case?
364 * @param cls Closure (set from GNUNET_MULTICAST_origin_start).
365 * @param sender Identity of the sender.
366 * @param req Request to the origin.
367 * @param flags Flags for the request.
370 (*GNUNET_MULTICAST_RequestCallback) (void *cls,
371 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
372 const struct GNUNET_MessageHeader *req,
373 enum GNUNET_MULTICAST_MessageFlags flags);
377 * Function called whenever a group member is receiving a message fragment from
380 * If admission to the group is denied, this function is called once with the
381 * response of the @e origin (as given to GNUNET_MULTICAST_join_decision()) and
382 * then a second time with NULL to indicate that the connection failed for good.
384 * FIXME: need to distinguish between origin cancelling a message (some fragments
385 * were sent, then the rest 'discarded') and the case where we got disconnected;
386 * right now, both would mean 'msg' is NULL, but they could be quite different...
387 * So the semantics from the receiver side of
388 * GNUNET_MULTICAST_origin_to_all_cancel() are not clear here.
390 * @param cls Closure (set from GNUNET_MULTICAST_member_join())
391 * @param msg Message from the origin, NULL if the origin shut down
392 * (or we were kicked out, and we should thus call
393 * GNUNET_MULTICAST_member_part() next)
396 (*GNUNET_MULTICAST_MessageCallback) (void *cls,
397 const struct GNUNET_MessageHeader *msg);
401 * Function called with the result of an asynchronous operation.
403 * @see GNUNET_MULTICAST_replay_fragment()
405 * @param result Result of the operation.
408 (*GNUNET_MULTICAST_ResultCallback) (void *cls,
413 * Opaque handle to a replay request from the multicast service.
415 struct GNUNET_MULTICAST_ReplayHandle;
419 * Functions with this signature are called whenever the multicast service needs
420 * a message fragment to be replayed by fragment_id.
422 * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE
423 * (with a message or an error); however, if the origin is destroyed or the
424 * group is left, the replay handle must no longer be used.
426 * @param cls Closure (set from GNUNET_MULTICAST_origin_start()
427 * or GNUNET_MULTICAST_member_join()).
428 * @param member_key The member requesting replay.
429 * @param fragment_id Which message fragment should be replayed.
430 * @param flags Flags for the replay.
431 * @param rh Handle to pass to message transmit function.
434 (*GNUNET_MULTICAST_ReplayFragmentCallback) (void *cls,
435 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
436 uint64_t fragment_id,
438 struct GNUNET_MULTICAST_ReplayHandle *rh);
441 * Functions with this signature are called whenever the multicast service needs
442 * a message fragment to be replayed by message_id and fragment_offset.
444 * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE
445 * (with a message or an error); however, if the origin is destroyed or the
446 * group is left, the replay handle must no longer be used.
448 * @param cls Closure (set from GNUNET_MULTICAST_origin_start()
449 * or GNUNET_MULTICAST_member_join()).
450 * @param member_key The member requesting replay.
451 * @param message_id Which message should be replayed.
452 * @param fragment_offset Offset of the fragment within of @a message_id to be replayed.
453 * @param flags Flags for the replay.
454 * @param rh Handle to pass to message transmit function.
457 (*GNUNET_MULTICAST_ReplayMessageCallback) (void *cls,
458 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
460 uint64_t fragment_offset,
462 struct GNUNET_MULTICAST_ReplayHandle *rh);
466 * Possible error codes during replay.
468 enum GNUNET_MULTICAST_ReplayErrorCode
472 * Everything is fine.
474 GNUNET_MULTICAST_REC_OK = 0,
477 * Message fragment not found in the message store.
479 * Either discarded if it is too old, or not arrived yet if this member has
480 * missed some messages.
482 GNUNET_MULTICAST_REC_NOT_FOUND = 1,
485 * Fragment ID counter was larger than the highest counter this
486 * replay function has ever encountered; thus it is likely the
487 * origin never sent it and we're at the HEAD of the multicast
488 * stream as far as this node is concerned.
492 GNUNET_MULTICAST_REC_PAST_HEAD = 2,
495 * Access is denied to the requested fragment, membership test did not pass.
497 GNUNET_MULTICAST_REC_ACCESS_DENIED = 3,
500 * Internal error (i.e. database error). Try some other peer.
502 GNUNET_MULTICAST_REC_INTERNAL_ERROR = 4
508 * Replay a message fragment for the multicast group.
510 * @param rh Replay handle identifying which replay operation was requested.
511 * @param msg Replayed message fragment, NULL if unknown/error.
512 * @param ec Error code.
515 GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
516 const struct GNUNET_MessageHeader *msg,
517 enum GNUNET_MULTICAST_ReplayErrorCode ec);
521 * Indicate the end of the replay session.
523 * Invalidates the replay handle.
525 * @param rh Replay session to end.
528 GNUNET_MULTICAST_replay_response_end (struct GNUNET_MULTICAST_ReplayHandle *rh);
532 * Function called to provide data for a transmission for a replay.
534 * @see GNUNET_MULTICAST_replay2()
537 (*GNUNET_MULTICAST_ReplayTransmitNotify) (void *cls,
543 * Replay a message for the multicast group.
545 * @param rh Replay handle identifying which replay operation was requested.
546 * @param notify Function to call to get the message.
547 * @param notify_cls Closure for @a notify.
550 GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
551 GNUNET_MULTICAST_ReplayTransmitNotify notify,
556 * Start a multicast group.
558 * Will advertise the origin in the P2P overlay network under the respective
559 * public key so that other peer can find this peer to join it. Peers that
560 * issue GNUNET_MULTICAST_member_join() can then transmit a join request to
561 * either an existing group member or to the origin. If the joining is
562 * approved, the member is cleared for @e replay and will begin to receive
563 * messages transmitted to the group. If joining is disapproved, the failed
564 * candidate will be given a response. Members in the group can send messages
565 * to the origin (one at a time).
567 * @param cfg Configuration to use.
568 * @param priv_key ECC key that will be used to sign messages for this
569 * multicast session; public key is used to identify the multicast group;
570 * @param max_fragment_id Maximum fragment ID already sent to the group.
572 * @param join_request_cb Function called to approve / disapprove joining of a peer.
573 * @param member_test_cb Function multicast can use to test group membership.
574 * @param replay_frag_cb Function that can be called to replay a message fragment.
575 * @param replay_msg_cb Function that can be called to replay a message.
576 * @param request_cb Function called with message fragments from group members.
577 * @param message_cb Function called with the message fragments sent to the
578 * network by GNUNET_MULTICAST_origin_to_all(). These message fragments
579 * should be stored for answering replay requests later.
580 * @param cls Closure for the various callbacks that follow.
581 * @return Handle for the origin, NULL on error.
583 struct GNUNET_MULTICAST_Origin *
584 GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
585 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key,
586 uint64_t max_fragment_id,
587 GNUNET_MULTICAST_JoinRequestCallback join_request_cb,
588 GNUNET_MULTICAST_MembershipTestCallback member_test_cb,
589 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
590 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
591 GNUNET_MULTICAST_RequestCallback request_cb,
592 GNUNET_MULTICAST_MessageCallback message_cb,
596 * Function called to provide data for a transmission from the origin to all
599 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
600 * invalidates the respective transmission handle.
602 * @param cls Closure.
603 * @param[in,out] data_size Initially set to the number of bytes available in
604 * @a data, should be set to the number of bytes written to data.
605 * @param[out] data Where to write the body of the message to give to the
606 * method. The function must copy at most @a data_size bytes to @a data.
607 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
608 * #GNUNET_NO on success, if more data is to be transmitted later.
609 * Should be used if @a data_size was not big enough to take all the
610 * data. If 0 is returned in @a data_size the transmission is paused,
611 * and can be resumed with GNUNET_MULTICAST_origin_to_all_resume().
612 * #GNUNET_YES if this completes the transmission (all data supplied)
615 (*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls,
621 * Handle for a request to send a message to all multicast group members
624 struct GNUNET_MULTICAST_OriginTransmitHandle;
628 * Send a message to the multicast group.
630 * @param origin Handle to the multicast group.
631 * @param message_id Application layer ID for the message. Opaque to multicast.
632 * @param group_generation Group generation of the message. Documented in
633 * GNUNET_MULTICAST_MessageHeader.
634 * @param notify Function to call to get the message.
635 * @param notify_cls Closure for @a notify.
636 * @return NULL on error (i.e. request already pending).
638 struct GNUNET_MULTICAST_OriginTransmitHandle *
639 GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
641 uint64_t group_generation,
642 GNUNET_MULTICAST_OriginTransmitNotify notify,
648 * Resume message transmission to multicast group.
650 * @param th Transmission to cancel.
653 GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginTransmitHandle *th);
657 * Cancel request for message transmission to multicast group.
659 * @param th Transmission to cancel.
662 GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginTransmitHandle *th);
666 * Stop a multicast group.
668 * @param origin Multicast group to stop.
671 GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin);
675 * Join a multicast group.
677 * The entity joining is always the local peer. Further information about the
678 * candidate can be provided in @a join_msg. If the join fails, the
679 * @a message_cb is invoked with a (failure) response and then with NULL. If
680 * the join succeeds, outstanding (state) messages and ongoing multicast
681 * messages will be given to the @a message_cb until the member decides to part
682 * the group. The @a mem_test_cb and @a replay_cb functions may be called at
683 * anytime by the multicast service to support relaying messages to other
684 * members of the group.
686 * @param cfg Configuration to use.
687 * @param group_key ECC public key that identifies the group to join.
688 * @param member_key ECC key that identifies the member and used to sign
689 * requests sent to the origin.
690 * @param origin Peer ID of the origin to send unicast requsets to. If NULL,
691 * unicast requests are sent back via multiple hops on the reverse path
692 * of multicast messages.
693 * @param relay_count Number of peers in the @a relays array.
694 * @param relays Peer identities of members of the group, which serve as relays
695 * and can be used to join the group at and send the @a join_request to.
696 * If empty, the @a join_request is sent directly to the @a origin.
697 * @param join_msg Application-dependent join message to be passed to the
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.
701 * @param mem_test_cb Function multicast can use to test group membership.
702 * @param replay_frag_cb Function that can be called to replay message fragments
703 * this peer already knows from this group. NULL if this
704 * client is unable to support replay.
705 * @param replay_msg_cb Function that can be called to replay message fragments
706 * this peer already knows from this group. NULL if this
707 * client is unable to support replay.
708 * @param message_cb Function to be called for all message fragments we
709 * receive from the group, excluding those our @a replay_cb
711 * @param cls Closure for callbacks.
712 * @return Handle for the member, NULL on error.
714 struct GNUNET_MULTICAST_Member *
715 GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
716 const struct GNUNET_CRYPTO_EddsaPublicKey *group_key,
717 const struct GNUNET_CRYPTO_EddsaPrivateKey *member_key,
718 const struct GNUNET_PeerIdentity *origin,
719 uint16_t relay_count,
720 const struct GNUNET_PeerIdentity *relays,
721 const struct GNUNET_MessageHeader *join_request,
722 GNUNET_MULTICAST_JoinRequestCallback join_request_cb,
723 GNUNET_MULTICAST_JoinDecisionCallback join_decision_cb,
724 GNUNET_MULTICAST_MembershipTestCallback mem_test_cb,
725 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
726 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
727 GNUNET_MULTICAST_MessageCallback message_cb,
731 * Handle for a replay request.
733 struct GNUNET_MULTICAST_MemberReplayHandle;
737 * Request a fragment to be replayed by fragment ID.
739 * Useful if messages below the @e max_known_fragment_id given when joining are
740 * needed and not known to the client.
742 * @param member Membership handle.
743 * @param fragment_id ID of a message fragment that this client would like to
745 * @param flags Additional flags for the replay request. It is used and defined
746 * by the replay callback. FIXME: which replay callback? FIXME: use enum?
747 * FIXME: why not pass reply cb here?
748 * @return Replay request handle, NULL on error.
750 struct GNUNET_MULTICAST_MemberReplayHandle *
751 GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member,
752 uint64_t fragment_id,
757 * Request a message fr to be replayed.
759 * Useful if messages below the @e max_known_fragment_id given when joining are
760 * needed and not known to the client.
762 * @param member Membership handle.
763 * @param message_id ID of the message this client would like to see replayed.
764 * @param fragment_offset Offset of the fragment within the message to replay.
765 * @param flags Additional flags for the replay request. It is used & defined
766 * by the replay callback.
767 * @param result_cb Function to be called for the replayed message.
768 * @param result_cb_cls Closure for @a result_cb.
769 * @return Replay request handle, NULL on error.
771 struct GNUNET_MULTICAST_MemberReplayHandle *
772 GNUNET_MULTICAST_member_replay_message (struct GNUNET_MULTICAST_Member *member,
774 uint64_t fragment_offset,
776 GNUNET_MULTICAST_ResultCallback result_cb,
777 void *result_cb_cls);
781 * Cancel a replay request.
783 * @param rh Request to cancel.
786 GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandle *rh);
790 * Part a multicast group.
792 * Disconnects from all group members and invalidates the @a member handle.
794 * An application-dependent part message can be transmitted beforehand using
795 * #GNUNET_MULTICAST_member_to_origin())
797 * @param member Membership handle.
800 GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member);
804 * Function called to provide data for a transmission from a member to the origin.
806 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
807 * invalidates the respective transmission handle.
809 * @param cls Closure.
810 * @param[in,out] data_size Initially set to the number of bytes available in
811 * @a data, should be set to the number of bytes written to data.
812 * @param[out] data Where to write the body of the message to give to the
813 * method. The function must copy at most @a data_size bytes to @a data.
815 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
816 * #GNUNET_NO on success, if more data is to be transmitted later.
817 * Should be used if @a data_size was not big enough to take all the
818 * data. If 0 is returned in @a data_size the transmission is paused,
819 * and can be resumed with GNUNET_MULTICAST_member_to_origin_resume().
820 * #GNUNET_YES if this completes the transmission (all data supplied)
823 (*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls,
829 * Handle for a message to be delivered from a member to the origin.
831 struct GNUNET_MULTICAST_MemberTransmitHandle;
835 * Send a message to the origin of the multicast group.
837 * @param member Membership handle.
838 * @param request_id Application layer ID for the request. Opaque to multicast.
839 * @param notify Callback to call to get the message.
840 * @param notify_cls Closure for @a notify.
842 * @return Handle to cancel request, NULL on error (i.e. request already pending).
844 struct GNUNET_MULTICAST_MemberTransmitHandle *
845 GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
847 GNUNET_MULTICAST_MemberTransmitNotify notify,
852 * Resume message transmission to origin.
854 * @param th Transmission to cancel.
857 GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberTransmitHandle *th);
861 * Cancel request for message transmission to origin.
863 * @param th Transmission to cancel.
866 GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberTransmitHandle *th);
869 #if 0 /* keep Emacsens' auto-indent happy */
876 /* ifndef GNUNET_MULTICAST_SERVICE_H */
878 /* end of gnunet_multicast_service.h */