0

I'm very new to OMNeT++ and I'm writing my first simulation with it. What I'm trying to do is to retrieve the complete topology of the network at execution time from a node.

Basically, I have a router node that needs to know the entire topology (which node is connect to who) but I don't want to statically change the C++ code according to the Network selected. Instead, the idea is that the router is able in its initialization function to discover all the connections between nodes.

How can I do that?

Thanks in advance.

arandomuser
  • 489
  • 7
  • 20

1 Answers1

1

What you need is the omnetpp::cTopology class from the OMNeT++ API: https://omnetpp.org/doc/omnetpp/api/classomnetpp_1_1cTopology.html

If you are using INET, there is a slightly enhanced version of this class in inet::common::Topology

Rudi
  • 4,880
  • 1
  • 14
  • 19
  • Just a side note: if you don't need any special thing, just a properly configured IP network, take a look at the IPv4NetworkConfigurator. It is using the Topology class to discover the whole network and sets all the IP addresses, netmasks, and even static routes. Optimizes the routing tables etc. – Rudi Jun 01 '16 at 09:58