aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-08-11 13:04:52 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-08-11 13:04:52 +0000
commit055b09ed1535ff02bb02503aaa88d1d02b9d366b (patch)
treeba4c34d277ba7a67a244c6f50ed6712e95644c92 /src/testbed
parent526fd6adbac1b3ef92edf457e035d6388921fd26 (diff)
downloadgnunet-055b09ed1535ff02bb02503aaa88d1d02b9d366b.tar.gz
gnunet-055b09ed1535ff02bb02503aaa88d1d02b9d366b.zip
forward operation msg cancel
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/testbed_api.c20
-rw-r--r--src/testbed/testbed_api.h14
2 files changed, 32 insertions, 2 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 62f16d300..597b7f348 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -751,7 +751,9 @@ GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
751 751
752/** 752/**
753 * Sends the given message as an operation. The given callback is called when a 753 * Sends the given message as an operation. The given callback is called when a
754 * reply for the operation is available 754 * reply for the operation is available. Call
755 * GNUNET_TESTBED_forward_operation_msg_cancel_() to cleanup the returned
756 * operation context if the cc hasn't been called
755 * 757 *
756 * @param controller the controller to which the message has to be sent 758 * @param controller the controller to which the message has to be sent
757 * @param operation_id the operation id of the message 759 * @param operation_id the operation id of the message
@@ -778,6 +780,7 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller
778 data->cc = cc; 780 data->cc = cc;
779 data->cc_cls = cc_cls; 781 data->cc_cls = cc_cls;
780 opc = GNUNET_malloc (sizeof (struct OperationContext)); 782 opc = GNUNET_malloc (sizeof (struct OperationContext));
783 opc->c = controller;
781 opc->type = OP_FORWARDED; 784 opc->type = OP_FORWARDED;
782 opc->data = data; 785 opc->data = data;
783 opc->id = operation_id; 786 opc->id = operation_id;
@@ -792,6 +795,21 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller
792 795
793 796
794/** 797/**
798 * Function to cancel an operation created by simply forwarding an operation
799 * message.
800 *
801 * @param opc the operation context from GNUNET_TESTBED_forward_operation_msg_()
802 */
803void
804GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc)
805{
806 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
807 GNUNET_free (opc->data);
808 GNUNET_free (opc);
809}
810
811
812/**
795 * Handle for controller process 813 * Handle for controller process
796 */ 814 */
797struct GNUNET_TESTBED_ControllerProc 815struct GNUNET_TESTBED_ControllerProc
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index d12d9aa96..a8cb383fa 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -356,7 +356,9 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
356 356
357/** 357/**
358 * Sends the given message as an operation. The given callback is called when a 358 * Sends the given message as an operation. The given callback is called when a
359 * reply for the operation is available 359 * reply for the operation is available. Call
360 * GNUNET_TESTBED_forward_operation_msg_cancel_() to cleanup the returned
361 * operation context if the cc hasn't been called
360 * 362 *
361 * @param controller the controller to which the message has to be sent 363 * @param controller the controller to which the message has to be sent
362 * @param operation_id the operation id of the message 364 * @param operation_id the operation id of the message
@@ -374,5 +376,15 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller
374 GNUNET_CLIENT_MessageHandler cc, 376 GNUNET_CLIENT_MessageHandler cc,
375 void *cc_cls); 377 void *cc_cls);
376 378
379/**
380 * Function to cancel an operation created by simply forwarding an operation
381 * message.
382 *
383 * @param opc the operation context from GNUNET_TESTBED_forward_operation_msg_()
384 */
385void
386GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc);
387
388
377#endif 389#endif
378/* end of testbed_api.h */ 390/* end of testbed_api.h */