aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/testbed/Makefile.am2
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c2
-rw-r--r--src/testbed/testbed_api.c1
-rw-r--r--src/testbed/testbed_api.h37
-rw-r--r--src/testbed/testbed_api_barriers.c4
-rw-r--r--src/testbed/testbed_api_barriers.h68
6 files changed, 40 insertions, 74 deletions
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index b5a7758f0..9c1bfcce6 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -45,7 +45,7 @@ gnunet_service_testbed_SOURCES = \
45 gnunet-service-testbed_oc.c \ 45 gnunet-service-testbed_oc.c \
46 gnunet-service-testbed_cpustatus.c \ 46 gnunet-service-testbed_cpustatus.c \
47 gnunet-service-testbed_meminfo.c gnunet-service-testbed_meminfo.h \ 47 gnunet-service-testbed_meminfo.c gnunet-service-testbed_meminfo.h \
48 gnunet-service-testbed_barriers.c gnunet-service-testbed_barriers.h \ 48 gnunet-service-testbed_barriers.c \
49 gnunet-service-testbed_connectionpool.c gnunet-service-testbed_connectionpool.h 49 gnunet-service-testbed_connectionpool.c gnunet-service-testbed_connectionpool.h
50gnunet_service_testbed_LDADD = $(XLIB) \ 50gnunet_service_testbed_LDADD = $(XLIB) \
51 $(top_builddir)/src/util/libgnunetutil.la \ 51 $(top_builddir)/src/util/libgnunetutil.la \
diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c
index 5b081ed12..d8545ad04 100644
--- a/src/testbed/gnunet-service-testbed_barriers.c
+++ b/src/testbed/gnunet-service-testbed_barriers.c
@@ -26,7 +26,7 @@
26 26
27#include "gnunet-service-testbed.h" 27#include "gnunet-service-testbed.h"
28#include "gnunet-service-testbed_barriers.h" 28#include "gnunet-service-testbed_barriers.h"
29#include "testbed_api_barriers.h" 29#include "testbed_api.h"
30 30
31 31
32/** 32/**
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 67b1e8c96..9b8066412 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -36,7 +36,6 @@
36 36
37#include "testbed.h" 37#include "testbed.h"
38#include "testbed_api.h" 38#include "testbed_api.h"
39#include "testbed_api_barriers.h"
40#include "testbed_api_hosts.h" 39#include "testbed_api_hosts.h"
41#include "testbed_api_peers.h" 40#include "testbed_api_peers.h"
42#include "testbed_api_operations.h" 41#include "testbed_api_operations.h"
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index 7a8e6539a..cd3358c9a 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -505,5 +505,42 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls,
505 uint32_t slave_host_id); 505 uint32_t slave_host_id);
506 506
507 507
508
509/**
510 * Initialise a barrier and call the given callback when the required percentage
511 * of peers (quorum) reach the barrier OR upon error.
512 *
513 * @param controller the handle to the controller
514 * @param name identification name of the barrier
515 * @param quorum the percentage of peers that is required to reach the barrier.
516 * Peers signal reaching a barrier by calling
517 * GNUNET_TESTBED_barrier_reached().
518 * @param cb the callback to call when the barrier is reached or upon error.
519 * Cannot be NULL.
520 * @param cls closure for the above callback
521 * @param echo #GNUNET_YES to echo the barrier crossed status message back to the
522 * controller
523 * @return barrier handle; NULL upon error
524 */
525struct GNUNET_TESTBED_Barrier *
526GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
527 const char *name,
528 unsigned int quorum,
529 GNUNET_TESTBED_barrier_status_cb cb,
530 void *cls,
531 int echo);
532
533
534/**
535 * Remove a barrier and it was the last one in the barrier hash map, destroy the
536 * hash map
537 *
538 * @param barrier the barrier to remove
539 */
540void
541GNUNET_TESTBED_barrier_remove_ (struct GNUNET_TESTBED_Barrier *barrier);
542
543
544
508#endif 545#endif
509/* end of testbed_api.h */ 546/* end of testbed_api.h */
diff --git a/src/testbed/testbed_api_barriers.c b/src/testbed/testbed_api_barriers.c
index deb8ca97f..527a86554 100644
--- a/src/testbed/testbed_api_barriers.c
+++ b/src/testbed/testbed_api_barriers.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2008--2013 GNUnet e.V. 3 Copyright (C) 2008--2013, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -23,11 +23,9 @@
23 * @brief API implementation for testbed barriers 23 * @brief API implementation for testbed barriers
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */ 25 */
26
27#include "platform.h" 26#include "platform.h"
28#include "gnunet_testbed_service.h" 27#include "gnunet_testbed_service.h"
29#include "testbed_api.h" 28#include "testbed_api.h"
30#include "testbed_api_barriers.h"
31 29
32/** 30/**
33 * Logging shorthand 31 * Logging shorthand
diff --git a/src/testbed/testbed_api_barriers.h b/src/testbed/testbed_api_barriers.h
deleted file mode 100644
index b839a4ce4..000000000
--- a/src/testbed/testbed_api_barriers.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2008--2013 GNUnet e.V.
4
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.
9
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.
14
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21/**
22 * @file testbed/testbed_api_barriers.h
23 * @brief interface for barriers API function that are used internally (not
24 * exposed as user API)
25 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
26 */
27#ifndef TESTBED_API_BARRIERS_H
28#define TESTBED_API_BARRIERS_H
29
30#include "gnunet_testbed_service.h"
31
32
33/**
34 * Initialise a barrier and call the given callback when the required percentage
35 * of peers (quorum) reach the barrier OR upon error.
36 *
37 * @param controller the handle to the controller
38 * @param name identification name of the barrier
39 * @param quorum the percentage of peers that is required to reach the barrier.
40 * Peers signal reaching a barrier by calling
41 * GNUNET_TESTBED_barrier_reached().
42 * @param cb the callback to call when the barrier is reached or upon error.
43 * Cannot be NULL.
44 * @param cls closure for the above callback
45 * @param echo #GNUNET_YES to echo the barrier crossed status message back to the
46 * controller
47 * @return barrier handle; NULL upon error
48 */
49struct GNUNET_TESTBED_Barrier *
50GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
51 const char *name,
52 unsigned int quorum,
53 GNUNET_TESTBED_barrier_status_cb cb,
54 void *cls,
55 int echo);
56
57
58/**
59 * Remove a barrier and it was the last one in the barrier hash map, destroy the
60 * hash map
61 *
62 * @param barrier the barrier to remove
63 */
64void
65GNUNET_TESTBED_barrier_remove_ (struct GNUNET_TESTBED_Barrier *barrier);
66
67
68#endif