src/routing/olsr/olsr-helper.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 03 Mar 2008 22:38:26 +0100
changeset 2565 d8730df76e9c
parent 2491 c06eb92133a1
child 2602 d9262bff6df2
permissions -rw-r--r--
start the OLSR agent
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2484
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
#include "olsr-helper.h"
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
#include "olsr-agent.h"
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
#include "ns3/node-list.h"
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
namespace ns3 {
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
OlsrHelper::OlsrHelper ()
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
{
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
  m_agentFactory.SetTypeId ("olsr::AgentImpl");
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
}
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
void 
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
OlsrHelper::SetAgent (std::string tid,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
		      std::string n0, Attribute v0,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
		      std::string n1, Attribute v1,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
		      std::string n2, Attribute v2,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
		      std::string n3, Attribute v3,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
		      std::string n4, Attribute v4,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
		      std::string n5, Attribute v5,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
		      std::string n6, Attribute v6,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
		      std::string n7, Attribute v7)
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
{
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
  m_agentFactory.SetTypeId (tid);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
  m_agentFactory.Set (n0, v0);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
  m_agentFactory.Set (n1, v1);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
  m_agentFactory.Set (n2, v2);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
  m_agentFactory.Set (n3, v3);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
  m_agentFactory.Set (n4, v4);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
  m_agentFactory.Set (n5, v5);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
  m_agentFactory.Set (n6, v6);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
  m_agentFactory.Set (n7, v7);
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
}
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
void 
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
OlsrHelper::Enable (NodeContainer container)
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
{
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
  Enable (container.Begin (), container.End ());
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
}
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
void 
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
OlsrHelper::Enable (Ptr<Node> node)
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
{
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
  Ptr<olsr::Agent> agent = m_agentFactory.Create<olsr::Agent> ();
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
  agent->SetNode (node);
2491
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2484
diff changeset
    44
  node->AggregateObject (agent);
2565
d8730df76e9c start the OLSR agent
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2491
diff changeset
    45
  agent->Start ();
2484
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
}
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
void 
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
OlsrHelper::EnableAll (void)
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
{
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
  Enable (NodeList::Begin (), NodeList::End ());
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
}
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
} // namespace ns3