Skip to first unread message

Khaled Soliman

unread,
Jun 6, 2015, 11:14:16 AM6/6/15
to ns-3-...@googlegroups.com
Hello All

I am facing the below problems while I am doing a "for loop" for all the routing table entries in "AODV" to select the entry of the highest battery value.

Objective: Developing a clustering technique for AODV based on battery value.

Problem:

1. The selected entry IP is always 127.0.0.1 or 10.255.255.255 or 102.102.102.102
2. The loop is only rotating 2 times not for the whole routing table

Please find the attached files for more information.

Thanks in advance.

===============================
void
RoutingProtocol::SendRequest (Ipv4Address dst)
{

    std::vector< RoutingTableEntry> ourGlobalVariable;
    m_routingTable.CopyVariable(ourGlobalVariable);
    RoutingTableEntry rt;
   
          uint32_t tempBattery =0, currentHighest= 0;
          bool isValidTable = true;
          Ipv4Address head;
          Ipv4Address tempAddress("10.255.255.255"), tempAddress2("102.102.102.102"), tempAddress3("127.0.0.1");
          std::cout << "\n\n HERE 1 >>\n\n  ";

          for( std::vector<RoutingTableEntry>::const_iterator i = ourGlobalVariable.begin(); i != ourGlobalVariable.end (); ++i)
          {

             std::cout << "<<\n\n HERE 2 >>\n\n  " ;

            const RoutingTableEntry tempEntry  = *i;
            Ipv4Address head = tempEntry.GetDestination();
            tempBattery= tempEntry.GetBatteryLife();

             std::cout << "\nDEB 3 tempEntry.GetHop = >> " << tempEntry.GetHop() ;
              if(tempEntry.GetHop() > 3)
              {
                  std::cout << "<<\n\n HERE 3 >>\n\n  ";
                  break;
              }

              std::cout << "temp battery  "<< tempBattery <<  " .\n";

              if (tempBattery > currentHighest)
                      {
                                std::cout << "<<\n\n HERE 5 >>\n\n  ";

                                 currentHighest = tempBattery ;
                                 isValidTable = true;
                                 head = tempEntry.GetDestination();
                                 std::cout << " >>>>>>>>> currentHighest  " << currentHighest <<  "tempBattery" << tempBattery << " >>>>>>>>>>>" << head;
                                 //headEntry.SetNextHop(tempEntry.GetDestination());
                      }

              if (tempBattery <= currentHighest)
                  {
                      head = tempEntry.GetDestination();
                      //headEntry.SetNextHop(tempEntry.GetDestination());
                      std::cout << "<<\n\n HERE 6 >>\n\n  " << head ;

                  }

              NS_LOG_DEBUG (" >>>>>>>>> current highest  " << currentHighest << " >>>>>>>>>>>");
              NS_LOG_DEBUG (" DEBUG RESULR OF HEAD SELETION CURRENT HEAD BATTERY  " << headEntry.GetBatteryLife() << " >>>>>>>>>>>");
            }

          if (head == tempAddress or head == tempAddress2 or head == tempAddress3 )
                                       {
                                            std::cout << "<<\n\n HERE 4 >>\n\n  ";
                                       }

===============================
aodv_routing protcol.cc
aodv-rtable.cc
aodv-rtable.h
Output.txt

Tommaso Pecorella

unread,
Jun 6, 2015, 6:06:08 PM6/6/15
to ns-3-...@googlegroups.com
Hi,

not to be harsh, but one thing is to try to help with ns-3 code, another thing is to debug other people's code. The first is  task we do for the community, the second doesn't fall on this category, and it's paid work.

My suggestion: don't bloat your code with debugging output lines and use a debugger.


T.

Ev A

unread,
Jan 29, 2022, 8:50:36 AM1/29/22
to ns-3-users

Hi

I need the simulation of Blackhole and Selective forwarding attack  module in ns3 using modified AODV and SAODV. Also, it must measure some of the matrices such as energy consumption, throughput, packet delivery ratio, end to end delay, precision, accuracy , recall and time overhead.


 If you know any open source code to apply this, please let me know.

I need to run this code and see the result between the AODV and SAODV.


Please help me. 


Thank you

Reply all
Reply to author
Forward
0 new messages