gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29565 - in gnunet/src: include multicast psyc


From: gnunet
Subject: [GNUnet-SVN] r29565 - in gnunet/src: include multicast psyc
Date: Wed, 25 Sep 2013 19:46:09 +0200

Author: tg
Date: 2013-09-25 19:46:08 +0200 (Wed, 25 Sep 2013)
New Revision: 29565

Modified:
   gnunet/src/include/gnunet_multicast_service.h
   gnunet/src/multicast/multicast_api.c
   gnunet/src/psyc/gnunet-service-psyc.c
Log:
multicast API: stop/resume transmission

Modified: gnunet/src/include/gnunet_multicast_service.h
===================================================================
--- gnunet/src/include/gnunet_multicast_service.h       2013-09-25 17:46:06 UTC 
(rev 29564)
+++ gnunet/src/include/gnunet_multicast_service.h       2013-09-25 17:46:08 UTC 
(rev 29565)
@@ -44,6 +44,10 @@
  */
 #define GNUNET_MULTICAST_VERSION 0x00000000
 
+/**
+ * Maximum size of a multicast message fragment.
+ */
+#define GNUNET_MULTICAST_FRAGMENT_MAX_SIZE 63 * 1024
 
 /** 
  * Opaque handle for a multicast group member.
@@ -500,15 +504,27 @@
 /**
  * Function called to provide data for a transmission from the origin to all
  * members.
- * FIXME: what if origin needs to pause transmission for a while?
  *
- * @param cls closure
- * @param data_size number of bytes available in @a data
- * @param data where to copy the message
- * @return number of bytes copied to @a data? (FIXME: size_t?), or status code?
+ * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
+ * invalidates the respective transmission handle.
+ *
+ * @param cls Closure.
+ * @param fragment_id Set to the unique fragment ID that was generated for
+ *        this message.
+ * @param[in,out] data_size Initially set to the number of bytes available in
+ *        @a data, should be set to the number of bytes written to data.
+ * @param[out] data Where to write the body of the message to give to the
+ *         method. The function must copy at most @a data_size bytes to @a 
data.
+ * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
+ *         #GNUNET_NO on success, if more data is to be transmitted later.
+ *         Should be used if @a data_size was not big enough to take all the
+ *         data.  If 0 is returned in @a data_size the transmission is paused,
+ *         and can be resumed with GNUNET_MULTICAST_origin_to_all_resume().
+ *         #GNUNET_YES if this completes the transmission (all data supplied)
  */
 typedef int
 (*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls,
+                                          uint64_t fragment_id,
                                           size_t *data_size,
                                           void *data);
 
@@ -527,11 +543,6 @@
  * @param message_id Application layer ID for the message.  Opaque to 
multicast.
  * @param group_generation Group generation of the message.  Documented in
  *             GNUNET_MULTICAST_MessageHeader.
- * @param size Number of bytes to transmit.  
- *        FIXME: Needed? The end of the message can be flagged with a last 
fragment flag.
- *        FIXME: what last fragment flag? OriginTransmitNotify is not that 
well documented...
- *        FIXME: size_t? If this is a total size, uint64_t might be better!
- *        FIXME: do we reserve "MAX" to indicate 'unknown'?
  * @param notify Function to call to get the message.
  * @param notify_cls Closure for @a notify.
  * @return NULL on error (i.e. request already pending).
@@ -540,12 +551,21 @@
 GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
                                 uint64_t message_id,
                                 uint64_t group_generation,
-                                size_t size,
                                 GNUNET_MULTICAST_OriginTransmitNotify notify,
                                 void *notify_cls);
 
 
+
 /** 
+ * Resume message transmission to multicast group.
+ *
+ * @param mh Request to cancel.
+ */
+void
+GNUNET_MULTICAST_origin_to_all_resume (struct 
GNUNET_MULTICAST_OriginMessageHandle *mh);
+
+
+/** 
  * Cancel request for message transmission to multicast group.
  *
  * @param mh Request to cancel.
@@ -695,13 +715,26 @@
 /** 
  * Function called to provide data for a transmission from a member to the 
origin.
  *
- * @param cls closure
- * @param data_size number of bytes available in @a data
- * @param data where to copy data for transmission
- * @return number of bytes copied to data
+ * Note that returning #GNUNET_OK or #GNUNET_SYSERR (but not #GNUNET_NO)
+ * invalidates the respective transmission handle.
+ *
+ * @param cls Closure.
+ * @param fragment_id Set to the unique fragment ID that was generated for
+ *        this message.
+ * @param[in,out] data_size Initially set to the number of bytes available in
+ *        @a data, should be set to the number of bytes written to data.
+ * @param[out] data Where to write the body of the message to give to the
+ *         method. The function must copy at most @a data_size bytes to @a 
data.
+ * @return #GNUNET_SYSERR on error (fatal, aborts transmission)
+ *         #GNUNET_NO on success, if more data is to be transmitted later.
+ *         Should be used if @a data_size was not big enough to take all the
+ *         data.  If 0 is returned in @a data_size the transmission is paused,
+ *         and can be resumed with GNUNET_MULTICAST_member_to_origin_resume().
+ *         #GNUNET_YES if this completes the transmission (all data supplied)
  */
 typedef int
 (*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls,
+                                          uint64_t fragment_id,
                                           size_t *data_size,
                                           void *data);
 
@@ -717,8 +750,6 @@
  * 
  * @param member Membership handle.
  * @param message_id Application layer ID for the message.  Opaque to 
multicast.
- * @param size Number of bytes we want to send to origin.
- *             FIXME: this should probably be a uint64_t?
  * @param notify Callback to call to get the message.
  * @param notify_cls Closure for @a notify.
  * @return Handle to cancel request, NULL on error (i.e. request already 
pending).
@@ -726,12 +757,20 @@
 struct GNUNET_MULTICAST_MemberRequestHandle *
 GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
                                    uint64_t message_id,
-                                   size_t size,
                                    GNUNET_MULTICAST_MemberTransmitNotify 
notify,
                                    void *notify_cls);
 
 
 /** 
+ * Resume message transmission to origin.
+ *
+ * @param rh Request to cancel.
+ */
+void
+GNUNET_MULTICAST_member_to_origin_resume (struct 
GNUNET_MULTICAST_MemberRequestHandle *rh);
+
+
+/** 
  * Cancel request for message transmission to origin.
  *
  * @param rh Request to cancel.

Modified: gnunet/src/multicast/multicast_api.c
===================================================================
--- gnunet/src/multicast/multicast_api.c        2013-09-25 17:46:06 UTC (rev 
29564)
+++ gnunet/src/multicast/multicast_api.c        2013-09-25 17:46:08 UTC (rev 
29565)
@@ -317,8 +317,6 @@
  * @param message_id Application layer ID for the message.  Opaque to 
multicast.
  * @param group_generation Group generation of the message.  Documented in
  *             `struct GNUNET_MULTICAST_MessageHeader`.
- * @param size Number of bytes to transmit.
- *        FIXME: Needed? The end of the message can be flagged with a last 
fragment flag.
  * @param notify Function to call to get the message.
  * @param notify_cls Closure for @a notify.
  * @return NULL on error (i.e. request already pending).
@@ -327,7 +325,6 @@
 GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin,
                                 uint64_t message_id,
                                 uint64_t group_generation,
-                                size_t size,
                                 GNUNET_MULTICAST_OriginTransmitNotify notify,
                                 void *notify_cls)
 {
@@ -336,6 +333,18 @@
 
 
 /** 
+ * Resume message transmission to multicast group.
+ *
+ * @param mh Request to cancel.
+ */
+void
+GNUNET_MULTICAST_origin_to_all_resume (struct 
GNUNET_MULTICAST_OriginMessageHandle *mh)
+{
+
+}
+
+
+/** 
  * Cancel request for message transmission to multicast group.
  *
  * @param mh Request to cancel.
@@ -515,8 +524,6 @@
  * 
  * @param member Membership handle.
  * @param message_id Application layer ID for the message.  Opaque to 
multicast.
- * @param size Number of bytes we want to send to origin. 
- *             FIXME: this should probably be a uint64_t?
  * @param notify Callback to call to get the message.
  * @param notify_cls Closure for @a notify.
  * @return Handle to cancel request, NULL on error (i.e. request already 
pending).
@@ -524,7 +531,6 @@
 struct GNUNET_MULTICAST_MemberRequestHandle *
 GNUNET_MULTICAST_member_to_origin (struct GNUNET_MULTICAST_Member *member,
                                    uint64_t message_id,
-                                   size_t size,
                                    GNUNET_MULTICAST_MemberTransmitNotify 
notify,
                                    void *notify_cls)
 {
@@ -533,6 +539,18 @@
 
 
 /** 
+ * Resume message transmission to origin.
+ *
+ * @param rh Request to cancel.
+ */
+void
+GNUNET_MULTICAST_member_to_origin_resume (struct 
GNUNET_MULTICAST_MemberRequestHandle *rh)
+{
+
+}
+
+
+/** 
  * Cancel request for message transmission to origin.
  *
  * @param rh Request to cancel.

Modified: gnunet/src/psyc/gnunet-service-psyc.c
===================================================================
--- gnunet/src/psyc/gnunet-service-psyc.c       2013-09-25 17:46:06 UTC (rev 
29564)
+++ gnunet/src/psyc/gnunet-service-psyc.c       2013-09-25 17:46:08 UTC (rev 
29565)
@@ -268,7 +268,7 @@
 
 
 static int
-transmit_notify (void *cls, size_t *data_size, void *data)
+transmit_notify (void *cls, uint64_t fragment_id, size_t *data_size, void 
*data)
 {
   struct Channel *ch = cls;
   struct TransmitMessage *msg = ch->tmit_head;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]