How do I map a node id to an IP address and vice versa in a discrete-event simulation?

Categories:
Solution Number:
S20795
Last Modified:
2013-08-20
Issue

How do I map a node id to an IP address and vice versa in a discrete-event simulation?

Solution

Getting the IP address corresponding to a node id==================================================Use the function ip_support_address_from_node_id_get to get the IP address from the node ID. This function is declared in ip_support.h. Note that in the case of gateway nodes (nodes with more than one IP interface), this function will return the IP address of the first loopback interface.To obtain all the addresses of a gateway node, follow the steps listed below.1) Use the function ip_support_module_data_get (ip_support.h) to get a handle to the ip module data structure of the node.2) Use the function ip_rte_num_interfaces_get (ip_rte_support.h) to get the number of interfaces of the node.3) For each interface, use the function ip_rte_intf_tbl_access (ip_rte_support.h) to get a handle to the an interface specified by the interface index. Interface indices start at 0.4) The function ip_rte_intf_addr_get (ip_rte_support.h) returns the address of a given interface.Getting the node id corresponding to an IP address==================================================To get the node id corresponding to a given IP address, use the function ip_support_node_id_from_ip_address_get (ip_support.h). The functions ip_address_to_nodename or ip_address_to_hname can be used to map an ip address directly to the node name. The difference between the two functions is that ip_address_to_hname returns the full hierarchical name of the node (e.g. Office Network.Router A) whereas ip_address_to_nodename returns just the name of the node (e.g Router A).

Environment

DES Kernel->Process Modeling/Coding

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case