View | Details | Raw Unified | Return to bug 2252
Collapse All | Expand All

(-)a/src/brite/examples/brite-MPI-example.cc (-13 / +2 lines)
 Lines 79-103    Link Here 
79
79
80
  PointToPointHelper p2p;
80
  PointToPointHelper p2p;
81
81
82
  Ipv4StaticRoutingHelper staticRouting;
83
  Ipv4GlobalRoutingHelper globalRouting;
84
  Ipv4ListRoutingHelper listRouting;
85
  Ipv4NixVectorHelper nixRouting;
86
82
87
  InternetStackHelper stack;
83
  InternetStackHelper stack;
88
84
89
  if (nix)
85
  if (nix)
90
    {
86
    {
91
      listRouting.Add (staticRouting, 0);
87
      Ipv4NixVectorHelper nixRouting;
92
      listRouting.Add (nixRouting, 10);
88
      stack.SetRoutingHelper (nixRouting);
93
    }
89
    }
94
  else
95
    {
96
      listRouting.Add (staticRouting, 0);
97
      listRouting.Add (globalRouting, 10);
98
    }
99
100
  stack.SetRoutingHelper (listRouting);
101
90
102
  Ipv4AddressHelper address;
91
  Ipv4AddressHelper address;
103
  address.SetBase ("10.0.0.0", "255.255.255.252");
92
  address.SetBase ("10.0.0.0", "255.255.255.252");
(-)a/src/brite/examples/brite-generic-example.cc (-13 / +2 lines)
 Lines 63-87    Link Here 
63
63
64
  PointToPointHelper p2p;
64
  PointToPointHelper p2p;
65
65
66
  Ipv4StaticRoutingHelper staticRouting;
67
  Ipv4GlobalRoutingHelper globalRouting;
68
  Ipv4ListRoutingHelper listRouting;
69
  Ipv4NixVectorHelper nixRouting;
70
66
71
  InternetStackHelper stack;
67
  InternetStackHelper stack;
72
68
73
  if (nix)
69
  if (nix)
74
    {
70
    {
75
      listRouting.Add (staticRouting, 0);
71
      Ipv4NixVectorHelper nixRouting;
76
      listRouting.Add (nixRouting, 10);
72
      stack.SetRoutingHelper (nixRouting);
77
    }
73
    }
78
  else
79
    {
80
      listRouting.Add (staticRouting, 0);
81
      listRouting.Add (globalRouting, 10);
82
    }
83
84
  stack.SetRoutingHelper (listRouting);
85
74
86
  Ipv4AddressHelper address;
75
  Ipv4AddressHelper address;
87
  address.SetBase ("10.0.0.0", "255.255.255.252");
76
  address.SetBase ("10.0.0.0", "255.255.255.252");
(-)a/src/mpi/examples/nms-p2p-nix-distributed.cc (-9 / +1 lines)
 Lines 46-53    Link Here 
46
#include "ns3/packet-sink-helper.h"
46
#include "ns3/packet-sink-helper.h"
47
#include "ns3/point-to-point-helper.h"
47
#include "ns3/point-to-point-helper.h"
48
#include "ns3/mpi-interface.h"
48
#include "ns3/mpi-interface.h"
49
#include "ns3/ipv4-static-routing-helper.h"
50
#include "ns3/ipv4-list-routing-helper.h"
51
#include "ns3/ipv4-nix-vector-helper.h"
49
#include "ns3/ipv4-nix-vector-helper.h"
52
50
53
using namespace ns3;
51
using namespace ns3;
 Lines 148-162    Link Here 
148
  p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
146
  p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
149
  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
147
  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
150
148
151
  Ipv4NixVectorHelper nixRouting;
152
  Ipv4StaticRoutingHelper staticRouting;
153
154
  Ipv4ListRoutingHelper list;
155
  list.Add (staticRouting, 0);
156
  list.Add (nixRouting, 10);
157
158
  if (nix)
149
  if (nix)
159
    {
150
    {
151
      Ipv4NixVectorHelper nixRouting;
160
      stack.SetRoutingHelper (list); // has effect on the next Install ()
152
      stack.SetRoutingHelper (list); // has effect on the next Install ()
161
    }
153
    }
162
154
(-)a/src/mpi/examples/simple-distributed-empty-node.cc (-9 / +1 lines)
 Lines 60-67    Link Here 
60
#include "ns3/network-module.h"
60
#include "ns3/network-module.h"
61
#include "ns3/mpi-interface.h"
61
#include "ns3/mpi-interface.h"
62
#include "ns3/ipv4-global-routing-helper.h"
62
#include "ns3/ipv4-global-routing-helper.h"
63
#include "ns3/ipv4-static-routing-helper.h"
64
#include "ns3/ipv4-list-routing-helper.h"
65
#include "ns3/point-to-point-helper.h"
63
#include "ns3/point-to-point-helper.h"
66
#include "ns3/internet-stack-helper.h"
64
#include "ns3/internet-stack-helper.h"
67
#include "ns3/ipv4-nix-vector-helper.h"
65
#include "ns3/ipv4-nix-vector-helper.h"
 Lines 185-199    Link Here 
185
    }
183
    }
186
184
187
  InternetStackHelper stack;
185
  InternetStackHelper stack;
188
  Ipv4NixVectorHelper nixRouting;
189
  Ipv4StaticRoutingHelper staticRouting;
190
191
  Ipv4ListRoutingHelper list;
192
  list.Add (staticRouting, 0);
193
  list.Add (nixRouting, 10);
194
195
  if (nix)
186
  if (nix)
196
    {
187
    {
188
      Ipv4NixVectorHelper nixRouting;
197
      stack.SetRoutingHelper (list); // has effect on the next Install ()
189
      stack.SetRoutingHelper (list); // has effect on the next Install ()
198
    }
190
    }
199
191
(-)a/src/mpi/examples/simple-distributed.cc (-9 / +1 lines)
 Lines 45-52    Link Here 
45
#include "ns3/network-module.h"
45
#include "ns3/network-module.h"
46
#include "ns3/mpi-interface.h"
46
#include "ns3/mpi-interface.h"
47
#include "ns3/ipv4-global-routing-helper.h"
47
#include "ns3/ipv4-global-routing-helper.h"
48
#include "ns3/ipv4-static-routing-helper.h"
49
#include "ns3/ipv4-list-routing-helper.h"
50
#include "ns3/point-to-point-helper.h"
48
#include "ns3/point-to-point-helper.h"
51
#include "ns3/internet-stack-helper.h"
49
#include "ns3/internet-stack-helper.h"
52
#include "ns3/ipv4-nix-vector-helper.h"
50
#include "ns3/ipv4-nix-vector-helper.h"
 Lines 161-175    Link Here 
161
    }
159
    }
162
160
163
  InternetStackHelper stack;
161
  InternetStackHelper stack;
164
  Ipv4NixVectorHelper nixRouting;
165
  Ipv4StaticRoutingHelper staticRouting;
166
167
  Ipv4ListRoutingHelper list;
168
  list.Add (staticRouting, 0);
169
  list.Add (nixRouting, 10);
170
171
  if (nix)
162
  if (nix)
172
    {
163
    {
164
      Ipv4NixVectorHelper nixRouting;
173
      stack.SetRoutingHelper (list); // has effect on the next Install ()
165
      stack.SetRoutingHelper (list); // has effect on the next Install ()
174
    }
166
    }
175
167
(-)a/src/nix-vector-routing/doc/nix-vector-routing.h (-22 lines)
 Lines 34-61    Link Here 
34
 * efficient adaptation to link failures.  It simply flushes all nix-vector 
34
 * efficient adaptation to link failures.  It simply flushes all nix-vector 
35
 * routing caches. Finally, IPv6 is not supported.
35
 * routing caches. Finally, IPv6 is not supported.
36
 *
36
 *
37
 * \section api API and Usage
38
 *
39
 * The Nix-vector routing protocol at the moment does not handle local
40
 * delivery. As a consequence, it must be used along with another routing
41
 * protocol, with the obvious candidate being Ipv4StaticRouting.
42
 * Moreover, Ipv4StaticRouting must have a higher precedence than
43
 * Nix-vector routing.
44
 *
45
 * Example:
46
 * \code
47
   Ipv4NixVectorHelper nixRouting;
48
   Ipv4StaticRoutingHelper staticRouting;
49
50
   Ipv4ListRoutingHelper list;
51
   list.Add (staticRouting, 0);
52
   list.Add (nixRouting, 10);
53
54
   InternetStackHelper stack;
55
   stack.SetRoutingHelper (list);
56
   stack.Install (allNodes);
57
 * \endcode
58
 *
59
 * \section impl Implementation
37
 * \section impl Implementation
60
 *
38
 *
61
 * ns-3 nix-vector-routing performs on-demand route computation using 
39
 * ns-3 nix-vector-routing performs on-demand route computation using 
(-)a/src/nix-vector-routing/examples/nix-simple.cc (-7 / +1 lines)
 Lines 68-81    Link Here 
68
  // NixHelper to install nix-vector routing
68
  // NixHelper to install nix-vector routing
69
  // on all nodes
69
  // on all nodes
70
  Ipv4NixVectorHelper nixRouting;
70
  Ipv4NixVectorHelper nixRouting;
71
  Ipv4StaticRoutingHelper staticRouting;
72
73
  Ipv4ListRoutingHelper list;
74
  list.Add (staticRouting, 0);
75
  list.Add (nixRouting, 10);
76
77
  InternetStackHelper stack;
71
  InternetStackHelper stack;
78
  stack.SetRoutingHelper (list); // has effect on the next Install ()
72
  stack.SetRoutingHelper (nixRouting); // has effect on the next Install ()
79
  stack.Install (allNodes);
73
  stack.Install (allNodes);
80
74
81
  NetDeviceContainer devices12;
75
  NetDeviceContainer devices12;
(-)a/src/nix-vector-routing/examples/nms-p2p-nix.cc (-11 / +3 lines)
 Lines 44-51    Link Here 
44
#include "ns3/onoff-application.h"
44
#include "ns3/onoff-application.h"
45
#include "ns3/packet-sink.h"
45
#include "ns3/packet-sink.h"
46
#include "ns3/simulator.h"
46
#include "ns3/simulator.h"
47
#include "ns3/ipv4-static-routing-helper.h"
48
#include "ns3/ipv4-list-routing-helper.h"
49
#include "ns3/ipv4-nix-vector-helper.h"
47
#include "ns3/ipv4-nix-vector-helper.h"
50
48
51
using namespace ns3;
49
using namespace ns3;
 Lines 126-132    Link Here 
126
  TIMER_TYPE t0, t1, t2;
124
  TIMER_TYPE t0, t1, t2;
127
  TIMER_NOW (t0);
125
  TIMER_NOW (t0);
128
  std::cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << std::endl;
126
  std::cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << std::endl;
129
  LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO);
127
  // LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO);
130
128
131
  int nCN = 2, nLANClients = 42;
129
  int nCN = 2, nLANClients = 42;
132
  bool nix = true;
130
  bool nix = true;
 Lines 174-189    Link Here 
174
  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
172
  p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms"));
175
173
176
  // Setup NixVector Routing
174
  // Setup NixVector Routing
177
  Ipv4NixVectorHelper nixRouting;
178
  Ipv4StaticRoutingHelper staticRouting;
179
180
  Ipv4ListRoutingHelper list;
181
  list.Add (staticRouting, 0);
182
  list.Add (nixRouting, 10);
183
184
  if (nix)
175
  if (nix)
185
    {
176
    {
186
      stack.SetRoutingHelper (list); // has effect on the next Install ()
177
      Ipv4NixVectorHelper nixRouting;
178
      stack.SetRoutingHelper (nixRouting); // has effect on the next Install ()
187
    }
179
    }
188
180
189
  // Create Campus Networks
181
  // Create Campus Networks
(-)a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc (+41 lines)
 Lines 619-624    Link Here 
619
619
620
  CheckCacheStateAndFlush ();
620
  CheckCacheStateAndFlush ();
621
621
622
  NS_ASSERT (m_ipv4 != 0);
623
  // Check if input device supports IP
624
  NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
625
  uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
626
627
  NS_LOG_LOGIC ("Unicast destination");
628
  /// \todo Configurable option to enable \RFC{1222} Strong End System Model
629
  // Right now, we will be permissive and allow a source to send us
630
  // a packet to one of our other interface addresses; that is, the
631
  // destination unicast address does not match one of the iif addresses,
632
  // but we check our other interfaces.  This could be an option
633
  // (to remove the outer loop immediately below and just check iif).
634
  for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
635
    {
636
      for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
637
        {
638
          Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
639
          Ipv4Address addr = iaddr.GetLocal ();
640
          if (addr.IsEqual (header.GetDestination ()))
641
            {
642
              if (j == iif)
643
                {
644
                  NS_LOG_LOGIC ("For me (destination " << addr << " match)");
645
                }
646
              else
647
                {
648
                  NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
649
                }
650
              lcb (p, header, iif);
651
              return true;
652
            }
653
          if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
654
            {
655
              NS_LOG_LOGIC ("For me (interface broadcast address)");
656
              lcb (p, header, iif);
657
              return true;
658
            }
659
          NS_LOG_LOGIC ("Address "<< addr << " not a match");
660
        }
661
    }
662
622
  Ptr<Ipv4Route> rtentry;
663
  Ptr<Ipv4Route> rtentry;
623
664
624
  // Get the nix-vector from the packet
665
  // Get the nix-vector from the packet
(-)a/src/topology-read/examples/topology-example-sim.cc (-9 / +1 lines)
 Lines 31-38    Link Here 
31
#include "ns3/internet-module.h"
31
#include "ns3/internet-module.h"
32
#include "ns3/point-to-point-module.h"
32
#include "ns3/point-to-point-module.h"
33
#include "ns3/applications-module.h"
33
#include "ns3/applications-module.h"
34
#include "ns3/ipv4-static-routing-helper.h"
35
#include "ns3/ipv4-list-routing-helper.h"
36
#include "ns3/ipv4-nix-vector-helper.h"
34
#include "ns3/ipv4-nix-vector-helper.h"
37
35
38
#include "ns3/topology-read-module.h"
36
#include "ns3/topology-read-module.h"
 Lines 101-113    Link Here 
101
99
102
  // Setup NixVector Routing
100
  // Setup NixVector Routing
103
  Ipv4NixVectorHelper nixRouting;
101
  Ipv4NixVectorHelper nixRouting;
104
  Ipv4StaticRoutingHelper staticRouting;
102
  stack.SetRoutingHelper (nixRouting);  // has effect on the next Install ()
105
106
  Ipv4ListRoutingHelper listRH;
107
  listRH.Add (staticRouting, 0);
108
  listRH.Add (nixRouting, 10);
109
110
  stack.SetRoutingHelper (listRH);  // has effect on the next Install ()
111
  stack.Install (nodes);
103
  stack.Install (nodes);
112
104
113
  NS_LOG_INFO ("creating ip4 addresses");
105
  NS_LOG_INFO ("creating ip4 addresses");
(-)a/src/topology-read/examples/wscript (-1 / +1 lines)
 Lines 1-5    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
def build(bld):
3
def build(bld):
4
    obj = bld.create_ns3_program('topology-read', ['topology-read', 'internet', 'nix-vector-routing', 'point-to-point', 'applications'])
4
    obj = bld.create_ns3_program('topology-example-sim', ['topology-read', 'internet', 'nix-vector-routing', 'point-to-point', 'applications'])
5
    obj.source = 'topology-example-sim.cc'
5
    obj.source = 'topology-example-sim.cc'

Return to bug 2252