Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Later, we add IP addresses.
- NS_LOG_INFO ("Assignings IP Addresses.");
- Ipv4AddressHelper ipv4_n;
- //ipv4_n.SetBase ("10.1.0.0", "255.255.0.0");
- NS_LOG_INFO ("Create Links Between Nodes");
- uint32_t linkCount = 0;
- Ipv4InterfaceContainer n_ic[nodes.GetN()][nodes.GetN()];
- for (size_t i = 0; i < nodes.GetN(); i++)
- {
- for (size_t j = 0; j < nodes.GetN(); j++)
- {
- if (NICM[i][j][2] != -1)
- {
- NodeContainer n_links = NodeContainer (nodes.Get (i), nodes.Get (j));
- NetDeviceContainer n_devs = p2phelper.Install (n_links);
- char * cstr;
- std::stringstream ss;
- ss << "10.1." << 1+j << ".0";
- cstr = new char [ss.str().size()+1];
- strcpy(cstr, ss.str().c_str());
- ipv4_n.SetBase(cstr, "255.255.255.0");
- n_ic[i][j] = ipv4_n.Assign (n_devs);
- ipv4_n.NewNetwork ();
- linkCount++;
- NS_LOG_INFO ("matrix element [" << i << "][" << j << "] is " << NICM[i][j][2]);
- }
- else
- {
- NS_LOG_INFO ("matrix element [" << i << "][" << j << "] is -1");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement