src/helper/olsr-helper.cc
changeset 4358 e63305078fe5
parent 4147 5d8530130930
child 4364 579bbfe8bb65
equal deleted inserted replaced
4279:7cb2938928d4 4358:e63305078fe5
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17  *
    17  *
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    19  */
    19  */
    20 #include "olsr-helper.h"
    20 #include "olsr-helper.h"
    21 #include "ns3/olsr-agent.h"
    21 #include "ns3/olsr-agent-impl.h"
    22 #include "ns3/node-list.h"
    22 #include "ns3/node-list.h"
    23 #include "ns3/names.h"
    23 #include "ns3/names.h"
    24 
    24 
    25 namespace ns3 {
    25 namespace ns3 {
    26 
    26 
    61     }
    61     }
    62 }
    62 }
    63 void 
    63 void 
    64 OlsrHelper::Install (Ptr<Node> node)
    64 OlsrHelper::Install (Ptr<Node> node)
    65 {
    65 {
    66   if (node->GetObject<olsr::Agent> () != 0)
    66   if (node->GetObject<olsr::AgentImpl> () != 0)
    67     {
    67     {
    68       NS_FATAL_ERROR ("OlsrHelper::Install(): Aggregating "
    68       NS_FATAL_ERROR ("OlsrHelper::Install(): Aggregating "
    69          "an Olsr Agent to a node with an existing Olsr Agent");
    69          "an Olsr Agent to a node with an existing Olsr Agent");
    70       return;
    70       return;
    71     }
    71     }
    72   Ptr<olsr::Agent> agent = m_agentFactory.Create<olsr::Agent> ();
    72   Ptr<olsr::AgentImpl> agent = m_agentFactory.Create<olsr::AgentImpl> ();
       
    73   node->AggregateObject (agent);
       
    74   Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
       
    75   ipv4->AddRoutingProtocol (agent, 10);
    73   agent->SetNode (node);
    76   agent->SetNode (node);
    74   node->AggregateObject (agent);
       
    75   agent->Start ();
    77   agent->Start ();
    76 }
    78 }
    77 void 
    79 void 
    78 OlsrHelper::Install (std::string nodeName)
    80 OlsrHelper::Install (std::string nodeName)
    79 {
    81 {