OMNET++ ROUTING is the process of passing information in a network from source to destination.It is also known for process of choosing path for fowarding packets in a network.
Classification of routing algorithms:
- Link-state versus distance vector.
- Host-intelligent versus router-intelligent.
- Static versus adaptive.
- Flat versus hierarchical.
- Single path versus multi-path.
- Intra-domain versus inter-domain.
Sample routing algorithm metrics are:
The below mentioned routing metrics are considered by the routing algorithms in order to find out the shortest path, optimal path etc. There are,
- Load.
- Communication cost.
- Path length.
- Reliability.
- Bandwidth.
- Delay.
Advantages of fixed routing:
- Routing is same for datagram and virtual circuit type of services.
- Routing is dependent on network topology that us static in nature.
- Routers are always fixed and hence the routing overhead is minimum.
Sample Source Code for OMNeT++ Routing:
void NetworkRouting::extractTopology(cTopology& topo, NodeInfoVector& nodeInfo) { topo.extractByProperty("node"); nodeInfo.resize(topo.getNumNodes()); for (int i=0; i<topo.getNumNodes(); i++) { cModule *mod = topo.getNode(i)->getModule(); nodeInfo[i].isIPNode = IPvXAddressResolver().findRoutingTableOf(mod)!=NULL && IPvXAddressResolver().findInterfaceTableOf(mod)!=NULL; if (nodeInfo[i].isIPNode) { nodeInfo[i].ift = IPvXAddressResolver().interfaceTableOf(mod); nodeInfo[i].rt = IPvXAddressResolver().routingTableOf(mod); nodeInfo[i].ipForwardEnabled = mod->hasPar("IPForward") ? mod->par("IPForward").boolValue() : false; topo.getNode(i)->setWeight(nodeInfo[i].ipForwardEnabled ? 0.0 : INFINITY); } }} void NetworkConfigurator::assignAddresses(cTopology& topo, NodeInfoVector& nodeInfo) { uint32 networkAddress = IPv4Address(par("networkAddress").stringValue()).getInt(); uint32 netmask = IPv4Address(par("netmask").stringValue()).getInt(); int maxNodes = (~netmask)-1; // 0 and ffff have special meaning and cannot be used for (int i=0; i<topo.getNumNodes(); i++) { // skip bus types if (!nodeInfo[i].isIPNode) continue; uint32 addr = networkAddress | uint32(++numIPNodes); nodeInfo[i].address.set(addr); // find interface table and assign address to all (non-loopback) interfaces IInterfaceTable *ift = nodeInfo[i].ift; for (int k=0; k<ift->getNumInterfaces(); k++) { InterfaceEntry *ie = ift->getInterface(k); if (!ie->isLoopback()) { ie->ipv4Data()->setIPAddress(IPv4Address(addr)); ie->ipv4Data()->setNetmask(IPv4Address::ALLONES_ADDRESS); // full address must match for local delivery } } } }