summaryrefslogtreecommitdiff
path: root/src/include/gnunet_multicast_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-09-25 17:46:08 +0000
committerGabor X Toth <*@tg-x.net>2013-09-25 17:46:08 +0000
commitee1787f39555c2295fb9629c856f467da82d94a2 (patch)
treea72541703e26f0734e2f965ee0e7091248316a88 /src/include/gnunet_multicast_service.h
parent7bec38c1bf3572bd01ddd064f69d1b744f7725a8 (diff)
downloadgnunet-ee1787f39555c2295fb9629c856f467da82d94a2.tar.gz
gnunet-ee1787f39555c2295fb9629c856f467da82d94a2.zip
multicast API: stop/resume transmission
Diffstat (limited to 'src/include/gnunet_multicast_service.h')
-rw-r--r--src/include/gnunet_multicast_service.h75
1 files changed, 57 insertions, 18 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h
index c80ecdee9..d8d2866a7 100644
--- a/src/include/gnunet_multicast_service.h
+++ b/src/include/gnunet_multicast_service.h
@@ -44,6 +44,10 @@ extern "C"
44 */ 44 */
45#define GNUNET_MULTICAST_VERSION 0x00000000 45#define GNUNET_MULTICAST_VERSION 0x00000000
46 46
47/**
48 * Maximum size of a multicast message fragment.
49 */
50#define GNUNET_MULTICAST_FRAGMENT_MAX_SIZE 63 * 1024
47 51
48/** 52/**
49 * Opaque handle for a multicast group member. 53 * Opaque handle for a multicast group member.
@@ -500,15 +504,27 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
500/** 504/**
501 * Function called to provide data for a transmission from the origin to all 505 * Function called to provide data for a transmission from the origin to all
502 * members. 506 * members.
503 * FIXME: what if origin needs to pause transmission for a while?
504 * 507 *
505 * @param cls closure 508 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
506 * @param data_size number of bytes available in @a data 509 * invalidates the respective transmission handle.
507 * @param data where to copy the message 510 *
508 * @return number of bytes copied to @a data? (FIXME: size_t?), or status code? 511 * @param cls Closure.
512 * @param fragment_id Set to the unique fragment ID that was generated for
513 * this message.
514 * @param[in,out] data_size Initially set to the number of bytes available in
515 * @a data, should be set to the number of bytes written to data.
516 * @param[out] data Where to write the body of the message to give to the
517 * method. The function must copy at most @a data_size bytes to @a data.
518 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
519 * #GNUNET_NO on success, if more data is to be transmitted later.
520 * Should be used if @a data_size was not big enough to take all the
521 * data. If 0 is returned in @a data_size the transmission is paused,
522 * and can be resumed with GNUNET_MULTICAST_origin_to_all_resume().
523 * #GNUNET_YES if this completes the transmission (all data supplied)
509 */ 524 */
510typedef int 525typedef int
511(*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls, 526(*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls,
527 uint64_t fragment_id,
512 size_t *data_size, 528 size_t *data_size,
513 void *data); 529 void *data);
514 530
@@ -527,11 +543,6 @@ struct GNUNET_MULTICAST_OriginMessageHandle;
527 * @param message_id Application layer ID for the message. Opaque to multicast. 543 * @param message_id Application layer ID for the message. Opaque to multicast.
528 * @param group_generation Group generation of the message. Documented in 544 * @param group_generation Group generation of the message. Documented in
529 * GNUNET_MULTICAST_MessageHeader. 545 * GNUNET_MULTICAST_MessageHeader.
530 * @param size Number of bytes to transmit.
531 * FIXME: Needed? The end of the message can be flagged with a last fragment flag.
532 * FIXME: what last fragment flag? OriginTransmitNotify is not that well documented...
533 * FIXME: size_t? If this is a total size, uint64_t might be better!
534 * FIXME: do we reserve "MAX" to indicate 'unknown'?
535 * @param notify Function to call to get the message. 546 * @param notify Function to call to get the message.
536 * @param notify_cls Closure for @a notify. 547 * @param notify_cls Closure for @a notify.
537 * @return NULL on error (i.e. request already pending). 548 * @return NULL on error (i.e. request already pending).
@@ -540,11 +551,20 @@ struct GNUNET_MULTICAST_OriginMessageHandle *
540GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, 551GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
541 uint64_t message_id, 552 uint64_t message_id,
542 uint64_t group_generation, 553 uint64_t group_generation,
543 size_t size,
544 GNUNET_MULTICAST_OriginTransmitNotify notify, 554 GNUNET_MULTICAST_OriginTransmitNotify notify,
545 void *notify_cls); 555 void *notify_cls);
546 556
547 557
558
559/**
560 * Resume message transmission to multicast group.
561 *
562 * @param mh Request to cancel.
563 */
564void
565GNUNET_MULTICAST_origin_to_all_resume (struct GNUNET_MULTICAST_OriginMessageHandle *mh);
566
567
548/** 568/**
549 * Cancel request for message transmission to multicast group. 569 * Cancel request for message transmission to multicast group.
550 * 570 *
@@ -695,13 +715,26 @@ GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member);
695/** 715/**
696 * Function called to provide data for a transmission from a member to the origin. 716 * Function called to provide data for a transmission from a member to the origin.
697 * 717 *
698 * @param cls closure 718 * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
699 * @param data_size number of bytes available in @a data 719 * invalidates the respective transmission handle.
700 * @param data where to copy data for transmission 720 *
701 * @return number of bytes copied to data 721 * @param cls Closure.
722 * @param fragment_id Set to the unique fragment ID that was generated for
723 * this message.
724 * @param[in,out] data_size Initially set to the number of bytes available in
725 * @a data, should be set to the number of bytes written to data.
726 * @param[out] data Where to write the body of the message to give to the
727 * method. The function must copy at most @a data_size bytes to @a data.
728 * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
729 * #GNUNET_NO on success, if more data is to be transmitted later.
730 * Should be used if @a data_size was not big enough to take all the
731 * data. If 0 is returned in @a data_size the transmission is paused,
732 * and can be resumed with GNUNET_MULTICAST_member_to_origin_resume().
733 * #GNUNET_YES if this completes the transmission (all data supplied)
702 */ 734 */
703typedef int 735typedef int
704(*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls, 736(*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls,
737 uint64_t fragment_id,
705 size_t *data_size, 738 size_t *data_size,
706 void *data); 739 void *data);
707 740
@@ -717,8 +750,6 @@ struct GNUNET_MULTICAST_MemberRequestHandle;
717 * 750 *
718 * @param member Membership handle. 751 * @param member Membership handle.
719 * @param message_id Application layer ID for the message. Opaque to multicast. 752 * @param message_id Application layer ID for the message. Opaque to multicast.
720 * @param size Number of bytes we want to send to origin.
721 * FIXME: this should probably be a uint64_t?
722 * @param notify Callback to call to get the message. 753 * @param notify Callback to call to get the message.
723 * @param notify_cls Closure for @a notify. 754 * @param notify_cls Closure for @a notify.
724 * @return Handle to cancel request, NULL on error (i.e. request already pending). 755 * @return Handle to cancel request, NULL on error (i.e. request already pending).
@@ -726,12 +757,20 @@ struct GNUNET_MULTICAST_MemberRequestHandle;
726struct GNUNET_MULTICAST_MemberRequestHandle * 757struct GNUNET_MULTICAST_MemberRequestHandle *
727GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member, 758GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
728 uint64_t message_id, 759 uint64_t message_id,
729 size_t size,
730 GNUNET_MULTICAST_MemberTransmitNotify notify, 760 GNUNET_MULTICAST_MemberTransmitNotify notify,
731 void *notify_cls); 761 void *notify_cls);
732 762
733 763
734/** 764/**
765 * Resume message transmission to origin.
766 *
767 * @param rh Request to cancel.
768 */
769void
770GNUNET_MULTICAST_member_to_origin_resume (struct GNUNET_MULTICAST_MemberRequestHandle *rh);
771
772
773/**
735 * Cancel request for message transmission to origin. 774 * Cancel request for message transmission to origin.
736 * 775 *
737 * @param rh Request to cancel. 776 * @param rh Request to cancel.