|
INET Framework for OMNeT++/OMNEST
|
#include <L3NetworkConfiguratorBase.h>
|
| virtual int | numInitStages () const override |
| |
| virtual void | initialize (int stage) override |
| |
| virtual void | handleMessage (cMessage *msg) override |
| |
| virtual void | extractTopology (Topology &topology) |
| | Extracts network topology by walking through the module hierarchy. More...
|
| |
| virtual void | extractWiredNeighbors (Topology &topology, Topology::Link *linkOut, LinkInfo *linkInfo, std::map< int, NetworkInterface * > &interfacesSeen, std::vector< Node * > &nodesVisited) |
| |
| virtual void | extractWirelessNeighbors (Topology &topology, const char *wirelessId, LinkInfo *linkInfo, std::map< int, NetworkInterface * > &interfacesSeen, std::vector< Node * > &nodesVisited) |
| |
| virtual void | extractDeviceNeighbors (Topology &topology, Node *node, LinkInfo *linkInfo, std::map< int, NetworkInterface * > &interfacesSeen, std::vector< Node * > &deviceNodesVisited) |
| |
| virtual InterfaceInfo * | determineGatewayForLink (LinkInfo *linkInfo) |
| | If this link has exactly one node that connects to other links as well, we can assume it is a "gateway" and return that (we'll use it in routing); otherwise return nullptr. More...
|
| |
| virtual double | computeNodeWeight (Node *node, const char *metric, cXMLElement *parameters) |
| |
| virtual double | computeLinkWeight (Link *link, const char *metric, cXMLElement *parameters) |
| |
| virtual double | computeWiredLinkWeight (Link *link, const char *metric, cXMLElement *parameters) |
| |
| virtual double | computeWirelessLinkWeight (Link *link, const char *metric, cXMLElement *parameters) |
| |
| virtual bool | isBridgeNode (Node *node) |
| |
| virtual bool | isWirelessInterface (NetworkInterface *networkInterface) |
| |
| virtual std::string | getWirelessId (NetworkInterface *networkInterface) |
| | If this function returns the same string for two wireless interfaces, they will be regarded as being in the same wireless network. More...
|
| |
| virtual InterfaceInfo * | createInterfaceInfo (Topology &topology, Node *node, LinkInfo *linkInfo, NetworkInterface *networkInterface) |
| |
| virtual Topology::Link * | findLinkOut (Node *node, int gateId) |
| |
| virtual InterfaceInfo * | findInterfaceInfo (Node *node, NetworkInterface *networkInterface) |
| |
| virtual IInterfaceTable * | findInterfaceTable (Node *node) |
| |
| virtual IRoutingTable * | findRoutingTable (Node *node) |
| |
| virtual void | dumpTopology (Topology &topology) |
| |
| virtual bool | getIpv4AddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
| |
| virtual bool | getIpv6AddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
| |
| virtual bool | getMacAddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
| |
| virtual bool | getModulePathAddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
| |
| virtual bool | getModuleIdAddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
| |
| virtual bool | getInterfaceIpv4Address (L3Address &ret, NetworkInterface *ie, bool mask) |
| |
| virtual bool | getInterfaceIpv6Address (L3Address &ret, NetworkInterface *ie, bool mask) |
| |
| virtual bool | getInterfaceMacAddress (L3Address &ret, NetworkInterface *ie, bool mask) |
| |
| virtual bool | getInterfaceModulePathAddress (L3Address &ret, NetworkInterface *ie, bool mask) |
| |
| virtual bool | getInterfaceModuleIdAddress (L3Address &ret, NetworkInterface *ie, bool mask) |
| |
| virtual void | doCollectNetworkNodes (cModule *parent, std::vector< cModule * > &result) |
| |
|
| enum | {
ADDR_IPv4 = 1,
ADDR_IPv6 = 2,
ADDR_MAC = 4,
ADDR_MODULEPATH = 8,
ADDR_MODULEID = 16,
ADDR_MASK = 32
} |
| |
| | L3AddressResolver () |
| |
| virtual | ~L3AddressResolver () |
| |
| virtual L3Address | resolve (const char *str, int addrType=DEFAULT_ADDR_TYPE) |
| | Accepts dotted decimal notation ("127.0.0.1"), module name of the host or router ("host[2]"), and empty string (""). More...
|
| |
| virtual std::vector< L3Address > | resolve (std::vector< std::string > strs, int addrType=DEFAULT_ADDR_TYPE) |
| | Utility function: Calls resolve() for each item in the string vector, and returns the result in an address vector. More...
|
| |
| virtual bool | tryResolve (const char *str, L3Address &result, int addrType=DEFAULT_ADDR_TYPE) |
| | Similar to resolve(), but returns false (instead of throwing an error) if the address cannot be resolved because the given host (or interface) doesn't have an address assigned yet. More...
|
| |
| bool | tryParse (L3Address &result, const char *addr, int addrType=DEFAULT_ADDR_TYPE) |
| |
| virtual L3Address | addressOf (cModule *host, int addrType=DEFAULT_ADDR_TYPE) |
| | Returns Ipv4 or Ipv6 address of the given host or router. More...
|
| |
| virtual L3Address | addressOf (cModule *host, const char *ifname, int addrType=DEFAULT_ADDR_TYPE) |
| | Similar to addressOf(), but only looks at the given interface. More...
|
| |
| virtual L3Address | addressOf (cModule *host, cModule *destmod, int addrType=DEFAULT_ADDR_TYPE) |
| | Returns Ipv4 or Ipv6 address of the given host or router. More...
|
| |
| virtual L3Address | routerIdOf (cModule *host) |
| | Returns the router Id of the given router. More...
|
| |
| virtual L3Address | getAddressFrom (IInterfaceTable *ift, int addrType=DEFAULT_ADDR_TYPE) |
| | Returns the Ipv4 or Ipv6 address of the given host or router, given its IInterfaceTable module. More...
|
| |
| virtual L3Address | getAddressFrom (NetworkInterface *ie, int addrType=DEFAULT_ADDR_TYPE) |
| | Returns the Ipv4 or Ipv6 address of the given interface (of a host or router). More...
|
| |
| virtual IInterfaceTable * | interfaceTableOf (cModule *host) |
| | The function tries to look up the IInterfaceTable module as submodule "interfaceTable" or "networkLayer.interfaceTable" within the host/router module. More...
|
| |
| virtual IIpv4RoutingTable * | getIpv4RoutingTableOf (cModule *host) |
| | The function tries to look up the IIpv4RoutingTable module as submodule "routingTable" or "networkLayer.routingTable" within the host/router module. More...
|
| |
| virtual Ipv6RoutingTable * | getIpv6RoutingTableOf (cModule *host) |
| | The function tries to look up the Ipv6RoutingTable module as submodule "routingTable6" or "networkLayer.routingTable6" within the host/router module. More...
|
| |
| virtual IInterfaceTable * | findInterfaceTableOf (cModule *host) |
| | Like interfaceTableOf(), but doesn't throw error if not found. More...
|
| |
| virtual IIpv4RoutingTable * | findIpv4RoutingTableOf (cModule *host) |
| | Like routingTableOf(), but doesn't throw error if not found. More...
|
| |
| virtual Ipv6RoutingTable * | findIpv6RoutingTableOf (cModule *host) |
| | Like interfaceTableOf(), but doesn't throw error if not found. More...
|
| |
| virtual NextHopRoutingTable * | findNextHopRoutingTableOf (cModule *host) |
| | Like interfaceTableOf(), but doesn't throw error if not found. More...
|
| |
| virtual std::vector< cModule * > | collectNetworkNodes () |
| | Collect modules that represent network nodes, as denoted by the @networkNode(true) annotation. More...
|
| |
| virtual cModule * | findHostWithAddress (const L3Address &addr) |
| | Find the Host with the specified address. More...
|
| |
| virtual NetworkInterface * | findInterfaceWithMacAddress (const MacAddress &addr) |
| | Find the interface with the specified MAC address. More...
|
| |
| virtual cModule * | findHostWithMacAddress (const MacAddress &addr) |
| | Find the host with the specified MAC address. More...
|
| |
◆ computeLinkWeight()
| double inet::L3NetworkConfiguratorBase::computeLinkWeight |
( |
Link * |
link, |
|
|
const char * |
metric, |
|
|
cXMLElement * |
parameters |
|
) |
| |
|
protectedvirtual |
◆ computeNodeWeight()
| double inet::L3NetworkConfiguratorBase::computeNodeWeight |
( |
Node * |
node, |
|
|
const char * |
metric, |
|
|
cXMLElement * |
parameters |
|
) |
| |
|
protectedvirtual |
308 const char *costAttribute = parameters->getAttribute(
"cost");
309 if (costAttribute !=
nullptr)
310 return parseCostAttribute(costAttribute);
312 if (node->routingTable && !node->routingTable->isForwardingEnabled())
Referenced by inet::Ipv4NetworkConfigurator::addStaticRoutes().
◆ computeWiredLinkWeight()
| double inet::L3NetworkConfiguratorBase::computeWiredLinkWeight |
( |
Link * |
link, |
|
|
const char * |
metric, |
|
|
cXMLElement * |
parameters |
|
) |
| |
|
protectedvirtual |
330 const char *costAttribute = parameters->getAttribute(
"cost");
331 if (costAttribute !=
nullptr)
332 return parseCostAttribute(costAttribute);
334 Topology::Link *linkOut =
static_cast<Topology::Link *
>(
static_cast<Topology::Link *
>(link));
335 if (!strcmp(metric,
"hopCount"))
337 else if (!strcmp(metric,
"delay")) {
338 cDatarateChannel *transmissionChannel =
dynamic_cast<cDatarateChannel *
>(linkOut->getLinkOutLocalGate()->findTransmissionChannel());
339 if (transmissionChannel !=
nullptr)
340 return transmissionChannel->getDelay().dbl();
344 else if (!strcmp(metric,
"dataRate")) {
345 cChannel *transmissionChannel = linkOut->getLinkOutLocalGate()->findTransmissionChannel();
346 if (transmissionChannel !=
nullptr) {
347 double dataRate = transmissionChannel->getNominalDatarate();
353 else if (!strcmp(metric,
"errorRate")) {
354 cDatarateChannel *transmissionChannel =
dynamic_cast<cDatarateChannel *
>(linkOut->getLinkOutLocalGate()->findTransmissionChannel());
355 if (transmissionChannel !=
nullptr) {
356 InterfaceInfo *sourceInterfaceInfo = link->sourceInterfaceInfo;
357 double bitErrorRate = transmissionChannel->getBitErrorRate();
358 double packetErrorRate = 1.0 - pow(1.0 - bitErrorRate, sourceInterfaceInfo->networkInterface->getMtu());
365 throw cRuntimeError(
"Unknown metric");
◆ computeWirelessLinkWeight()
| double inet::L3NetworkConfiguratorBase::computeWirelessLinkWeight |
( |
Link * |
link, |
|
|
const char * |
metric, |
|
|
cXMLElement * |
parameters |
|
) |
| |
|
protectedvirtual |
371 const char *costAttribute = parameters->getAttribute(
"cost");
372 if (costAttribute !=
nullptr)
373 return parseCostAttribute(costAttribute);
375 if (!strcmp(metric,
"hopCount"))
377 #ifdef INET_WITH_PHYSICALLAYERWIRELESSCOMMON
378 else if (!strcmp(metric,
"delay")) {
380 const InterfaceInfo *transmitterInterfaceInfo = link->sourceInterfaceInfo;
381 const InterfaceInfo *receiverInterfaceInfo = link->destinationInterfaceInfo;
382 cModule *transmitterInterfaceModule = transmitterInterfaceInfo->networkInterface;
383 cModule *receiverInterfaceModule = receiverInterfaceInfo->networkInterface;
384 const IRadio *transmitterRadio = check_and_cast<IRadio *>(transmitterInterfaceModule->getSubmodule(
"radio"));
385 const IRadio *receiverRadio = check_and_cast<IRadio *>(receiverInterfaceModule->getSubmodule(
"radio"));
386 const Packet *macFrame =
new Packet();
392 else if (!strcmp(metric,
"dataRate")) {
393 cModule *transmitterInterfaceModule = link->sourceInterfaceInfo->networkInterface;
394 IRadio *transmitterRadio = check_and_cast<IRadio *>(transmitterInterfaceModule->getSubmodule(
"radio"));
396 double dataRate = transmitter ? transmitter->
getBitrate().
get() : 0;
399 else if (!strcmp(metric,
"errorRate")) {
401 const InterfaceInfo *transmitterInterfaceInfo = link->sourceInterfaceInfo;
402 const InterfaceInfo *receiverInterfaceInfo = link->destinationInterfaceInfo;
403 cModule *transmitterInterfaceModule = transmitterInterfaceInfo->networkInterface;
404 cModule *receiverInterfaceModule = receiverInterfaceInfo->networkInterface;
405 const IRadio *transmitterRadio = check_and_cast<IRadio *>(transmitterInterfaceModule->getSubmodule(
"radio"));
406 const IRadio *receiverRadio = check_and_cast<IRadio *>(receiverInterfaceModule->getSubmodule(
"radio"));
408 Packet *transmittedFrame =
new Packet();
409 auto byteCountChunk = makeShared<ByteCountChunk>(
B(transmitterInterfaceInfo->networkInterface->getMtu()));
410 transmittedFrame->insertAtBack(byteCountChunk);
414 check_and_cast<const Radio *>(transmitterRadio)->encapsulate(transmittedFrame);
425 double packetErrorRate;
426 if (!isReceptionPossible)
430 const std::vector<const IReceptionDecision *> *receptionDecisions =
new std::vector<const IReceptionDecision *> { receptionDecision };
432 Packet *receivedFrame =
const_cast<Packet *
>(receptionResult->
getPacket());
433 packetErrorRate = receivedFrame->getTag<ErrorRateInd>()->getPacketErrorRate();
434 delete receptionResult;
435 delete receptionDecision;
443 delete transmittedFrame;
450 throw cRuntimeError(
"Unknown metric");
◆ createInterfaceInfo()
Reimplemented in inet::Ipv4NetworkConfigurator.
562 InterfaceInfo *interfaceInfo =
new InterfaceInfo(node, linkInfo, ie);
563 node->interfaceInfos.push_back(interfaceInfo);
564 topology.interfaceInfos[ie->getId()] = interfaceInfo;
565 return interfaceInfo;
◆ determineGatewayForLink()
If this link has exactly one node that connects to other links as well, we can assume it is a "gateway" and return that (we'll use it in routing); otherwise return nullptr.
528 InterfaceInfo *gatewayInterfaceInfo =
nullptr;
529 for (
auto& interfaceInfo : linkInfo->interfaceInfos) {
530 IInterfaceTable *interfaceTable = interfaceInfo->node->interfaceTable;
531 IRoutingTable *routingTable = interfaceInfo->node->routingTable;
534 int numInterfaces = 0;
535 for (
int i = 0; i < interfaceTable->getNumInterfaces(); i++)
536 if (!interfaceTable->getInterface(i)->isLoopback())
539 if (numInterfaces > 1 && routingTable && routingTable->isForwardingEnabled()) {
541 if (gatewayInterfaceInfo)
544 gatewayInterfaceInfo = interfaceInfo;
547 return gatewayInterfaceInfo;
◆ dumpTopology()
| void inet::L3NetworkConfiguratorBase::dumpTopology |
( |
Topology & |
topology | ) |
|
|
protectedvirtual |
647 for (
int i = 0; i < topology.getNumNodes(); i++) {
648 Node *node = (Node *)topology.getNode(i);
649 EV_INFO <<
"Node " << node->module->getFullPath() << endl;
650 for (
int j = 0; j < node->getNumOutLinks(); j++) {
651 Topology::Link *linkOut = node->getLinkOut(j);
652 ASSERT(linkOut->getLinkOutLocalNode() == node);
653 Node *remoteNode = (Node *)linkOut->getLinkOutRemoteNode();
654 EV_INFO <<
" -> " << remoteNode->module->getFullPath() << endl;
656 for (
int j = 0; j < node->getNumInLinks(); j++) {
657 Topology::Link *linkIn = node->getLinkIn(j);
658 ASSERT(linkIn->getLinkInLocalNode() == node);
659 Node *remoteNode = (Node *)linkIn->getLinkInRemoteNode();
660 EV_INFO <<
" <- " << remoteNode->module->getFullPath() << endl;
Referenced by inet::Ipv4NetworkConfigurator::dumpConfiguration(), and inet::NextHopNetworkConfigurator::initialize().
◆ extractDeviceNeighbors()
| void inet::L3NetworkConfiguratorBase::extractDeviceNeighbors |
( |
Topology & |
topology, |
|
|
Node * |
node, |
|
|
LinkInfo * |
linkInfo, |
|
|
std::map< int, NetworkInterface * > & |
interfacesSeen, |
|
|
std::vector< Node * > & |
deviceNodesVisited |
|
) |
| |
|
protectedvirtual |
236 deviceNodesVisited.push_back(node);
237 IInterfaceTable *interfaceTable = node->interfaceTable;
238 if (interfaceTable) {
240 for (
int i = 0; i < interfaceTable->getNumInterfaces(); i++) {
241 NetworkInterface *networkInterface = interfaceTable->getInterface(i);
242 if (!networkInterface->isLoopback() && !
containsKey(interfacesSeen, networkInterface->getId())) {
246 Topology::Link *linkOut =
findLinkOut(node, networkInterface->getNodeOutputGateId());
255 for (
int i = 0; i < node->getNumOutLinks(); i++) {
256 Topology::Link *linkOut = node->getLinkOut(i);
◆ extractTopology()
| void inet::L3NetworkConfiguratorBase::extractTopology |
( |
Topology & |
topology | ) |
|
|
protectedvirtual |
Extracts network topology by walking through the module hierarchy.
Creates vertices from modules having @networkNode property. Creates edges from connections (wired and wireless) between network interfaces.
66 topology.extractByProperty(
"networkNode");
67 EV_DEBUG <<
"Topology found " << topology.getNumNodes() <<
" nodes\n";
70 std::map<int, std::vector<Node *>> isolatedNetworks;
71 for (
int i = 0; i < topology.getNumNodes(); i++) {
72 Node *node = (Node *)topology.getNode(i);
73 int networkId = node->getNetworkId();
74 auto networkNodes = isolatedNetworks.find(networkId);
75 if (networkNodes == isolatedNetworks.end()) {
76 std::vector<Node *> collection = { node };
77 isolatedNetworks[networkId] = collection;
80 networkNodes->second.push_back(node);
82 if (isolatedNetworks.size() == 1)
83 EV_DEBUG <<
"All network nodes belong to a connected network.\n";
85 EV_DEBUG <<
"There exists " << isolatedNetworks.size() <<
" isolated networks.\n";
88 for (
int i = 0; i < topology.getNumNodes(); i++) {
89 Node *node = (Node *)topology.getNode(i);
90 cModule *module = node->getModule();
91 node->module = module;
97 std::map<int, NetworkInterface *> interfacesSeen;
98 for (
int i = 0; i < topology.getNumNodes(); i++) {
99 Node *node = (Node *)topology.getNode(i);
100 IInterfaceTable *interfaceTable = node->interfaceTable;
101 if (interfaceTable) {
102 for (
int j = 0; j < interfaceTable->getNumInterfaces(); j++) {
103 NetworkInterface *networkInterface = interfaceTable->getInterface(j);
104 if (!networkInterface->isLoopback() && !
containsKey(interfacesSeen, networkInterface->getId())) {
108 interfacesSeen[networkInterface->getId()] = networkInterface;
110 LinkInfo *linkInfo =
new LinkInfo();
111 linkInfo->networkId = node->getNetworkId();
112 topology.linkInfos.push_back(linkInfo);
115 linkInfo->interfaceInfos.push_back(interfaceInfo);
118 std::vector<Node *>
empty;
123 Topology::Link *linkOut =
findLinkOut(node, networkInterface->getNodeOutputGateId());
125 std::vector<Node *>
empty;
136 for (
int i = 0; i < topology.getNumNodes(); i++) {
137 Node *node = (Node *)topology.getNode(i);
138 for (
int j = 0; j < node->getNumOutLinks(); j++) {
139 Topology::Link *linkOut = node->getLinkOut(j);
140 Link *link = (Link *)linkOut;
141 Node *localNode = (Node *)linkOut->getLinkOutLocalNode();
142 if (localNode->interfaceTable)
143 link->sourceInterfaceInfo =
findInterfaceInfo(localNode, localNode->interfaceTable->findInterfaceByNodeOutputGateId(linkOut->getLinkOutLocalGateId()));
144 Node *remoteNode = (Node *)linkOut->getLinkOutRemoteNode();
145 if (remoteNode->interfaceTable)
146 link->destinationInterfaceInfo =
findInterfaceInfo(remoteNode, remoteNode->interfaceTable->findInterfaceByNodeInputGateId(linkOut->getLinkOutRemoteGateId()));
151 std::map<std::string, std::vector<InterfaceInfo *>> wirelessIdToInterfaceInfosMap;
152 for (
auto& entry : topology.interfaceInfos) {
153 InterfaceInfo *interfaceInfo = entry.second;
154 NetworkInterface *networkInterface = interfaceInfo->networkInterface;
157 wirelessIdToInterfaceInfosMap[wirelessId].push_back(interfaceInfo);
162 for (
auto& entry : wirelessIdToInterfaceInfosMap) {
163 std::vector<InterfaceInfo *>& interfaceInfos = entry.second;
164 for (
size_t i = 0; i < interfaceInfos.size(); i++) {
165 InterfaceInfo *interfaceInfoI = interfaceInfos.at(i);
166 for (
size_t j = i + 1; j < interfaceInfos.size(); j++) {
168 InterfaceInfo *interfaceInfoJ = interfaceInfos.at(j);
169 Link *linkIJ =
new Link();
170 linkIJ->sourceInterfaceInfo = interfaceInfoI;
171 linkIJ->destinationInterfaceInfo = interfaceInfoJ;
172 topology.addLink(linkIJ, interfaceInfoI->node, interfaceInfoJ->node);
173 Link *linkJI =
new Link();
174 linkJI->sourceInterfaceInfo = interfaceInfoJ;
175 linkJI->destinationInterfaceInfo = interfaceInfoI;
176 topology.addLink(linkJI, interfaceInfoJ->node, interfaceInfoI->node);
182 for (
auto& linkInfo : topology.linkInfos)
Referenced by inet::Ipv4NetworkConfigurator::computeConfiguration(), and inet::NextHopNetworkConfigurator::initialize().
◆ extractWiredNeighbors()
188 Node *node = (Node *)linkOut->getLinkOutRemoteNode();
189 int inputGateId = linkOut->getLinkOutRemoteGateId();
190 IInterfaceTable *interfaceTable = node->interfaceTable;
192 NetworkInterface *networkInterface = interfaceTable->findInterfaceByNodeInputGateId(inputGateId);
193 if (!networkInterface) {
196 else if (!
containsKey(interfacesSeen, networkInterface->getId())) {
197 InterfaceInfo *neighborInterfaceInfo =
createInterfaceInfo(topology, node, linkInfo, networkInterface);
198 linkInfo->interfaceInfos.push_back(neighborInterfaceInfo);
199 interfacesSeen[networkInterface->getId()] = networkInterface;
203 if (!
contains(deviceNodesVisited, node))
◆ extractWirelessNeighbors()
| void inet::L3NetworkConfiguratorBase::extractWirelessNeighbors |
( |
Topology & |
topology, |
|
|
const char * |
wirelessId, |
|
|
LinkInfo * |
linkInfo, |
|
|
std::map< int, NetworkInterface * > & |
interfacesSeen, |
|
|
std::vector< Node * > & |
nodesVisited |
|
) |
| |
|
protectedvirtual |
210 for (
int nodeIndex = 0; nodeIndex < topology.getNumNodes(); nodeIndex++) {
211 Node *node = (Node *)topology.getNode(nodeIndex);
212 IInterfaceTable *interfaceTable = node->interfaceTable;
213 if (interfaceTable) {
214 for (
int j = 0; j < interfaceTable->getNumInterfaces(); j++) {
215 NetworkInterface *networkInterface = interfaceTable->getInterface(j);
219 InterfaceInfo *interfaceInfo =
createInterfaceInfo(topology, node, linkInfo, networkInterface);
220 linkInfo->interfaceInfos.push_back(interfaceInfo);
221 interfacesSeen[networkInterface->getId()] = networkInterface;
224 if (!
contains(deviceNodesVisited, node))
◆ findInterfaceInfo()
285 if (networkInterface ==
nullptr)
287 for (
auto& interfaceInfo : node->interfaceInfos)
288 if (interfaceInfo->networkInterface == networkInterface)
289 return interfaceInfo;
◆ findInterfaceTable()
◆ findLinkOut()
276 for (
int i = 0; i < node->getNumOutLinks(); i++)
277 if (node->getLinkOut(i)->getLinkOutLocalGateId() == gateId)
278 return node->getLinkOut(i);
◆ findRoutingTable()
◆ getWirelessId()
| std::string inet::L3NetworkConfiguratorBase::getWirelessId |
( |
NetworkInterface * |
networkInterface | ) |
|
|
protectedvirtual |
If this function returns the same string for two wireless interfaces, they will be regarded as being in the same wireless network.
(The actual value of the string doesn't count.)
462 cModule *hostModule = networkInterface->getInterfaceTable()->getHostModule();
463 std::string hostFullPath = hostModule->getFullPath();
464 std::string hostShortenedFullPath = hostFullPath.substr(hostFullPath.find(
'.') + 1);
465 cXMLElementList wirelessElements =
configuration->getChildrenByTagName(
"wireless");
466 for (
auto& wirelessElement : wirelessElements) {
467 const char *hostAttr = wirelessElement->getAttribute(
"hosts");
468 const char *interfaceAttr = wirelessElement->getAttribute(
"interfaces");
471 Matcher hostMatcher(hostAttr);
472 Matcher interfaceMatcher(interfaceAttr);
475 if ((hostMatcher.matchesAny() || hostMatcher.matches(hostShortenedFullPath.c_str()) || hostMatcher.matches(hostFullPath.c_str())) &&
476 (interfaceMatcher.matchesAny() || interfaceMatcher.matches(networkInterface->getInterfaceName())))
478 const char *idAttr = wirelessElement->getAttribute(
"id");
479 return idAttr ? idAttr : wirelessElement->getSourceLocation();
482 catch (std::exception&
e) {
483 throw cRuntimeError(
"Error in XML <wireless> element at %s: %s", wirelessElement->getSourceLocation(),
e.what());
486 #if defined(INET_WITH_IEEE80211) || defined(INET_WITH_PHYSICALLAYERWIRELESSCOMMON)
487 cModule *interfaceModule = networkInterface;
488 #ifdef INET_WITH_IEEE80211
489 if (
auto mibModule =
dynamic_cast<ieee80211::Ieee80211Mib *
>(interfaceModule->getSubmodule(
"mib"))) {
490 auto ssid = mibModule->bssData.ssid;
491 if (ssid.length() != 0)
494 cModule *mgmtModule = interfaceModule->getSubmodule(
"mgmt");
495 if (mgmtModule !=
nullptr && mgmtModule->hasPar(
"ssid")) {
496 const char *value = mgmtModule->par(
"ssid");
500 cModule *agentModule = interfaceModule->getSubmodule(
"agent");
501 if (agentModule !=
nullptr && agentModule->hasPar(
"defaultSsid")) {
502 const char *value = agentModule->par(
"defaultSsid");
506 #endif // INET_WITH_IEEE80211
507 #ifdef INET_WITH_PHYSICALLAYERWIRELESSCOMMON
508 cModule *radioModule = interfaceModule->getSubmodule(
"radio");
509 const IRadio *radio =
dynamic_cast<const IRadio *
>(radioModule);
510 if (radio !=
nullptr) {
511 const cModule *mediumModule =
dynamic_cast<const cModule *
>(radio->
getMedium());
512 if (mediumModule !=
nullptr)
513 return mediumModule->getFullName();
515 #endif // INET_WITH_PHYSICALLAYERWIRELESSCOMMON
516 #endif // defined(INET_WITH_IEEE80211) || defined(INET_WITH_PHYSICALLAYERWIRELESSCOMMON)
◆ handleMessage()
| virtual void inet::L3NetworkConfiguratorBase::handleMessage |
( |
cMessage * |
msg | ) |
|
|
inlineoverrideprotectedvirtual |
Reimplemented in inet::Ipv4NetworkConfigurator.
142 {
throw cRuntimeError(
"this module doesn't handle messages, it runs only in initialize()"); }
◆ initialize()
| void inet::L3NetworkConfiguratorBase::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ isBridgeNode()
| bool inet::L3NetworkConfiguratorBase::isBridgeNode |
( |
Node * |
node | ) |
|
|
protectedvirtual |
◆ isWirelessInterface()
| bool inet::L3NetworkConfiguratorBase::isWirelessInterface |
( |
NetworkInterface * |
networkInterface | ) |
|
|
protectedvirtual |
◆ numInitStages()
| virtual int inet::L3NetworkConfiguratorBase::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ configuration
| cXMLElement* inet::L3NetworkConfiguratorBase::configuration = nullptr |
|
protected |
◆ configureIsolatedNetworksSeparatly
| bool inet::L3NetworkConfiguratorBase::configureIsolatedNetworksSeparatly = false |
|
protected |
◆ minLinkWeight
| double inet::L3NetworkConfiguratorBase::minLinkWeight = NaN |
|
protected |
The documentation for this class was generated from the following files:
@ SIGNAL_PART_WHOLE
Definition: IRadioSignal.h:26
virtual bool isWirelessInterface(NetworkInterface *networkInterface)
Definition: L3NetworkConfiguratorBase.cc:269
This interface represents the reception of a transmission at a receiver.
Definition: IReception.h:25
virtual bps getBitrate() const
Definition: FlatTransmitterBase.h:41
This interface represents the result of a receiver's reception process.
Definition: IReceptionResult.h:24
const char empty[]
Definition: ConstType.h:29
virtual const simtime_t getStartTime() const =0
virtual void extractWiredNeighbors(Topology &topology, Topology::Link *linkOut, LinkInfo *linkInfo, std::map< int, NetworkInterface * > &interfacesSeen, std::vector< Node * > &nodesVisited)
Definition: L3NetworkConfiguratorBase.cc:186
This interface represents the space and time coordinates of a transmission arriving at a receiver.
Definition: IArrival.h:26
virtual const simtime_t getStartPropagationTime() const =0
virtual bool computeIsReceptionPossible(const IListening *listening, const ITransmission *transmission) const =0
Returns whether the reception of the provided transmission is possible or not independently of the re...
virtual double computeWirelessLinkWeight(Link *link, const char *metric, cXMLElement *parameters)
Definition: L3NetworkConfiguratorBase.cc:369
virtual bool isBridgeNode(Node *node)
Definition: L3NetworkConfiguratorBase.cc:264
Definition: Interference.h:16
virtual const simtime_t getEndTime() const =0
virtual const IBackgroundNoise * getBackgroundNoise() const =0
Returns the background noise model of this medium.
virtual const ITransmitter * getTransmitter() const =0
Returns the transmitter part of this radio.
virtual IInterfaceTable * findInterfaceTable(Node *node)
Definition: L3NetworkConfiguratorBase.cc:550
const value< double, units::C > e(1.602176487e-19)
virtual const IRadioMedium * getMedium() const =0
Returns the radio medium where this radio is transmitting and receiving radio signals.
virtual void extractWirelessNeighbors(Topology &topology, const char *wirelessId, LinkInfo *linkInfo, std::map< int, NetworkInterface * > &interfacesSeen, std::vector< Node * > &nodesVisited)
Definition: L3NetworkConfiguratorBase.cc:208
virtual const IPropagation * getPropagation() const =0
Returns the signal propagation model of this medium.
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
virtual const Coord & getEndPosition() const =0
virtual const IReception * computeReception(const IRadio *receiver, const ITransmission *transmission, const IArrival *arrival) const =0
Returns the reception for the provided transmission at the receiver.
virtual double computeWiredLinkWeight(Link *link, const char *metric, cXMLElement *parameters)
Definition: L3NetworkConfiguratorBase.cc:328
This interface represents the whole medium.
Definition: IRadioMedium.h:38
intscale< b, 1, 8 > B
Definition: Units.h:1168
This interface represents a physical device (a part of the radio) which converts electric signals int...
Definition: IReceiver.h:42
double minLinkWeight
Definition: L3NetworkConfiguratorBase.h:135
bool contains(const std::vector< T > &v, const Tk &a)
Definition: stlutils.h:65
#define INFINITY
Definition: Topology.h:20
virtual const Packet * getPacket() const =0
Returns the packet corresponding to this reception.
virtual void extractDeviceNeighbors(Topology &topology, Node *node, LinkInfo *linkInfo, std::map< int, NetworkInterface * > &interfacesSeen, std::vector< Node * > &deviceNodesVisited)
Definition: L3NetworkConfiguratorBase.cc:234
cXMLElement * configuration
Definition: L3NetworkConfiguratorBase.h:137
virtual IMobility * getMobility() const =0
Returns the mobility of this antenna that describes its position and orientation over time.
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
This interface represents the transmission of a radio signal.
Definition: ITransmission.h:33
virtual IInterfaceTable * findInterfaceTableOf(cModule *host)
Like interfaceTableOf(), but doesn't throw error if not found.
Definition: L3AddressResolver.cc:486
virtual const INoise * computeNoise(const IListening *listening) const =0
virtual InterfaceInfo * determineGatewayForLink(LinkInfo *linkInfo)
If this link has exactly one node that connects to other links as well, we can assume it is a "gatewa...
Definition: L3NetworkConfiguratorBase.cc:526
virtual const IArrival * computeArrival(const ITransmission *transmission, IMobility *mobility) const =0
Returns the time and space coordinates when the transmission arrives at the object that moves with th...
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
Definition: FlatTransmitterBase.h:17
This interface represents the interference related to a reception.
Definition: IInterference.h:23
virtual const IListening * createListening(const IRadio *radio, const simtime_t startTime, const simtime_t endTime, const Coord &startPosition, const Coord &endPosition) const =0
Returns a description of how the receiver is listening on the medium.
virtual InterfaceInfo * createInterfaceInfo(Topology &topology, Node *node, LinkInfo *linkInfo, NetworkInterface *networkInterface)
Definition: L3NetworkConfiguratorBase.cc:560
static const Protocol ackingMac
Definition: Protocol.h:122
This interface represents how a receiver is listening on the radio channel.
Definition: IListening.h:23
const value_type & get() const
Definition: Units.h:108
virtual std::string getWirelessId(NetworkInterface *networkInterface)
If this function returns the same string for two wireless interfaces, they will be regarded as being ...
Definition: L3NetworkConfiguratorBase.cc:459
This interface represents a physical device that is capable of transmitting and receiving radio signa...
Definition: IRadio.h:32
This interface represents the decisions of a receiver's reception process.
Definition: IReceptionDecision.h:22
virtual IRoutingTable * findRoutingTable(Node *node)
Definition: L3NetworkConfiguratorBase.cc:555
virtual const ITransmission * createTransmission(const IRadio *transmitter, const Packet *packet, const simtime_t startTime) const =0
Returns a transmission which describes the radio signal corresponding to the provided packet.
virtual const IAnalogModel * getAnalogModel() const =0
Returns the signal analog model of this medium.
virtual const Coord & getStartPosition() const =0
virtual InterfaceInfo * findInterfaceInfo(Node *node, NetworkInterface *networkInterface)
Definition: L3NetworkConfiguratorBase.cc:283
virtual const IReceiver * getReceiver() const =0
Returns the receiver part of this radio.
virtual Topology::Link * findLinkOut(Node *node, int gateId)
Definition: L3NetworkConfiguratorBase.cc:274
virtual const ISnir * computeSNIR(const IReception *reception, const INoise *noise) const =0
Returns the signal to noise and interference ratio.
Definition: ReceptionDecision.h:16
virtual const IAntenna * getAntenna() const =0
Returns the antenna used by the transceiver of this radio.
This interface represents a meaningless radio signal.
Definition: INoise.h:20
virtual const IReceptionResult * computeReceptionResult(const IListening *listening, const IReception *reception, const IInterference *interference, const ISnir *snir, const std::vector< const IReceptionDecision * > *decisions) const =0
Returns the complete result of the reception process for the provided reception.
bool containsKey(const std::map< K, V, _C > &m, const Tk &a)
Definition: stlutils.h:80
bool configureIsolatedNetworksSeparatly
Definition: L3NetworkConfiguratorBase.h:136