aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-12-09 18:26:40 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-12-09 18:26:40 +0000
commitac60f21c94c2fed44532b9b796d2ee7feef58f33 (patch)
treecf4b6702dc8545c7dc67adaa846fc9a340d158df /src/include
parentd756e4aa680f7af668a434736888f1782de33525 (diff)
downloadgnunet-ac60f21c94c2fed44532b9b796d2ee7feef58f33.tar.gz
gnunet-ac60f21c94c2fed44532b9b796d2ee7feef58f33.zip
new underlay API
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_testbed_service.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 01c7d674b..b204804d1 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -1593,6 +1593,104 @@ void
1593GNUNET_TESTBED_barrier_wait_cancel (struct GNUNET_TESTBED_BarrierWaitHandle *h); 1593GNUNET_TESTBED_barrier_wait_cancel (struct GNUNET_TESTBED_BarrierWaitHandle *h);
1594 1594
1595 1595
1596/**
1597 * Model for configuring underlay links of a peer
1598 * @ingroup underlay
1599 */
1600struct GNUNET_TESTBED_UnderlayLinkModel;
1601
1602
1603/**
1604 * The type of GNUNET_TESTBED_UnderlayLinkModel
1605 * @ingroup underlay
1606 */
1607enum GNUNET_TESTBED_UnderlayLinkModelType
1608{
1609 /**
1610 * The model is based on white listing of peers to which underlay connections
1611 * are permitted. Underlay connections to all other peers will not be
1612 * permitted.
1613 */
1614 GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_BLACKLIST,
1615
1616 /**
1617 * The model is based on black listing of peers to which underlay connections
1618 * are not permitted. Underlay connections to all other peers will be
1619 * permitted
1620 */
1621 GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_WHITELIST
1622};
1623
1624
1625/**
1626 * Create a GNUNET_TESTBED_UnderlayLinkModel for the given peer. A peer can
1627 * have ONLY ONE model and it can be either a blacklist or whitelist based one.
1628 *
1629 * @ingroup underlay
1630 * @param peer the peer for which the model has to be created
1631 * @param type the type of the model
1632 * @return the model
1633 */
1634struct GNUNET_TESTBED_UnderlayLinkModel *
1635GNUNET_TESTBED_underlaylinkmodel_create (struct GNUNET_TESTBED_Peer *peer,
1636 enum GNUNET_TESTBED_UnderlayLinkModelType type);
1637
1638
1639/**
1640 * Add a peer to the given model. Underlay connections to the given peer will
1641 * be permitted if the model is whitelist based; otherwise they will not be
1642 * permitted.
1643 *
1644 * @ingroup underlay
1645 * @param model the model
1646 * @param peer the peer to add
1647 */
1648void
1649GNUNET_TESTBED_underlaylinkmodel_add_peer (struct GNUNET_TESTBED_UnderlayLinkModel *model,
1650 struct GNUNET_TESTBED_Peer *peer);
1651
1652
1653/**
1654 * Set the metrics for a link to the given peer in the underlay model. The link
1655 * SHOULD be permittable according to the given model.
1656 *
1657 * @ingroup underlay
1658 * @param model the model
1659 * @param peer the other end peer of the link
1660 * @param latency latency of the link in microseconds
1661 * @param loss data loss of the link expressed as a percentage
1662 * @param bandwidth bandwidth of the link in kilobytes per second [kB/s]
1663 */
1664void
1665GNUNET_TESTBED_underlaylinkmodel_set_link (struct GNUNET_TESTBED_UnderlayLinkModel *model,
1666 struct GNUNET_TESTBED_Peer *peer,
1667 uint32_t latency,
1668 uint32_t loss,
1669 uint32_t bandwidth);
1670
1671
1672/**
1673 * Commit the model. The model is freed in this function(!).
1674 *
1675 * @ingroup underlay
1676 * @param model the model to commit
1677 */
1678void
1679GNUNET_TESTBED_underlaylinkmodel_commit (struct GNUNET_TESTBED_UnderlayLinkModel *model);
1680
1681
1682/**
1683 * Free the resources of the model. Use this function only if the model has not
1684 * be committed and has to be unallocated. The peer can then have another model
1685 * created.
1686 *
1687 * @ingroup underlay
1688 * @param model the model to unallocate
1689 */
1690void
1691GNUNET_TESTBED_underlaylinkmodel_free (struct GNUNET_TESTBED_UnderlayLinkModel *model);
1692
1693
1596#if 0 /* keep Emacsens' auto-indent happy */ 1694#if 0 /* keep Emacsens' auto-indent happy */
1597{ 1695{
1598#endif 1696#endif