A Discrete-Event Network Simulator
API
nix-vector-helper.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2009 The Georgia Institute of Technology
4 * Copyright (c) 2021 NITK Surathkal
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * This file is adapted from the old ipv4-nix-vector-helper.h.
20 *
21 * Authors: Josh Pelkey <jpelkey@gatech.edu>
22 *
23 * Modified by: Ameya Deshpande <ameyanrd@outlook.com>
24 */
25
26#ifndef NIX_VECTOR_HELPER_H
27#define NIX_VECTOR_HELPER_H
28
29#include "ns3/object-factory.h"
30#include "ns3/ipv4-routing-helper.h"
31#include "ns3/ipv6-routing-helper.h"
32
33namespace ns3 {
34
49template <typename T>
50class NixVectorHelper : public std::enable_if<std::is_same<Ipv4RoutingHelper, T>::value || std::is_same<Ipv6RoutingHelper, T>::value, T>::type
51{
53 using IsIpv4 = std::is_same <Ipv4RoutingHelper, T>;
60public:
66
74
75 // Delete assignment operator to avoid misuse
77
84 NixVectorHelper<T>* Copy (void) const;
85
92 virtual Ptr<IpRoutingProtocol> Create (Ptr<Node> node) const;
93
108 void PrintRoutingPathAt (Time printTime, Ptr<Node> source, IpAddress dest, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
109
110private:
112
125 static void PrintRoute (Ptr<Node> source, IpAddress dest, Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S);
126};
127
135
141} // namespace ns3
142
143#endif /* NIX_VECTOR_HELPER_H */
Helper class that adds Nix-vector routing to nodes.
static void PrintRoute(Ptr< Node > source, IpAddress dest, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing path for the source and destination.
std::is_same< Ipv4RoutingHelper, T > IsIpv4
Alias for determining whether the parent is Ipv4RoutingHelper or Ipv6RoutingHelper.
typename std::conditional< IsIpv4::value, Ipv4Address, Ipv6Address >::type IpAddress
Alias for Ipv4Address and Ipv6Address classes.
NixVectorHelper< T > * Copy(void) const
ObjectFactory m_agentFactory
Object factory.
typename std::conditional< IsIpv4::value, Ipv4RoutingProtocol, Ipv6RoutingProtocol >::type IpRoutingProtocol
Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes.
NixVectorHelper & operator=(const NixVectorHelper &)=delete
typename std::conditional< IsIpv4::value, Ipv4, Ipv6 >::type Ip
Alias for Ipv4 and Ipv6 classes.
void PrintRoutingPathAt(Time printTime, Ptr< Node > source, IpAddress dest, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing path for a source and destination at a particular time.
virtual Ptr< IpRoutingProtocol > Create(Ptr< Node > node) const
NixVectorHelper()
Construct an NixVectorHelper to make life easier while adding Nix-vector routing to nodes.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:110
@ S
second
Definition: nstime.h:115
NixVectorHelper< Ipv6RoutingHelper > Ipv6NixVectorHelper
Create the typedef Ipv6NixVectorHelper with T as Ipv6RoutingHelper.
NixVectorHelper< Ipv4RoutingHelper > Ipv4NixVectorHelper
Create the typedef Ipv4NixVectorHelper with T as Ipv4RoutingHelper.
Every class exported by the ns3 library is enclosed in the ns3 namespace.