aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing.h')
-rw-r--r--src/transport/transport-testing.h58
1 files changed, 55 insertions, 3 deletions
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h
index 42daa4596..dc26950cb 100644
--- a/src/transport/transport-testing.h
+++ b/src/transport/transport-testing.h
@@ -256,6 +256,16 @@ struct TRANSPORT_TESTING_SendJob
256 struct GNUNET_TRANSPORT_TransmitHandle *th; 256 struct GNUNET_TRANSPORT_TransmitHandle *th;
257 257
258 /** 258 /**
259 * Function to call upon completion.
260 */
261 GNUNET_SCHEDULER_TaskCallback cont;
262
263 /**
264 * Closure for @e cont.
265 */
266 void *cont_cls;
267
268 /**
259 * Number of the message. 269 * Number of the message.
260 */ 270 */
261 uint32_t num; 271 uint32_t num;
@@ -774,6 +784,8 @@ GNUNET_TRANSPORT_TESTING_main_ (const char *argv0,
774 * @param mtype message type to use 784 * @param mtype message type to use
775 * @param msize size of the message, at least `sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage)` 785 * @param msize size of the message, at least `sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage)`
776 * @param num unique message number 786 * @param num unique message number
787 * @param cont continuation to call after transmission
788 * @param cont_cls closure for @a cont
777 * @return #GNUNET_OK if message was queued, 789 * @return #GNUNET_OK if message was queued,
778 * #GNUNET_NO if peers are not connected 790 * #GNUNET_NO if peers are not connected
779 * #GNUNET_SYSERR if @a msize is illegal 791 * #GNUNET_SYSERR if @a msize is illegal
@@ -783,7 +795,9 @@ GNUNET_TRANSPORT_TESTING_send (struct GNUNET_TRANSPORT_TESTING_PeerContext *send
783 struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, 795 struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
784 uint16_t mtype, 796 uint16_t mtype,
785 uint16_t msize, 797 uint16_t msize,
786 uint32_t num); 798 uint32_t num,
799 GNUNET_SCHEDULER_TaskCallback cont,
800 void *cont_cls);
787 801
788 802
789/** 803/**
@@ -808,10 +822,48 @@ GNUNET_NETWORK_STRUCT_END
808 822
809 823
810/** 824/**
825 * Type of the closure argument to pass to
826 * #GNUNET_TRANSPORT_TESTING_simple_send() and
827 * #GNUNET_TRANSPORT_TESTING_large_send().
828 */
829struct GNUNET_TRANSPORT_TESTING_SendClosure
830{
831 /**
832 * Context for the transmission.
833 */
834 struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
835
836 /**
837 * Function that returns the desired message size. Overrides
838 * the message size, can be NULL in which case the message
839 * size is the default.
840 */
841 size_t (*get_size_cb)(unsigned int n);
842
843 /**
844 * Number of messages to be transmitted in a loop.
845 * Use zero for "forever" (until external shutdown).
846 */
847 unsigned int num_messages;
848
849 /**
850 * Function to call after all transmissions, can be NULL.
851 */
852 GNUNET_SCHEDULER_TaskCallback cont;
853
854 /**
855 * Closure for @e cont.
856 */
857 void *cont_cls;
858
859};
860
861
862/**
811 * Task that sends a minimalistic test message from the 863 * Task that sends a minimalistic test message from the
812 * first peer to the second peer. 864 * first peer to the second peer.
813 * 865 *
814 * @param cls the `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext` 866 * @param cls the `struct GNUNET_TRANSPORT_TESTING_SendClosure`
815 * which should contain at least two peers, the first two 867 * which should contain at least two peers, the first two
816 * of which should be currently connected 868 * of which should be currently connected
817 */ 869 */
@@ -829,7 +881,7 @@ GNUNET_TRANSPORT_TESTING_simple_send (void *cls);
829 * Task that sends a large test message from the 881 * Task that sends a large test message from the
830 * first peer to the second peer. 882 * first peer to the second peer.
831 * 883 *
832 * @param cls the `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext` 884 * @param cls the `struct GNUNET_TRANSPORT_TESTING_SendClosure`
833 * which should contain at least two peers, the first two 885 * which should contain at least two peers, the first two
834 * of which should be currently connected 886 * of which should be currently connected
835 */ 887 */