fw: forward Interest/Data to ad hoc incoming face
Change-Id: Ia2eacf2a54d65ea4bffb607a709e1d1263547fd7
Refs: #3968
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 9f97413..892dc01 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -54,7 +54,7 @@
{
public:
explicit
- TopologyLink(const time::nanoseconds& delay);
+ TopologyLink(time::nanoseconds delay);
/** \brief fail the link, cause packets to be dropped silently
*/
@@ -72,11 +72,24 @@
m_isUp = true;
}
+ /** \brief block transmission from i to j
+ *
+ * Packets transmitted by i would not be delivered to j. Packets from j to i are unaffected.
+ * This can be used to simulate a wireless channel.
+ */
+ void
+ block(TopologyNode i, TopologyNode j);
+
+ /** \brief unblock transmission from i to j
+ */
+ void
+ unblock(TopologyNode i, TopologyNode j);
+
/** \brief change the link delay
* \param delay link delay, must be positive
*/
void
- setDelay(const time::nanoseconds& delay);
+ setDelay(time::nanoseconds delay);
/** \brief attach a face to the link
* \param i forwarder index
@@ -90,15 +103,9 @@
Face&
getFace(TopologyNode i)
{
- return *m_faces.at(i);
+ return *m_transports.at(i).face;
}
-protected:
- /** \brief attach a Transport onto this link
- */
- void
- attachTransport(TopologyNode i, face::InternalTransportBase* transport);
-
private:
void
transmit(TopologyNode i, const Block& packet);
@@ -109,8 +116,14 @@
private:
bool m_isUp;
time::nanoseconds m_delay;
- std::unordered_map<TopologyNode, face::InternalTransportBase*> m_transports;
- std::unordered_map<TopologyNode, shared_ptr<Face>> m_faces;
+
+ struct NodeTransport
+ {
+ face::InternalTransportBase* transport;
+ shared_ptr<Face> face;
+ std::set<TopologyNode> blockedDestinations;
+ };
+ std::unordered_map<TopologyNode, NodeTransport> m_transports;
};
/** \brief represents a link to a local application
@@ -203,15 +216,18 @@
}
/** \brief makes a link that interconnects two or more forwarders
+ * \brief linkType desired link type; LINK_TYPE_NONE to use point-to-point for two forwarders
+ * and multi-access for more than two forwarders; it's an error to specify
+ * point-to-point when there are more than two forwarders
*
* A face is created on each of \p forwarders .
* When a packet is sent onto one of the faces on this link,
* this packet will be received by all other faces on this link after \p delay .
*/
shared_ptr<TopologyLink>
- addLink(const std::string& label, const time::nanoseconds& delay,
+ addLink(const std::string& label, time::nanoseconds delay,
std::initializer_list<TopologyNode> forwarders,
- bool forceMultiAccessFace = false);
+ ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_NONE);
/** \brief makes a link to local application
*/
@@ -246,10 +262,11 @@
/** \brief creates a consumer application that sends \p n Interests under \p prefix
* at \p interval fixed rate.
+ * \param seq if non-negative, append sequence number instead of timestamp
*/
void
- addIntervalConsumer(ndn::Face& face, const Name& prefix,
- const time::nanoseconds& interval, size_t n);
+ addIntervalConsumer(ndn::Face& face, const Name& prefix, time::nanoseconds interval,
+ size_t n, int seq = -1);
private:
bool m_wantPcap = false;