src/routing/dsdv/helper/dsdv-helper.cc
author Hemanth Narra <hemanth@ittc.ku.edu>
Tue, 21 Dec 2010 22:43:06 -0800
changeset 6717 e041eb593928
permissions -rw-r--r--
DSDV routing protocol
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6717
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     2
/*
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     3
 * Copyright (c) 2010 Hemanth Narra
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     4
 *
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     8
 *
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    13
 *
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    17
 *
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    18
 * Authors: Hemanth Narra <hemanth@ittc.ku.com>, written after OlsrHelper by Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    19
 *
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    20
 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    21
 * ResiliNets Research Group  http://wiki.ittc.ku.edu/resilinets
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    22
 * Information and Telecommunication Technology Center (ITTC)
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    23
 * and Department of Electrical Engineering and Computer Science
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    24
 * The University of Kansas Lawrence, KS USA.
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    25
 *
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    26
 * Work supported in part by NSF FIND (Future Internet Design) Program
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    27
 * under grant CNS-0626918 (Postmodern Internet Architecture),
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    28
 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    29
 * US Department of Defense (DoD), and ITTC at The University of Kansas.
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    30
 */
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    31
#include "dsdv-helper.h"
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    32
#include "ns3/dsdv-routing-protocol.h"
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    33
#include "ns3/node-list.h"
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    34
#include "ns3/names.h"
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    35
#include "ns3/ipv4-list-routing.h"
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    36
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    37
namespace ns3 {
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    38
DsdvHelper::~DsdvHelper ()
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    39
{
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    40
}
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    41
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    42
DsdvHelper::DsdvHelper () : Ipv4RoutingHelper ()
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    43
{
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    44
  m_agentFactory.SetTypeId ("ns3::dsdv::RoutingProtocol");
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    45
}
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    46
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    47
DsdvHelper*
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    48
DsdvHelper::Copy (void) const
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    49
{
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    50
  return new DsdvHelper (*this);
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    51
}
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    52
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    53
Ptr<Ipv4RoutingProtocol>
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    54
DsdvHelper::Create (Ptr<Node> node) const
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    55
{
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    56
  Ptr<dsdv::RoutingProtocol> agent = m_agentFactory.Create<dsdv::RoutingProtocol> ();
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    57
  node->AggregateObject (agent);
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    58
  return agent;
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    59
}
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    60
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    61
void
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    62
DsdvHelper::Set (std::string name, const AttributeValue &value)
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    63
{
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    64
  m_agentFactory.Set (name, value);
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    65
}
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    66
e041eb593928 DSDV routing protocol
Hemanth Narra <hemanth@ittc.ku.edu>
parents:
diff changeset
    67
}