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_JoinCallback 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_JoinCallback.
245 * @param jh Join request handle.
246 * @param is_admitted #GNUNET_YES if joining is approved,
247 * #GNUNET_NO if it is disapproved
248 * @param relay_count Number of relays given.
249 * @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 * are already part of the multicast group and might thus be willing
252 * to help with routing). If empty, only this local peer (which must
253 * be the multicast origin) is a good candidate for building the
254 * multicast tree. Note that it is unnecessary to specify our own
255 * peer identity in this array.
256 * @param join_resp Message to send in response to the joining peer;
257 * can also be used to redirect the peer to a different group at the
258 * application layer; this response is to be transmitted to the
259 * peer that issued the request even if admission is denied.
261 struct GNUNET_MULTICAST_ReplayHandle *
262 GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh,
264 unsigned int relay_count,
265 const struct GNUNET_PeerIdentity *relays,
266 const struct GNUNET_MessageHeader *join_resp);
270 * Method called whenever another peer wants to join the multicast group.
272 * Implementations of this function must call GNUNET_MULTICAST_join_decision()
275 * @param cls Closure.
276 * @param peer Identity of the member that wants to join.
277 * @param member_key Requesting member's public key.
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_JoinCallback) (void *cls,
283 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
284 const struct GNUNET_MessageHeader *join_msg,
285 struct GNUNET_MULTICAST_JoinHandle *jh);
289 * Handle to pass back for the answer of a membership test.
291 struct GNUNET_MULTICAST_MembershipTestHandle;
295 * Call informing multicast about the decision taken for a membership test.
297 * @param mth Handle that was given for the query.
298 * @param result #GNUNET_YES if peer was a member, #GNUNET_NO if peer was not a member,
299 * #GNUNET_SYSERR if we cannot answer the membership test.
302 GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestHandle *mth,
307 * Method called to test if a member was in the group at a particular time.
309 * It is called when a replay request is received to determine if the requested
310 * message can be replayed.
312 * @param cls Closure.
313 * @param member_key Identity of the member that we want to test.
314 * @param message_id Message ID for which to perform the test.
315 * @param group_generation Group generation of the message. It has relevance if
316 * the message consists of multiple fragments with different group
318 * @param mth Handle to give to GNUNET_MULTICAST_membership_test_answer().
321 (*GNUNET_MULTICAST_MembershipTestCallback) (void *cls,
322 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
324 uint64_t group_generation,
325 struct GNUNET_MULTICAST_MembershipTestHandle *mth);
329 * Function called whenever a group member has transmitted a request
330 * to the origin (other than joining or leaving).
332 * FIXME: need to distinguish between origin cancelling a message (some fragments
333 * were sent, then the rest 'discarded') and the case where we got disconnected;
334 * right now, both would mean 'msg' is NULL, but they could be quite different...
335 * So the semantics from the receiver side of
336 * GNUNET_MULTICAST_member_to_origin_cancel() are not clear here. Maybe we
337 * should do something with the flags in this case?
339 * @param cls Closure (set from GNUNET_MULTICAST_origin_start).
340 * @param sender Identity of the sender.
341 * @param req Request to the origin.
342 * @param flags Flags for the request.
345 (*GNUNET_MULTICAST_RequestCallback) (void *cls,
346 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
347 const struct GNUNET_MessageHeader *req,
348 enum GNUNET_MULTICAST_MessageFlags flags);
352 * Function called whenever a group member is receiving a message fragment from
355 * If admission to the group is denied, this function is called once with the
356 * response of the @e origin (as given to GNUNET_MULTICAST_join_decision()) and
357 * then a second time with NULL to indicate that the connection failed for good.
359 * FIXME: need to distinguish between origin cancelling a message (some fragments
360 * were sent, then the rest 'discarded') and the case where we got disconnected;
361 * right now, both would mean 'msg' is NULL, but they could be quite different...
362 * So the semantics from the receiver side of
363 * GNUNET_MULTICAST_origin_to_all_cancel() are not clear here.
365 * @param cls Closure (set from GNUNET_MULTICAST_member_join())
366 * @param msg Message from the origin, NULL if the origin shut down
367 * (or we were kicked out, and we should thus call
368 * GNUNET_MULTICAST_member_part() next)
371 (*GNUNET_MULTICAST_MessageCallback) (void *cls,
372 const struct GNUNET_MessageHeader *msg);
376 * Function called with the result of an asynchronous operation.
378 * @see GNUNET_MULTICAST_replay_fragment()
380 * @param result Result of the operation.
383 (*GNUNET_MULTICAST_ResultCallback) (void *cls,
388 * Opaque handle to a replay request from the multicast service.
390 struct GNUNET_MULTICAST_ReplayHandle;
394 * Functions with this signature are called whenever the multicast service needs
395 * a message fragment to be replayed by fragment_id.
397 * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE
398 * (with a message or an error); however, if the origin is destroyed or the
399 * group is left, the replay handle must no longer be used.
401 * @param cls Closure (set from GNUNET_MULTICAST_origin_start()
402 * or GNUNET_MULTICAST_member_join()).
403 * @param member_key The member requesting replay.
404 * @param fragment_id Which message fragment should be replayed.
405 * @param flags Flags for the replay.
406 * @param rh Handle to pass to message transmit function.
409 (*GNUNET_MULTICAST_ReplayFragmentCallback) (void *cls,
410 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
411 uint64_t fragment_id,
413 struct GNUNET_MULTICAST_ReplayHandle *rh);
416 * Functions with this signature are called whenever the multicast service needs
417 * a message fragment to be replayed by message_id and fragment_offset.
419 * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE
420 * (with a message or an error); however, if the origin is destroyed or the
421 * group is left, the replay handle must no longer be used.
423 * @param cls Closure (set from GNUNET_MULTICAST_origin_start()
424 * or GNUNET_MULTICAST_member_join()).
425 * @param member_key The member requesting replay.
426 * @param message_id Which message should be replayed.
427 * @param fragment_offset Offset of the fragment within of @a message_id to be replayed.
428 * @param flags Flags for the replay.
429 * @param rh Handle to pass to message transmit function.
432 (*GNUNET_MULTICAST_ReplayMessageCallback) (void *cls,
433 const struct GNUNET_CRYPTO_EddsaPublicKey *member_key,
435 uint64_t fragment_offset,
437 struct GNUNET_MULTICAST_ReplayHandle *rh);
441 * Possible error codes during replay.
443 enum GNUNET_MULTICAST_ReplayErrorCode
447 * Everything is fine.
449 GNUNET_MULTICAST_REC_OK = 0,
452 * Message fragment not found in the message store.
454 * Either discarded if it is too old, or not arrived yet if this member has
455 * missed some messages.
457 GNUNET_MULTICAST_REC_NOT_FOUND = 1,
460 * Fragment ID counter was larger than the highest counter this
461 * replay function has ever encountered; thus it is likely the
462 * origin never sent it and we're at the HEAD of the multicast
463 * stream as far as this node is concerned.
467 GNUNET_MULTICAST_REC_PAST_HEAD = 2,
470 * Access is denied to the requested fragment, membership test did not pass.
472 GNUNET_MULTICAST_REC_ACCESS_DENIED = 3,
475 * Internal error (i.e. database error). Try some other peer.
477 GNUNET_MULTICAST_REC_INTERNAL_ERROR = 4
483 * Replay a message fragment for the multicast group.
485 * @param rh Replay handle identifying which replay operation was requested.
486 * @param msg Replayed message fragment, NULL if unknown/error.
487 * @param ec Error code.
490 GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
491 const struct GNUNET_MessageHeader *msg,
492 enum GNUNET_MULTICAST_ReplayErrorCode ec);
496 * Indicate the end of the replay session.
498 * Invalidates the replay handle.
500 * @param rh Replay session to end.
503 GNUNET_MULTICAST_replay_response_end (struct GNUNET_MULTICAST_ReplayHandle *rh);
507 * Function called to provide data for a transmission for a replay.
509 * @see GNUNET_MULTICAST_replay2()
512 (*GNUNET_MULTICAST_ReplayTransmitNotify) (void *cls,
518 * Replay a message for the multicast group.
520 * @param rh Replay handle identifying which replay operation was requested.
521 * @param notify Function to call to get the message.
522 * @param notify_cls Closure for @a notify.
525 GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh,
526 GNUNET_MULTICAST_ReplayTransmitNotify notify,
531 * Start a multicast group.
533 * Will advertise the origin in the P2P overlay network under the respective
534 * public key so that other peer can find this peer to join it. Peers that
535 * issue GNUNET_MULTICAST_member_join() can then transmit a join request to
536 * either an existing group member or to the origin. If the joining is
537 * approved, the member is cleared for @e replay and will begin to receive
538 * messages transmitted to the group. If joining is disapproved, the failed
539 * candidate will be given a response. Members in the group can send messages
540 * to the origin (one at a time).
542 * @param cfg Configuration to use.
543 * @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;
545 * @param next_fragment_id Next fragment ID to continue counting fragments from
546 * when restarting the origin. 1 for a new group.
547 * @param join_cb Function called to approve / disapprove joining of a peer.
548 * @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.
550 * @param replay_msg_cb Function that can be called to replay a message.
551 * @param request_cb Function called with message fragments from group members.
552 * @param message_cb Function called with the message fragments sent to the
553 * network by GNUNET_MULTICAST_origin_to_all(). These message fragments
554 * should be stored for answering replay requests later.
555 * @param cls Closure for the various callbacks that follow.
556 * @return Handle for the origin, NULL on error.
558 struct GNUNET_MULTICAST_Origin *
559 GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
560 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key,
561 uint64_t next_fragment_id,
562 GNUNET_MULTICAST_JoinCallback join_cb,
563 GNUNET_MULTICAST_MembershipTestCallback member_test_cb,
564 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
565 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
566 GNUNET_MULTICAST_RequestCallback request_cb,
567 GNUNET_MULTICAST_MessageCallback message_cb,
571 * Function called to provide data for a transmission from the origin to all
574 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
575 * invalidates the respective transmission handle.
577 * @param cls Closure.
578 * @param[in,out] data_size Initially set to the number of bytes available in
579 * @a data, should be set to the number of bytes written to data.
580 * @param[out] data Where to write the body of the message to give to the
581 * method. The function must copy at most @a data_size bytes to @a data.
582 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
583 * #GNUNET_NO on success, if more data is to be transmitted later.
584 * Should be used if @a data_size was not big enough to take all the
585 * data. If 0 is returned in @a data_size the transmission is paused,
586 * and can be resumed with GNUNET_MULTICAST_origin_to_all_resume().
587 * #GNUNET_YES if this completes the transmission (all data supplied)
590 (*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls,
596 * Handle for a request to send a message to all multicast group members
599 struct GNUNET_MULTICAST_OriginTransmitHandle;
603 * Send a message to the multicast group.
605 * @param origin Handle to the multicast group.
606 * @param message_id Application layer ID for the message. Opaque to multicast.
607 * @param group_generation Group generation of the message. Documented in
608 * GNUNET_MULTICAST_MessageHeader.
609 * @param notify Function to call to get the message.
610 * @param notify_cls Closure for @a notify.
611 * @return NULL on error (i.e. request already pending).
613 struct GNUNET_MULTICAST_OriginTransmitHandle *
614 GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
616 uint64_t group_generation,
617 GNUNET_MULTICAST_OriginTransmitNotify notify,
623 * Resume message transmission to multicast group.
625 * @param th Transmission to cancel.
628 GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginTransmitHandle *th);
632 * Cancel request for message transmission to multicast group.
634 * @param th Transmission to cancel.
637 GNUNET_MULTICAST_origin_to_all_cancel (struct GNUNET_MULTICAST_OriginTransmitHandle *th);
641 * Stop a multicast group.
643 * @param origin Multicast group to stop.
646 GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin);
650 * Join a multicast group.
652 * The entity joining is always the local peer. Further information about the
653 * candidate can be provided in @a join_msg. If the join fails, the
654 * @a message_cb is invoked with a (failure) response and then with NULL. If
655 * the join succeeds, outstanding (state) messages and ongoing multicast
656 * messages will be given to the @a message_cb until the member decides to part
657 * the group. The @a mem_test_cb and @a replay_cb functions may be called at
658 * anytime by the multicast service to support relaying messages to other
659 * members of the group.
661 * @param cfg Configuration to use.
662 * @param group_key ECC public key that identifies the group to join.
663 * @param member_key ECC key that identifies the member and used to sign
664 * requests sent to the origin.
665 * @param origin Peer ID of the origin to send unicast requsets to. If NULL,
666 * unicast requests are sent back via multiple hops on the reverse path
667 * of multicast messages.
668 * @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
670 * 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.
672 * @param join_msg Application-dependent join message to be passed to the
674 * @param join_cb Function called to approve / disapprove joining of a peer.
675 * @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
677 * this peer already knows from this group. NULL if this
678 * client is unable to support replay.
679 * @param replay_msg_cb Function that can be called to replay message fragments
680 * this peer already knows from this group. NULL if this
681 * client is unable to support replay.
682 * @param message_cb Function to be called for all message fragments we
683 * receive from the group, excluding those our @a replay_cb
685 * @param cls Closure for callbacks.
686 * @return Handle for the member, NULL on error.
688 struct GNUNET_MULTICAST_Member *
689 GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
690 const struct GNUNET_CRYPTO_EddsaPublicKey *group_key,
691 const struct GNUNET_CRYPTO_EddsaPrivateKey *member_key,
692 const struct GNUNET_PeerIdentity *origin,
693 uint32_t relay_count,
694 const struct GNUNET_PeerIdentity *relays,
695 const struct GNUNET_MessageHeader *join_request,
696 GNUNET_MULTICAST_JoinCallback join_cb,
697 GNUNET_MULTICAST_MembershipTestCallback mem_test_cb,
698 GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb,
699 GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb,
700 GNUNET_MULTICAST_MessageCallback message_cb,
704 * Handle for a replay request.
706 struct GNUNET_MULTICAST_MemberReplayHandle;
710 * Request a fragment to be replayed by fragment ID.
712 * Useful if messages below the @e max_known_fragment_id given when joining are
713 * needed and not known to the client.
715 * @param member Membership handle.
716 * @param fragment_id ID of a message fragment that this client would like to
718 * @param flags Additional flags for the replay request. It is used and defined
719 * by the replay callback. FIXME: which replay callback? FIXME: use enum?
720 * FIXME: why not pass reply cb here?
721 * @return Replay request handle, NULL on error.
723 struct GNUNET_MULTICAST_MemberReplayHandle *
724 GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member,
725 uint64_t fragment_id,
730 * Request a message fr to be replayed.
732 * Useful if messages below the @e max_known_fragment_id given when joining are
733 * needed and not known to the client.
735 * @param member Membership handle.
736 * @param message_id ID of the message this client would like to see replayed.
737 * @param fragment_offset Offset of the fragment within the message to replay.
738 * @param flags Additional flags for the replay request. It is used & defined
739 * by the replay callback.
740 * @param result_cb Function to be called for the replayed message.
741 * @param result_cb_cls Closure for @a result_cb.
742 * @return Replay request handle, NULL on error.
744 struct GNUNET_MULTICAST_MemberReplayHandle *
745 GNUNET_MULTICAST_member_replay_message (struct GNUNET_MULTICAST_Member *member,
747 uint64_t fragment_offset,
749 GNUNET_MULTICAST_ResultCallback result_cb,
750 void *result_cb_cls);
754 * Cancel a replay request.
756 * @param rh Request to cancel.
759 GNUNET_MULTICAST_member_replay_cancel (struct GNUNET_MULTICAST_MemberReplayHandle *rh);
763 * Part a multicast group.
765 * Disconnects from all group members and invalidates the @a member handle.
767 * An application-dependent part message can be transmitted beforehand using
768 * #GNUNET_MULTICAST_member_to_origin())
770 * @param member Membership handle.
773 GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member);
777 * Function called to provide data for a transmission from a member to the origin.
779 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
780 * invalidates the respective transmission handle.
782 * @param cls Closure.
783 * @param[in,out] data_size Initially set to the number of bytes available in
784 * @a data, should be set to the number of bytes written to data.
785 * @param[out] data Where to write the body of the message to give to the
786 * method. The function must copy at most @a data_size bytes to @a data.
788 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
789 * #GNUNET_NO on success, if more data is to be transmitted later.
790 * Should be used if @a data_size was not big enough to take all the
791 * data. If 0 is returned in @a data_size the transmission is paused,
792 * and can be resumed with GNUNET_MULTICAST_member_to_origin_resume().
793 * #GNUNET_YES if this completes the transmission (all data supplied)
796 (*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls,
802 * Handle for a message to be delivered from a member to the origin.
804 struct GNUNET_MULTICAST_MemberTransmitHandle;
808 * Send a message to the origin of the multicast group.
810 * @param member Membership handle.
811 * @param request_id Application layer ID for the request. Opaque to multicast.
812 * @param notify Callback to call to get the message.
813 * @param notify_cls Closure for @a notify.
815 * @return Handle to cancel request, NULL on error (i.e. request already pending).
817 struct GNUNET_MULTICAST_MemberTransmitHandle *
818 GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
820 GNUNET_MULTICAST_MemberTransmitNotify notify,
825 * Resume message transmission to origin.
827 * @param th Transmission to cancel.
830 GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberTransmitHandle *th);
834 * Cancel request for message transmission to origin.
836 * @param th Transmission to cancel.
839 GNUNET_MULTICAST_member_to_origin_cancel (struct GNUNET_MULTICAST_MemberTransmitHandle *th);
842 #if 0 /* keep Emacsens' auto-indent happy */
849 /* ifndef GNUNET_MULTICAST_SERVICE_H */
851 /* end of gnunet_multicast_service.h */