diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-08-30 14:55:13 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-08-30 14:55:13 +0000 |
commit | 5e1efe185cf484018f53dd33d64e546ac042fdee (patch) | |
tree | e1369e8e1a239426d4ba2d81bb31571bbd4f82eb /src/include | |
parent | 7d8d536bbaa0f72587552af517f643e3c05e7a6f (diff) | |
download | gnunet-5e1efe185cf484018f53dd33d64e546ac042fdee.tar.gz gnunet-5e1efe185cf484018f53dd33d64e546ac042fdee.zip |
- towards testbed barriers
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_protocols.h | 19 | ||||
-rw-r--r-- | src/include/gnunet_testbed_service.h | 57 |
2 files changed, 75 insertions, 1 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 04745c5f9..a52727f4d 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -1566,10 +1566,27 @@ extern "C" | |||
1566 | #define GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE 483 | 1566 | #define GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE 483 |
1567 | 1567 | ||
1568 | /** | 1568 | /** |
1569 | * Message to initialise a barrier. Messages of these type are flooded to all | ||
1570 | * sub-controllers | ||
1571 | */ | ||
1572 | #define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT 484 | ||
1573 | |||
1574 | /** | ||
1575 | * Message for signalling status of a barrier | ||
1576 | */ | ||
1577 | #define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS 485 | ||
1578 | |||
1579 | /** | ||
1580 | * Message sent by a peer when it has reached a barrier and is waiting for it to | ||
1581 | * be crossed | ||
1582 | */ | ||
1583 | #define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT 486 | ||
1584 | |||
1585 | /** | ||
1569 | * Not really a message, but for careful checks on the testbed messages; Should | 1586 | * Not really a message, but for careful checks on the testbed messages; Should |
1570 | * always be the maximum and never be used to send messages with this type | 1587 | * always be the maximum and never be used to send messages with this type |
1571 | */ | 1588 | */ |
1572 | #define GNUNET_MESSAGE_TYPE_TESTBED_MAX 484 | 1589 | #define GNUNET_MESSAGE_TYPE_TESTBED_MAX 487 |
1573 | 1590 | ||
1574 | /** | 1591 | /** |
1575 | * The initialization message towards gnunet-testbed-helper | 1592 | * The initialization message towards gnunet-testbed-helper |
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index 6249707d9..173aa76b3 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -1471,6 +1471,63 @@ GNUNET_TESTBED_test_run (const char *testname, | |||
1471 | void *test_master_cls); | 1471 | void *test_master_cls); |
1472 | 1472 | ||
1473 | 1473 | ||
1474 | /** | ||
1475 | * Opaque handle for barrier | ||
1476 | */ | ||
1477 | struct GNUNET_TESTBED_Barrier; | ||
1478 | |||
1479 | |||
1480 | /** | ||
1481 | * Functions of this type are to be given as callback argument to | ||
1482 | * GNUNET_TESTBED_barrier_init(). The callback will be called when status | ||
1483 | * information is available for the barrier. | ||
1484 | * | ||
1485 | * @param cls the closure given to GNUNET_TESTBED_barrier_init() | ||
1486 | * @param name the name of the barrier | ||
1487 | * @param barrier the barrier handle | ||
1488 | * @param status status of the barrier; GNUNET_OK if the barrier is crossed; | ||
1489 | * GNUNET_SYSERR upon error | ||
1490 | * @param emsg if the status were to be GNUNET_SYSERR, this parameter has the | ||
1491 | * error messsage | ||
1492 | */ | ||
1493 | typedef void (*GNUNET_TESTBED_barrier_status_cb) (void *cls, | ||
1494 | const char *name, | ||
1495 | struct GNUNET_TESTBED_Barrier | ||
1496 | *barrier, | ||
1497 | int status, | ||
1498 | const char *emsg); | ||
1499 | |||
1500 | |||
1501 | /** | ||
1502 | * Initialise a barrier and call the given callback when the required percentage | ||
1503 | * of peers (quorum) reach the barrier. | ||
1504 | * | ||
1505 | * @param controller the handle to the controller | ||
1506 | * @param name identification name of the barrier | ||
1507 | * @param quorum the percentage of peers that is required to reach the barrier. | ||
1508 | * Peers signal reaching a barrier by calling | ||
1509 | * GNUNET_TESTBED_barrier_reached(). | ||
1510 | * @param cb the callback to call when the barrier is reached or upon error. | ||
1511 | * Cannot be NULL. | ||
1512 | * @param cls closure for the above callback | ||
1513 | * @return barrier handle | ||
1514 | */ | ||
1515 | struct GNUNET_TESTBED_Barrier * | ||
1516 | GNUNET_TESTBED_barrier_init (struct GNUNET_TESTBED_Controller *controller, | ||
1517 | const char *name, | ||
1518 | unsigned int quorum, | ||
1519 | GNUNET_TESTBED_barrier_status_cb cb, void *cls); | ||
1520 | |||
1521 | |||
1522 | /** | ||
1523 | * Cancel a barrier. | ||
1524 | * | ||
1525 | * @param barrier the barrier handle | ||
1526 | */ | ||
1527 | void | ||
1528 | GNUNET_TESTBED_barrier_cancel (struct GNUNET_TESTBED_Barrier *barrier); | ||
1529 | |||
1530 | |||
1474 | #if 0 /* keep Emacsens' auto-indent happy */ | 1531 | #if 0 /* keep Emacsens' auto-indent happy */ |
1475 | { | 1532 | { |
1476 | #endif | 1533 | #endif |